var url = window.location.href;
var queryString = url.replace(/^[^\?]+\??/,'');
var params = parseQuery( queryString );
function parseQuery ( query ) {
   var Params1 = new Object ();
   if ( ! query ) 
   {
   return Params1; // return empty object
   }
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) continue;
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params1[key] = val;
   }
   return Params1;
}


if ( queryString.length != 0 )
    {
    switch (params['site'].toLowerCase())
        {
        case "default": 

                var sPath = window.location.pathname;
                //var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
                var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
               switch (sPage.toLowerCase())
                {
                    
                    case "home.html":
                            OAS_listpos = 'Top,Right,Middle,x09,x25,x11';
                            OAS_sitepage = 'mysa.com/sagametime/index';
                            break;
                    case "district.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "sport.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "high_school_basketball.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "school.html":
                            //schoolTags(params['TeamID'].toLowerCase());
                            OAS_listpos = 'Top,Middle,x09,Right';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "school_test.html":
                            //schoolTags(params['TeamID'].toLowerCase());
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "schooldetails.html":
                            //schoolTags(params['TeamID'].toLowerCase());
                            OAS_listpos = 'Top,Middle,x09,Right';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "volleyball.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "high_school_soccer.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "high_school_baseball.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "high_school_softball.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "statsleaders.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "standings.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    //TEST PAGE
                    case "standings_test.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "stories.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "results.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "details.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "girls_high_school_basketball_scores.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "boys_high_school_basketball_scores.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "high_school_softball_scores.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "high_school_baseball_scores.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "girls_high_school_soccer_scores.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "boys_high_school_soccer_scores.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "high_school_basketball_names_alphabetical.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "alamo_heights_high_school.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "boys_high_school_soccer_standing.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "girls_high_school_soccer_standing.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "boys_high_school_basketball_standing.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "girls_high_school_basketball_standing.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "high_school_softball_standing.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "high_school_baseball_standing.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "boys_high_school_basketball_stats_leaders.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                    case "girls_high_school_basketball_stats_leaders.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                 
                            
                    //Ad tags test page        
                    case "AdTagsTest.html":
                            OAS_listpos = 'Top,Middle,x09';
                            OAS_sitepage = 'mysa.com/sagametime';
                            break;
                } 
            break;
        case "undefined":
            
            OAS_listpos = 'Top,Right,Middle,x09,x25,x10,x11,x12';
            OAS_sitepage = 'mysa.com/sagametime/index';
            break;
           }
    }
else
    {
    OAS_listpos = 'Top,Right,Middle,x09,x25,x10,x11,x12';
    OAS_sitepage = 'mysa.com/sagametime/index';
    }     

//Ads targeted according to schools - AFTER NEW AD TAGS THIS FUNCTION IS JUST A PLACE HOLDER - NEVER CALLED
//   
//function schoolTags(teamId)
//    {
//   
//    switch (teamId)
//        {
//        case "1058": //Boerne
//            OAS_listpos = 'Banner,MedRectangle,Popunder,Txt3,RectangleRos,Rectangle2,Rectangle3,Skyscraper,Sponsor1,Sponsor2,Sponsor3,Sponsor4,Sponsor5,Sponsor6,Sponsor7,Sponsor8,Sponsor9,EyeblasterRovion,LeaderTop,Ribbon1';
//            OAS_sitepage = 'www.mysanantonio.com/sports/sagt/schools/Boerne';
//            OAS_query = '';
//            OAS_target = '_top';
//            break;
//        default:
//            OAS_listpos = 'Banner,MedRectangle,Popunder,Txt3,RectangleRos,Rectangle2,Rectangle3,Skyscraper,Sponsor1,Sponsor2,Sponsor3,Sponsor4,Sponsor5,Sponsor6,Sponsor7,Sponsor8,Sponsor9,EyeblasterRovion,LeaderTop,Ribbon1';
//            OAS_sitepage = 'www.mysanantonio.com/sports/sagt/schools';
//            OAS_query = '';
//            OAS_target = '_top';
//            break;
//        case "undefined":
//            OAS_listpos = 'Banner,MedRectangle,Popunder,Txt3,RectangleRos,Rectangle2,Rectangle3,Skyscraper,Sponsor1,Sponsor2,Sponsor3,Sponsor4,Sponsor5,Sponsor6,Sponsor7,Sponsor8,Sponsor9,EyeblasterRovion,LeaderTop,Ribbon1';
//            OAS_sitepage = 'www.mysanantonio.com/sports/sagt/schools';
//            OAS_query = '';
//            OAS_target = '_top';
//            break;
//        } 
//    } 
   
   //This function is called from the Menu to open new window
   //Included here because all the pages should and will include this JavaScript 
   
   function popup(url)
    {
    var generator = window.open(url,'Slide','height=900,width=986,resizable=no,scrollbars=no,toolbar=no,status=no,location=no,menubar=no');
    } 
   
   
   //FROM http://www.mysanantonio.com/global-includes/javascript/GlobalFunctions.js
   
  //-----------------------------------------------------------------------------
