// JavaScript Document
var http=null;
var sgObj=null;
var http=getHTTPObject();

function getURL(url)
{
	window.location = url;
}
function resetform(){
		document.formSearch.acct_rating[0].selected = true;
		document.formSearch.grade_level[0].selected=true;
		document.formSearch.all_sat_avg[0].selected = true;
		document.formSearch.city.value = "";
		document.formSearch.ZIP.value = "";
		document.formSearch.campus_name.value = "";
		document.formSearch.County.checked=false;
}
	
function checkCampusSearch(){
	//at least have one criteria
		if((document.formSearch.campus_name.value == "") && (document.formSearch.grade_level.selectedIndex == 0) &&   (document.formSearch.city.value=="")	&& (document.formSearch.ZIP.value=="") && (document.formSearch.acct_rating.selectedIndex== 0) && (document.formSearch.all_sat_avg.selectedIndex==0) && document.formSearch.County.checked==false){
			alert("Please provide at least one criteria for search.");
			document.formSearch.campus_name.focus();
			return false;
		} 
		// contradictary SAT and scholl_type
		else if (document.formSearch.grade_level.selectedIndex < 3 && document.formSearch.all_sat_avg.selectedIndex != 0 ){
			alert("Search criteria contradictary to each ohter, \n only high school has SAT score")
			return false;
		}
		else {
			document.formSearch.action = "dispSearchCampus.cfm";
			//document.formSearch.submit();
			return true;
		}
	}	
		

function checkzipform(){
	if (document.formZip.zip.value ==""){
		alert("Please provide at least zipcode for proximity school search");
		formZip.zip.focus;
	}else if (isZip(document.formZip.zip.value)){
		document.formZip.action = "doGetCity.cfm";
		document.formZip.submit();
	}

}
	
function isZip(s) {

 // Check for correct zip code
	 reZip = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);
	
	 if (!reZip.test(s)) {
		  alert("Zip Code Is Not Valid");
		  return false;
	 }

	return true;
}




	
function setAlpha(letter)
{
 window.location = 'dispSearchDistrict.cfm?letter=' + letter;
}
function setAlphaCampus(letter)
{
 window.location = 'dispSearchCampus.cfm?letter=' + letter;
}
function setAlphaCounty(letter)
{
 window.location = 'dispCounty.cfm?letter=' + letter;
}

function checkform()
{
	if(document.searchfrm.letter.value == ""){
		alert("Please provide a DISTRICT to search for.");
		document.searchfrm.letter.focus;
	}else{
		document.searchfrm.submit(); 
	}
}	

function checkExemp(tID,city,type)
{
/*var pos=new Array(2);	
	pos=findPos(tID);
	var cleft=pos[0];
	var ctop=pos[1];
	*/
		var sgObj=document.getElementById(tID);
	/*	
		sgObj.style.display="block";
		sgObj.style.left=cleft;
		sgObj.style.top=ctop+19;
		*/

		var http=getHTTPObject();
		
		var url='doCheckExemp.cfm?nc='+Math.random()+'&q='+city+'&type='+type;

		http.open("GET", url, false);
		http.send(null);
		sgObj.innerHTML="<span align='left' class='smGrayBoldText'>Loading...</span>";
		//sgObj.innerHTML=http.responseText;
		var sugw=http.responseText;
		
		sgObj.innerHTML=sugw;
}



function showElem(tID,file,queryName,gradeLevel)
{

	var pos=new Array(2);	
	pos=findPos(tID);
	
	var cleft=pos[0];
	var ctop=pos[1];
	waitGen(tID);
		sgObj=document.getElementById(tID);
		
		sgObj.style.display="block";
		sgObj.style.left=cleft;
		sgObj.style.top=ctop+19;
		
		http=getHTTPObject();
		var url=file+'.cfm?&nc='+Math.random()+'&q='+queryName+'&g='+gradeLevel;

		http.onreadystatechange=processXML;
		http.open("GET", url, true);
		http.send(null);

}


