function btnSearchClick( type )
{
if(document.getElementById('searchType').value == 'SBD')
return GetSelectDistrict();
else
return GetSelectCity();
}
function addDistrictsByCounties()
{
var listC = document.getElementById("lbxCounties");
if( listC.selectedIndex == -1 )
return;
var countyCode = listC.options[listC.selectedIndex].value;
var countyName = listC.options[listC.selectedIndex].text + " County";
iGen.WebServices.schools.GetDistrict(countyCode,onGetDistrictSuccessed);
}
function onGetDistrictSuccessed(result,userContext,methodName)
{
if( result != null && result.Rows.length > 0 )
{
var listD = document.getElementById("lbxDistricts");
var i = 0;
while( listD.options.length > 0 )
{
listD.remove(0);
}
for( i = 0; i < result.Rows.length; i++ )
{
var oOption = document.createElement("OPTION");
var uAgent = window.navigator.userAgent;
if( uAgent.indexOf("Firefox") != -1 || uAgent.indexOf("Netscape") != -1 )
listD.options.add( oOption );
else
listD.add( oOption );
oOption.value = result.Rows[i].dist_code.substring(0,7);
oOption.innerHTML = result.Rows[i].dist_name;
}
}
}
function additem()
{	
var src = document.forms[0].elements["lbxLocation1"];
while(src.selectedIndex > -1)
{
var targ = src.form.elements["lbxLocation2"];
var opt = src.options[src.selectedIndex];
opt.text = src.options[src.selectedIndex].text;
opt.value = src.options[src.selectedIndex].value;
targ.options[targ.options.length] = new Option(opt.text,opt.value);
src.options[src.selectedIndex] = null;
}
}
function delitem()
{
var i=0;
var list1=document.getElementById("lbxLocation2");	
if(list1.selectedIndex<0)
{
return;
}
var item=list1.options[list1.selectedIndex];
var list2=document.getElementById("lbxLocation1");
var options=list2.options;
var cityname=new Array(options.length+1);
var citycode=new Array(options.length+1);
for(i=0;i<options.length;i++)
{
if(options[i].text<item.text)
{
cityname[i]=options[i].text;
citycode[i]=options[i].value;	
}
else
{
cityname[i]=item.text;
citycode[i]=item.value;	
break;
}
}
if(i==options.length)
{
cityname[i]=item.text;
citycode[i]=item.value;	
}
else
{
while(i<options.length)
{
cityname[i+1]=options[i].text;
citycode[i+1]=options[i].value;
i++;
}
}
i=0;
while(list2.options.length>0)
{
list2.remove(0);	
}
for(i=0;i<cityname.length;i++)
{
var oOption = document.createElement("OPTION");
var uAgent = window.navigator.userAgent;
if(uAgent.indexOf("Firefox") != -1 || uAgent.indexOf("Netscape") != -1)//for FireFox and Netscape
list2.options.add(oOption);
else
list2.add(oOption);
oOption.innerHTML = cityname[i];
oOption.value = citycode[i];	
}
list1.remove(list1.selectedIndex);
}
function GetSelectCity()
{
var i=0;
var list1=document.getElementById("lbxLocation2");
if(list1.options.length<1)
{
alert("Please select at least one city.");
return false;
}
var tb=document.getElementById("TempTbx");
var tb2=document.getElementById("tbxSelectCity");
tb.value="";
tb2.value="";
for(i=0;i<list1.options.length;i++)
{
tb.value+="'"+list1.options[i].value+"'"+",";
tb2.value+=list1.options[i].text+", ";
}
if(tb.value!="")
{
tb.value=tb.value.substring(0,tb.value.length-1);
tb2.value=tb2.value.substring(0,tb2.value.length-2);
}	
return true;	
}
function GetSelectDistrict()
{
var listD = document.getElementById("lbxDistricts");
if( listD.selectedIndex == -1 )
{
alert("Please select at least one district");
return false;
}
var tbxTempD = document.getElementById("tbxTempD");
tbxTempD.value = listD.options[listD.selectedIndex].value;
return true;
}
function getCDSList(str,cdsNum,cdsList,sch_type,state)
{
var cdsType = document.getElementById("cdsType");
var stateList = document.getElementById("stateList");
var cdsNum=document.getElementById(cdsNum);
if(cdsNum.value=="")
cdsNum.value="0";
var cdsCode=document.getElementById(str);
var cdsList=document.getElementById(cdsList);
if(cdsCode.checked)
{
cdsType.value += ","+sch_type;
stateList.value += "," + state;
cdsNum.value=eval(cdsNum.value)+1;
if(cdsList.value)
cdsList.value+=","+cdsCode.value;
else
cdsList.value=cdsCode.value;
}
else
{
if(cdsType.value != "" && cdsType.value.indexOf(sch_type)>-1 )
cdsType.value = cdsType.value.replace(","+sch_type,"");
if(stateList.value != "" && stateList.value.indexOf(state)>-1)
stateList.value = stateList.value.replace(","+state,"");
cdsNum.value=eval(cdsNum.value)-1;
var cdsArray=cdsList.value.split(',');
if(cdsArray.length>1)
{
if(cdsArray[0]==cdsCode.value)
cdsList.value=cdsList.value.split(cdsCode.value+",").join("");
else
cdsList.value=cdsList.value.split(","+cdsCode.value).join("");
}
else
cdsList.value="";
}
if(cdsNum.value>3)
{
alert("You may compare only up to 3 schools.");
if(cdsType.value != "" && cdsType.value.indexOf(sch_type)>-1 )
cdsType.value = cdsType.value.replace(","+sch_type,"");
if(stateList.value != "" && stateList.value.indexOf(state)>-1)
stateList.value = stateList.value.replace(","+state,"");
cdsCode.checked=false;
cdsNum.value=eval(cdsNum.value)-1;
var cdsArray=cdsList.value.split(',');
if(cdsArray.length>1)
{
if(cdsArray[0]==cdsCode.value)
{
cdsList.value=cdsList.value.split(cdsCode.value+",").join("");
}
else
{
cdsList.value=cdsList.value.split(","+cdsCode.value).join("");
}
}
else
{
cdsList.value="";
}
}
}
function compareSchools(cdsNum,cdsList)
{
var cdsType = document.getElementById("cdsType");
if(cdsType.value != "" && cdsType.value.split(',').length>2)
{
var sch_list = cdsType.value.substring(1).split(',');
var isSameSchType = true;
var tempSchType = sch_list[0];
for(var i=1; i<sch_list.length; i++)
{
if(tempSchType != sch_list[i])
{
isSameSchType = false;
break;
}
}
if(isSameSchType == false)
{
alert("You can only compare schools of the same type.");
return;
}
}
var stateList = document.getElementById("stateList");
var stateFirst = "";
if(stateList.value != "" && stateList.value.split(',').length>2)
{
var state_list = stateList.value.substring(1).split(',');
var isSameState = true;
var tempState = state_list[0];
stateFirst = state_list[0];
for(var i=1; i<state_list.length; i++)
{
if(tempState != state_list[i])
{
isSameState = false;
break;
}
}
if(isSameState == false)
{
alert("You can only compare schools within the same state.");
return;
}
}
var cdsNum=document.getElementById(cdsNum);
var cdsList=document.getElementById(cdsList);
if(cdsNum.value>0)
{
window.location = "detailedschool.aspx?cds_code="+cdsList.value+"&State=" + stateFirst;
}
else
{
alert("You may compare only up to 3 schools.");
}
}
function btnFocus(e,tbx, btnID)
{
var btnID=document.getElementById(btnID);
var target;
var key;
if (window.event)
{
target = window.event.srcElement;
key = event.keyCode;
}
else if (e)
{
target = e.target;
key = e.which;
}
else
{
return;
}
if(key==13&&(target.type== "text"||target.type =="password"))
{
btnID.focus();
btnID.click();
}
}
function checkFirstSearchInput()
{
var tbxStreetAddress = document.getElementById("tbxStreetAddress");
var tbxCity = document.getElementById("tbxCity");
var msgAddr = document.getElementById("msgAddr");
var msgCity = document.getElementById("msgCity");
if(Trim(tbxStreetAddress.value) == "" || Trim(tbxCity.value) == "")
{
if(Trim(tbxStreetAddress.value) == "")
msgAddr.innerHTML = "<font color=red>*Required</font>";
else
msgAddr.innerHTML = "";
if(Trim(tbxCity.value) == "")
msgCity.innerHTML = "<font color=red>*Required</font>";
else
msgCity.innerHTML = "";
return false;
}
else
{
msgAddr.innerHTML = "";
msgCity.innerHTML = "";
return true;
}
}
function getCityList()
{
var tb=document.getElementById("TempTbx");
var list1=document.getElementById("lbxLocation1");
var list2=document.getElementById("lbxLocation2");
if(tb.value!="")
{
var cityCode=tb.value.replace(/'/g,"");
var cityCodeList=cityCode.split(',');
if(cityCodeList.length>0)
{
for(var i=0;i<cityCodeList.length;i++)
{
for(var j=0;j<list1.options.length;j++)
{
if(list1.options[j].value==cityCodeList[i])
{
var oOption = document.createElement("OPTION");
var uAgent = window.navigator.userAgent;
if(uAgent.indexOf("Firefox") != -1 || uAgent.indexOf("Netscape") != -1)//for FireFox and Netscape
list2.options.add(oOption);
else
list2.add(oOption);
oOption.innerHTML = list1.options[j].text;
oOption.value = list1.options[j].value;
list1.remove(j);
break;
}
}
}
}
}
}
function GetDistrictList()
{
var tb = document.getElementById("tbxTempD");
var list=document.getElementById("lbxDistricts");
if(tb.value!="")
{
addDistrictsByCounties();
var distCode=tb.value.replace(/'/g,"");
if( distCode != "")
{
for(var j=0;j<list.options.length;j++)
{
if(list.options[j].value == distCode)
{
list.selectedIndex = j;
break;
}
}
}
}
}
function ShowBtnCompareOrNot( type )
{
var showSchoolResult = document.getElementById("showSchoolResult_" + type );
var btnCompare = document.getElementById("btnCompare_" + type );
if( showSchoolResult != null && btnCompare != null && showSchoolResult.innerHTML == "" )
{
btnCompare.style.display = "none";
}
else
btnCompare.style.display = "block";
}
function ShowSearchResultControls(type)
{
var sch_result_sba = document.getElementById("sch_result_sba");
var sch_result_sbc = document.getElementById("sch_result_sbc");
var sch_result_sbd = document.getElementById("sch_result_sbd");
sch_result_sba.style.display = "none";
sch_result_sbc.style.display = "none";
sch_result_sbd.style.display = "none";
var sch_result = document.getElementById("sch_result_" + type);
if( sch_result!=null )
{
sch_result.style.display = "block";
}
ShowBtnCompareOrNot( type );
}
function GetTabValue(type)
{
if(type == "")
type = "SBC";
var searchType = document.getElementById("searchType");
searchType.value = type ;
if( type.toLowerCase() == "sbd")
{
GetDistrictList();
}
if( type.toLowerCase() == "sbc")
{
getCityList();
}
var sba = document.getElementById("SBA");
var sbc = document.getElementById("SBC");
var sbd = document.getElementById("SBD");
sba.style.display = "none";
sbc.style.display = "none";
sbd.style.display = "none";	
var tab = document.getElementById(type);
if( tab != null)
{
tab.style.display = "block";
}
ShowSearchResultControls( type.toLowerCase() );
RestoreSearchCondition( type.toLowerCase() );
TdStyle();
}
function RestoreSearchCondition( type )
{
var searchCondition = document.getElementById("searchCondition_" + type );
if( searchCondition != null && searchCondition.value != "" )
{
var sC = searchCondition.value.split('_');
if( sC.length > 0 )
{
if(type.toLowerCase() == "sba")
{
var strAddr = document.getElementById("tbxStreetAddress");
if( strAddr!= null)
strAddr.value = sC[0];
var strCity = document.getElementById("tbxCity");
if(strCity!= null)
strCity.value = sC[1];
}
else if(type.toLowerCase() == "sbd")
{
RestoreSchoolTypeAndAPI("chbxSchType1_", sC, type );
}
else
{
RestoreSchoolTypeAndAPI("chbxSchType_", sC, type );
}
}
BtnEvent_SchoolInfo( type );
}
else
{
TrackGoogleAnalytics(GetPageNameForGA(type.toLowerCase(), 0));
}
}
function RestoreSchoolTypeAndAPI( chbxName, sC, type)
{
for( var j=0; j<3; j++)
{
var sC1 = sC[0].split(',');
var chbx = document.getElementById(chbxName + j);
for( var k=0; k<sC1.length; k++)
{
if( chbx != null && chbx.value.toLowerCase() == sC1[k].replace(/'/g,"").toLowerCase())
{
chbx.checked = true;
break;
}
else
chbx.checked = false;
}
}
}
function TdStyle()
{
var td1=document.getElementById("td1");
var td2=document.getElementById("td2");
var td3 = document.getElementById("td3");
td1.className="switch";
td2.className="switch";
td3.className = "switch";
var searchType=document.getElementById("searchType");
switch(searchType.value)
{
case "SBA":
td1.className="switchTab";
tdOut("td2");
tdOut("td3");
break;
case "SBC": default:
td2.className="switchTab";
tdOut("td1");
tdOut("td3");
break;
case "SBD":
td3.className="switchTab";
tdOut("td1");
tdOut("td2");
break;
}
}
function tdOver(ID)
{
var searchType=document.getElementById("searchType");
var tID;
switch ( searchType.value)
{
case "SBA":
tID = "td1";
break;
case "SBC": default:
tID = "td2";
break;
case "SBD":
tID = "td3";
break;
}
if( tID != ID)
{
var tdID=document.getElementById(ID);
tdID.style.backgroundColor = "white";
}
}
function tdOut(ID)
{
var searchType=document.getElementById("searchType");
var tID;
switch ( searchType.value)
{
case "SBA":
tID = "td1";
break;
case "SBC":default:
tID = "td2";
break;
case "SBD":
tID = "td3";
break;
}
if( tID != ID)
{
var tdID=document.getElementById(ID);
tdID.style.backgroundColor = "#f4f0c3";
}
}
function HomesNearby_Click(cdscode,sch_type)
{
iGen.WebServices.schools.homesNearby_click(cdscode,sch_type,onhomesNearby_clickSuccessed);
}
function onhomesNearby_clickSuccessed(result,userContext,methodName)
{
window.location.href = result;
}
function getMap()
{
var tbCDS = document.getElementById("tbCDS");
var iptState = document.getElementById("iptState");
if(iptState==null || iptState.value == "")
return;
iGen.WebServices.DetailedSchool.getSchoolsData(tbCDS.value, iptState.value, onGetSchoolDataSucceed);	
}
function onGetSchoolDataSucceed(res)
{
GetDetailMap(res,"school",1);
var igen_key = Trim(document.getElementById("tbMLS").value);
if(igen_key != "")
{	
iGen.WebServices.DetailedSchool.GetPropertyHouseData(igen_key, onGetPropertyHouseDataSucceed);
}
}
function onGetPropertyHouseDataSucceed(res)
{
if(isValid(res))
{	
var dt =GetTable(res);
if(dt.Rows.length !=1) return;
var i = 0;
var icon = CreateIcon();	
var point; var	markerinfo = ""; var imgurl;
longitude = dt.Rows[i].Longitude;
latitude = dt.Rows[i].Latitude;	
var igenkey = dt.Rows[i].IGen_Key;
imgurl = GetPropertyImg(1000,0);
if(dt.Rows[i].List_Price!=null)	
markerinfo = "<br>"+"$"+dt.Rows[i].List_Price+ "<br>";	
var address = "";
if(dt.Rows[i].Address!=null)
address = GetHouseAddress(igenkey,dt.Rows[i].Address,2,"","house");	
markerinfo = "<table align=left border=0 cellpadding=0 cellspacing=0><FONT size=1>"+address+markerinfo + dt.Rows[i].Remark+"</FONT></table>";
icon.image = imgurl;	
point = new GPoint(longitude, latitude);	
markers[igenkey] = createXMarker(point,icon, markerinfo,igenkey,"house");	
if(gmapContn!=null && gmapContn.map != null && markers[igenkey]!= null)	
gmapContn.map.addOverlay(markers[igenkey]);
}
}
function showNotes(noteId)
{
var note="";
switch(noteId)
{
case "apiPerformanceNotes":
note="<span style='FONT-SIZE:80%'>API Score<br>The API is a numeric index or scale that ranges from a low of 200 to a high of 1000. A school's score or placement on the API is an indicator of a school's performance level. The state has set 800 as the API score that schools should strive to meet. A school's growth is measured by how well it is moving toward (or past) that goal. Schools that fall short of 800 will be required to meet annual growth targets until the statewide target of 800 is reached. Schools that already meet or exceed the statewide target of 800 should continue working to improve the academic performance of all of their students.</span>";
break;
case "api1PerformanceNotes"://decile rank noteId
note="<span style='FONT-SIZE:80%'>Decile Ranks<BR>Schools' API scores are ranked separately within school type: elementary, middle, and high schools. For each of the three categories, schools' API scores are first sorted from lowest to highest statewide and then divided into ten equal groups (or deciles) ranked from lowest (one) to highest (ten). This first process produces the statewide ranks. A second process produces the similar schools ranks.</span>";
break;	
case "api2PerformanceNotes"://similar schools rank noteId
note="<span style='FONT-SIZE:80%'>Similar Schools Ranks<BR>The API reports include a \"similar schools rank.\" This information shows where a school ranks academically on a scale of 1 to 10, compared with 100 other schools with similar demographic characteristics. California public schools serve students with many different backgrounds and needs. As a result, schools face different educational challenges. The similar schools ranks allow schools to look at their academic performance compared to other schools with some of the same opportunities and challenges.</span>";
break;
case "taksPerformanceNotes":
note="<span style='FONT-SIZE:80%'>In the state of Texas, school performance is scored by the Texas Assessment of Knowledge and Skills (TAKS) tests. The values below represent the percentage of students who met or exceeded the standards in the all the TAKS tests.</span>";
break;
case "taksEnglishHeaderNotes":
case "taksMathHeaderNotes":
case "taksSocialHeaderNotes":
case "taksScienceHeaderNotes":
case "taksAllHeaderNotes":
note="<span style='FONT-SIZE:80%'><br>In the state of Texas, school performance is scored by the Texas Assessment of Knowledge and Skills (TAKS) tests."
+" The graphs below display the percentage of students who met or exceeded the standards in each subject.<BR><BR>"
+"Math and English* scores are available for grades 3 through 11.<BR>"
+"Science scores are available in grades 5, 8, 10, and 11.<BR>"
+"Social studies scores are available in grades 8, 10, and 11.<BR><BR>"
+"*The English score represents reading in grades 3 through 9, and English language arts in grades 10 and 11.<BR><BR></span>";
break;
case "gaPerformanceNotes":
note = "<span style='FONT-SIZE:80%'>The number in the test score column represents the average (mean) value of "
+"students passing the following tests. To see each subject individually, click "
+"on the school name to see a detailed report on the school.<BR><BR> "
+"Elementary Schools: Grade 5 English language arts, reading, math, science, and "
+"social studies CRCT tests.<BR><BR> "
+"Middle Schools: Grade 8 English language arts, reading, math, science, and "
+"social studies CRCT tests.<BR><BR> "
+"High Schools: Grade 11 English language arts, math, science, and social studies "
+"EOCT tests.</span>";
break;
case "ncPerformanceNotes":
note = "<span style='FONT-SIZE:80%'>Elementary and middle school students in North Carolina are tested with the "
+"End-of-Grade (EOG) tests in the subjects of reading and math. Movoto shows the percentage of students per "
+"school who scored at or above the proficient level in each subject.<BR><BR> "
+"High school students are tested with End-of-Course (EOC) tests in the "
+"subjects algebra 1, algebra 2, English 1, biology, United States "
+"history, geometry, chemistry, physical science, physics, and ELPS. Movoto "
+"shows the percentage of students per school who scored at or above the proficient level in each subject.</span>";
break;
case "fcatPerformanceNotes":
note = "<span style='FONT-SIZE:80%'>In the State of Florida, school performance is scored using the Florida "
+"Comprehensive Assessment (FCAT) Tests. The scores displayed on Movoto for each "
+"grade represent the percentage of students who received an achievement level of "
+"3 (passing) or better in the subject.</span>";
break;
case "fcat1PerformanceNotes"://fact nrt note
note = "<span style='FONT-SIZE:80%'>The FCAT NRT percentage is used to compare the performance of the students in "
+"the Florida school to students nationwide. The nationwide average is 50. If "
+"the score is 65, then the students performed equal to or better than 65% of "
+"students across the country.</span>";
break;
case "oaksPerformanceNotes":
note = "<span style='FONT-SIZE:80%'>The four scores represent the Oregon Assessment of Knowledge and Skills (OAKS) "
+"scores for the highest available grade level in the school. The scores are "
+"Reading/Math/Science/Writing respectively.<br><br>*95% is the highest possible score, and 5% is the lowest possible score.</span>";
break;
case "waslPerformanceNotes":
note = "<span style='FONT-SIZE:80%'>The four scores represent the Washington Assessment of Student Learning (WASL) "
+"scores for the highest available grade level in the school. The scores are "
+"Reading/Math/Science/Writing respectively.</span>";
break;
case "aimsPerformanceNotes":
note = "<span style='FONT-SIZE:80%'>The four scores represent the Arizona Instrument to Measure Standards (AIMS) "
+"results for the highest available grade level in the school. The scores are Reading/Math/Science/Writing respectively.</span>";
break;
case "isatPerformanceNotes":
note = "<span style='FONT-SIZE:80%'>The number for each school is a percentage that represents the performance of "
+"students in the school on the ISAT test for elementary/middle schools, or the "
+"PSAE test for high schools. This score is provided by the Illinois State Board "
+"of Education.</span>";
break;
case "pssaPerformanceNotes":
note = "<span style='FONT-SIZE:80%'>The four numbers represent the Pennsylvania System of State Assessments (PSSA) "
+"scores for the highest available grade level in the school. The scores are "
+"Reading/Math/Science/Writing respectively.</span>";
break;
case "nysaPerformanceNotes"://math a/english noteId
case "nysa1PerformanceNotes"://math b/math noteId
case "nysa2PerformanceNotes"://english noteId
case "nysa3PerformanceNotes"://living environment noteId
case "nysa4PerformanceNotes"://physics noteId
case "nysa5PerformanceNotes"://chemistry noteId
case "nysa6PerformanceNotes"://earth science noteId
case "nysa7PerformanceNotes"://intergrated algebra noteId
case "nysa8PerformanceNotes"://global history and geography noteId
case "nysa9PerformanceNotes"://u.s. history and government noteId
note = "<span style='FONT-SIZE:80%'>In the State of New York, school performance is scored using the New York "
+"State Assessment (NYSA) tests. The scores displayed on Movoto for each grade represent the percentage of students "
+"school-wide who scored at or above the proficient level in the subject.</span>"
break;
case "tcapPerformanceNotes":
note = "<span style='FONT-SIZE:80%'>The two scores below represent the Tennessee Comprehensive Assessment Program "
+ "(TCAP) results for the highest available grade level in the school. The scores are displayed as Math/Reading respectively.</span>";
break;
case "dstpPerformanceNotes":
note = "<span style='FONT-SIZE:80%'>The two scores below represent the Delaware Student Testing Program (DSTP) results "
+ "for the highest available grade level in the school. The scores are displayed as "
+ "Math/Reading/Writing respectively.</span>";
break;
case "nj_askPerformanceNotes":
note = "<span style='FONT-SIZE:80%'>For high schools, the two numbers represent the High School Proficiency Assessment (HSPA)"
+" test results in the subjects of math and language arts respectively. For elementary and middle schools, the three numbers "
+"represent the New Jersey Assessment of Skills and Knowledge (NJ ASK) test results in the subjects of math, language arts, and "
+"science respectively.</span>";
break;
default:
break;
}
var ID=document.getElementById(noteId);
ID.className="notesStyle";
ID.innerHTML=note;	
}
function HiddenNotes(noteId)
{
var ID=document.getElementById(noteId);
ID.className="notesStyleHidden";
}
function GetSchoolType( typeName )
{
var schType = "";
for(var i=0;i<4;i++)
{
var chbx = document.getElementById(typeName + i);
if( chbx != null && chbx.checked == true )
{
schType += "'" + chbx.value + "',";
}
}
if(schType !="")
schType = schType.substring( 0, schType.length-1);
return schType;
}
function BtnEvent_SchoolInfo( type )
{
var searchCondition = document.getElementById("searchCondition_" + type );
switch(type.toLowerCase())
{
case "sbc":
if(!btnSearchClick(type))
{
if( searchCondition != null )
searchCondition.value = "";
return;
}
var cityList = document.getElementById("TempTbx").value;
var sch_type = GetSchoolType("chbxSchType_");
if( searchCondition != null )
searchCondition.value = sch_type;
iGen.WebServices.schools.GetSchoolsInfo_byCity( cityList,sch_type,onGetSchoolsInfo_byCitySuccessed,null,{"type":type});//,minAPI,maxAPI );	
break;
case "sba":
if(!checkFirstSearchInput())
{
if( searchCondition != null )
searchCondition.value = "";
return;
}
var strAddr = Trim(document.getElementById("tbxStreetAddress").value);
var strCity = Trim(document.getElementById("tbxCity").value);
var tbxState = document.getElementById("tbxState");
var strState = Trim(tbxState.options[tbxState.selectedIndex].value);
iGen.WebServices.schools.CheckCity(strCity, tbxState.value, GetCurrentMetroAreaCode(),onCheckCitySuccessed,null,{"strAddr":strAddr,"strCity":strCity,"strState":strState,"searchCondition":searchCondition,"type":type})
break;
case "sbd":
if(!btnSearchClick(type))
{
if( searchCondition != null )
searchCondition.value = "";
return;
}
var dist_code = document.getElementById("tbxTempD").value;
var sch_type = GetSchoolType("chbxSchType1_");
if( searchCondition != null )
searchCondition.value = sch_type;// + "_" + minAPI + "_" + maxAPI;
iGen.WebServices.schools.GetSchoolsInfo_byDistrict( dist_code,sch_type,onGetSchoolsInfo_byDistrictSuccessed,null,{"type":type});//,minAPI,maxAPI );
break;
default:
break;
}
}
function onCheckCitySuccessed(result,userContext,methodName)
{
if(!result)
{
alert("City unavailable.");
return;
}
if( userContext.searchCondition != null )
userContext.searchCondition.value = userContext.strAddr + "_" + userContext.strCity + "_" + userContext.strState;
iGen.WebServices.schools.GetSchoolsInfo_byAddress( userContext.strAddr, userContext.strCity, userContext.strState, GetCurrentMetroAreaCode(),onGetSchoolsInfo_byAddressSuccessed,null,{"type":userContext.type});
}
function onGetSchoolsInfo_byCitySuccessed(result,userContext,methodName)
{
onGetSchoolsInfoSuccessed(result,userContext,methodName)
}
function onGetSchoolsInfo_byAddressSuccessed(result,userContext,methodName)
{
onGetSchoolsInfoSuccessed(result,userContext,methodName)
}
function onGetSchoolsInfo_byDistrictSuccessed(result,userContext,methodName)
{
onGetSchoolsInfoSuccessed(result,userContext,methodName)
}
function onGetSchoolsInfoSuccessed(result,userContext,methodName)
{
GetSchoolInfo(result,userContext.type);
SetADSKeyword(result);
TrackGoogleAnalyticsNew();
ReloadADS();
ClearSchoolList( userContext.type );
TrackGoogleAnalytics(GetPageNameForGA(userContext.type.toLowerCase(), 1));
}
function ClearSchoolList( type )
{
var cdsList = document.getElementById("cdsList_"+type);
var cdsNum = document.getElementById("cdsNum_"+type);
var schType = document.getElementById("cdsType");
var stateList = document.getElementById("stateList");
if(schType!=null && schType.value!="")
schType.value = "";
if( cdsList!=null && cdsList.value != "")
cdsList.value = "";
if( cdsNum !=null && cdsNum.value != "" )
cdsNum.value = "";
if( stateList != null && stateList.value != "")
stateList.value = "";
}
function SetADSKeyword(res)
{
if(res != null && res.ADSKeywords != null)
document.getElementById("pHeader_GetCityZipForAd").value = res.ADSKeywords;
}
function GetSchoolInfo( res, type )
{
var msg = document.getElementById("errorMSG_" + type);
if( msg != null )
msg.style.display = "none";
var showSchoolResult = document.getElementById("showSchoolResult_"+ type);
var sch_result = document.getElementById("sch_result_"+ type);
if( res.Tables[0] == null || res.Tables[0].Rows.length == 0 )
{
showSchoolResult.innerHTML = "";
if( msg != null)
{
msg.innerHTML = "No results found.";
msg.style.display = "block";
}
ShowBtnCompareOrNot( type );
return;
}
var amType = res.Tables[0].Rows[0].amType.toLowerCase();
var testScoreHeader = "Test Score";
testScoreHeader=GetTestScoreHeader(amType,type);
var strHTML = "<table cellspacing=\"0\" cellpadding=\"2\" rules=\"all\" border=\"1\" id=\"dgSchoolsInfo\" style=\"color:DimGray;width:100%;border-collapse:collapse;\">"
+"	<tr align=\"Center\" style=\"font-weight:bold;\">"
+"	<td style=\"width:40px;\"><img src=\"images/arrow.gif\" alt=\"\" border=\"0\" /></td>"
+"	<td>School Name</td>"
+"	<td>Type</td>"
+"	<td>Address<span id=\"MCASNotes\"></span><span id=\"schoolNotes\"><span id=\"dcNotes\"><span id=\"taksNotes\"></span></td>"
+"	<td>City</td>"
+"	<td>"+ testScoreHeader +"</td>"
+"	<td>Homes Near this School</td>"
+"	</tr>";
for( var i=0; i<res.Tables[0].Rows.length; i++)
{
var state = res.Tables[0].Rows[i].str_st;
var testScore = res.Tables[0].Rows[i].TestScore;
if(testScore==null)
testScore = "N/A";
strHTML += "	<tr align=\"Center\">"
+"	<td style=\"width:40px;\"><INPUT type=\"checkbox\" onclick=\"getCDSList('"+type+res.Tables[0].Rows[i].CDS_CODE+"','cdsNum_"+type+"','cdsList_"+type+"','"+res.Tables[0].Rows[i].SCH_TYPE+"','"+state+"')\" id=\""+ type + res.Tables[0].Rows[i].CDS_CODE+"\" value=\""+res.Tables[0].Rows[i].CDS_CODE+"\"></td>"
+"	<td><a href='"+res.Tables[0].Rows[i].url+"'><u>"+res.Tables[0].Rows[i].SCHOOL+"</u></a><span id=\"dgSchoolsInfo__ctl2_Label6\"></span></td>"
+"	<td>"+ res.Tables[0].Rows[i].SCH_TYPE +"</td>"
+"	<td>"+ res.Tables[0].Rows[i].STR_ADDR +"<span id=\""+amType+"Notes"+type+"\"></span></td>"//fixure showing notes
+"	<td>"+ res.Tables[0].Rows[i].STR_CITY +"</td>"
+"	<td>"+ ((amType=="api")?res.Tables[0].Rows[i].API_This_Year:testScore) +"</td>"
+"	<td style=\"width:100px;\"><input type=\"button\" class=\"btnSource\" onmouseover=\"className='btnOver'\" onmouseout=\"className='btnSource'\" value=\"Search\" onclick=\"HomesNearby_Click('"+ res.Tables[0].Rows[i].CDS_CODE +"','"+ res.Tables[0].Rows[i].SCH_TYPE +"')\"></td>"
+"	</tr>";
}
strHTML += "</table>";
showSchoolResult.innerHTML = strHTML;
sch_result.style.display = "block";
ShowBtnCompareOrNot( type );
}
function GetPageNameForGA(type, tag)
{
var pageName = "School Search - City";
switch(type)
{
case "sbc":default:
break;
case "sba":
pageName = "School Search - Address";
break;
case "sbd":
pageName = "School Search - District";
break;
}
if(tag == 1)
pageName = pageName.replace("School Search","School Search Result");;
return pageName;
}
function BindMCASCharts()
{
var ifmMCASCharts = document.getElementById("ifmMCASCharts");
var eng1 = document.getElementById("eng1");
var eng2 = document.getElementById("eng2");
var eng3 = document.getElementById("eng3");
var math1 = document.getElementById("math1");
var math2 = document.getElementById("math2");
var math3 = document.getElementById("math3");
var sci1 = document.getElementById("sci1");
var sci2 = document.getElementById("sci2");
var sci3 = document.getElementById("sci3");
var grade1 = -1; var grade2 = -1; var grade3 = -1
if(eng1!=null && eng2!=null && math1!=null && math2!=null)
{
if(eng1.checked == true)
grade1 = eval(eng1.value);
else if(eng2.checked == true)
grade1 = eval(eng2.value);
else
grade1 = eval(eng3.value);
if(math1.checked == true)
grade2 = eval(math1.value);
else if(math2.checked == true)
grade2 = eval(math2.value);
else
grade2 = eval(math3.value);
if(sci1!=null && sci1.checked == true)
grade3 = eval(sci1.value);
else if(sci2!=null && sci2.checked == true)
grade3 = eval(sci2.value);
else if(sci3!=null && sci3.checked == true)
grade3 = eval(sci3.value);
}
var cds_code = document.getElementById("iptCdsCode");
var amType = "MCAS";
if(document.getElementById("iptState")!=null)
amType = document.getElementById("iptState").value;
var date = new Date();
ifmMCASCharts.src = gWebPath + "MCAS_Charts.aspx?cds_code="+cds_code.value+"&grade="+grade1+","+grade2+","+grade3 + "&amType=" + amType + "&"+date.getTime();
}
function BindTAKSCharts(diplayType)
{
var cds_code = document.getElementById("iptCdsCode");
var amType = "TAKS";
if(document.getElementById("iptState")!=null)
amType = document.getElementById("iptState").value;
var date = new Date();
var grade1 = -1; var grade2 = -1; var grade3 = -1;var grade4 = -1; var grade5 = -1
if(diplayType=="DisplayAll"||diplayType=="EnglsihMathSocial")
{
var taksEnglish1 = document.getElementById("taksEnglish1");
var taksEnglish2 = document.getElementById("taksEnglish2");
var taksEnglish3 = document.getElementById("taksEnglish3");
var taksMath1 = document.getElementById("taksMath1");
var taksMath2 = document.getElementById("taksMath2");
var taksMath3 = document.getElementById("taksMath3");
var taksSocial1 = document.getElementById("taksSocial1");
var taksSocial2 = document.getElementById("taksSocial2");
var taksSocial3 = document.getElementById("taksSocial3");
if(taksEnglish1.checked == true)
grade1 = eval(taksEnglish1.value);
else if(taksEnglish2.checked == true)
grade1 = eval(taksEnglish2.value);
else
grade1 = eval(taksEnglish3.value);
if(taksMath1.checked == true)
grade2 = eval(taksMath1.value);
else if(taksMath2.checked == true)
grade2 = eval(taksMath2.value);
else
grade2 = eval(taksMath3.value);
if(taksSocial1!=null && taksSocial1.checked == true)
grade3 = eval(taksSocial1.value);
else if(taksSocial2!=null && taksSocial2.checked == true)
grade3 = eval(taksSocial2.value);
else if(taksSocial3!=null && taksSocial3.checked == true)
grade3 = eval(taksSocial3.value);
var ifmTaksEnglishtMathSocialCharts = document.getElementById("ifmTaksEnglishtMathSocialCharts");
ifmTaksEnglishtMathSocialCharts.src = gWebPath + "Taks_English_Math_Social.aspx?cds_code="+cds_code.value+"&grade="+grade1+","+grade2+","+grade3 + "&amType=" + amType + "&"+date.getTime();
}
if(diplayType=="DisplayAll"||diplayType=="ScienceAll")
{
var taksScience1 = document.getElementById("taksScience1");
var taksScience2 = document.getElementById("taksScience2");
var taksScience3 = document.getElementById("taksScience3");
var taksAll1 = document.getElementById("taksAll1");
var taksAll2 = document.getElementById("taksAll2");
var taksAll3 = document.getElementById("taksAll3");
if(taksScience1!=null && taksScience1.checked == true)
grade4 = eval(taksScience1.value);
else if(taksScience2!=null && taksScience2.checked == true)
grade4 = eval(taksScience2.value);
else if(taksScience3!=null && taksScience3.checked == true)
grade4 = eval(taksScience3.value);
if(taksAll1.checked == true)
grade5 = eval(taksAll1.value);
else if(taksAll2.checked == true)
grade5 = eval(taksAll2.value);
else
grade5 = eval(taksAll3.value);
var ifmTaksScienceAllCharts = document.getElementById("ifmTaksScienceAllCharts");
ifmTaksScienceAllCharts.src = gWebPath + "Taks_Science_All.aspx?cds_code="+cds_code.value+"&grade="+grade4+","+grade5 + "&amType=" + amType + "&"+date.getTime();
}
}	
function GetCurrentState(MetroAreaCode)
{
var State = "CA";
switch(eval(MetroAreaCode))
{
case 30:
State = "MA";
break;
case 31:
State = "DC";	
break;
case 40:
State = "TX";	
break;
default:
break;
}
return State;
}
function GetAmTypeByState(stateCode)
{
var amType = "MCAS";
switch(stateCode.toLowerCase())
{
case "ca":
amType = "API";
break;
case "va":
amType = "SOL";
break;
case "md":
amType = "MSA";
break;
default:
break;
}
return amType;
}
function GetTestScoreHeader(amType,type)
{	
var amTypeUpper=amType.toUpperCase();
if(amType == "api")
return "API Score";
else if(amType == "sol" || amType == "msa" || amType == "ayp" || amType == "ga" || amType == "nc" || amType == "isat" || amType == "nj_ask" || amType == "tcap")
return "<div style=\"float:left\">Test Score </div><div class=\"NotesIcon\" onmouseover=\"showTestScoreNotes('"+amType+"Notes','"+type+"')\" onmouseout=\"HiddenTestScoreNotes('"+amType+"Notes','"+type+"')\"></div><div class=\"clearFloat\"></div>";
else
return "<div style=\"float:left\">"+ amTypeUpper +" % </div><div class=\"NotesIcon\" onmouseover=\"showTestScoreNotes('"+amType+"Notes','"+type+"')\" onmouseout=\"HiddenTestScoreNotes('"+amType+"Notes','"+type+"')\"></div><div class=\"clearFloat\"></div>";//<span id=\""+amType+"Notes"+type+"\"></span>	
}