// The following array is used to populate the search options drop-down box
// in the page header. It contains all of the different databases that can
// be search.
var SearchOptions = ['Stories','Archives','Celebrations','Crimebase','Newspaper Ads','News Wires','Obituaries','Slideshows','Video Headlines','Yellow Pages'];

//-----------------------------------------------------------------------------
// MakeUsYourHomePage() -- Sets the browser's HomePage property to
// www.mysanantonio.com
//-----------------------------------------------------------------------------
function MakeUsYourHomePage() {
	if((navigator.org == "microsoft") && (navigator.version >= 5.5)) {
		var obj = self.document.getElementById("frm_top");
		if(obj != null) {
			obj.style.behavior = "url(#default#homepage)";
			obj.setHomePage("www.mysanantonio.com");
		}
	}
	
	return false;
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function PopupWindow(url, title, settings) {
	window.open(url, title, settings);
}

function ShowHelp(){
	self.location.href = "http://www.mysanantonio.com/help/";
}

function ShowKeywordHelp(){
	var settings = "toolbar=no,location=no,directories=no,status=no,menubar=no"
		+ ",scrollbars=yes,resizable=no,width=350,height=350";
	var url = "http://www.mysanantonio.com/keyword/help.cfm";
	
	window.open(url, "helpWindow", settings);
}

function ShowFAQ(){
	var settings = "toolbar=no,location=no,directories=no,status=no,menubar=no"
		+ ",scrollbars=yes,resizable=yes,width=600,height=500";
	var url = "http://www.mysanantonio.com/help/faq/";

	window.open(url, "faqWindow", settings);
}

function CreateFlashObject(file_path, width, height) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + width + '" height="' + height + '">');
	document.write('<param name="movie" value="' + file_path + '" />');
	document.write('<param name="quality" value="high" />');
	document.write('<embed src="' + file_path + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>');
	document.write('</object>');
}

//-----------------------------------------------------------------------------
//	Added for use by dropbox menus (specifically for the date select in the
//	obituaries section).  -Jay Flaherty, Oct 21, 2003
//-----------------------------------------------------------------------------
function select_loadpage (select) {
	self.location.href = select.options[select.selectedIndex].value;
}

//function ShowMemberMessage(cookiename,membermessage,visitormessage) {
function ShowMemberMessage() {
	var membermessage = 'Welcome, Member!<IMG SRC="http://www.mysanantonio.com/global-images/header_new/register_spacer_small.gif" width="15" height="3" vspace="2" align="middle">\<a href="http://www.mysanantonio.com/sharedcontent/registration/membercenter.jsp">Member Center\</a><IMG SRC="http://www.mysanantonio.com/global-images/header_new/register_spacer_small.gif" width="15" height="3" vspace="2" align="middle">\<a href="http://www.mysanantonio.com/LogOut.do">Log Out\</a>';
	var visitormessage = 'Welcome, Visitor!<IMG SRC="http://www.mysanantonio.com/global-images/header_new/register_spacer_small.gif" width="15" height="3" vspace="2" align="middle">\<a href="http://www.mysanantonio.com/sharedcontent/registration/">Sign In / Register\</a>';
	var cookiename = 'img';

	if (document.cookie.length > 0) { // if there are any cookies
		memberstatus = document.cookie.indexOf(cookiename)
		begin = document.cookie.indexOf(cookiename+"="); 
		if (begin != -1) { 
			begin += cookiename.length+1; 
			end = document.cookie.indexOf(";", begin);
			
			if (end == -1) end = document.cookie.length;
			cookiedata = document.cookie.substring(begin, end);
		}
			
		if (memberstatus != -1) { // if cookie exists				
			var regEx = new RegExp("|","g");
			var checkforname = regEx.exec(cookiedata);
			if (checkforname) {
				var userArray = cookiedata.split("|");
				var usersname = userArray[1];
				if (usersname) {
					if(usersname.length > 10) {
						usersname = usersname.substring(0,7) + "...";
					}
					membermessage = membermessage.replace("Member", usersname)
				}
				document.write(membermessage);
			} else {
				document.write(membermessage);
			}	
		} else {
			document.write(visitormessage);
		}
	}	else{
		document.write(visitormessage);
	}
}

//-----------------------------------------------------------------------------
// The following are stock Macromedia functions that are used in several
// different places throughout the site.

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers(i,p,v) { //v6.0
	if ((obj=document.getElementById(i))!=null) { 
		if (obj.style) { 
			obj=obj.style; 
			v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
		}
		obj.visibility=v; 
	}
}