// JavaScript Document
searchVals2="";
		if(typeof(searchVals)!="undefined"){
			var searchVals2=searchVals;	
		}

	function getURL(url)
				{
					window.location = url;
				}

	function setAlpha(letter,idx)
				{

				 window.location = 'dispSearchDistrict.cfm?letterDist=' + letter+idx;
				}
				
			
	function setAlphaCounty(letter,idx)
				{
				 window.location = 'dispSearchCounty.cfm?letter=' + letter+idx;
				}
	function setAlphaCampus(letter,idx)
				{
				 window.location = 'dispSearchCampus.cfm?letter=' + letter+idx;
				}
	function checkform()
				{
					if(document.searchfrm.letter.value == "")
					{
					alert("Please provide a DISTRICT to search for.");
					document.searchfrm.letter.focus;
					}else
					{document.searchfrm.submit(); 
					}
				}	


//ajax stuff
function checkExemp(tID,city,type)
{

		var sgObj=document.getElementById(tID);
		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>";
		var sugw=http.responseText;
		sgObj.innerHTML=sugw;
}

var http=null;
var sgObj=null;
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+'&nc='+Math.random()+'&q='+queryName+'&g='+gradeLevel;
	
		http.onreadystatechange=processXML;
		http.open("GET", url, true);
		http.send(null);
}


function processXML(){
		if(http.readyState==4){
			sgObj.innerHTML=http.responseText;	
		}
}


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 showElem2(obj,tID,fieldName)
{

var pos=new Array(2);	
	pos=findPos(obj);
	var pDiv=document.getElementById(tID+"X");
	var cleft=pos[0];
	var ctop=pos[1];
	
	 sgObj=document.getElementById(tID);
		 
		 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()+'&field='+fieldName;
		http.onreadystatechange=processXML;
		http.open("GET", url,true);
		http.send(null);

}


var isFree=true;


function turnOn(){
	isFree=true;
}
	

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){
		 sgObj=document.getElementById(tID);
		sgObj.style.display="";
		sgObj.style.left=cleft;
		sgObj.style.top=ctop+19;
		 http=getHTTPObject();
		var url="getNameSuggestions.cfm?term=" +sObj.value+ "&nc="+Math.random();
		http.onreadystatechange=processXML;
		http.open("GET", url,true);
		http.send(null);

	}

}

function hideNameSuggestions(){
		document.getElementById("namesugDiv").style.display="none";	
}