function showElem2(obj,tID,fieldName)
{
	var pos=new Array(2);	
	pos=findPos(obj);
	var pDiv=document.getElementById(tID+"X");
	pDiv.style.display="";
	var cleft=pos[0];
	var ctop=pos[1];
	
	sgObj=document.getElementById(tID);
		 
	var ospace=getSpace();
	
	if(cleft+360>ospace[0]){
		cleft=cleft-250;	
	}
		 
	pDiv.style.top=ctop+20+"px";
	pDiv.style.left= cleft+"px"; //cleft;
	waitGen(tID);
	sgObj.style.display="";

	sgObj.style.left=cleft;
	sgObj.style.top=ctop+19;
	http=getHTTPObject();
	var url='doGetZips.cfm?&nc='+Math.random()+'&fieldback='+fieldName;
		
	http.onreadystatechange=processXML;
	http.open("GET", url,true);
	http.send(null);
}

function hideDiv(divid){
	//alert(divName);
	document.getElementById(divid).style.display='none';
}
function showDiv(divid){
	//alert(divName);
	document.getElementById(divid).style.display='';
}

function hideZipDiv(){
	//alert(divName);
	document.getElementById('divZipX').style.display='none';
}


function waitGen(divID){
	document.getElementById(divID).innerHTML="<div style='text-align:center;width:auto;padding-top:10px;color:#c0c0c0;font-size:11px;'><img src='images/load2.gif'><br>Loading...</div>";
}

function processXML(){
	if(http.readyState==4){
		sgObj.innerHTML=http.responseText;	
	}
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


function showNameSuggestions(e,sObj,tID){
		
	var pos=new Array(2);	
	pos=findPos(sObj);
	var cleft=pos[0];
	var ctop=pos[1];
	if(sObj.value.length==0){
		//hide
		hideNameSuggestions();
	}
	if(sObj.value.length==1){
		var sgObj=document.getElementById(tID);
		sgObj.style.display="";
		sgObj.style.left=cleft;
		sgObj.style.top=ctop+19;
		var http=getHTTPObject();
		var url="getNameSuggestions.cfm?term=" +sObj.value+ "&nc="+Math.random();
	
		http.open("GET", url, false);
		http.send(null);

		//sgObj.innerHTML=http.responseText;
		var sugw=http.responseText;
		sgObj.innerHTML=sugw;
	}

}

function hideNameSuggestions(){
	document.getElementById("namesugDiv").style.display="none";	
}


 
function hideSuggestions(tID){
	document.getElementById(tID).style.display="none";	
}

function getHTTPObject() {
  var xmlhttp;
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
  
  return xmlhttp;
}


function getSpace(){	
	var d=document;
	if(d.getElementById){
	 if(d.documentElement&&d.documentElement.clientHeight){
	  xMax=d.documentElement.clientWidth;
	  yMax=d.documentElement.clientHeight;
	 }else{
	  xMax=(d.all)?d.body.clientWidth:window.innerWidth;
	  yMax=(d.all)?d.body.clientHeight:window.innerHeight;
	 }
	}else if(d.layers){
	 xMax=window.innerWidth;
	 yMax=window.innerHeight;
	}
	return[xMax,yMax];
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function getHTTPObject() {
  var xmlhttp;
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
  
  return xmlhttp;
}

function updateTerm(targName,val){
	//auto redirect or fill ?

	//var sugTerm=document.getElementById(termDv).innerHTML;
	//var filename =location.pathname.substring(location.pathname.lastIndexOf('/')+1);
	//document.location="showdetail.cfm?sid="+id;
	sugTerm = val;
	sugTerm = trim(sugTerm);
	document.getElementById(targName).value=sugTerm;	
	// example of using trim, ltrim, and rtrim
	//document.formSearch.CAMPUSmit();
}

function updateNameTerm(targName,termDv){
	//auto redirect or fill ?
	var filename =location.pathname.substring(location.pathname.lastIndexOf('/')+1);
	document.location=filename+"?sl_id="+termDv;
	//document.getElementById(targName).value=sugTerm;	
}

///////////////////////////////////////////////////////////////////////   end ajax stuff

function closeDivs()
{
if (document.getElementById) { // DOM3 = IE5, NS6

		if (document.getElementById("sugDivCity")){document.getElementById("sugDivCity").style.display= 'none';}
		if (document.getElementById("sugDivSchoolName")){document.getElementById("sugDivSchoolName").style.display = 'none';}
} else { 
		if (document.layers) 
		{	
			if (document.divZip.display == "block"){document.divZip.display = 'none';}
			if (document.divZipX.display == "block"){document.divZipX.display = 'none';}
			if (document.sugDivSchoolName.display == "block"){document.sugDivSchoolName.display = 'none';}
		}else {
			if (document.all.divZip.style.visibility == "block"){document.all.divZip.style.display = 'none';} 
			if (document.all.divZipX.style.visibility == "block"){document.all.divZipX.style.display = 'none';} 
			if (document.all.sugDivSchoolName.style.visibility == "block"){document.all.sugDivSchoolName.style.display = 'none';} 
		}
	}
}


function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function toggleDiv(id) { 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = 'block';
					
		} else {
			
			document.getElementById(id).style.display = 'none';			
		}	
	} else { 
		if (document.layers) {	
			if (document.id.display == "none"){
				document.id.display = 'block';
				
			} else {
					
				document.id.display = 'none';
			}
		} else {
			if (document.all.id.style.visibility == "none"){
				document.all.id.style.display = 'block';
			} else {
				
				document.all.id.style.display = 'none';
			}
		}
	}
}
function doHover(id,onOff)
{
	var aVal = id;
	if(document.getElementById(id))
	{
		origColor = document.getElementById(id).style.backgroundColor;
	if (aVal) 
		{
			if(onOff == "on" || onOff == "On")
			{
				document.getElementById(id).style.backgroundColor='D1E8A4';
			}else if(onOff =="off" || onOff == "Off")
			{
				document.getElementById(id).style.backgroundColor='FFFFFF';
			}else if(onOff =="over" || onOff == "Over")
			{
				document.getElementById(id).style.backgroundColor='FFFF99';
			}
		}
	}
}





