﻿var map="";
var mapControl="";
var marker=new Array();

function xwindow(x){
	var pgstr2=inf5[x];		
	return pgstr2;
}

function add2map(x,y){
	var latlon=x.split(",")
	var Mlat= latlon[0];
  	var Mlon= latlon[1];
  	var point=new GLatLng(Mlat,Mlon);
  	marker[y] = new GMarker(point);
  	GEvent.addListener(marker[y],"click",function(){marker[y].openInfoWindowHtml(xwindow(y));});
    map.addOverlay(marker[y]);
}

function showmap(y){
	var pos=inf6[y].split(",")
	pos1=pos[0];
	pos2=pos[1];
	map.setCenter(new GLatLng(pos1,pos2), 15);
	marker[y].openInfoWindowHtml(xwindow(y));
}

function showhideSch(x){
	if(document.getElementById().style.display=='none'){
		
		document.getElementById().style.display=='block'
	}
}

	function GetXmlHttpObject(){
	  var xmlHttp=null;
	  try{
	    // Firefox, Opera 8.0+, Safari
	    xmlHttp=new XMLHttpRequest();
	    }
	  catch (e){
	    // Internet Explorer
	    try{
	      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	      }
	    catch (e){
	      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	      }
	    }
	  return xmlHttp;
	} 
	
	var ready=true;
	
	function stateChange() {
	if (xmlHttp.readyState==1||xmlHttp.readyState==2||xmlHttp.readyState==3){ 
		document.getElementById(tmpDiv).innerHTML="<img src='images/loading.gif' width='15' height='15' style='float:left;margin-right:5px;margin-left:5px;' />Loading Results";
		document.getElementById(tmpDiv).style.display="block";
		ready=false;
		}
	
	if (xmlHttp.readyState==4){ 
		document.getElementById(tmpDiv).innerHTML=xmlHttp.responseText;
		document.getElementById(tmpDiv).style.display="block";
		ready=true;
		parseSched(0);
		}
	}
	
	var tmpDiv="";
	var tmpLink="";
	
	function getResults(x,z,a,fl){
		if(!ready){return false;}
		tmpDiv=z;
		tmpLink=a;
		var randomnumber=Math.floor(Math.random()*31);
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null){
		  alert ("Your browser does not support AJAX!");
		  return;
		  } 
		var url="resultsAjax.asp";
		url=url+"?id="+x;
		url=url+"&rdm="+randomnumber;
		url=url+"&flags="+fl;
		xmlHttp.onreadystatechange=stateChange;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		return;
	}
	
	function getDir2(id,add,city,state,zip,div,Link) {
		tmpDiv=div;
		tmpLink=Link;
		var z="From Address:<br /><input style=\"font:8pt arial;\" type=\"text\" size=\"20\" id=\"d"+id+"\" />";
		z=z+"<input name=\"GO\" type=\"button\" value=\"GO\" onClick=\"getdir('"+add+"','"+city+"','"+state+"','"+zip+"','d"+id+".value','d"+id+"')\" />";
		document.getElementById(div).innerHTML=z;
		document.getElementById(div).style.display="block";
		document.getElementById(Link).style.display="block";
	}
	
	function getdir(add,city,state,zip,from,id){
		
		var iv=document.getElementById(id).value
		var durl="directions.asp?add="+add+"&city="+city+"&st="+state+"&zip="+zip+"&from=";
		durl2=durl+iv;
		if(iv==""||iv==null){
			alert("Please enter an address.");		
		}else{
			window.open(durl2,'directions','width=750,height=550,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes')
		}
	}
	
	function hideWindows(x){
		var tempLink="cLink"+x
		var tempDiv="place"+x
		document.getElementById(tempDiv).style.display="none";
		document.getElementById(tempLink).style.display="none";
	}
	
	function showArea(x){
		if(x!="all"){
			for(xa in jsArea){
				document.getElementById(jsArea[xa]).style.display="none";
			}
			document.getElementById(x).style.display="block";
		}else{
			for(xa in jsArea){
				document.getElementById(jsArea[xa]).style.display="block";
			}
		}
	}
	

