String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};var prefilter=false;var prefilterPath='';var prefilterProgram='';var prefilterDegree='';$j(document).ready(function(){$j('.customMapSelectBox').sSelect();$j('.viewSchoolsMap').click(function(){prefilter=true;$j('.modalMap').css('top',(($j(window).height()/2)-($j('.modalMap').height()/2)+$j(document).scrollTop()));$j('.modalMap').css('left',(($j(document).width()/2)-($j('.modalMap').width()/2)));$j('.modalOverlay').height($j(document).height()).width($j(document).width()).show();window.setTimeout(loadAndInitMap,100);});$j('.mapFilterDD ul').hide();$j('.mapSchoolDD').click(function(){if($j(' ul',this).is(':visible')==true){$j(' ul',this).hide();}else{if($j(' ul',this).text()!=$j(' ul li:eq(0)',this).text()){$j(' ul',this).show();}}
$j('.mapProgramDD ul, .mapDegreeDD ul').hide();});$j('.mapProgramDD').click(function(){if($j(' ul',this).is(':visible')==true){$j(' ul',this).hide();}else{if($j(' ul',this).text()!=$j(' ul li:eq(0)',this).text()){$j(' ul',this).show();}}
$j('.mapDegreeDD ul, .mapSchoolDD ul').hide();});$j('.mapDegreeDD').click(function(){if($j(' ul',this).is(':visible')==true){$j(' ul',this).hide();}else{if($j(' ul',this).text()!=$j(' ul li:eq(0)',this).text()){$j(' ul',this).show();}}
$j('.mapProgramDD ul, .mapSchoolDD ul').hide();});$j('.campusEducation .mapHolder, .mapLowerButtons, .schoolListingColumn .launchMap, .twoColumnRight .schoolsNear a').click(function(){$j('.modalMap').css('visibility','visible');$j('.modalMap').css('top',(($j(window).height()/2)-($j('.modalMap').height()/2)+$j(document).scrollTop()));$j('.modalMap').css('left',(($j(document).width()/2)-($j('.modalMap').width()/2)));$j('.modalOverlay').height($j(document).height()).width($j(document).width()).show();window.setTimeout(loadAndInitMap,100);});$j('.mapClose').click(function(){$j('.modalMap').css('visibility','hidden');$j('.modalOverlay').hide();onHideMap();$j('.mainInnerBody').cycle('resume');});$j('.mapTabs div').click(function(){$j('.mapProgramDD .txtMapSelected').text('Select A Career Path');$j('.mapDegreeDD .txtMapSelected').text('Select A Program');$j('.mapSchoolDD .txtMapSelected').text('Select A Degree');$j('.mapDegreeDD ul').html('');$j('.mapSchoolDD ul').html('');$j('.mapDegreeDD ul, .mapSchoolDD ul, .mapProgramDD ul').hide();if($j(this).hasClass('mapTabOff')==true){if($j.trim($j(this).text().toString())=='Europe'){europe=true;$j('.mapFilters').hide();$j('.mapSchoolList').css('height','387px');$j('.mapTabs div:eq(0)').attr('class','mapTabOff');$j('.mapTabs div:eq(1)').attr('class','mapTabOn');coldLocation('Europe');}else{europe=false;$j('.mapFilters').show();$j('.mapSchoolList').css('height','214px');$j('.mapTabs div:eq(1)').attr('class','mapTabOff');$j('.mapTabs div:eq(0)').attr('class','mapTabOn');coldLocation('United States');}}});});var Addresses={doc:"",getLocation:function(address){var location="";var result="";address=address.replace("  "," ").trim();if(this.doc!=""){var node=$j(this.doc).find("Address:contains('"+address.replace("\"","\\\"")+"')").filter(function(index){return $j(this).text().replace(/\s/gm,"")==address.replace(/\s/gm,"")});if(node.length>0){location=$j(node).first().parent().children('Location').text();}}
if(location==""){$j.ajax({type:'GET',url:siteUrl+'/?addresslocation='+encodeURIComponent(address),dataType:'html',async:false,success:function(data){if(data!=""){var arr=data.split("<[<X>]>");if(arr.length>=1&&arr[0]!='')location=arr[0];if(arr.length>=2)result=arr[1];}}});if(result!="")
this.doc=$j(result);}
return location;},setAddresses:function(xml){this.doc=$j(xml);},contains:function(address){var location="";address=address.replace("  "," ").trim();if(this.doc!=""){var node=$j(this.doc).find("Address:contains('"+address.replace("\"","\\\"")+"')").filter(function(index){return $j(this).text().replace(/\s/gm,"")==address.replace(/\s/gm,"")});if(node.length>0){location=$j(node).first().parent().children('Location').text();}}
if(location!="")
return true;else
return false;}};var MapMarkers={nextMarkerZIndex:1001,markers:new Array(),count:function(){return this.markers.length;},addMarker:function(address,marker){var obj=new MapMarker(address,marker);this.markers[this.markers.length]=obj;return obj;},clearMarkers:function(){var i;for(i=0;i<this.markers.length;i++){this.markers[i].hideMarker();}},getNextZIndex:function(){var z=this.nextMarkerZIndex;this.nextMarkerZIndex++;return z;},getNextZ:function(){return this.getNextZIndex();},existsByID:function(id,dbid){var i;for(i=0;i<this.markers.length;i++){if(this.markers[i].id==id&&this.markers[i].dbid==dbid){return true;}}
return false;},exists:function(address){var i;for(i=0;i<this.markers.length;i++){if(this.markers[i].address==address){return true;}}
return false;},getMarkerByID:function(id,dbid){var i;var m=null;for(i=0;i<this.markers.length;i++){if(this.markers[i].id==id&&this.markers[i].dbid==dbid){m=this.markers.marker;break;}}
return m;},getMarker:function(address){var i;var m=null;for(i=0;i<this.markers.length;i++){if(this.markers[i].address==address){m=this.markers.marker;break;}}
return m;}};function MapMarker(address,marker){this.id=0;this.dbid='';this.address=address;this.marker=marker;this.showMarker=function(){if(this.marker!=null)this.marker.setVisible(true);};this.hideMarker=function(){if(this.marker!=null)this.marker.setVisible(false);};this.setZIndex=function(z){if(this.marker!=null)this.marker.setZIndex(z);};this.setZ=function(z){this.setZIndex(z);};this.showMarkerTop=function(z){this.setZIndex(z);this.showMarker();};this.animate=function(){this.showMarkerTop();if(this.marker!=null)this.marker.setAnimation(google.maps.Animation.DROP);};}
function getLatLng(location){var result=null;var arr=location.split(",");if(arr.length>=2)
result=new google.maps.LatLng(arr[0],arr[1]);return result;}
function isValidXmlVar(xml){if(!xml||xml==null||(typeof(xml)=='string'&&xml==''))
return false;else
return true;}
function mapSchoolListLoading(){$j('.mapSchoolList').html('<div class="mapSchoolListLoader"><img src="/images/CareerEd/loading.gif" alt="loading" /></div>');}
function closeInfoWindow(){if(infoWindow)infoWindow.close();}
var mapShown=false;var mapOpen=false;var mcounter=-1;var mTimer=null;function preloadMap(){getSchoolData();loadSchoolList();showMap();initializeMap();}
function onShowMap(){mapOpen=true;if(!mapShown){mcounter=0;mTimer=window.setTimeout(showHiddenMarkers,10);}}
function onHideMap(){mapOpen=false;}
function showHiddenMarkers(){if(parseInt(mcounter)<parseInt(MapMarkers.count())){var i;for(i=0;i<3;i++){if(i>0&&parseInt(mcounter)<parseInt(MapMarkers.count())){if(MapMarkers.markers[mcounter])MapMarkers.markers[mcounter].showMarker();}
mcounter+=1;}
mTimer=window.setTimeout(showHiddenMarkers,10);}else{if(parseInt(MapMarkers.count())>0)window.clearTimeout(mTimer);}}
function loadAndInitMap(){$j('.mainInnerBody').cycle('pause');onShowMap();mapShown=true;}
function getSchoolData(){if(!isValidXmlVar(globalXmlDoc)){$j.ajax({type:'GET',url:siteUrl+'/?xml=1',dataType:'xml',async:false,success:function(data){globalXmlDoc=data;loadMapSchools(globalXmlDoc);}});}else{loadMapSchools(globalXmlDoc);}}
function loadMapSchools(xmlDoc){var schoolList='<li onclick="javascript:selectMapOption(this);">Select A Career Path</li>';schoolList+='<li onclick="javascript:selectMapOption(this);">Show All</li>';$j(xmlDoc).find('CareerPath').each(function(){schoolList+='<li onclick="javascript:selectMapOption(this);">'+$j(this).children('Title').text()+'</li>';});$j('.mapProgramDD ul').html(schoolList);checkDDHeight($j('.mapProgramDD ul'));}
selectMapOption=function(e){var topNode=$j(e).parent().children('li:eq(0)').html();var selectedText=$j(e).text();if(selectedText!=topNode){if(selectedText.length>24){selectedText=selectedText.substring(0,24)+' ...';}
$j(e).parent().prev('.txtMapSelected').text(selectedText);$j(this).parent().hide();window.clearTimeout(objTimer);if(europe==false){coldReset('United States');}else{coldReset('Europe');}
if($j(e).parent().parent().hasClass('mapProgramDD')==true){window.setTimeout(function(){globalActiveCareerPath=$j(e).text();populatePrograms($j(e).text());getCareerPathSchools($j(e).text());},50);}else if($j(e).parent().parent().hasClass('mapDegreeDD')==true){window.setTimeout(function(){globalActiveProgram=$j(e).text();populateDegrees($j(e).text());getCareerPathDegreeSchools($j(e).text());},50);}else if($j(e).parent().parent().hasClass('mapSchoolDD')==true){window.setTimeout(function(){globalActiveDegree=$j(e).text();getSchoolSpecificDegrees($j(e).text());},50);}}}
function coldReset(countryName){var defaultLocation='';if(countryName!='Europe'){defaultLocation=new google.maps.LatLng(37.0625,-95.677068);}else{defaultLocation=new google.maps.LatLng(47.398349,6.328125);}
var myOptions={zoom:4,center:defaultLocation,mapTypeId:google.maps.MapTypeId.ROADMAP};closeInfoWindow();MapMarkers.clearMarkers();map.setCenter(defaultLocation);map.setOptions(myOptions);}
function populatePrograms(selectedProgram){var programList='';var programList='<li onclick="javascript:selectMapOption(this);">Select A Program</li>';programList+='<li onclick="javascript:selectMapOption(this);">Show All</li>';var node=$j(globalXmlDoc).find("CareerPath > Title:contains('"+selectedProgram.replace("\"","\\\"")+"')").filter(function(index){return $j(this).text()==selectedProgram});if(node.length>0){$j(node).first().parent().find('Program').each(function(){programList+='<li onclick="javascript:selectMapOption(this);">'+$j(this).children('Title').text()+'</li>';});}
$j('.mapDegreeDD .txtMapSelected').text('Select A Program');$j('.mapSchoolDD .txtMapSelected').text('Select A Degree');$j('.mapDegreeDD ul').html(programList);$j('.mapSchoolDD ul').html('');$j('.mapDegreeDD ul, .mapSchoolDD ul').hide();checkDDHeight($j('.mapDegreeDD ul'));}
function populateDegrees(selectedDegree){var degreeList='<li onclick="javascript:selectMapOption(this);">Select A Degree</li>';degreeList+='<li onclick="javascript:selectMapOption(this);">Show All</li>';var node=$j(globalXmlDoc).find("CareerPath > Title:contains('"+globalActiveCareerPath.replace("\"","\\\"")+"')").filter(function(index){return $j(this).text()==globalActiveCareerPath});if(node.length>0){node=$j(node).first().parent().find("Program > Title:contains('"+selectedDegree.replace("\"","\\\"")+"')").filter(function(index){return $j(this).text()==selectedDegree});if(node.length>0){$j(node).first().parent().find('Degree').each(function(){degreeList+='<li onclick="javascript:selectMapOption(this);">'+$j(this).children('Title').text()+'</li>';});}}
$j('.mapSchoolDD .txtMapSelected').text('Select A Degree');$j('.mapSchoolDD ul').html(degreeList);$j('.mapSchoolDD ul').hide();checkDDHeight($j('.mapSchoolDD ul'));}
function getCareerPathSchools(selectedCareerPath){var schoolArray=new Array();var schoolIDArray=new Array();var schoolDBIDArray=new Array();var node;mapSchoolListLoading();if(selectedCareerPath!='Show All'){node=$j(globalXmlDoc).find("CareerPath > Title:contains('"+selectedCareerPath.replace("\"","\\\"")+"')").filter(function(index){return $j(this).text()==selectedCareerPath});if(node.length>0){$j(node).first().parent().find('SchoolItem').sort(sortSchoolList).each(function(){if(checkForDuplication($j(this).children('SchoolID').text(),$j(this).children('DB').text())==false){schoolArray.push($j(this).children('Name').text()+'=='+$j(this).children('SchoolID').text());schoolIDArray.push($j(this).children('SchoolID').text());schoolDBIDArray.push($j(this).children('DB').text());}});}}else{$j(globalXmlDoc).find('SchoolItem').sort(sortSchoolList).each(function(){if(checkForDuplication($j(this).children('SchoolID').text(),$j(this).children('DB').text())==false){schoolArray.push($j(this).children('Name').text()+'=='+$j(this).children('SchoolID').text());schoolIDArray.push($j(this).children('SchoolID').text());schoolDBIDArray.push($j(this).children('DB').text());}});}
function checkForDuplication(schoolName,DB){var schoolFound=false;for(ndx=0;ndx<=schoolIDArray.length-1;ndx++){if(schoolName==schoolIDArray[ndx]&&DB==schoolDBIDArray[ndx]){schoolFound=true;break;}}
return schoolFound;}
var txtOutput='';for(ndx=0;ndx<=schoolArray.length-1;ndx++){var fullSchoolName=schoolArray[ndx];var schoolLinkedName='';var schoollFullName,schoolCountry,shortName;fullSchoolName=fullSchoolName.split("==");shortName=fullSchoolName[0];if(europe==false){txtOutput+='<div class="mapSchoolRow">';txtOutput+='<div class="mapImgHolder"><img src="/images/CareerEd/darts/'+findMarkerColor(shortName)+'_sml.png" border="0" alt="" /></div><a href="javascript:getSchoolID('+fullSchoolName[1]+', \''+schoolDBIDArray[ndx]+'\');">'+shortName+'</a>';txtOutput+='</div>';}}
$j('.mapSchoolList').html(txtOutput);mapSchoolsFromList(schoolIDArray,schoolDBIDArray);}
function getCareerPathDegreeSchools(selectedDegree){var schoolArray=new Array();var schoolIDArray=new Array();var schoolDBIDArray=new Array();var selectedCareerPath=$j('.mapProgramDD .txtMapSelected').text();var node;mapSchoolListLoading();if(selectedDegree!='Show All'){node=$j(globalXmlDoc).find("CareerPath > Title:contains('"+globalActiveCareerPath.replace("\"","\\\"")+"')").filter(function(index){return $j(this).text()==globalActiveCareerPath});if(node.length>0){node=$j(node).first().parent().find("Program > Title:contains('"+selectedDegree.replace("\"","\\\"")+"')").filter(function(index){return $j(this).text()==selectedDegree});if(node.length>0){$j(node).first().parent().find('SchoolItem').each(function(){if(checkForDuplication($j(this).children('SchoolID').text(),$j(this).children('DB').text())==false){schoolArray.push($j(this).children('Name').text()+'=='+$j(this).children('SchoolID').text());schoolIDArray.push($j(this).children('SchoolID').text());schoolDBIDArray.push($j(this).children('DB').text());}});}}}else{node=$j(globalXmlDoc).find("CareerPath > Title:contains('"+globalActiveCareerPath.replace("\"","\\\"")+"')").filter(function(index){return $j(this).text()==globalActiveCareerPath});if(node.length>0){$j(node).first().parent().find('SchoolItem').each(function(){if(checkForDuplication($j(this).children('SchoolID').text(),$j(this).children('DB').text())==false){schoolArray.push($j(this).children('Name').text()+'=='+$j(this).children('SchoolID').text());schoolIDArray.push($j(this).children('SchoolID').text());schoolDBIDArray.push($j(this).children('DB').text());}});}}
function checkForDuplication(schoolName,DB){var schoolFound=false;for(ndx=0;ndx<=schoolIDArray.length-1;ndx++){if(schoolName==schoolIDArray[ndx]&&DB==schoolDBIDArray[ndx]){schoolFound=true;}}
return schoolFound;}
var txtOutput='';for(ndx=0;ndx<=schoolArray.length-1;ndx++){var fullSchoolName=schoolArray[ndx];var schoolLinkedName='';var schoollFullName,schoolCountry,shortName;fullSchoolName=fullSchoolName.split("==");shortName=fullSchoolName[0];if(europe==false){txtOutput+='<div class="mapSchoolRow">';txtOutput+='<div class="mapImgHolder"><img src="/images/CareerEd/darts/'+findMarkerColor(shortName)+'_sml.png" border="0" alt="" /></div><a href="javascript:getSchoolID('+fullSchoolName[1]+', \''+schoolDBIDArray[ndx]+'\');">'+shortName+'</a>';txtOutput+='</div>';}}
$j('.mapSchoolList').html(txtOutput);mapSchoolsFromList(schoolIDArray,schoolDBIDArray);}
function getSchoolSpecificDegrees(selectedDegreeType){var schoolArray=new Array();var schoolIDArray=new Array();var schoolDBIDArray=new Array();var selectedCareerPath=$j('.mapProgramDD .txtMapSelected').text();var selectedCareerPathDegree=$j('.mapDegreeDD .txtMapSelected').text();var node;mapSchoolListLoading();if(selectedDegreeType!='Show All'){node=$j(globalXmlDoc).find("CareerPath > Title:contains('"+globalActiveCareerPath.replace("\"","\\\"")+"')").filter(function(index){return $j(this).text()==globalActiveCareerPath});if(node.length>0){node=$j(node).first().parent().find("Program > Title:contains('"+globalActiveProgram.replace("\"","\\\"")+"')").filter(function(index){return $j(this).text()==globalActiveProgram});if(node.length>0){node=$j(node).first().parent().find("Degree > Title:contains('"+selectedDegreeType.replace("\"","\\\"")+"')").filter(function(index){return $j(this).text()==selectedDegreeType});if(node.length>0){$j(node).first().parent().find('SchoolItem').each(function(){if(checkForDuplication($j(this).children('SchoolID').text(),$j(this).children('DB').text())==false){schoolArray.push($j(this).children('Name').text()+'=='+$j(this).children('SchoolID').text());schoolIDArray.push($j(this).children('SchoolID').text());schoolDBIDArray.push($j(this).children('DB').text());}});}}}}else{node=$j(globalXmlDoc).find("CareerPath > Title:contains('"+globalActiveCareerPath.replace("\"","\\\"")+"')").filter(function(index){return $j(this).text()==globalActiveCareerPath});if(node.length>0){node=$j(node).first().parent().find("Program > Title:contains('"+globalActiveProgram.replace("\"","\\\"")+"')").filter(function(index){return $j(this).text()==globalActiveProgram});if(node.length>0){$j(node).first().parent().find('SchoolItem').each(function(){if(checkForDuplication($j(this).children('SchoolID').text(),$j(this).children('DB').text())==false){schoolArray.push($j(this).children('Name').text()+'=='+$j(this).children('SchoolID').text());schoolIDArray.push($j(this).children('SchoolID').text());schoolDBIDArray.push($j(this).children('DB').text());}});}}}
function checkForDuplication(schoolName,DB){var schoolFound=false;for(ndx=0;ndx<=schoolIDArray.length-1;ndx++){if(schoolName==schoolIDArray[ndx]&&DB==schoolDBIDArray[ndx]){schoolFound=true;break;}}
return schoolFound;}
var txtOutput='';for(ndx=0;ndx<=schoolArray.length-1;ndx++){var fullSchoolName=schoolArray[ndx];var schoolLinkedName='';var schoollFullName,schoolCountry,shortName;fullSchoolName=fullSchoolName.split("==");shortName=fullSchoolName[0];if(europe==false){txtOutput+='<div class="mapSchoolRow">';txtOutput+='<div class="mapImgHolder"><img src="/images/CareerEd/darts/'+findMarkerColor(shortName)+'_sml.png" border="0" alt="" /></div><a href="javascript:getSchoolID('+fullSchoolName[1]+', \''+schoolDBIDArray[ndx]+'\');">'+shortName+'</a>';txtOutput+='</div>';}}
$j('.mapSchoolList').html(txtOutput);mapSchoolsFromList(schoolIDArray,schoolDBIDArray);}
function mapSchoolsFromList(schoolArray,schoolDBIDArray){windowContentArray=[];windowNameArray=[];windowAddressArray=[];if(europe==false){$j(globalXmlDoc).find('BrandList').find('School').filter(function(index){var ndx,schoolid=$j.trim($j(this).find("SchoolID").text()),dbid=$j.trim($j(this).find("DB").text());for(ndx=0;ndx<schoolArray.length;ndx++){if(schoolid==schoolArray[ndx]&&dbid==schoolDBIDArray[ndx])return true;}
return false;}).sort(sortSchoolList).each(function(){var id=$j(this).find('SchoolID').text();var dbid=$j(this).find('DB').text();var txtAddress='';if(parseInt(dbid)==parseInt(4))
txtAddress=getGSSchoolInfoAddress(id);if(txtAddress==''){$j(this).find("Address").each(function(){if($j(this)!='')
txtAddress+=(txtAddress!=''?' ':'')+$j(this).text();});txtAddress+='<br>'+$j(this).find("City").text()+', ';txtAddress+=$j(this).find("State").text()+' '+$j(this).find("Zip").text();}
var shortName=$j(this).find('Name').text();var linkValue=$j(this).find('Url').text();if(shortName!=''&&typeof(shortName)!='undefined'){var windowContent='<div class="infoWindow">';windowContent+='<div class="infoTopImage"><img src="images/CareerEd/'+findSchoolHeader(shortName)+'" border="0" alt="" /></div>';windowContent+='<div class="infoAddress wideAddress">';if(typeof(linkValue)!='undefined'&&linkValue!=''){windowContent+='<h4><a href="'+linkValue+'">'+shortName+'</a></h4>';}else{windowContent+='<h4>'+shortName+'</h4>';}
windowContent+='<p>'+txtAddress+'</p>';windowContent+='<div class="infoContactButton">';if(linkValue!=''&&typeof(linkValue)!='undefined'){windowContent+='<a href="'+linkValue+'"><img src="images/CareerEd/contact_us.png" border="0" alt="" /></a>';}
windowContent+='</div></div></div>';windowContentArray.push(windowContent);windowNameArray.push(shortName);windowAddressArray.push(txtAddress);}});}else{$j(globalEuropeSchoolXMLDoc).find("SchoolInfo").sort(sortSchoolList).each(function(){var txtAddress='';txtAddress+=$j(this).find("City").text()+', ';txtAddress+=$j(this).find("Country").text();var shortName=$j(this).find('Name').text();var linkValue;var windowContent='<div class="infoWindow">';windowContent+='<div class="infoAddress wideAddress">';if(typeof(linkValue)!='undefined'&&linkValue!=''){windowContent+='<h4><a href="'+linkValue+'">'+shortName+'</a></h4>';}else{windowContent+='<h4>'+shortName+'</h4>';}
windowContent+='<p>'+txtAddress+'</p>';windowContent+='<div class="infoContactButton">';if(linkValue!=''&&typeof(linkValue)!='undefined'){windowContent+='<a href="'+linkValue+'"><img src="images/CareerEd/contact_us.png" border="0" alt="" /></a>';}
windowContent+='</div></div></div>';windowContentArray.push(windowContent);windowNameArray.push(shortName);windowAddressArray.push(txtAddress);});}
kounter=-1;spaceGeoLocate();}
function checkDDHeight(ddList){$j(ddList).css('height','');if($j(ddList).height()>220){$j(ddList).css('height','220px');}else{$j(ddList).css('height','auto');}}
function sortSchoolList(a,b){var vala=$j(a).find('Name').text();var valb=$j(b).find('Name').text();return(vala<valb)?-1:(vala==valb)?0:1;}
function loadSchoolList(){if(!isValidXmlVar(globalSchoolXMLDoc)){$j.ajax({type:'GET',url:siteUrl+'/?xml=GSSchoolInfo',async:false,dataType:'xml',success:function(data){globalSchoolXMLDoc=data;parseTable();}});}else{parseTable();}}
function parseTable(){var txtOutput='';var txtAddress='';if(europe==false){$j(globalXmlDoc).find('BrandList').find('School').sort(sortSchoolList).each(function(){var id=$j(this).find('SchoolID').text();var dbid=$j(this).find('DB').text();var shortName=$j(this).find('Name').text();if(shortName!=''&&typeof(shortName)!='undefined'){txtOutput+='<div class="mapSchoolRow">';txtOutput+='<div class="mapImgHolder"><img src="/images/CareerEd/darts/'+findMarkerColor(shortName)+'_sml.png" border="0" alt="" /></div><a href="javascript:getSchoolID('+id+', \''+dbid+'\');">'+shortName+'</a>';txtOutput+='</div>';}});}
$j('.mapSchoolList').html(txtOutput);}
function loadEuropeSchoolList(){if(!isValidXmlVar(globalEuropeSchoolXMLDoc)){$j.ajax({type:'GET',url:siteUrl+'/?xml=EuropeSchools',async:false,dataType:'xml',success:function(data){globalEuropeSchoolXMLDoc=data;parseEuroTable();}});}else{parseEuroTable();}}
function parseEuroTable(){var txtOutput='';var txtAddress='';$j(globalEuropeSchoolXMLDoc).find("SchoolInfo").sort(sortSchoolList).each(function(){txtAddress='';var shortName=$j(this).find("Name").text();txtOutput+='<div class="mapSchoolRow">';txtOutput+='<div class="mapImgHolder"><img src="/images/CareerEd/darts/'+findMarkerColor(shortName)+'_sml.png" border="0" alt="" /></div><a href="javascript:getSchoolID('+$j(this).find("sycampusid").text()+', \'4\');">'+shortName+'</a>';txtOutput+='</div>';});$j('.mapSchoolList').html(txtOutput);loadStateID();}
function showMap(){handleNoGeolocation();function handleNoGeolocation(){var defaultLocation=new google.maps.LatLng(37.0625,-95.677068);var myOptions={zoom:4,center:defaultLocation,mapTypeId:google.maps.MapTypeId.ROADMAP};map=new google.maps.Map(document.getElementById("mainMap"),myOptions);}}
function initializeMap(){loadSchoolByStateXML();}
function coldLocation(countryName){var defaultLocation='';if(countryName!='Europe'){defaultLocation=new google.maps.LatLng(37.0625,-95.677068);}else{defaultLocation=new google.maps.LatLng(47.398349,6.328125);}
var myOptions={zoom:4,center:defaultLocation,mapTypeId:google.maps.MapTypeId.ROADMAP};closeInfoWindow();MapMarkers.clearMarkers();map.setCenter(defaultLocation);map.setOptions(myOptions);if(countryName=='Europe'){loadEuropeSchoolList();}else{loadSchoolList();loadSchoolByStateXML();}}
function getStateSchools(stateID){usersState=stateID;loadSchoolByStateXML();}
function loadSchoolByStateXML(){if(!isValidXmlVar(globalSchoolXMLDoc)){$j.ajax({type:'GET',url:siteUrl+'/?xml=GSSchoolInfo',async:false,dataType:'xml',success:function(data){globalSchoolXMLDoc=data;loadStateID();}});}else{loadStateID();}}
var windowContentArray=new Array();var windowNameArray=new Array();var windowAddressArray=new Array();function loadStateID(){windowContentArray=[];windowNameArray=[];windowAddressArray=[];if(europe==false){$j(globalXmlDoc).find('BrandList').find('School').sort(sortSchoolList).each(function(){var id=$j(this).find('SchoolID').text();var dbid=$j(this).find('DB').text();var txtAddress='';if(parseInt(dbid)==parseInt(4))
txtAddress=getGSSchoolInfoAddress(id);if(txtAddress==''){$j(this).find("Address").each(function(){if($j(this)!='')
txtAddress+=(txtAddress!=''?' <br />':'')+$j(this).text();});txtAddress+='<br />'+$j(this).find("City").text()+', ';txtAddress+=$j(this).find("State").text()+' '+$j(this).find("Zip").text();}
var shortName=$j(this).find('Name').text();var linkValue=$j(this).find('Url').text();if(shortName!=''&&typeof(shortName)!='undefined'){var windowContent='<div class="infoWindow">';windowContent+='<div class="infoTopImage"><img src="images/CareerEd/'+findSchoolHeader(shortName)+'" border="0" alt="" /></div>';windowContent+='<div class="infoAddress wideAddress">';if(typeof(linkValue)!='undefined'&&linkValue!=''){windowContent+='<h4><a href="'+linkValue+'">'+shortName+'</a></h4>';}else{windowContent+='<h4>'+shortName+'</h4>';}
windowContent+='<p>'+txtAddress+'</p>';windowContent+='<div class="infoContactButton">';if(linkValue!=''&&typeof(linkValue)!='undefined'){windowContent+='<a href="'+linkValue+'"><img src="images/CareerEd/contact_us.png" border="0" alt="" /></a>';}
windowContent+='</div></div></div>';windowContentArray.push(windowContent);windowNameArray.push(shortName);windowAddressArray.push(txtAddress);}});}else{$j(globalEuropeSchoolXMLDoc).find("SchoolInfo").sort(sortSchoolList).each(function(){var txtAddress='';txtAddress+=$j(this).find("City").text()+', ';txtAddress+=$j(this).find("Country").text();var shortName=$j(this).find("Name").text();var linkValue;var windowContent='<div class="infoWindow infoWindowEurope">';windowContent+='<div class="infoAddress wideAddress">';if(typeof(linkValue)!='undefined'&&linkValue!=''){windowContent+='<h4><a href="'+linkValue+'">'+shortName+'</a></h4>';}else{windowContent+='<h4>'+shortName+'</h4>';}
windowContent+='<p>'+txtAddress+'</p>';windowContent+='<div class="infoContactButton">';if(linkValue!=''&&typeof(linkValue)!='undefined'){windowContent+='<a href="'+linkValue+'"><img src="images/CareerEd/contact_us.png" border="0" alt="" /></a>';}
windowContent+='</div></div></div>';windowContentArray.push(windowContent);windowNameArray.push(shortName);windowAddressArray.push(txtAddress);});}
kounter=-1;spaceGeoLocate();}
function spaceGeoLocate(needTimer){if(needTimer==null||!needTimer)
needTimer=false;if(parseInt(kounter)<=parseInt(windowContentArray.length-1)){if(needTimer){objTimer=window.setTimeout(function(){var result=codeAddress(windowContentArray[kounter],windowNameArray[kounter],windowAddressArray[kounter]);spaceGeoLocate(result);},500);}else{objTimer=window.setTimeout(function(){var result=codeAddress(windowContentArray[kounter],windowNameArray[kounter],windowAddressArray[kounter]);spaceGeoLocate(result);},10);}}else{if(parseInt(windowContentArray.length)>0)window.clearTimeout(objTimer);}
kounter+=1;}
function codeAddress(windowContent,schoolName,schoolAddress){var address='';if(schoolAddress!=undefined){address=schoolAddress.replace("<br />"," ").replace("<br>"," ").replace(/(\r\n|\n|\r)/gm,"");}else{return false;}
var m=MapMarkers.getMarker(address);if(m!=null){marker.showMarkerTop(MapMarkers.getNextZ());}
else{var result=!Addresses.contains(address);var location=Addresses.getLocation(address);if(location!=""){if(kounter<=1){map.setZoom(4);}
var imageIcon="/images/CareerEd/darts/"+findMarkerColor(schoolName)+".png";var marker=new google.maps.Marker({map:map,icon:imageIcon,title:schoolName,position:getLatLng(location),visible:mapOpen});google.maps.event.addListener(marker,'click',function(){closeInfoWindow();infoWindow.setContent(windowContent);infoWindow.open(map,marker);window.clearTimeout(objTimer);});MapMarkers.addMarker(address,marker);}}
return result;}
var kounter=0;var europe=false;var activeSchoolID='',activeSchoolDBID='',geocoder,europe;var map=null;var infoWindow=new google.maps.InfoWindow();var usersState,objTimer;var globalSchoolXMLDoc='';var globalEuropeSchoolXMLDoc='';var globalXmlDoc='';var globalActiveCareerPath,globalActiveProgram,globalActiveDegree;function getSchoolID(schoolID,schoolDBID){window.clearTimeout(objTimer);activeSchoolID=schoolID;activeSchoolDBID=schoolDBID;loadSchoolMarkerXML();}
function getGSSchoolInfoAddress(schoolID){var schoolAddress='';try{var node=$j(globalSchoolXMLDoc).find("sycampusid:contains('"+schoolID+"')").filter(function(index){return parseInt($j(this).text())==parseInt(schoolID);});if(node.length>0){node=$j(node).parent();$j(node).find("Address").each(function(){if($j(this)!='')
schoolAddress+=(schoolAddress!=''?' ':'')+$j(this).text();});schoolAddress+='<br>'+$j(node).find("City").text()+', ';schoolAddress+=$j(node).find("State").text()+', '+$j(node).find("Zip").text();}}catch(err){log(err);}
return schoolAddress;}
function loadSchoolMarkerXML(){if(activeSchoolID>9999){if(!isValidXmlVar(globalEuropeSchoolXMLDoc)){$j.ajax({type:'GET',url:siteUrl+'/?xml=EuropeSchools',dataType:'xml',async:false,success:function(data){globalEuropeSchoolXMLDoc=data;loadSchoolID(globalEuropeSchoolXMLDoc);}});}else{loadSchoolID(globalEuropeSchoolXMLDoc);}}else{if(!isValidXmlVar(globalSchoolXMLDoc)){$j.ajax({type:'GET',url:siteUrl+'/?xml=GSSchoolInfo',dataType:'xml',async:false,success:function(data){globalSchoolXMLDoc=data;loadSchoolID(globalSchoolXMLDoc);}});}else{loadSchoolID(globalSchoolXMLDoc);}}}
function loadSchoolID(xmlRef){if(europe==false){var node=$j(globalXmlDoc).find('BrandList').find("School > SchoolID:contains('"+activeSchoolID.toString().replace("\"","\\\"")+"')").filter(function(){return $j(this).text()==activeSchoolID&&$j(this).parent().children("DB").first().text()==activeSchoolDBID;});if(node.length>0){node=$j(node).first().parent();var id=$j(node).find('SchoolID').text();var dbid=$j(node).find('DB').text();var txtAddress='';if(parseInt(dbid)==parseInt(4))
txtAddress=getGSSchoolInfoAddress(id);if(txtAddress==''){$j(node).find("Address").each(function(){if($j(this)!='')
txtAddress+=(txtAddress!=''?' <br />':'')+$j(this).text();});txtAddress+='<br />'+$j(node).find("City").text()+', ';txtAddress+=$j(node).find("State").text()+' '+$j(node).find("Zip").text();}
var shortName=$j(node).find('Name').text();var linkValue=$j(node).find('Url').text();if(shortName!=''&&typeof(shortName)!='undefined'){var windowContent='<div class="infoWindow">';windowContent+='<div class="infoTopImage"><img src="images/CareerEd/'+findSchoolHeader(shortName)+'" border="0" alt="" /></div>';windowContent+='<div class="infoAddress wideAddress">';if(typeof(linkValue)!='undefined'&&linkValue!=''){windowContent+='<h4><a href="'+linkValue+'">'+shortName+'</a></h4>';}else{windowContent+='<h4>'+shortName+'</h4>';}
windowContent+='<p>'+txtAddress+'</p>';windowContent+='<div class="infoContactButton">';if(linkValue!=''&&typeof(linkValue)!='undefined'){windowContent+='<a href="'+linkValue+'"><img src="images/CareerEd/contact_us.png" border="0" alt="" /></a>';}
windowContent+='</div></div></div>';}
codeAddress1(windowContent,shortName,txtAddress);}}else{var node=$j(globalEuropeSchoolXMLDoc).find("SchoolInfo > sycampusid:contains('"+activeSchoolID.toString().replace("\"","\\\"")+"')").filter(function(){return $j(this).text()==activeSchoolID;});if(node.length>0){node=$j(node).first().parent();var txtAddress='';txtAddress+=$j(node).find("City").text()+', ';txtAddress+=$j(node).find("Country").text();var shortName=$j(node).find("Name").text();var linkValue;var windowContent='<div class="infoWindow infoWindowEurope">';windowContent+='<div class="infoAddress wideAddress">';if(typeof(linkValue)!='undefined'&&linkValue!=''){windowContent+='<h4><a href="'+linkValue+'">'+shortName+'</a></h4>';}else{windowContent+='<h4>'+shortName+'</h4>';}
windowContent+='<p>'+txtAddress+'</p>';windowContent+='<div class="infoContactButton">';if(linkValue!=''&&typeof(linkValue)!='undefined'){windowContent+='<a href="'+linkValue+'"><img src="images/CareerEd/contact_us.png" border="0" alt="" /></a>';}
windowContent+='</div></div></div>';codeAddress1(windowContent,shortName,txtAddress);}}}
function codeAddress1(windowContent,schoolName,schoolAddress){var address=schoolAddress.replace("<br />"," ").replace("<br>"," ").replace(/(\r\n|\n|\r)/gm,"");var m=MapMarkers.getMarker(address);if(m!=null){m.animate();}else{var location=Addresses.getLocation(address);if(location!=""){map.setZoom(6);map.setCenter(getLatLng(location));var imageIcon="/images/CareerEd/darts/"+findMarkerColor(schoolName)+".png";var marker=new google.maps.Marker({map:map,animation:google.maps.Animation.DROP,icon:imageIcon,title:schoolName,position:getLatLng(location)});google.maps.event.addListener(marker,'click',function(){closeInfoWindow();infoWindow.setContent(windowContent);infoWindow.open(map,marker);});m=MapMarkers.addMarker(address,marker);m.setZ(MapMarkers.getNextZ());}}}
function findMarkerColor(schoolName){var matchFound=false;var markerImage='red1_Dart';var aiu,cca,ctu,iadt,lcb,briarcliffe,sanfordbrown1,sanfordbrown2,sanfordbrown3,brown,missouri,brooks,collins,harrington;var aiu2,biwi,cefire,eceebs,inseec,ium,im,mbai,supdepub,supsante;aiu='aiu';cca='california culinary academy';ctu='ctu';iadt='iadt';iadt2='internationale du design';lcb='le cordon bleu';briarcliffe='briarcliffe';sanfordbrown1='sanford brown';sanfordbrown2='sanford-brown';sanfordbrown3='sb-';brown='brown college';missouri='missouri college';brooks='brooks';collins='collins college';harrington='harrington college';schoolName=schoolName.toLowerCase();aiu=schoolName.indexOf(aiu);if(aiu!=-1){markerImage='blue1_Dart';return markerImage;}
ctu=schoolName.indexOf(ctu);if(ctu!=-1){markerImage='red1_Dart';return markerImage;}
iadt=schoolName.indexOf(iadt);if(iadt!=-1){markerImage='black_Dart';return markerImage;}
iadt2=schoolName.indexOf(iadt2);if(iadt2!=-1){markerImage='black_Dart';return markerImage;}
lcb=schoolName.indexOf(lcb);if(lcb!=-1){markerImage='blue2_Dart';return markerImage;}
cca=schoolName.indexOf(cca);if(cca!=-1){markerImage='blue2_Dart';return markerImage;}
briarcliffe=schoolName.indexOf(briarcliffe);if(briarcliffe!=-1){markerImage='brown_Dart';return markerImage;}
sanfordbrown1=schoolName.indexOf(sanfordbrown1);if(sanfordbrown1!=-1){markerImage='yellow_Dart';return markerImage;}
sanfordbrown2=schoolName.indexOf(sanfordbrown2);if(sanfordbrown2!=-1){markerImage='yellow_Dart';return markerImage;}
brown=schoolName.indexOf(brown);if(brown!=-1){markerImage='blue3_Dart';return markerImage;}
missouri=schoolName.indexOf(missouri);if(missouri!=-1){markerImage='red2_Dart';return markerImage;}
brooks=schoolName.indexOf(brooks);if(brooks!=-1){markerImage='gray_Dart';return markerImage;}
collins=schoolName.indexOf(collins);if(collins!=-1){markerImage='purple_Dart';return markerImage;}
harrington=schoolName.indexOf(harrington);if(harrington!=-1){markerImage='orange_Dart';return markerImage;}
sanfordbrown3=schoolName.indexOf(sanfordbrown3);if(sanfordbrown3!=-1){markerImage='yellow_Dart';return markerImage;}
markerImage=(schoolName.indexOf('aiu study abroad')!=-1)?'int_red':markerImage;markerImage=(schoolName.indexOf('bordeaux international wine institute')!=-1)?'int_maroon':markerImage;markerImage=(schoolName.indexOf('cefire')!=-1)?'int_red':markerImage;markerImage=(schoolName.indexOf('ece european business school')!=-1)?'int_blue':markerImage;markerImage=(schoolName.indexOf('inseec')!=-1)?'int_blue':markerImage;markerImage=(schoolName.indexOf('international university of monaco')!=-1)?'int_red':markerImage;markerImage=(schoolName.indexOf('istituto marangoni')!=-1)?'int_light-blue':markerImage;markerImage=(schoolName.indexOf('mba institute')!=-1)?'int_yellow':markerImage;markerImage=(schoolName.indexOf('sup de pub')!=-1)?'int_green':markerImage;markerImage=(schoolName.indexOf('supsante')!=-1)?'int_dark-blue':markerImage;return markerImage;}
function findSchoolHeader(schoolName){var matchFound=false;var markerImage='red1_Dart';var aiu,aiu2,ctu,ctu2,iadt,iadt2,iadt3,lcb,lcb2,briarcliffe,sanfordbrown1,sanfordbrown2,brown,missouri,brooks,collins,harrington;aiu='american intercontinental';aiu2='aiu ';ctu='colorado technical university';ctu2='ctu ';iadt='international academy of design';iadt2='internationale du design';iadt3='iadt ';lcb='le cordon bleu';lcb2='california culinary academy';briarcliffe='briarcliffe';sanfordbrown1='sanford brown';sanfordbrown2='sanford-brown';brown='brown college';missouri='missouri college';brooks='brooks';collins='collins college';harrington='harrington college';schoolName=schoolName.toLowerCase();aiu=schoolName.indexOf(aiu);if(aiu!=-1){markerImage='aiu.png';return markerImage;}
aiu2=schoolName.indexOf(aiu2);if(aiu2!=-1){markerImage='aiu.png';return markerImage;}
ctu=schoolName.indexOf(ctu);if(ctu!=-1){markerImage='ctu.png';return markerImage;}
ctu2=schoolName.indexOf(ctu2);if(ctu2!=-1){markerImage='ctu.png';return markerImage;}
iadt=schoolName.indexOf(iadt);if(iadt!=-1){markerImage='iadt.png';return markerImage;}
iadt2=schoolName.indexOf(iadt2);if(iadt2!=-1){markerImage='iadt.png';return markerImage;}
iadt3=schoolName.indexOf(iadt3);if(iadt3!=-1){markerImage='iadt.png';return markerImage;}
lcb=schoolName.indexOf(lcb);if(lcb!=-1){markerImage='lcb.png';return markerImage;}
lcb2=schoolName.indexOf(lcb2);if(lcb2!=-1){markerImage='lcb.png';return markerImage;}
briarcliffe=schoolName.indexOf(briarcliffe);if(briarcliffe!=-1){markerImage='briarcliffe.png';return markerImage;}
sanfordbrown1=schoolName.indexOf(sanfordbrown1);if(sanfordbrown1!=-1){markerImage='sanford_brown.png';return markerImage;}
sanfordbrown2=schoolName.indexOf(sanfordbrown2);if(sanfordbrown2!=-1){markerImage='sanford_brown.png';return markerImage;}
brown=schoolName.indexOf(brown);if(brown!=-1){markerImage='brown_college.png';return markerImage;}
missouri=schoolName.indexOf(missouri);if(missouri!=-1){markerImage='missouri_college.png';return markerImage;}
brooks=schoolName.indexOf(brooks);if(brooks!=-1){markerImage='brooks_institute.png';return markerImage;}
collins=schoolName.indexOf(collins);if(collins!=-1){markerImage='collins_college.png';return markerImage;}
harrington=schoolName.indexOf(harrington);if(harrington!=-1){markerImage='harrington_college.png';return markerImage;}
return markerImage;}