/////////////////////////// compare functions
// JavaScript Document
function uncheckAll(field)
{

for (i = 0; i < field.length; i++)
	{field[i].checked = false ;}

}

function go(url)
{
	window.location = url;
}

/*
function add_Compare(id,cookieName,obj)
{
	if(document.getElementById(id).checked)
	{
		if(fnGetCookie(cookieName))
			{
				var contents = fnGetCookie(cookieName);
				var arrayCAMPUS = new Array();
				arrayCAMPUS = contents.split(",");
				if (arrayCAMPUS.length >= 4) 
				{
					alert("You may only select up to 4 Schools to compare.\r\n Click 'Compare Campus' to view schools you have selected.")
					obj.checked = false;
					return;
				}
				
				var contents = fnGetCookie(cookieName);
				contents = contents + "," + id;
				fnSetCookie(cookieName,contents);
			}else
			{
					fnSetCookie(cookieName,id);
			}
	}else
	{
			doRemove(id,cookieName,'1');
	}
}
*/
function doRemove(id,cookieName,pid) 
{
	cookieName2 = cookieName + "_NAME";
 	var listSub = fnGetCookie(cookieName);
	var listSubName = fnGetCookie(cookieName2);
	arraySub = listSub.split(",");
	arraySubName = listSubName.split(",");
	listSub = "";
	listSubName = "";
	
	for ( i=0; i<arraySub.length; i++) {
		if(arraySub[i]!=id){
			listSub = listSub + "," + arraySub[i];
			listSubName = listSubName + "," + arraySubName[i];
		}
	}
	
	if (listSub) {
		// if still have MLNUM left, reset the cookie
		listSub = listSub.substring(1, listSub.length);
		listSubName = listSubName.substring(1, listSubName.length);
		fnSetCookie(cookieName, listSub);
		fnSetCookie(cookieName2, listSubName);
	} else {
		// clear the cookie
		fnDeleteCookie(cookieName);
		fnDeleteCookie(cookieName2);
	}
	
	//if we are on the showDetail.cfm page, toggle the  neighborhood to add 
	if(document.getElementById('divAddNeighborhood'))
	{
		if(id == pid)
		{
				toggleDiv('divAddNeighborhood');	
				toggleDiv('divNeighborhood');	
		}
		
	}
	refreshNeighborhood();
}

function fnGetCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function fnDeleteCookie(name,path,domain) {
    if (fnGetCookie(name)) document.cookie = name + "=" +
       ( (path) ? ";path=" + path : "") +
       ( (domain) ? ";domain=" + domain : "") +
       ";expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function fnSetCookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}

/////////////////////////////////////////////

//cart stuff
function setCompare(obj, name)
{
	var listCAMPUS = fnGetCookie("HAR_CAMPUS");
	var listCAMPUSName = fnGetCookie("HAR_CAMPUS_NAME");
	var arrayCAMPUS = new Array();
	var arrayCAMPUSName = new Array();
	i=0;
	//arrayCAMPUS = listCAMPUS.split(",");
	//arrayCAMPUSName = listCAMPUSName.split(",");
	if(obj.checked)
	{
		if (listCAMPUS)
			{
				arrayCAMPUS = listCAMPUS.split(",");
				arrayCAMPUSName = listCAMPUSName.split(",");
				if (arrayCAMPUS.length >= 5)
				{
					alert("You may only select up to 5 CAMPUSES to compare. \nYou may remove campuses in the 'My Schools' area or by clicking on the 'Compare' button.")
					obj.checked = false;
					return;
				}else 
				{
					for ( i=0; i<arrayCAMPUS.length; i++) 
					{
						if(arrayCAMPUS[i]==obj.value)
						{
						//the selected mlnum is already in cookie, return don't do anything
						return;
						}
					}
				}
				// only set after checked less than 5, and no dups
				showMyNeighborhoods();
				fnSetCookie("HAR_CAMPUS", listCAMPUS + "," + obj.value);
				fnSetCookie("HAR_CAMPUS_NAME", listCAMPUSName + "," + name);
				
				doHover(obj.value,'on')
				}else 
				{
			// set first MLNUM
			showMyNeighborhoods();
			fnSetCookie("HAR_CAMPUS", obj.value);
			fnSetCookie("HAR_CAMPUS_NAME", name);
			doHover(obj.value,'on')
		}
	} else 	{
		// MLNUM from the list
		if (listCAMPUS) 
		{
			arrayCAMPUS = listCAMPUS.split(",");
			arrayCAMPUSName = listCAMPUSName.split(",");
			listCAMPUS = "";
			listCAMPUSName = "";
			for ( i=0; i<arrayCAMPUS.length; i++) {
				if(arrayCAMPUS[i]!=obj.value){
					listCAMPUS = listCAMPUS + "," + arrayCAMPUS[i];
					listCAMPUSName = listCAMPUSName + "," + arrayCAMPUSName[i];
				}
			}
			if (listCAMPUS) {
				// if still have MLNUM left, reset the cookie
				listCAMPUS = listCAMPUS.substring(1, listCAMPUS.length);
				listCAMPUSName = listCAMPUSName.substring(1, listCAMPUSName.length);
				fnSetCookie("HAR_CAMPUS", listCAMPUS);
				fnSetCookie("HAR_CAMPUS_NAME", listCAMPUSName);

			} else {
				// clear the cookie
				fnDeleteCookie("HAR_CAMPUS");
				fnDeleteCookie("HAR_CAMPUS_NAME");

			}
		doHover(obj.value,'over')
		}
	}

	if(i==0)
	{
		arrayCAMPUS[0] = obj.value;
		arrayCAMPUSName[0] = name;
	}	
	k=i;
	if(obj.checked == false) 
	{ 
		i = i - 1;
		arrayCAMPUS[i] = null;
		arrayCAMPUSName[i] = null;
	}else
	{
		arrayCAMPUS[k] = obj.value;
		arrayCAMPUSName[k] = name;
	}	
	refreshNeighborhood();
}

function setCompareDistrict(obj, name)
{
	var listDISTRICT = fnGetCookie("HAR_DISTRICT");
	var listDISTRICTName = fnGetCookie("HAR_DISTRICT_NAME");
	var arrayDISTRICT = new Array();
	var arrayDISTRICTName = new Array();
	i=0;
	//arrayDISTRICT = listDISTRICT.split(",");
	//arrayDISTRICTName = listDISTRICTName.split(",");
	if(obj.checked)
	{
		if (listDISTRICT)
			{
				arrayDISTRICT = listDISTRICT.split(",");
				arrayDISTRICTName = listDISTRICTName.split(",");
				if (arrayDISTRICT.length >= 5)
				{
					alert("You may only select up to 5 DISTRICTS to compare. \nClick on Compare button and you can delete saved DISTRICTS.")
					obj.checked = false;
					return;
				}else 
				{
					for ( i=0; i<arrayDISTRICT.length; i++) 
					{
						if(arrayDISTRICT[i]==obj.value)
						{
						//the selected mlnum is already in cookie, return don't do anything
						return;
						}
					}
				}
				// only set after checked less than 5, and no dups
				showMyNeighborhoods();
				fnSetCookie("HAR_DISTRICT", listDISTRICT + "," + obj.value);
				fnSetCookie("HAR_DISTRICT_NAME", listDISTRICTName + "," + name);
				
				doHover(obj.value,'on')
				}else 
				{
			// set first MLNUM
			showMyNeighborhoods();
			fnSetCookie("HAR_DISTRICT", obj.value);
			fnSetCookie("HAR_DISTRICT_NAME", name);
			doHover(obj.value,'on')
		}
	} else 	{
		// MLNUM from the list
		if (listDISTRICT) 
		{
			arrayDISTRICT = listDISTRICT.split(",");
			arrayDISTRICTName = listDISTRICTName.split(",");
			listDISTRICT = "";
			listDISTRICTName = "";
			for ( i=0; i<arrayDISTRICT.length; i++) {
				if(arrayDISTRICT[i]!=obj.value){
					listDISTRICT = listDISTRICT + "," + arrayDISTRICT[i];
					listDISTRICTName = listDISTRICTName + "," + arrayDISTRICTName[i];
				}
			}
			if (listDISTRICT) {
				// if still have MLNUM left, reset the cookie
				listDISTRICT = listDISTRICT.substring(1, listDISTRICT.length);
				listDISTRICTName = listDISTRICTName.substring(1, listDISTRICTName.length);
				fnSetCookie("HAR_DISTRICT", listDISTRICT);
				fnSetCookie("HAR_DISTRICT_NAME", listDISTRICTName);

			} else {
				// clear the cookie
				fnDeleteCookie("HAR_DISTRICT");
				fnDeleteCookie("HAR_DISTRICT_NAME");

			}
		doHover(obj.value,'over')
		}
	}

	if(i==0)
	{
		arrayDISTRICT[0] = obj.value;
		arrayDISTRICTName[0] = name;
	}	
	k=i;
	if(obj.checked == false) 
	{ 
		i = i - 1;
		arrayDISTRICT[i] = null;
		arrayDISTRICTName[i] = null;
	}else
	{
		arrayDISTRICT[k] = obj.value;
		arrayDISTRICTName[k] = name;
	}	
	refreshNeighborhood();
}

function showMyNeighborhoods()
{
	if (document.getElementById('tabDivSearch') ) {
		document.getElementById('tabDivSearch').style.display = 'none';
		document.getElementById('tabMySchools').style.display = 'block';
	}
}

function addToMyNeighborhoods(id,name,cookieName)
{
	var cookieName2 = cookieName + "_NAME";
	var listSUB = fnGetCookie(cookieName);
	var listSUBName = fnGetCookie(cookieName2);
	var arraySub = new Array();
	var arraySubName = new Array();
	i=0;
	//arraySub = listSUB.split(",");
	//arraySubName = listSUBName.split(",");
	if (listSUB) 
		{
			arraySub = listSUB.split(",");
			arraySubName = listSUBName.split(",");
			if (arraySub.length >= 5) 
			{
				alert("You may only select up to 5 to compare. \nClick on 'My Schools' tab if you would like to delete saved Schools.")
				return;
			}else 
			{
				for ( i=0; i<arraySub.length; i++) 
				{
					if(arraySub[i]==id)
					{
					//the selected mlnum is already in cookie, return don't do anything
					return;
					}
				}
			}
				// only set after checked less than 5, and no dups
				showMyNeighborhoods();
				
				fnSetCookie(cookieName, listSUB + "," + id);
				fnSetCookie(cookieName2, listSUBName + "," + name);
				toggleDiv('divAddNeighborhood');
				toggleDiv('divNeighborhood');
				//doHover(id,'on')
		}else 
		{
			// set first MLNUM
			showMyNeighborhoods();
			fnSetCookie(cookieName, id);
			fnSetCookie(cookieName2, name);
			toggleDiv('divAddNeighborhood');
			toggleDiv('divNeighborhood');
			//doHover(obj.value,'on')
		}
	refreshNeighborhood(id);
}

function checkForNeighborhood(id,cookieName)
{

	var listSUB = fnGetCookie(cookieName);
	var arraySub = new Array();
	i=0;
	if (listSUB) 
	{
				
				arraySub = listSUB.split(",");
				for ( i=0; i<arraySub.length; i++) 
					{
						if(arraySub[i]==id)
						{
							toggleDiv('divAddNeighborhood');
							//the subdivision for this page is already in their cart, hide add button div, leave  div shoing
							return;
						}
					}
					toggleDiv('divNeighborhood');
	}else
	{
			
		toggleDiv('divNeighborhood');
	}
}


function refreshNeighborhood(pageid)
{
	 pid  = ((pageid) ? pageid : "0");

	var divObj=document.getElementById("myCart");
	if (divObj) {
		var cart_html="<table width='100%'><tr><td><div align='center'>&nbsp;<br><span class='smGrayText'>You have not selected any Schools.</span></div></td></td></table>";
		var cart_html2="";
		
		var listCAMPUS = fnGetCookie("HAR_CAMPUS");
		var listCAMPUSName = fnGetCookie("HAR_CAMPUS_NAME");
		var arCAMPUS = new Array();
		var arCAMPUSName = new Array();
		
		var listDISTRICT = fnGetCookie("HAR_DISTRICT");
		var listDISTRICTName = fnGetCookie("HAR_DISTRICT_NAME");
		var arDISTRICT = new Array();
		var arDISTRICTName = new Array();
		
		if (listCAMPUS) 
		{
				
				arCAMPUS = listCAMPUS.split(",");
				arCAMPUSName = listCAMPUSName.split(",");
				cart_html="<table><tr><td colspan='2'><span class='smGrayText' align='center'>Click X to remove an item from your cart.</span></td></tr><tr><td colspan='2' class='borderDarkBlueBottom'><span class='mdGreenTextBold'>SCHOOLS</span></td></tr>";
		
				for(var i=0;i<arCAMPUSName.length;i++){
					if(arCAMPUSName[i] != null)
					{
						//cart_html+="<span><img src='imageurl'></span><span>"+arObj[i]+"</span>"
						cart_html+="<tr  onMouseOver='javascript:doHover("+'"'+arCAMPUS[i]+'"'+","+'"on"'+")' onMouseOut='javascript:doHover("+'"'+arCAMPUS[i]+'"'+","+'"off"'+")'><td width='40' align='right' valign='bottom'><span class='smBlueHeader'><a href='javascript:doRemove(" +'"'+ arCAMPUS[i] +'"'+','+'"'+ "HAR_CAMPUS"+'"'+','+'"'+ pageid +'"'+");refreshNeighborhood("+'"'+pageid+'"'+");doHover("+'"'+arCAMPUS[i]+'"'+","+'"off"'+");unCheck("+'"'+arCAMPUS[i]+'"'+");if(pid=="+'"'+"4"+'"'+"){location.reload(true);}'><img src='images/x.gif' alt='Remove' name='text' width='18' height='16' border='0' id='text'></a></span></td><td width='185' align='left' valign='middle' ><span class='smBlueHeader'><strong><a href='dispCampusDetail.cfm?id="+arCAMPUS[i]+"'>"+arCAMPUSName[i]+"</a></strong></span></td>";
					}
				}
		cart_html+="<tr><td></td><td align='left' valign='top'><div align='left'> <input type='button' class='submit' value='COMPARE' onClick=\"goTo('dispCompareCampus.cfm')\" /><br><br></div></td></tr>";		
		showMyNeighborhoods();
		}
		
		
		if (listDISTRICT) 
		{
				if(listCAMPUS){}else{cart_html="";};
				cart_html2="<table><tr><td colspan='2' class='borderDarkBlueBottom'><span class='mdGreenTextBold'>DISTRICTS</span></td></tr>";
				arDISTRICT = listDISTRICT.split(",");
				arDISTRICTName = listDISTRICTName.split(",");
	
		
				for(var i=0;i<arDISTRICTName.length;i++){
					if(arDISTRICTName[i] != null)
					{
						//cart_html+="<span><img src='imageurl'></span><span>"+arObj[i]+"</span>"
						cart_html2+="<tr  onMouseOver='javascript:doHover("+'"'+arDISTRICT[i]+'"'+","+'"on"'+")' onMouseOut='javascript:doHover("+'"'+arDISTRICT[i]+'"'+","+'"off"'+")'><td width='40' align='right' valign='bottom' ><span class='smBlueHeader'><a href='javascript:doRemove("+'"'+arDISTRICT[i]+'"'+','+'"'+"HAR_DISTRICT"+'"'+","+'"'+pageid+'"'+");refreshNeighborhood("+'"'+pageid+'"'+");doHover("+'"'+arDISTRICT[i]+'"'+","+'"off"'+");unCheck("+'"'+arDISTRICT[i]+'"'+");if(pid=="+'"'+"5"+'"'+"){location.reload(true);}'><img src='images/x.gif' alt='Remove' name='text' width='18' height='16' border='0' id='text'></a></span></td><td width='185' valign='middle'  align='left'><span class='smBlueHeader'><strong><a href='dispDistrictDetail.cfm?id="+arDISTRICT[i]+"'>"+arDISTRICTName[i]+"</a></strong></span></td>";
					}
				}
		cart_html2+="<tr><td></td><td align='left' valign='top'><div align='left'> <input type='button' class='submit' value='COMPARE' onClick=\"goTo('dispCompareDistrict.cfm')\" /></div></td></tr>";		
		showMyNeighborhoods();
		}
		
		cart_html2+="</table>";
		var allHTML = cart_html+cart_html2;
		divObj.innerHTML=allHTML;
	
	}

}

function frmvalidator(aform){
//alert(document.formMap.county.value);
if (document.formMap.county.value =='' && document.formMap.city.value ==''){
	alert('Please search schools by selecting either county or city');
	return false;
}else{
	document.formMap.action='dispMapSearch.cfm';
	document.formMap.submit();
	
	}

}