function hideZipDiv(divName){
	//alert("Hidding");
	document.getElementById(divName).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 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 updateTerm(targName,termDv,id){
	//auto redirect or fill ?
	var sugTerm=document.getElementById(termDv).innerHTML;
	//sugTerm = val;
	var filename =location.pathname.substring(location.pathname.lastIndexOf('/')+1);
	//document.location="showdetail.cfm?sid="+id;	
	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 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).className='tdHoverSelected';
				//document.getElementById(id).style.backgroundColor='D1E8A4';
			}else if(onOff =="off" || onOff == "Off")
			{
				document.getElementById(id).className='tdOff';
				//document.getElementById(id).style.backgroundColor='FFFFFF';
			}else if(onOff =="over" || onOff == "Over")
			{
				document.getElementById(id).className='tdHover';
	//				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 doRemoveCampus(id,HAR_DISTRICT,HAR_DISTRICT_NAME,HAR_CAMPUS,HAR_CAMPUS_NAME,myParam,pid) 
{
	
 	var listSub = HAR_CAMPUS
	var listSubName = HAR_CAMPUS_NAME
	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);
				
		HAR_CAMPUS = listSub;
		HAR_CAMPUS_NAME = listSubName;
		var goHere = "";
		
		goHere = getLocation(myParam,pid);

		var goHere = goHere + "&HAR_DISTRICT=" + HAR_DISTRICT +  "&HAR_DISTRICT_NAME=" + HAR_DISTRICT_NAME + "&HAR_CAMPUS=" + HAR_CAMPUS + "&HAR_CAMPUS_NAME=" + HAR_CAMPUS_NAME+"&"+searchVals2;
		
		window.location = goHere;

	} else {
		var goHere = "";
		goHere = getLocation(myParam,pid);

		var goHere = goHere + "&HAR_DISTRICT=" + HAR_DISTRICT +  "&HAR_DISTRICT_NAME=" + HAR_DISTRICT_NAME+"&"+searchVals2;

		window.location = goHere;
		
	}

}
function doRemoveDISTRICT(id,HAR_DISTRICT,HAR_DISTRICT_NAME,HAR_CAMPUS,HAR_CAMPUS_NAME,myParam,pid) 
{
	//alert(id);alert(HAR_DISTRICT);alert(HAR_DISTRICT_NAME);alert(myParam);alert(pid);
 	var listSub = HAR_DISTRICT
	var listSubName = HAR_DISTRICT_NAME
	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);
				
		HAR_DISTRICT = listSub;
		HAR_DISTRICT_NAME = listSubName;
		var goHere = "";
		goHere = getLocation(myParam,pid);
		var goHere = goHere + "&HAR_DISTRICT=" + HAR_DISTRICT +  "&HAR_DISTRICT_NAME=" + HAR_DISTRICT_NAME + "&HAR_CAMPUS=" + HAR_CAMPUS + "&HAR_CAMPUS_NAME=" + HAR_CAMPUS_NAME+"&"+searchVals2;
	
		window.location = goHere;

	} else {
		var goHere = "";
		goHere = getLocation(myParam,pid);


		goHere = goHere + "&HAR_CAMPUS=" + HAR_CAMPUS + "&HAR_CAMPUS_NAME=" + HAR_CAMPUS_NAME+"&"+searchVals2;
			alert(goHere);
		window.location = goHere;

	}
	

}


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 getLocation(myParam,id)
{
	pageid  = ((id) ? id : "0");
	var returnMe ="";
	var myParamTrim = myParam;
	var campus_name = document.formSearch.campus_name.value;
	
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	
	var lastChar1 = myParam.indexOf('HAR_CAMPUS');
	var lastChar2 = myParam.indexOf('HAR_DISTRICT');
	var lastChar = 0;
	
	if(lastChar1 < lastChar2)
	{ lastChar = lastChar1;
	}else{
		lastChar = lastChar2;
	}
	
	
	if(lastChar > 1)
	{ var myParamTrim = myParam.substring(0,lastChar-1); }
	
	//if(
	//alert(document.formSearch.campus_name.value );
	var lowerPage= sPage.toLowerCase();
	if((lowerPage == 'dispcampusdetail.cfm') || (lowerPage == 'dispdistrictdetail.cfm'))
	{
		returnMe = sPage + "?id=" + pageid + myParamTrim;
	}else
	{
		returnMe = sPage + "?" + myParamTrim;
	}

	return returnMe;
}

function setCompare(obj, name, HAR_DISTRICT, HAR_DISTRICT_NAME,HAR_CAMPUS,HAR_CAMPUS_NAME, myParam)
{
	//alert("campus");
	var listCAMPUS = 'none';
	var listCAMPUSName = 'none';
	 listCAMPUS = HAR_CAMPUS;
	 listCAMPUSName = HAR_CAMPUS_NAME;
	var arrayCAMPUS = new Array();
	var arrayCAMPUSName = new Array();
	i=0;
	
	//arrayCAMPUS = listCAMPUS.split(",");
	//arrayCAMPUSName = listCAMPUSName.split(",");
	if(obj.checked)
	{
		
		 //if there are already items in the cart
		if (listCAMPUS != 'none')
			{	
				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();
				HAR_CAMPUS = listCAMPUS + "," + obj.value;
				HAR_CAMPUS_NAME = listCAMPUSName + "," + name;
				//get current page name
				var goHere = "";
				goHere = getLocation(myParam);
				
				goHere = goHere + "&HAR_DISTRICT=" + HAR_DISTRICT +  "&HAR_DISTRICT_NAME=" + HAR_DISTRICT_NAME + "&HAR_CAMPUS=" + HAR_CAMPUS + "&HAR_CAMPUS_NAME=" + HAR_CAMPUS_NAME+"&"+searchVals2;
		    	window.location = goHere;
				//doHover(obj.value,'on')
			}else 
			{
			
			// cart empty, so set first MLNUM
			var goHere = getLocation(myParam);
			var goHere = goHere + "&HAR_DISTRICT=" + HAR_DISTRICT +  "&HAR_DISTRICT_NAME=" + HAR_DISTRICT_NAME + "&HAR_CAMPUS=" + obj.value + "&HAR_CAMPUS_NAME=" + name+"&"+searchVals2;
	
			window.location = goHere;
			//showMyNeighborhoods();

		}
	} else 	{
		// remove School 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 Schools left, reset the URL
				listCAMPUS = listCAMPUS.substring(1, listCAMPUS.length);
				listCAMPUSName = listCAMPUSName.substring(1, listCAMPUSName.length);
				
				HAR_CAMPUS = listCAMPUS;
				HAR_CAMPUS_NAME = listCAMPUSName;
				
				var goHere = "";
				goHere = getLocation(myParam);
							
				goHere = goHere + "&HAR_DISTRICT=" + HAR_DISTRICT +  "&HAR_DISTRICT_NAME=" + HAR_DISTRICT_NAME + "&HAR_CAMPUS=" + HAR_CAMPUS + "&HAR_CAMPUS_NAME=" + HAR_CAMPUS_NAME;
				window.location = goHere;

			} else {
				var goHere = "";
				goHere = getLocation(myParam);
			goHere = goHere + "&HAR_DISTRICT=" + HAR_DISTRICT +  "&HAR_DISTRICT_NAME=" + HAR_DISTRICT_NAME ;
				window.location = goHere;
				// clear the URL of schools
			}
		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(HAR_DISTRICT,HAR_DISTRICT_NAME,HAR_CAMPUS,HAR_CAMPUS_NAME);
	disableButton();
	//.disabled=true;
}


