//<![CDATA[
// Welcome to the HTMLHttpRequest demonstration!
//
// This script allows you to make background asynchronous GET and POST requests to a
// server in an accessible manner that is backwards-compatible with older browsers,
// mobile devices, screenreaders and search engines.
//
// The overall architecture is assembled in 3 layers:
//
// 1) A "Transport" object ('HTMLHttpRequest') that makes a request to the server.
// 2) A "Threading" object ('RemoteFileLoader') that creates and allocates Transports
// and provides an easy way of loading content into your existing page.
// 3) An "Interface" layer of code that captures clicks/submissions on the document.
//
// Layers (1) and (2) are objects included in the external .JS file above.
// Both contain documentation if you are interested in customising the implementation.
// Otherwise, the code below is the "Interface" layer that will process our document.
/*
HTMLHttpRequest v1.0 beta2
(c) 2001-2005 Angus Turnbull, TwinHelix Designs http://www.twinhelix.com
Licensed under the CC-GNU LGPL, version 2.1 or later:
http://creativecommons.org/licenses/LGPL/2.1/
This is distributed WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
var aeOL=[];function addEvent(o,n,f,l){var a='addEventListener',h='on'+n,b='',s='';if(o[a]&&!l)return o[a](n,f,false);o._c|=0;if(o[h]){b='_f'+o._c++;o[b]=o[h]}s='_f'+o._c++;o[s]=f;o[h]=function(e){e=e||window.event;var r=true;if(b)r=o[b](e)!=false&&r;r=o[s](e)!=false&&r;return r};aeOL[aeOL.length]={o:o,h:h}};addEvent(window,'unload',function(){for(var i=0;i<aeOL.length;i++)with(aeOL[i]){o[h]=null;for(var c=0;o['_f'+c];c++)o['_f'+c]=null}});function cancelEvent(e,c){e.returnValue=false;if(e.preventDefault)e.preventDefault();if(c){e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation()}};function HTMLHttpRequest(myName,callback){with(this){this.myName=myName;this.callback=callback;this.xmlhttp=null;this.iframe=null;window._ifr_buf_count|=0;this.iframeID='iframebuffer'+window._ifr_buf_count++;this.loadingURI='';if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();if(xmlhttp.overrideMimeType)xmlhttp.overrideMimeType('text/xml')}if(!xmlhttp){if(document.createElement&&document.documentElement&&(window.opera||navigator.userAgent.indexOf('MSIE 5.0')==-1)){var ifr=document.createElement('iframe');ifr.setAttribute('id',iframeID);ifr.setAttribute('name',iframeID);ifr.style.visibility='hidden';ifr.style.position='absolute';ifr.style.width=ifr.style.height=ifr.borderWidth='0px';iframe=document.getElementsByTagName('body')[0].appendChild(ifr)}else if(document.body&&document.body.insertAdjacentHTML){document.body.insertAdjacentHTML('beforeEnd','<iframe name="'+iframeID+'" id="'+iframeID+'" style="display:none"></iframe>')}if(window.frames&&window.frames[iframeID])iframe=window.frames[iframeID];iframe.name=iframeID}return this}};HTMLHttpRequest.prototype.parseForm=function(form){with(this){var str='',gE='getElementsByTagName',inputs=[(form[gE]?form[gE]('input'):form.all?form.all.tags('input'):[]),(form[gE]?form[gE]('select'):form.all?form.all.tags('select'):[]),(form[gE]?form[gE]('textarea'):form.all?form.all.tags('textarea'):[])];for(var i=0;i<inputs.length;i++)for(j=0;j<inputs[i].length;j++)if(inputs[i][j]){var plus='++'.substring(0,1);str+=escape(inputs[i][j].getAttribute('name')).replace(plus,'%2B')+'='+escape(inputs[i][j].value).replace(plus,'%2B')+'&'}return str.substring(0,str.length-1)}};HTMLHttpRequest.prototype.xmlhttpSend=function(uri,formStr){with(this){xmlhttp.open(formStr?'POST':'GET',uri,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){var doc=xmlhttp.responseXML;if(callback)callback(doc,loadingURI);loadingURI=''}};if(formStr&&xmlhttp.setRequestHeader)xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send(formStr);loadingURI=uri;return true}};HTMLHttpRequest.prototype.iframeSend=function(uri,formRef){with(this){if(!document.readyState)return false;if(document.getElementById)var o=document.getElementById(iframeID).offsetWidth;if(formRef)formRef.setAttribute('target',iframeID);else{var ifrDoc=iframe.contentDocument||iframe.document;if(!window.opera&&ifrDoc.location&&ifrDoc.location.href!=location.href)ifrDoc.location.replace(uri);else iframe.src=uri}loadingURI=uri;setTimeout(myName+'.iframeCheck()',(window.opera?250:100));return true}};HTMLHttpRequest.prototype.iframeCheck=function(){with(this){doc=iframe.contentDocument||iframe.document;var il=iframe.location,dr=doc.readyState;if((il&&il.href?il.href.match(loadingURI):1)&&(dr=='complete'||(!document.getElementById&&dr=='interactive'))){if(callback)callback((doc.documentElement||doc),loadingURI);loadingURI=''}else setTimeout(myName+'.iframeCheck()',50)}};HTMLHttpRequest.prototype.load=function(uri){with(this){if(!uri||(!xmlhttp&&!iframe))return false;if(xmlhttp)return xmlhttpSend(uri,'');else if(iframe)return iframeSend(uri,null);else return false}};HTMLHttpRequest.prototype.submit=function(formRef,evt){with(this){evt=evt||window.event;if(!formRef||(!xmlhttp&&!iframe))return false;var method=formRef.getAttribute('method'),uri=formRef.getAttribute('action');if(method&&method.toLowerCase()=='post'){if(xmlhttp){cancelEvent(evt);return xmlhttpSend(uri,parseForm(formRef))}else if(iframe)return iframeSend(uri,formRef);else return false}else{return load(uri+(uri.indexOf('?')==-1?'?':'&')+parseForm(formRef));cancelEvent(evt)}}};function RemoteFileLoader(myName){this.myName=myName;this.threads=[];this.loadingIDs={};this.onload=null};RemoteFileLoader.prototype.getThread=function(destId){with(this){var thr=-1;for(var id in loadingIDs){if(id==destId){thr=loadingIDs[id];break}}if(thr==-1)for(var t=0;t<threads.length;t++){if(!threads[t].loadingURI){thr=t;break}}if(thr==-1){thr=threads.length;threads[thr]=new HTMLHttpRequest(myName+'.threads['+thr+']',null);loadingIDs[destId]=thr}threads[thr].callback=new Function('doc','uri','with('+myName+'){copyContent(doc,"'+destId+'");if(onload)onload(doc,uri,"'+destId+'")}');return threads[thr]}};RemoteFileLoader.prototype.loadInto=function(uri,destId){return this.getThread(destId).load(uri)};RemoteFileLoader.prototype.submitInto=function(formRef,destId,event){return this.getThread(destId).submit(formRef,event)};RemoteFileLoader.prototype.copyContent=function(domDoc,destId){var src=domDoc.getElementsByTagName?domDoc.getElementsByTagName('body')[0]:(domDoc.body?domDoc.body:null);var dest=document.getElementById?document.getElementById(destId):(document.all?document.all[destId]:null);if(!src||!dest)return;if(src.innerHTML)dest.innerHTML=src.innerHTML;else if(document.importNode){while(dest.firstChild)dest.removeChild(dest.firstChild);for(var i=0;i<src.childNodes.length;i++)dest.appendChild(document.importNode(src.childNodes.item(i),true))}};
// First, we create an example object for our document click handler.
var docClickLoader = new RemoteFileLoader('docClickLoader');
// At any stage you can call docClickLoader.loadInto('file.html', 'IDOfTarget') to trigger
// a content load into an element from your script.
// The example below does this when suitable links in the document are clicked.
function loadInto(src, destId, evt)
{
// Called to when a link with class="loadinto-IdOfTarget" is clicked.
// Parameters: src = reference to link, destId = ID of target element, evt = event object.
var ok = docClickLoader.loadInto(src.href || src.getAttribute('href'), destId);
if (ok) cancelEvent(evt);
};
function toggleInto(src, destId, evt)
{
// As above, but loads only once and toggles the display of the target.
var dest = document.getElementById(destId);
if (!dest.contentLoaded)
{
var ok = docClickLoader.loadInto(src.href || src.getAttribute('href'), destId);
if (ok) dest.contentLoaded = true;
}
cancelEvent(evt);
if (!dest.toggleState)
{
src.innerHTML = 'Close: ' + src.innerHTML;
dest.style.display = 'block';
dest.toggleState = 1;
}
else
{
src.innerHTML = src.innerHTML.replace(/^Close: /, '');
dest.style.display = 'none';
dest.toggleState = 0;
}
};
// addEvent is defined within htmlhttprequest.js, feel free to reuse :).
addEvent(document, 'click', function(evt)
{
// Here we capture all clicks on the document, scanning for links with a CLASS
// attribute of "loadinto-IdOfTarget" and routing them to loadInto() above.
evt = evt || window.event;
var src = evt.target || evt.srcElement;
if (src.nodeType && src.nodeType != 1) src = src.parentNode;
// Loop up the DOM tree scanning all elements to find a matching one.
while (src)
{
var srcName = (src.nodeName||src.tagName||'').toLowerCase();
if (srcName == 'a' && src.className && src.className.match(/^(load|toggle)into-(.+)$/))
{
// Call our load handlers if we have a match; they'll cancel the normal action.
if (RegExp.$1 == 'load') return loadInto(src, RegExp.$2, evt);
if (RegExp.$1 == 'toggle') return toggleInto(src, RegExp.$2, evt);
}
src = src.parentNode;
}
}, 1);
//]]>
//ajax_summaryPage.js
function initXMLHTTPRequest(){
var xmlRequest=null;
//Mozilla Safari
if(window.XMLHttpRequest){
xmlRequest= new XMLHttpRequest();
}else if(window.ActiveXObject){ // MS Browser
xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlRequest;
}
// Send request to server
function sendSummaryRequest(url,params,HttpMethod){
if(!HttpMethod){
HttpMethod='GET';
}
req=initXMLHTTPRequest();
if(req){
req.onreadystatechange=onReadyStateSummary;
req.open("GET",url,true);
req.setRequestHeader("Content-Type","application/x-www-form-urlenclosed");
//alert(params);
req.send(null);
}
}
function onReadyStateSummary(){
var ready=req.readyState;
var data=null;
if(ready==4){
data=req.responseText;
if(data!=""){
paintSummary(data);
}
}
}
function paintSummary(data){
var schoolArray = new Array();
schoolArray = data.split(",");
removeAllOptions(document.editMavenForm.preschool1);
removeAllOptions(document.editMavenForm.preschool2);
removeAllOptions(document.editMavenForm.preschool3);
removeAllOptions(document.editMavenForm.preschool4);
removeAllOptions(document.editMavenForm.preschool5);
addOption(document.editMavenForm.preschool1, "-1", "- Select School -");
addOption(document.editMavenForm.preschool2, "-1", "- Select School -");
addOption(document.editMavenForm.preschool3, "-1", "- Select School -");
addOption(document.editMavenForm.preschool4, "-1", "- Select School -");
addOption(document.editMavenForm.preschool5, "-1", "- Select School -");
fillPreschool(schoolArray);
}
function getPreschool(url){
var citySelect = document.editMavenForm.schoolCity;
var city =citySelect.options[citySelect.selectedIndex].value;
url+= "&city=" + city;
sendSummaryRequest(url,"","");
}
function fillPreschool(schoolArray){
for(i=0;i<schoolArray.length;i++){
// take out siid and school name
var schObj = schoolArray[i].split(":");
addOption(document.editMavenForm.preschool1,schObj[0],schObj[1]);
addOption(document.editMavenForm.preschool2,schObj[0],schObj[1]);
addOption(document.editMavenForm.preschool3,schObj[0],schObj[1]);
addOption(document.editMavenForm.preschool4,schObj[0],schObj[1]);
addOption(document.editMavenForm.preschool5,schObj[0],schObj[1]);
}
setPreSchool();
}
function selectPreSchool(combo,selectValue){
for(var i=1;i<combo.length;i++){
if(combo[i].value==selectValue){
combo[i].selected='selected';
break;
}
}
}
//ajax_save_search.js
var bSaf = (navigator.userAgent.indexOf('Safari') != -1);
var bOpera = (navigator.userAgent.indexOf('Opera') != -1);
var bMoz = (navigator.appName == 'Netscape');
function execJS() {
var elem = document.getElementById("searchNames");
var strExec;
var IEBrow = document.all?true:false
if(IEBrow){
strExec = elem.innerHTML;
}else if (bSaf) {
strExec = elem.innerHTML;
}
else if (bOpera) {
strExec = elem.text;
}
else if (bMoz) {
strExec = elem.textContent;
}
else {
strExec = elem.text;
}
searchNameList=strExec;
}
function deleteSearch(){	
sendSaveRequest(urlMain,"","");
switchDisplay('deleteFunction');
switchDisplay('saveOrDeleteSearch');
presentPopUpVar = null;
}
function saveSearch(url){	
sendSaveRequest(url,"","");
}
function sendSaveRequest(url,params,HttpMethod){
if(!HttpMethod){
HttpMethod='GET';
}
req=initXMLHTTPRequest();
if(req){
req.onreadystatechange=onReadyStateForSave;
req.open("GET",url,true);
req.setRequestHeader("Content-Type","application/x-www-form-urlenclosed");
//alert(params);
req.send(null);
}
}
function onReadyStateForSave(){
var ready=req.readyState;
var data=null;
if(ready==4){
data=req.responseText;
//alert(data);
displaySavedSearch(data);
}
}
function displaySavedSearch(data){
var contents = document.getElementById("savedSearches");
contents.innerHTML = "";
contents.innerHTML = data;
execJS();
}
// SWITCH DISPLAY
function switchDisplay(obj) {
if (obj!=this) {
var el = document.getElementById(obj);
}
if(el.style.display != "none") {
el.style.display = "none";
}
else if(el.style.display != "block") {
el.style.display = "block";
}
}
function displayOff(obj) {
var el = document.getElementById(obj);
if (el.style.display!='none') {
el.style.display = "none";
};
}
function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function
function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;
while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1; 
} //End While
return strTemp; 
} //End Function 
function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";
var iTemp = 0;
while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function
// Search Name Validation
function validateSearchName(obj,url) {
el = document.getElementById(obj);
if (document.getElementById('savesearchName').value=="name your search") {
el.innerHTML = "<span class='errorMessageTextColor'>Name this search before saving: </span>";
} else {
var isUnique="true";	
var str= document.getElementById('savesearchName').value;
str=str.toLowerCase(); 
str=Trim(str); 
var list=searchNameList.split("~");
for(k=0;k<list.length;k++)
{
var str2=list[k];
str2=str2.toLowerCase();
str2=Trim(str2);
if(str==str2){
isUnique="false";	
}
}
if(isUnique=="false"){
el.innerHTML = "<span class='errorMessageTextColor'>This name is already taken.</span><br />Please choose another:";
}else{	
switchDisplay('saveFunction');	
document.getElementById('saveOrDeleteSearch').innerHTML = "<strong>Your Search has been saved</strong>";
switchDisplay('saveOrDeleteSearch');
presentPopUpVar = null;
var nam=document.getElementById('savesearchName').value;
nam=escape(nam);
url=url+"&searchName="+nam;
saveSearch(url);
el.innerHTML ="Name: ";
document.getElementById('savesearchName').value="name your search";
}
}
}
function onDeleteSearch(hrefId,name,url){
var contents = document.getElementById("searchName");
contents.innerHTML = "<p><strong>Name:</strong> <strong>" + name + "</strong></p> ";
contents = document.getElementById("deleteSearchId");
urlMain=url;
contents.innerHTML = "<a href='javascript:void(0);' onclick='javascript:deleteSearch();' class='clearBorder'><img src='images/deleteButton.gif' alt='Delete' width='49' height='19' /></a>";
if(isLeft=="true"){
//alert("left");
moreInfoLeft(hrefId,'deleteFunction');
}
else{
// alert("no left");
moreinfo(hrefId,'deleteFunction');
}
}
//ajax_search.js
// Ajax Function for Creating XMLHTTPRequest
var username="";
function initXMLHTTPRequest(){
var xmlRequest=null;
//Mozilla Safari
if(window.XMLHttpRequest){
xmlRequest= new XMLHttpRequest();
}else if(window.ActiveXObject){ // MS Browser
xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlRequest;
}
// Send request to server
function sendRequest(url,params,HttpMethod){
if(!HttpMethod){
HttpMethod='GET';
}
req=initXMLHTTPRequest();
if(req){
req.onreadystatechange=onReadyState;
req.open("GET",url,true);
req.setRequestHeader("Content-Type","application/x-www-form-urlenclosed");
//alert(params);
req.send(null);
}
}
function sendBookmarkSchoolRequest(url,siId,HttpMethod,params,cnt,desc){ 
if(!HttpMethod){
HttpMethod='GET';
}
req=initXMLHTTPRequest();
if(req){
//req.onreadystatechange=onReadyStateBookmark; 
req.open("GET",url,true);
req.setRequestHeader("Content-Type","application/x-www-form-urlenclosed");
req.send(null); 
if(req.readyState==0 || req.readyState==1 || req.readyState==2 || req.readyState==3 )
{
}	
req.onreadystatechange=function(){
//alert(req.readyState);
if(req.readyState==4){
if(req.status==200){
var code=req.responseText;
//alert("code="+code)	
var strBookmark = code.split("-");
//alert("status="+strBookmark[0]); 
var objBookmark = document.getElementById(siId);
//alert("spanid="+objBookmark);
if(strBookmark[0]=="actbookmarked")
{ 
objBookmark.innerHTML="<img src='/savvy/images/icon_bookmarked.gif' alt='Bookmarked.' width='17' height='21'/>";
}
if(strBookmark[0]=="campsbookmarked")
{ 
objBookmark.innerHTML="<img src='/savvy/images/icon_bookmarked.gif' alt='Bookmarked.' width='17' height='21'/>";
var newcnt = parseInt(cnt)+1;
//document.getElementById(desc).innerHTML ="Great Idea! (" +newcnt+")";
}
if(strBookmark[0]=="classbookmarked"){ 
objBookmark.innerHTML="<img src='/savvy/images/icon_bookmarked.gif' alt='Bookmarked.' width='17' height='21'/>";
var newcnt = parseInt(cnt)+1;
//document.getElementById(desc).innerHTML ="Great Idea! (" +newcnt+")";
}
if(strBookmark[0]=="alreadybookmark")
{ 
alert("Already Bookmarked")
}
if(strBookmark[0]=="notloggeduser")
{ 
alert("NotLogged User")
//document.search1.action="/savvy/parentRatingSignup.do?role=parentlite&pageHeader=signup&actId=actid";
//document.search1.submit();
} 
}
} 
}	
}
} 
function sendBookmarkRequest(url,params,HttpMethod,actid,desc,votecount){ 
if(!HttpMethod){
HttpMethod='GET';
}
req=initXMLHTTPRequest();
if(req){
req.onreadystatechange=onReadyStateBookmark;
req.open("GET",url,true);
req.setRequestHeader("Content-Type","application/x-www-form-urlenclosed");
req.send(null); 
if(req.readyState==0 || req.readyState==1 || req.readyState==2 || req.readyState==3 )
{
}	
req.onreadystatechange=function(){
if(req.readyState==4){
if(req.status==200){
var code=req.responseText;
//alert("code="+code)	
var strBookmark = code.split("-");
//alert("status="+strBookmark[0]); 
var objBookmark = document.getElementById(actid);
if(strBookmark[0]=="actbookmarked")
{ 
objBookmark.innerHTML="<img src='/savvy/images/icon_bookmarked.gif' alt='Bookmarked.' width='17' height='21'/>"; 
var newcnt = parseInt(votecount)+1;
document.getElementById(desc).innerHTML ="Great Idea! (" +newcnt+")"; 
}
if(strBookmark[0]=="alreadybookmark")
{ 
alert("Already Bookmarked")
}
if(strBookmark[0]=="notloggeduser")
{ 
//alert("NotLogged User")
document.search1.action="/savvy/parentRatingSignup.do?role=parentlite&pageHeader=signup&actId=actid";
document.search1.submit();
} 
}
} 
}	
}
}
function sendBookmarkCampRequest(url,params,HttpMethod){
if(!HttpMethod){
HttpMethod='GET';
}
req=initXMLHTTPRequest();
if(req){
req.onreadystatechange=onReadyStateBookmarkCamp;
req.open("GET",url,true);
req.setRequestHeader("Content-Type","application/x-www-form-urlenclosed");
//alert(params);
req.send(null);
}
}
function sendBookmarkClassRequest(url,params,HttpMethod){
if(!HttpMethod){
HttpMethod='GET';
}
req=initXMLHTTPRequest();
if(req){
req.onreadystatechange=onReadyStateBookmarkClass;
req.open("GET",url,true);
req.setRequestHeader("Content-Type","application/x-www-form-urlenclosed");
//alert(params);
req.send(null);
}
}
// Call Back Handler
function onReadyState(){
var ready=req.readyState;
var data=null;
if(ready==4){
data=req.responseText;
//alert(data);
paintResults(data);
ajaxFlag=true;
mapFlag=true;
if (document.getElementById("popGlanceAjax") != null) {
var contents = document.getElementById("popGlanceAjax").innerHTML;
if(contents != ""){
contents = contents.substring(0,contents.length-1);
var strExceArrayGlance = contents.split("~");
for(var g=0;g<strExceArrayGlance.length;g++){
var popElem=new popGlanceElement();
var temp = strExceArrayGlance[g];
var tempArray = temp.split("^");
if(tempArray[0]!='null' && tempArray[0]!=''){
popElem.schoolName=tempArray[0];
}
if(tempArray[1]!='null' && tempArray[1]!=''){
popElem.address=tempArray[1];
}
if(tempArray[2]!='null' && tempArray[2]!=''){
popElem.city=tempArray[2];
}
if(tempArray[3]!='null' && tempArray[3]!=''){
popElem.state=tempArray[3];
}
if(tempArray[4]!='null' && tempArray[4]!=''){
popElem.zip=tempArray[4];
}
if(tempArray[7]!='null' && tempArray[7]!=''){
popElem.tel=tempArray[7];
}
if(tempArray[10]!='null' && tempArray[10]!=''){
popElem.sid=tempArray[10];
}
if(tempArray[5]!='null' && tempArray[5]!=''){
popElem.website=tempArray[5];
}
if(tempArray[6]!='null' && tempArray[6]!=''){
popElem.websiteShow=tempArray[6];
}
if(tempArray[8]!='null' && tempArray[8]!=''){
popElem.fax=tempArray[8];
}
if(tempArray[9]!='null' && tempArray[9]!=''){
popElem.dirName=tempArray[9];
}
if(tempArray[11]!='null' && tempArray[11]!=''){
popElem.ratQuality=tempArray[11];
popElem.isRat="Y";
}
if(tempArray[12]!='null' && tempArray[12]!=''){
popElem.ratHome=tempArray[12];
popElem.isRat="Y";
}
if(tempArray[13]!='null' && tempArray[13]!=''){
popElem.ratSocial=tempArray[13];
popElem.isRat="Y";
}
if(tempArray[14]!='null' && tempArray[14]!=''){
popElem.ratCom=tempArray[14];
popElem.isRat="Y";
}
if(tempArray[15]!='null' && tempArray[15]!=''){
popElem.ratDis=tempArray[15];
popElem.isRat="Y";
}
if(tempArray[16]!='null' && tempArray[16]!=''){
popElem.ratFacility=tempArray[16];
popElem.isRat="Y";
}
if(tempArray[17]!='null' && tempArray[17]!=''){
popElem.ratHealth=tempArray[17];
popElem.isRat="Y";
}
if(tempArray[18]!='null' && tempArray[18]!=''){
popElem.ratSafety=tempArray[18];
popElem.isRat="Y";
}
if(tempArray[19]!='null' && tempArray[19]!=''){
popElem.ratSeparation=tempArray[19];
popElem.isRat="Y";
}
var divId = 'div'+popElem.sid;
popGlance[divId]=popElem
}
} 
}
//eval(contents);
execMapJS();
}
}
function onReadyStateBookmark(){
var ready=req.readyState;
var data=null;
if(ready==4){
data=req.responseText;
//alert(data);
paintBookmark(data);
}
}
function onReadyStateBookmarkCamp(){
var ready=req.readyState;
var data=null;
if(ready==4){
data=req.responseText;
//alert(data);
paintBookmarkCamp(data);
}
}
function onReadyStateBookmarkClass(){
var ready=req.readyState;
var data=null;
if(ready==4){
data=req.responseText;
//alert(data);
paintBookmarkClass(data);
}
}
// paint results Area
function paintResults(data){
var contents = document.getElementById("searchResultsMainBoxSwitch");
contents.innerHTML = "";
contents.innerHTML = data;
}
function paintBookmark(obj)
{
//alert("obj "+obj);	
if(obj.length <= 0 )
{
if( username=="" || username.length <= 0)
{
document.forms[0].action="/activites/booksignup";
document.forms[0].submit();
//window.location = "parentRatingSignup.do?role=parentlite&pageHeader=signup";
}
/*else
{
alert(" Already Bookmarked");	
}*/
}
/*else if(obj.length > 15)
{
alert(" Already Bookmarked");	
}*/
else
{
if(obj == 'bookmark'){
document.getElementById('bookmark').innerHTML="<img src='/savvy/images/bookmarkedWithBlackBG.gif' alt='Bookmark' />Bookmarked";
}else{
//alert("obj else"+obj);
document.getElementById(obj).innerHTML="<img src='/savvy/images/bookmarkWithCheckMark.gif' alt='Bookmarked.' width='31' height='21'/>Bookmarked";
}
}
}
function paintBookmarkCamp(obj){
if(obj == 'bookmark'){
document.getElementById('bookmark').innerHTML="<img src='/savvy/images/bookmarkedWithBlackBG.gif' alt='Bookmark' />This Camp is Bookmarked";
}else{
document.getElementById(obj).innerHTML="<img src='/savvy/images/bookmarkWithCheckMark.gif' alt='This Camp is Bookmarked.' width='31' height='21'/>";
}
}
function paintBookmarkClass(obj){
if(obj == 'bookmark'){
document.getElementById('bookmark').innerHTML="<img src='/savvy/images/bookmarkedWithBlackBG.gif' alt='Bookmark' />This Class is Bookmarked";
}else{
document.getElementById(obj).innerHTML="<img src='/savvy/images/bookmarkWithCheckMark.gif' alt='This Class is Bookmarked.' width='31' height='21'/>";
}
}
function paintResults2(data){
var schoolList = data.getElementsByTagName("schoolList")[0];
// Check that a more recent schoolList document hasn't been processed
// already
var generated = schoolList.getAttribute("generated");
var lastschoolListUpdate=0;
if (generated > lastschoolListUpdate) {
lastschoolListUpdate = generated;
// Clear the HTML list used to display the schoolList contents
var contents = document.getElementById("searchResultsMainBoxSwitch");
contents.innerHTML = "";
// Loop over the schools in the schoolList
var schools = schoolList.getElementsByTagName("school");
for (var I = 0 ; I < schools.length ; I++) {
var school = schools[I];
// Extract the text nodes from the name and distance elements
var name = school.getElementsByTagName("name")[0]
.firstChild.nodeValue;
var distance = school.getElementsByTagName("distance")[0]
.firstChild.nodeValue;
// Create and add a list school HTML element for this schoolList school
var li = document.createElement("li");
li.appendChild(document.createTextNode(name+" x "+distance));
contents.appendChild(li);
}
}
}
// SchoolPhilosophy
function refineSchoolPhilosophy(url,form){
var phil = document.schoolPhilosophyAjax.philosophy;
var selectedPhil="";
for(var i=0; i < phil.length; i++ ){
//alert(phil[i].checked);	
if(phil[i].checked){
if(selectedPhil==""){
selectedPhil=phil[i].value;
}else{
selectedPhil+=','+phil[i].value;
}
}
}
if(selectedPhil==""){
alert("Please select at least one school.");
}else{
url+='&schoolPhilosophy='+selectedPhil;
switchDisplay('schoolPhilosophy');
switchClass('schoolPhilosophyLI');
window.location.href=url;
}
}
function refinePreschoolPhilosophy(url)
{
var phil = document.PhilosophyscheduleForm.philosophyAge;
var selectedPhil="";
for(var i=0; i < phil.length; i++ ){
//alert(phil[i].checked);	
if(phil[i].checked){
if(selectedPhil==""){
selectedPhil=phil[i].value;
}else{
selectedPhil+=','+phil[i].value;
}
}
}
if(selectedPhil==""){
alert("Please select at least one school.");
}else{
url+='&schoolPhilosophy='+selectedPhil;
switchDisplay('schoolPhilosophy');
switchClass('schoolPhilosophyLI');
window.location.href=url;
} 
}
function refineParentReco(url){
var parReco = document.parentRecoForm.parentReco;
var selectedVal = parReco.options[parReco.selectedIndex].value;
url+='&parentRecomendation='+selectedVal;
switchDisplay('parentsRecommend');
switchClass('parentsRecommendLI');
window.location.href=url;
}
function refineParentRat(url){
var qot = document.parentRatForm.qualityTeaching;
var selectedVal = qot.options[qot.selectedIndex].value;
url+='&qualityOfTeaching='+selectedVal;
var socialSkills = document.parentRatForm.socialSkills;
var selectedVal = socialSkills.options[socialSkills.selectedIndex].value;
url+='&devSocialSkills='+selectedVal;
var schoolConnection = document.parentRatForm.schoolConnection;
var selectedVal = schoolConnection.options[schoolConnection.selectedIndex].value;
url+='&homeSchoolConnection='+selectedVal;
var community = document.parentRatForm.community;
var selectedVal = community.options[community.selectedIndex].value;
url+='&parentCommunity='+selectedVal;
var discipline = document.parentRatForm.discipline;
var selectedVal = discipline.options[discipline.selectedIndex].value;
url+='&discipline='+selectedVal;
var facilities = document.parentRatForm.facilities;
var selectedVal = facilities.options[facilities.selectedIndex].value;
url+='&facilities='+selectedVal;
var health = document.parentRatForm.health;
var selectedVal = health.options[health.selectedIndex].value;
url+='&health='+selectedVal;
var safety = document.parentRatForm.safety;
var selectedVal =safety.options[safety.selectedIndex].value;
url+='&safety='+selectedVal;
var separation = document.parentRatForm.separation;
var selectedVal = separation.options[separation.selectedIndex].value;
url+='&separation='+selectedVal;
switchDisplay('parentRating');
switchClass('parentRatingLI');
window.location.href=url;
}
function refineOrderBy(url){
}
function refineKeyStats(url){
// Total enrollment is pending
var totEnroll = document.keyStatsForm.totEnrol;
var selectedVal = totEnroll.value;
if(selectedVal!=""){
if(isNumericField(selectedVal)){
url+='&totalEnrollment='+selectedVal;
}else{
alert("Total enrollment cannot be a non numeric value.");
return;
}
}else{
url+='&totalEnrollment='+0;
}
//Teacher Tenure
var teacherTenure = document.keyStatsForm.teacherTenure;
var selectedVal = teacherTenure.options[teacherTenure.selectedIndex].value;
url+='&teacherTenure='+selectedVal;
//Transportation 
var transOpt1 = document.keyStatsForm.transPar;
var transOpt2 = document.keyStatsForm.transBus;
var transOpt3 = document.keyStatsForm.transPub;
if(transOpt1.checked){
var selectedVal = transOpt1.value;
url+='&transParent='+selectedVal;
}
if(transOpt2.checked){
var selectedVal = transOpt2.value;
url+='&transBus='+selectedVal;
}
if(transOpt3.checked){
var selectedVal = transOpt3.value;
url+='&transPublic='+selectedVal;
}
// dropOff
//Teacher Tenure
var dropOff = document.keyStatsForm.dropOff;
var selectedVal = dropOff.options[dropOff.selectedIndex].value;
url+='&dropOff='+selectedVal;
// Third Year
var thirdYear = document.keyStatsForm.thirdYear;
if(thirdYear.checked){
//alert("thirdYear " + thirdYear.checked);
var selectedVal = thirdYear.value;
url+='&thirdYear='+true;
}
var nayc = document.keyStatsForm.nayc;
if(nayc.checked){
var selectedVal = nayc.value;
url+='&nayc='+true;
}
var kindergarten = document.keyStatsForm.kindergarten;
if(kindergarten.checked){
var selectedVal = kindergarten.value;
url+='&kgElem='+true;
}
var relAff = document.keyStatsForm.relAff;
if(relAff.checked){
var selectedVal = relAff.value;
url+='&relAffl='+true;
}
var splNeeds = document.keyStatsForm.splNeeds;
if(splNeeds.checked){
var selectedVal = splNeeds.value;
url+='&childSplNeeds='+true;
}
switchDisplay('keyStats');
switchClass('keyStatsLI');
window.location.href=url;
}
function refinePreschoolAgeTuition(url){
var twoThreeAge = document.ageTuitionForm.twoThreeAge;
if(twoThreeAge.checked){
var selectedVal = twoThreeAge.value;
url+='&twoThreeAge='+true;
}
var threeFourAge = document.ageTuitionForm.threeFourAge;
if(threeFourAge.checked){
var selectedVal = threeFourAge.value;
url+='&threeFourAge='+true;
}
var fourFiveAge = document.ageTuitionForm.fourFiveAge;
if(fourFiveAge.checked){
var selectedVal = fourFiveAge.value;
url+='&fourFiveAge='+true;
}
var fiveSixAge = document.ageTuitionForm.fiveSixAge;
if(fiveSixAge.checked){
var selectedVal = fiveSixAge.value;
url+='&fiveSixAge='+true;
}
var classSize = document.ageTuitionForm.classSize;
if(classSize.value!=""){
if(isNumericField(classSize.value)){
var selectedVal = classSize.value;
url+='&classSize='+selectedVal;
}else{
alert("Class size cannot be a non numeric value.");
return;
}
}else{
url+='&classSize='+0;
}
switchDisplay('agesSchedule');
switchClass('agesScheduleLI');
window.location.href=url;
}
function refineMinAge(url){
var minAgeYear = document.minAgeForm.year;
var minAgeMonth = document.minAgeForm.months;
var selectedValYear = minAgeYear.options[minAgeYear.selectedIndex].value;
var selectedValMonth = minAgeMonth.options[minAgeMonth.selectedIndex].value;
var selectedVal=0;
if(selectedValYear != -1){
selectedVal=selectedValYear*12;
}
if(selectedValMonth != -1){
selectedVal=eval(selectedVal) + eval(selectedValMonth);
}
if((selectedValMonth != -1) || (selectedValYear != -1)) {
url+='&cutOffAge='+selectedVal;
}
switchDisplay('minimumAge');
switchClass('minimumAgeLI');
window.location.href=url;
}
function refineTuition(url){
var tuition = document.tuitionForm.tuitionFees;
var selectedValTuition= tuition.options[tuition.selectedIndex].value;
if(selectedValTuition != -1){
url+='&tuitionFees='+selectedValTuition;
}
switchDisplay('tuitionLevels');
switchClass('tuitionLevelsLI');
window.location.href=url;
}
function refineStudenTeacherRatio(url){
var ratio = document.studentTeacherRatioForm.studentTeacherRatio;
var selectedValRatio= ratio.options[ratio.selectedIndex].value;
if(selectedValRatio != 0.0){
url+='&studentTeacherRatio='+selectedValRatio;
}
switchDisplay('teacherStudent');
switchClass('teacherStudentLI');
window.location.href=url;
}
function refineApplications(url){
var applicationsAcceptedMonth = document.applicationsForm.applicationsAcceptedMonth;
var applicationsAcceptedMonthValue= applicationsAcceptedMonth.options[applicationsAcceptedMonth.selectedIndex].value;
var applicationsAcceptedDay = document.applicationsForm.applicationsAcceptedDay;
var applicationsAcceptedDayValue= applicationsAcceptedDay.options[applicationsAcceptedDay.selectedIndex].value;
if(applicationsAcceptedMonthValue != -1 && applicationsAcceptedDayValue != -1){
var applicationsAcceptedValue = applicationsAcceptedMonthValue + applicationsAcceptedDayValue;
url+='&applicationAccepted='+applicationsAcceptedValue;
}
var applicationsDeadlineMonth = document.applicationsForm.applicationsDeadlineMonth;
var applicationsDeadlineMonthValue= applicationsDeadlineMonth.options[applicationsDeadlineMonth.selectedIndex].value;
var applicationsDeadlineDay = document.applicationsForm.applicationsDeadlineDay;
var applicationsDeadlineDayValue= applicationsDeadlineDay.options[applicationsDeadlineDay.selectedIndex].value;
if(applicationsDeadlineMonthValue != -1 && applicationsDeadlineDayValue != -1){
var applicationsDeadlineValue = applicationsDeadlineMonthValue + applicationsDeadlineDayValue;
url+='&applicationDeadLine='+applicationsDeadlineValue;
}
var waitList = document.applicationsForm.waitList;
if(waitList.checked){
url+='&waitList='+true;
}
var financialAid = document.applicationsForm.financialAid;
if(financialAid.checked){
url+='&financialAid='+true;
}
var appCrit = document.applicationsForm.appCrit;
for (var i=0; i < appCrit.length; i++){
if (appCrit[i].checked){
url+='&acceptanceCriteria='+appCrit[i].value;
}
}
switchDisplay('applications');
switchClass('applicationsLI');
window.location.href=url;
}
function refinePreschoolSchedule(url){
var amSchedule = document.scheduleForm.amSchedule;
if(amSchedule.checked){
url+='&amSchedule='+true;
}
var pmSchedule = document.scheduleForm.pmSchedule;
if(pmSchedule.checked){
url+='&pmSchedule='+true;
}
var extendedDay = document.scheduleForm.extendedDay;
if(extendedDay.checked){
url+='&extendedSchedule='+true;
}
var yearRound = document.scheduleForm.yearRound;
if(yearRound.checked){
url+='&yrRoundSchedule='+true;
}
switchDisplay('schedule');
switchClass('scheduleLI');
window.location.href=url;
}
function refineDistance(url){
var distance = document.distanceAjax.distance;
var selectedValDistance= distance.options[distance.selectedIndex].value;
url+='&distance='+selectedValDistance;
switchDisplay('distance');
switchClass('distanceLI');
window.location.href=url;
}
function pagination(url,currPage){
url+='&currPage='+currPage;
window.location.href=url;
}
function sorting(url,sortOrder){
url+='&sortOrder='+sortOrder;
window.location.href =url;
}
function bookmark(url,schoolId){
url+='&bmId='+schoolId;
alert(url);
sendBookmarkRequest(url,"","");
}
function bookmarkSchool(url,schoolId,vote,desc){
url+='&bmId='+schoolId; 
sendBookmarkSchoolRequest(url,schoolId,"","",vote,desc);
} 
function bookmarkSchoolReview(url,schoolId){
url+='&bmId='+schoolId;
sendBookmarkRequest(url,"","");
}
function bookmarkActivities(url,user,actid,desr,votecount){	
username=user;
sendBookmarkRequest(url,"","",actid,desr,votecount);
}
function bookmarkCamp(url,schoolId){
url+='&bmId='+schoolId;
sendBookmarkCampRequest(url,"","");
}
function bookmarkClass(url,schoolId){
url+='&bmId='+schoolId;
sendBookmarkClassRequest(url,"","");
}
function resetRefineSearch(url){
window.location.href=url;
}
//Numeric Check
function isNumericField(sText){
var validChars = "0123456789";
var isNumber=true;
var aChar;
for (i = 0; i < sText.length && isNumber == true; i++) { 
aChar = sText.charAt(i); 
if (validChars.indexOf(aChar) == -1) {
isNumber = false;
}
}
return isNumber;
}