function disableButton(){
		var butObj=document.getElementsByTagName("button");
		for(var i=0;i<butObj.length;i++){
			butObj[i].disabled=true;	
		}
}

function setCompareDistrict(obj, name,lettername,HAR_DISTRICT,HAR_DISTRICT_NAME, HAR_CAMPUS,HAR_CAMPUS_NAME, myParam)
{
   //alert(obj);alert(name);alert(HAR_DISTRICT);alert(HAR_DISTRICT_NAME);alert(myParam);
	var listDISTRICT = 'none';
	var listDISTRICTName = 'none';
	 listDISTRICT = HAR_DISTRICT;
	 listDISTRICTName = HAR_DISTRICT_NAME;
	var arrayDISTRICT = new Array();
	var arrayDISTRICTName = new Array();
	i=0;

	
	if(obj.checked)
	{	
		 //if there are already items in the cart
		if (listDISTRICT != 'none')
			{
				arrayDISTRICT = listDISTRICT.split(",");
			
				arrayDISTRICTName = listDISTRICTName.split(",");
				if (arrayDISTRICT.length >= 5)
				{
					alert("You may only select up to 5 DISTRICTS to compare. \nYou may remove Districts in the 'My Schools' area or by clicking on the 'Compare' button.");
					obj.checked = false;
					return;
				}else 
				{
					for ( i=0; i<arrayDISTRICT.length; i++) 
					{
						if(arrayDISTRICT[i]==obj.value)
						{
							alert("found it in cart");
						//the selected mlnum is already in cookie, return don't do anything
						return;
						}
					}
				}
				// only set after checked less than 5, and no dups
				//showMyNeighborhoods();
				HAR_DISTRICT = listDISTRICT + "," + obj.value;
				//alert(HAR_DISTRICT);
				HAR_DISTRICT_NAME = listDISTRICTName + "," + name;
				//get current page name
				var goHere2 = "";
				goHere2 = getLocation(myParam);
			///	alert(goHere)
				goHere2 = goHere2 + "&HAR_DISTRICT=" + HAR_DISTRICT +  "&HAR_DISTRICT_NAME=" + HAR_DISTRICT_NAME + "&HAR_CAMPUS=" + HAR_CAMPUS + "&HAR_CAMPUS_NAME=" + HAR_CAMPUS_NAME+"&"+lettername;
		    //	alert(goHere2);
				//window.open(goHere);
			alert(lettername);
				window.location=goHere2;
				//doHover(obj.value,'on')
			}else 
			{
		
			
			// cart empty, so set first MLNUM
			var goHere = getLocation(myParam)
			
			var goHere =goHere +"&HAR_DISTRICT=" + obj.value + "&HAR_DISTRICT_NAME=" + name + "&HAR_CAMPUS=" + HAR_CAMPUS + "&HAR_CAMPUS_NAME=" + HAR_CAMPUS_NAME + HAR_CAMPUS_NAME+"&"+lettername;
alert(lettername);
			window.location = goHere;
			//refreshNeighborhood(HAR_DISTRICT,HAR_DISTRICT_NAME,HAR_CAMPUS,HAR_CAMPUS_NAME);
			//showMyNeighborhoods();

		}
	} else 	{
		// remove School 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 Schools left, reset the URL
				listDISTRICT = listDISTRICT.substring(1, listDISTRICT.length);
				listDISTRICTName = listDISTRICTName.substring(1, listDISTRICTName.length);
				
				HAR_DISTRICT = listDISTRICT;
				HAR_DISTRICT_NAME = listDISTRICTName;
				
				var goHere = "";
				goHere = getLocation(myParam);
							
				goHere = goHere + "&HAR_DISTRICT=" + HAR_DISTRICT + "&HAR_DISTRICT_NAME=" + HAR_DISTRICT_NAME + "&HAR_CAMPUS=" + HAR_CAMPUS + "&HAR_CAMPUS_NAME=" + HAR_CAMPUS_NAME+"&"+lettername;;
				window.location = goHere;

			} else {
				var goHere = "";
				goHere = getLocation(myParam);
				goHere = goHere + "&HAR_CAMPUS=" + HAR_CAMPUS + "&HAR_CAMPUS_NAME=" + HAR_CAMPUS_NAME+"&"+lettername;;
				window.location = goHere;
				// clear the URL of schools
			}
		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;
	}

}


function showMyNeighborhoods(){
		if(document.getElementById('tabDivSearch') ) {
			document.getElementById('tabDivSearch').style.display = 'none';
			document.getElementById('tabMySchools').style.display = 'block';
		}
		
}

function addSchoolToMyNeighborhoods(id,name,HAR_DISTRICT,HAR_DISTRICT_NAME,HAR_CAMPUS,HAR_CAMPUS_NAME,myParam)
{
	//alert(id);alert(name);alert(HAR_DISTRICT);alert(HAR_DISTRICT_NAME);alert(HAR_CAMPUS);alert(HAR_CAMPUS_NAME);alert(myParam);
	var listCAMPUS = HAR_CAMPUS
	var listCAMPUSName = HAR_CAMPUS_NAME
	var arrayCAMPUS = new Array();
	var arrayCAMPUSName = new Array();
	i=0;
	// if there are schools aready in the cart, add this one
	if (listCAMPUS != 'none') 
		{
				
				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]==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();
				HAR_CAMPUS = listCAMPUS + "," + id;
				HAR_CAMPUS_NAME = listCAMPUSName + "," + name;
				
				var goHere = "";
				goHere = getLocation(myParam,pid);
				
				goHere = goHere + "&HAR_DISTRICT=" + HAR_DISTRICT + "&HAR_DISTRICT_NAME=" + HAR_DISTRICT_NAME + "&HAR_CAMPUS=" + HAR_CAMPUS + "&HAR_CAMPUS_NAME=" + HAR_CAMPUS_NAME;
		    	
				window.location = goHere;
				//doHover(obj.value,'on')
			}else 
			{
			// cart empty, so set first School
			var goHere = getLocation(myParam,pid)
			var goHere = goHere +"&HAR_DISTRICT=" + HAR_DISTRICT + "&HAR_DISTRICT_NAME=" + HAR_DISTRICT_NAME + "&HAR_CAMPUS=" + id + "&HAR_CAMPUS_NAME=" + name;
	
			window.location = goHere;

		}

}



function addDistrictToMyNeighborhoods(id,name,HAR_DISTRICT,HAR_DISTRICT_NAME,HAR_CAMPUS,HAR_CAMPUS_NAME,myParam)
{

	var listDISTRICT = 'none';
	var listDISTRICTName = 'none';
	var listDISTRICT = HAR_DISTRICT + "";
	var listDISTRICTName = HAR_DISTRICT_NAME + "";
	var arrayDISTRICT = new Array();
	var arrayDISTRICTName = new Array();
	i=0;
	// if there are schools aready in the cart, add this one
	if (listDISTRICT != 'none') 
		{
				arrayDISTRICT = listDISTRICT.split(",");
				arrayDISTRICTName = listDISTRICTName.split(",");
				if (arrayDISTRICT.length >= 5)
				{
					alert("You may only select up to 5 Districts to compare. \nYou may remove districts in the 'My Schools' area or by clicking on the 'Compare' button.");
					//obj.checked = false;
					return;
				}else 
				{
					for ( i=0; i<arrayDISTRICT.length; i++) 
					{
						if(arrayDISTRICT[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();
				HAR_DISTRICT = listDISTRICT + "," + id;
				HAR_DISTRICT_NAME = listDISTRICTName + "," + name;
				
				var goHere = "";
				goHere = getLocation(myParam,pid);
				
				goHere = goHere + "&HAR_DISTRICT=" + HAR_DISTRICT + "&HAR_DISTRICT_NAME=" + HAR_DISTRICT_NAME + "&HAR_CAMPUS=" + HAR_CAMPUS + "&HAR_CAMPUS_NAME=" + HAR_CAMPUS_NAME;
		    	
				window.location = goHere;
				//doHover(obj.value,'on')
			}else 
			{
			// cart empty, so set first School
			var goHere = getLocation(myParam,pid)
			var goHere = goHere +"&HAR_DISTRICT=" +  id + "&HAR_DISTRICT_NAME=" + name + "&HAR_CAMPUS=" + HAR_CAMPUS + "&HAR_CAMPUS_NAME=" + HAR_CAMPUS_NAME;

			window.location = goHere;
		}
}




function checkForNeighborhood(id,HAR_CAMPUS)
{

	var listSUB = HAR_CAMPUS;
	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(HAR_DISTRICT,HAR_DISTRICT_NAME,HAR_CAMPUS,HAR_CAMPUS_NAME,myParam,pageid)
{

	 pid  = ((pageid) ? pageid : "0");

	var divObj=document.getElementById("myCart");

	var cart_html="<table width='100%'><tr><td><div align='center'>&nbsp;<br><span class='descText'>You have not selected any Schools.</span></div></td></td></table>";
	var cart_html2="";
	
	
	
	var listCAMPUS = "";
	listCAMPUS = HAR_CAMPUS;
	var listCAMPUSName = HAR_CAMPUS_NAME;
	var arCAMPUS = new Array();
	var arCAMPUSName = new Array();
	
	var listDISTRICT = "";
	listDISTRICT = HAR_DISTRICT;
	var listDISTRICTName = HAR_DISTRICT_NAME;
	var arDISTRICT = new Array();
	var arDISTRICTName = new Array();
	
	if (listCAMPUS != 'none' && listCAMPUS != '') 
	{
			
			arCAMPUS = listCAMPUS.split(",");
			arCAMPUSName = listCAMPUSName.split(",");
			cart_html="<table><tr><td colspan='2'><span class='descText' align='center'>Click X to remove an item from your cart.</span></td></tr><tr><td colspan='2' class='bottomline'><span class='descLabel'>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 class ='linkText' onMouseOver='javascript:doHover("+'"'+arCAMPUS[i]+'"'+","+'"on"'+")' onMouseOut='javascript:doHover("+'"'+arCAMPUS[i]+'"'+","+'"off"'+")'><td width='40' align='right' valign='bottom'><span class='linkText'><a href='javascript:doRemoveCampus(" +'"'+ arCAMPUS[i] +'"'+','+'"'+ HAR_DISTRICT +'"'+','+'"'+ HAR_DISTRICT_NAME +'"'+','+'"'+ HAR_CAMPUS +'"'+','+'"'+ HAR_CAMPUS_NAME +'"'+','+'"'+myParam +'"'+','+'"'+ pageid +'"'+");'><span class='formLabel'>X</span></a></span></td><td width='185' valign='middle' ><span class='linkText'><a href='dispCampusDetail.cfm?id="+arCAMPUS[i]+"'>"+arCAMPUSName[i]+"</a></span></td>";
				}
			}
	cart_html+="<tr><td></td><td align='left' valign='top'><div align='left'> <button onClick='javascript:window.location="+'"'+"dispCompareCampus.cfm?"+myParam+'"'+";' onmouseover='this.style.cursor="+'"'+"pointer"+'"'+";' class='submitButton' type='button'>Compare</button><br><br></div></td></tr>";		
	showMyNeighborhoods();
	}
	

	if (listDISTRICT != 'none' && listDISTRICT != '') 
	{

			if(listCAMPUS){}else{cart_html="";};
			cart_html2="<table><tr><td colspan='2' class='bottomline'><span class='descLabel'>DISTRICTS</span></td></tr>";
			arDISTRICT = listDISTRICT.split(",");
			arDISTRICTName = listDISTRICTName.split(",");

	
			for(var i=0;i<arDISTRICT.length;i++){
				if(arDISTRICT[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='linkText'><a href='javascript:doRemoveDISTRICT(" +'"'+ arDISTRICT[i] +'"'+','+'"'+ HAR_DISTRICT +'"'+','+'"'+ HAR_DISTRICT_NAME +'"'+','+'"'+ HAR_CAMPUS +'"'+','+'"'+ HAR_CAMPUS_NAME +'"'+','+'"'+myParam +'"'+','+'"'+ pageid +'"'+");'><span class='formLabel'>X</span></a></span></td><td width='185' valign='middle' ><span class='linkText'><a href='dispDISTRICTDetail.cfm?id="+arDISTRICT[i]+"'>"+arDISTRICTName[i]+"</a></span></td>";
				}
			}
	cart_html2+="<tr><td></td><td align='left' valign='top'><div align='left'><button onClick='javascript:window.location="+'"'+"dispCompareDistrict.cfm?"+myParam+'"'+";'  onmouseover='this.style.cursor="+'"'+"pointer"+'"'+";' class='submitButton' type='button'>Compare</button></div></td></tr>";		
	showMyNeighborhoods();
	}
	
	cart_html2+="</table>";
	var allHTML = cart_html+cart_html2;
	divObj.innerHTML=allHTML;
	
		

}


