/////////////////////// // DEFINE VARIABLES // ////////////////////// window.types = new Array('start','pause','stop','clear','redo','undo','save','open'); window.nonOnOff = new Array('redo','undo','save','open'); var mapCenter = ', , , '; var startZoom = 14; var map; ///////////////////// // PRELOAD IMAGES // //////////////////// if (document.images) { var x, tmp; window.pics = new Array(); for (x in window.types) { tmp = window.types[x]; window.pics[tmp] = new Image(38,36); window.pics[tmp].src = "/images/map/"+tmp+"_over.png"; } } /////////////// // LOAD MAP // ////////////// function init() { if(GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map"),{size:new GSize(715,300)}); // var location = new GLatLng(centerLatitude, centerLongitude); // map.setCenter(location, startZoom); if(!mapCenter) { var location = new GLatLng(centerLatitude, centerLongitude); map.setCenter(location, startZoom); } else { geocoder = new GClientGeocoder(); setCenterLocation(mapCenter,startZoom); } map.addControl(new GLargeMapControl3D()); map.addControl(new GMapTypeControl()); map.addMapType(G_PHYSICAL_MAP); GEvent.addListener(map,'click',function(overlay,latlng){ addMarker(overlay,latlng); }); geocoder = new GClientGeocoder(); openCourseLink(); } } window.onload = init; window.onunload = GUnload; ////////////////////////// // SET CENTER LOCATION // ///////////////////////// function setCenterLocation(address,startZoom) { if (geocoder) { geocoder.getLatLng( address, function(point) { if(!point) { point = window.centerLatitude+','+window.centerLongitude; } map.setCenter(point, startZoom); } ); } } //////////////////////////////// // ROUTE RECORDING FUNCTIONS // /////////////////////////////// function recording(type) { if(!(in_array(type, window.nonOnOff))) { window.start = false; window.pause = false; window.stop = false; for (x in window.types) { if(window.types[x]!=type) { tmpName = window.types[x]+'State'; window[tmpName] = 'out'; document.getElementById(window.types[x]).src = '/images/map/'+window.types[x]+'.png'; } else if(window.types[x]==type && window.types[x]!='clear') { key = x; window[type+'State'] = 'on'; document.getElementById(type).src = '/images/map/'+type+'_over.png'; } } } if(type=='start') { window.start = true; } if(type=='pause') { window.pause = true; } if(type=='stop') { stopR(); } if(type=='clear') { clearR(); } if(type=='save') { saveC(); } if(type=='open') { openC(); } } ///////////////////// // STOP RECORDING // //////////////////// function stopR() { window.stop = true; window.point1 = ''; window.click = 'point1'; } //////////////// // CLEAR MAP // /////////////// function clearR() { map.clearOverlays(); window.mileArr = []; window.polylineArr = []; window.markerArr = []; document.getElementById('distance').innerHTML = '0.00'; window.d = 0; window.point1 = ''; window.click = 'point1'; document.getElementById('clear').src = '/images/map/clear.png'; window.userEvents = new Array(); window.eventOn = 0; } ////////////////// // SAVE COURSE // ///////////////// function saveC() { openPopup(); ajaxINT('save',window.d); } ////////////////// // OPEN COURSE // ///////////////// function openC() { openPopup(); ajaxINT('open',''); } ///////////////////////// // RECORD USER EVENTS // //////////////////////// window.userEvents = new Array(); window.eventOn = 0; function recordEvents(value) { var n = (window.eventOn *1) + 1; window.userEvents[n] = value; window.eventOn = n; } ////////////////////// // UNDO USER EVENT // ///////////////////// window.recentlyStopped = false; function undoEvent() { var l = window.eventOn; var n = (l *1) -1; if(n<0) { alert("Nothing left to undo!"); return false; } window.eventOn = n; var arr = window.userEvents[l].split('*|*'); if(arr[0]=='click') { var o = window.d; // calculate & subtract distance of point var d = (window.d *1) - (arr[1] *1); if(d<=0 || d<0.000000000000001) { d = '0.00'; } document.getElementById('distance').innerHTML = decial2Places(d); window.d = d; // remove marker, ployline, and mile marker map.removeOverlay(window.markerArr[n]); map.removeOverlay(window.polylineArr[n]); removeMileMarker(o,d); window.point1 = window.latlngArr[(n -1)]; map.panTo(window.latlngArr[(n -1)]); } // add past maker back in if(n>=2) { var icon = new GIcon(); icon.image = '/images/map/foot_icon.png'; icon.iconSize = new GSize(35,17); icon.iconAnchor = new GPoint(14,14); var latlng = window.latlngArr[(n -1)]; var marker = new GMarker(latlng,icon); map.addOverlay(marker); window.markerArr[(n-1)] = marker; } if(arr[0]=='marker') { map.removeOverlay(window.markerArr[n]); window.click = 'point1'; map.panTo(window.latlngArr[n]); } window.recentlyStopped = true; window.undoWas = true; } ////////////////////// // REDO USER EVENT // ///////////////////// function redoEvent() { var o = window.d; var t = (window.userEvents.length *1) - 1; var l = window.eventOn; var n = (l *1) +1; if(n>t) { alert("Nothing left to redo!"); return false; } window.eventOn = n; var arr = window.userEvents[n].split('*|*'); if(arr[0]=='click') { // calculate & add distance of point var d = (window.d *1) + (arr[1] *1); document.getElementById('distance').innerHTML = decial2Places(d); window.d = d; // remove past maker if(l>=2) { map.removeOverlay(window.markerArr[(l-1)]); } // add marker, ployline, and mile marker map.addOverlay(window.markerArr[l]); map.addOverlay(window.polylineArr[l]); addMileMarker(d,o); window.click = 'point2'; window.point1 = window.latlngArr[l]; map.panTo(window.latlngArr[l]); } if(arr[0]=='marker') { map.addOverlay(window.markerArr[l]); window.click = 'point2'; window.point1 = window.latlngArr[l]; map.panTo(window.latlngArr[l]); } } ///////////////// // ADD MARKER // //////////////// window.markerArr = new Array(); window.latlngArr = new Array(); function addMarker(overlay,latlng) { if(window.start) { // if(window.recentlyStopped) // { window.click = 'point2'; window.eventOn = window.point1 = window.latlngArr[(window.eventOn-1)]; window.recentlyStopped = false; } window.undoWas = false; var icon = new GIcon(); icon.image = '/images/map/foot_icon.png'; icon.iconSize = new GSize(35,17); icon.iconAnchor = new GPoint(14,14); var marker = new GMarker(latlng,icon); map.addOverlay(marker); map.panTo(latlng); var n = window.eventOn; if(window.eventOn==0 || window.click=='point1') { recordEvents('marker'); } if(n>=2) { map.removeOverlay(window.markerArr[(n-1)]); } window.markerArr[n] = marker; window.latlngArr[n] = latlng; userClicks(latlng); } } //////////////////// // REMOVE MARKER // /////////////////// function removeMarker(n) { var i = 0; marker = map.getFirstMarker(); while(marker!=null) { if(i==n) { marker.remove(); } marker = map.getNextMarker(); i++; } } /////////////////////// // JUMP TO LOCATION // ////////////////////// function jumpTo() { var zoom = map.getZoom(); var address = document.getElementById('jumpTo').value; if (geocoder) { geocoder.getLatLng( address, function(point) { if (!point) { alert("Error - Address was not found! \n\n Please try again."); } else { map.setCenter(point, zoom); } } ); } } /////////////////// // ADD POLYLINE // ////////////////// window.polylineArr = new Array(); function addPolyline(latlng1,latlng2,color,width) { var polyline = new GPolyline([latlng1,latlng2], color, width); map.addOverlay(polyline); var n = window.eventOn; window.polylineArr[n] = polyline; processMiles(); } ///////////////////// // PROCESS CLICKS // //////////////////// window.point1 = ''; window.click = 'point1'; function userClicks(latlng) { if(window.click=='point1') { window.point1 = latlng; window.click = 'point2'; } else if(window.click=='point2') { addPolyline(window.point1,latlng,"#ff0000",5); showDistance(window.point1+', '+latlng); window.point1 = latlng; } else { alert("There was an internal error with the Google Map! \n\n Please try mapping your course again."); } } ////////////////////////// // SHOW TOTAL DISTANCE // ///////////////////////// window.d = 0; function showDistance(points) { var o = window.d; var latlng = points.split(','); var lat1 = latlng[0].substr((latlng[0].indexOf('(')+1)); var lon1 = latlng[1].substr(0,(latlng[1].indexOf(')'))); var lat2 = latlng[2].substr((latlng[2].indexOf('(')+1)); var lon2 = latlng[3].substr(0,(latlng[3].indexOf(')'))); var calcD = calcDistance(lat1,lon1,lat2,lon2) *1; recordEvents('click*|*'+calcD); var d = (window.d * 1) + calcD; window.d = d; document.getElementById('distance').innerHTML = decial2Places(d); } ///////////////////////// // CALCULATE DISTANCE // //////////////////////// function toRad(degrees) { yo=(2*Math.PI)/360; return (degrees * yo); } function decial2Places(n) { var num = n.toString(); var e = num.indexOf('.'); if(num.substr((e+3),1) >= 5) { num = num.substring(0,(e+3)); num = (num *1) + 0.01; num = num.toString(); } return num.substring(0,(e+3)); } function calcDistance(lat1,lon1,lat2,lon2) { var R = 6371; // km var dLat = toRad((lat2-lat1)); var dLon = toRad((lon2-lon1)); var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) * Math.sin(dLon/2) * Math.sin(dLon/2); var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); var d = R * c; return (d / 1.609); } /////////////////////////////// // MOUSEOVER TOOLBAR IMAGES // ////////////////////////////// function imageChange(type) { var state = window[type+'State']; if(state=='out' || state=='' || !state) { document.getElementById(type).src = '/images/map/'+type+'_over.png'; window[type+'State'] = 'over'; } else if(state=='over') { document.getElementById(type).src = '/images/map/'+type+'.png'; window[type+'State'] = 'out'; } } //////////////////////////// // PROCESS SAVING COURSE // /////////////////////////// function doSave() { var p,t,i,m,l,x,s,d,courseName,query; // Fix for part of bug fix when saving unedited opened courses if(window.userEvents.length>1 && window.userEvents[window.userEvents.length - 1]=='marker') { window.userEvents = removeKey(window.userEvents,(window.userEvents.length - 1)); } p = ''; for (x in window.userEvents) { p += ';'+x+'=>'+window.userEvents[x]; } p = p.substr(1); m = ''; for (x in window.markerArr) { m += ';'+x+'=>'+window.markerArr[x]; } m = m.substr(1); l = ''; for (x in window.latlngArr) { l += ';'+x+'=>'+window.latlngArr[x]; } l = l.substr(1); t = document.getElementById('savetype').value; i = document.getElementById('coursePick').value; if(document.getElementById('shared').checked==true) { s = 'Y'; } else { s = 'N'; } courseName = document.getElementById('courseName').value; d = addslashes(document.getElementById('description').value); // Reverse geocode // http://googlegeodevelopers.blogspot.com/2008/10/geocoding-in-reverse.html geocoder = new GClientGeocoder(); geocoder.getLocations(window.latlngArr[0],function(response) { if(response.Status.code!=200) { stateAbv = ''; countryAbv = ''; } else { place = response.Placemark[0]; stateAbv = place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName; countryAbv = place.AddressDetails.Country.CountryNameCode; } // Create query string query = 'doSave=Y&type='+t+'&id='+i+'&courseName='+courseName+'&shared='+s+'&miles='+window.d+'&state='+stateAbv+'&country='+countryAbv+'&events='+p+'&markers='+m+'&latlng='+l+'&description='+d; document.getElementById('saveButton').style.display='none'; document.getElementById('processing').innerHTML=' saving...'; document.getElementById('processing').style.display='block'; ajaxINT('doSave',query); }); } ////////////////////////// // PROCESS OPEN COURSE // ///////////////////////// function openCourse(id) { clearR(); var p,x,k,v,t,l,lt,lk,lv,n; window.userEvents = new Array(); window.d = 0; p = id+'p'; l = id+'l'; p = document.getElementById(p).value.split(';'); l = document.getElementById(l).value.split(';'); n = p.length - 1; for (x in p) { t = p[x].split('=>'); k = t[0]; v = t[1]; lt = l[x].split('=>'); lk = lt[0]; lv = lt[1]; // window.userEvents[k] = v; if(x==0) { applyEvents(k,v,lv,x,'S'); } else if(n==x) { applyEvents(k,v,lv,x,'E'); } else { applyEvents(k,v,lv,x,''); } } window.eventOn = p.length - 1; closeWindow(); } window.lastApply = ''; function applyEvents(l,arr,latlng,x,position) { window.eventOn = x; // FIX PROBLEM WITH THIS arr = arr.split('*|*'); latlng = latlng.replace('(',''); latlng = latlng.replace(')',''); latlng = latlng.split(','); lat = latlng[0]; lng = latlng[1]; if(arr[0]=='click') { // calculate & add distance of point var d = (window.d *1) + (arr[1] *1); document.getElementById('distance').innerHTML = decial2Places(d); window.d = d; // get last points var latlngO = window.lastApply latlngO = latlngO.split(','); latO = latlngO[0]; lngO = latlngO[1]; // add ployline var latlngA = new GLatLng(latO, lngO); var latlngB = new GLatLng(lat, lng); var latlngVal = latlngA,latlngB; window.latlngArr[(x-1)] = latlngVal; var polyline = new GPolyline([latlngA,latlngB], "#ff0000", 5); map.addOverlay(polyline); // record events var points = latlngA+','+latlngB; var latlng = points.split(','); var lat1 = latlng[0].substr((latlng[0].indexOf('(')+1)); var lon1 = latlng[1].substr(0,(latlng[1].indexOf(')'))); var lat2 = latlng[2].substr((latlng[2].indexOf('(')+1)); var lon2 = latlng[3].substr(0,(latlng[3].indexOf(')'))); var calcD = calcDistance(lat1,lon1,lat2,lon2) *1; recordEvents('click*|*'+calcD); /* PROBLEM: mile markers not showing up in right places with following commented JS - markers are always off to left right in a group and for longer polylines they do strech out instead of being in a group I've outline 2 ways of getting the mile markers below SOLUTION: get commented JS some how to get mile markers in correct positions WAY 1: window.eventOn = x; window.polylineArr[x] = polyline; processMiles(); WAY 2: REMOVE var polyine AND map.addOverlay IN LINES ABOVE COMMENTS window.eventOn = x; addPolyline((new GLatLng(latO, lngO)),(new GLatLng(lat, lng)),"#ff0000",5); */ window.lastApply = lat+','+lng; } if(arr[0]=='marker' || position=='E') { var icon = new GIcon(); if(position!='E') { icon.image = '/images/map/foot_icon.png'; icon.iconSize = new GSize(35,17); icon.iconAnchor = new GPoint(14,14); } else { icon.image = '/images/map/flag_icon.png'; icon.iconSize = new GSize(20,20); icon.iconAnchor = new GPoint(1,19); } var point = new GLatLng(lat,lng); var marker = new GMarker(point,icon); map.addOverlay(marker); window.markerArr[x] = marker; window.userEvents[(x+1)] = 'marker'; window.lastApply = lat+','+lng; } if(position=='S') { map.panTo(new GLatLng(lat,lng)); } } //////////////////////////// // OPEN COURSE FROM LINK // /////////////////////////// function openCourseLink() { var p,x,k,v,t,l,lt,lk,lv,n; window.userEvents = new Array(); window.d = 0; p = '01=>marker;2=>click*|*0.02279606314693333;3=>click*|*0.02195440611899771;4=>click*|*0.019421512363581882;5=>click*|*0.007999854235050936;6=>click*|*0.009168092938509847;7=>click*|*0.010822168238673619;8=>click*|*0.013488059934112935;9=>click*|*0.014893112108061006;10=>click*|*0.015465382223339366;11=>click*|*0.015465434168705343;12=>click*|*0.010333374798315;13=>click*|*0.008564899797800469;14=>click*|*0.011429190158830494;15=>click*|*0.01642682589724009;16=>click*|*0.021036549139171155;17=>click*|*0.023931788964063946;18=>click*|*0.02647809454941163;19=>click*|*0.025767385431673378;20=>click*|*0.014701969831391864;21=>click*|*0.016894424053020315;22=>click*|*0.019420655705976897;23=>click*|*0.02634305651534549;24=>click*|*0.0292203000006838;25=>click*|*0.027535055537843342;26=>click*|*0.026481045531196144;27=>click*|*0.015991102310442054;28=>click*|*0.01418552190105563;29=>click*|*0.014185563915326898;30=>click*|*0.014691515115169706;31=>click*|*0.014691560871124503;32=>click*|*0.01469160662563984;33=>click*|*0.01469165238206882;34=>click*|*0.014147458634021774;35=>click*|*0.012903111793131078;36=>click*|*0.01669930973156086;37=>click*|*0.017904328150583508;38=>click*|*0.017904364232202954;39=>click*|*0.019423426995370547;40=>click*|*0.02200453393229059;41=>click*|*0.008609052129998766;42=>click*|*0.009160163217010278;43=>click*|*0.010089416028362436;44=>click*|*0.011833002610241849;45=>click*|*0.01321480307292791;46=>click*|*0.013214840998750319;47=>click*|*0.013214878925554271;48=>click*|*0.013928486556642377;49=>click*|*0.014770596723838902;50=>click*|*0.014770644077107825;51=>click*|*0.014770691428905162;52=>click*|*0.014770738781683352;53=>click*|*0.01477078613348045;54=>click*|*0.01476481698643192;55=>click*|*0.014960812523864983;56=>click*|*0.015637765858713137;57=>click*|*0.01587901775964124;58=>click*|*0.015908887756391214;59=>click*|*0.015908942641613064;60=>click*|*0.015271945074114014;61=>click*|*0.01424723269441894;62=>click*|*0.0151115154127961;63=>click*|*0.01596983751981961;64=>click*|*0.01540600657666788;65=>click*|*0.014668736684308879;66=>click*|*0.01505934683952912;67=>click*|*0.015348371049692852;68=>click*|*0.015564963374402076;69=>click*|*0.014397866746188084;70=>click*|*0.004966230963820168;71=>click*|*0.014069822141860975;72=>click*|*0.013976923071843027;73=>click*|*0.014086733531150811;74=>click*|*0.015317107477918708;75=>click*|*0.015229239300697365;76=>click*|*0.015177334427714035;77=>click*|*0.01535845918067542;78=>click*|*0.01546039124280432;79=>click*|*0.01616601878794703;80=>click*|*0.01616607554230554;81=>click*|*0.016166132297154877;82=>click*|*0.016891997823063068;83=>click*|*0.016892059701725182;84=>click*|*0.01729018234622744;85=>click*|*0.017290247266624453;86=>click*|*0.01729031218800322;87=>click*|*0.01707371726237903;88=>click*|*0.0170204879800806;89=>click*|*0.01750391133759825;90=>click*|*0.01855126083063599;91=>click*|*0.018971852113990398;92=>click*|*0.01897191466063337;93=>click*|*0.018971977209214397;94=>click*|*0.018747945294809346;95=>click*|*0.018748008821202533;96=>click*|*0.01880276798903114;97=>click*|*0.01858306040302159;98=>click*|*0.01848774729480547;99=>click*|*0.018794523744877764;100=>click*|*0.018882119488018916;101=>click*|*0.018788323949806614;102=>click*|*0.018788376713351596;103=>click*|*0.01878842947653121;104=>click*|*0.01917967033292136;105=>click*|*0.019179726538261253;106=>click*|*0.019179782739772284;107=>click*|*0.019179838943671937;108=>click*|*0.01917989514616063;109=>click*|*0.019179951349656273;110=>click*|*0.019180007551395546;111=>click*|*0.01918006375621426;112=>click*|*0.019180119957549525;113=>click*|*0.019180176159891725;114=>click*|*0.019200819004991623;115=>click*|*0.019315752199579834;116=>click*|*0.01952483208543661;117=>click*|*0.017862274569394203;118=>click*|*0.017595495871059654;119=>click*|*0.017595553337095653;120=>click*|*0.016998934984599832;121=>click*|*0.016998987906079618;122=>click*|*0.017191426533727513;123=>click*|*0.017112591380518585;124=>click*|*0.017356202814359793;125=>click*|*0.017356258438664084;126=>click*|*0.01735631406044586;127=>click*|*0.01735636968513286;128=>click*|*0.01735642530813238;129=>click*|*0.017856323224823764;130=>click*|*0.01624361923275939;131=>click*|*0.01640582661624406;132=>click*|*0.007971802534000838;133=>click*|*0.016740226031983985;134=>click*|*0.019288169193757407;135=>click*|*0.019288164484137317;136=>click*|*0.019288159774631317;137=>click*|*0.019288155065096287;138=>click*|*0.02080899620623751;139=>click*|*0.020949492689743453;140=>click*|*0.020949490132121763;141=>click*|*0.02309300060961829;142=>click*|*0.02420765424251657;143=>click*|*0.025158428089648636;144=>click*|*0.025158428089648636;145=>click*|*0.026429355543867824;146=>click*|*0.026429352317225582;147=>click*|*0.027576792389267503;148=>click*|*0.02548644642304314;149=>click*|*0.013730775425466938;150=>click*|*0.019298311565481046;151=>click*|*0.02001775852392288;152=>click*|*0.02001770109273944;153=>click*|*0.020017643662819558;154=>click*|*0.02047999730368809;155=>click*|*0.020479939796599293;156=>click*|*0.02047988228947627;157=>click*|*0.020479824780768874;158=>click*|*0.020479767272957344;159=>click*|*0.013091166308049526;160=>click*|*0.018974226724951734;161=>click*|*0.018975787370995006;162=>click*|*0.02109875100221819;163=>click*|*0.00787057237823827;164=>click*|*0.009847235903641643;165=>click*|*0.009847214865269223;166=>click*|*0.010041852475380105;167=>click*|*0.00938288483890452;168=>click*|*0.009382866508563143;169=>click*|*0.009119151969706953;170=>click*|*0.01056420501273702;171=>click*|*0.012327060715220689;172=>click*|*0.012327031743594596;173=>click*|*0.012260324238658905;174=>click*|*0.01253433795331944;175=>click*|*0.01358326642245544;176=>click*|*0.013583231179527842;177=>click*|*0.013583195939184101;178=>click*|*0.013583160696673775;179=>click*|*0.0135831254567473;180=>click*|*0.013771546835478496;181=>click*|*0.01377150942223664;182=>click*|*0.013771472010326498;183=>click*|*0.013492521753695442;184=>click*|*0.01349248509765941;185=>click*|*0.013492448443439298;186=>click*|*0.014269311228478798;187=>click*|*0.014269268977515804;188=>click*|*0.014269226728894554;189=>click*|*0.014929374931435504;190=>click*|*0.014929327992562006;191=>click*|*0.01503802684071161;192=>click*|*0.00562494689801038;193=>click*|*0.009901530623447338;194=>click*|*0.009901509464604507;195=>click*|*0.009901488309664403;196=>click*|*0.011300598759953949;197=>click*|*0.011300571507536253;198=>click*|*0.011300544256082597;199=>click*|*0.011300517005592982;200=>click*|*0.012431442792530356;201=>click*|*0.011300459741745882;202=>click*|*0.01713460119765064;203=>click*|*0.01876668038978016;204=>click*|*0.018766604195332545;205=>click*|*0.019958349455540043;206=>click*|*0.0198167587189751;207=>click*|*0.019595700840454887;208=>click*|*0.01475823671308549;209=>click*|*0.017294167073120557;210=>click*|*0.019352627475650405;211=>click*|*0.01989149297753159;212=>click*|*0.02009586736003114;213=>click*|*0.020095783313875952;214=>click*|*0.014755229806955547;215=>click*|*0.015546977703739641;216=>click*|*0.015546926443932298;217=>click*|*0.017196902902718508;218=>click*|*0.017847108740054785;219=>click*|*0.01784703954559416;220=>click*|*0.017901655634830885;221=>click*|*0.01705886881176436;222=>click*|*0.01483954696857976;223=>click*|*0.014467581427687084;224=>click*|*0.014467539909415898;225=>click*|*0.013455552741591386;226=>click*|*0.0065096035569558765;227=>click*|*0.015585088072838336;228=>click*|*0.015585064283677345;229=>click*|*0.018855333097718627;230=>click*|*0.018855297407562078;231=>click*|*0.0188552617167062;232=>click*|*0.02300095062884521;233=>click*|*0.02300090006936371;234=>click*|*0.0257025754638397;235=>click*|*0.027694890574213215;236=>click*|*0.029357779235575112;237=>click*|*0.029728980209990735;238=>click*|*0.029728917582955997;239=>click*|*0.0300012473256689;240=>click*|*0.030040988794959016;241=>click*|*0.029037635594744444;242=>click*|*0.012572077340410917;243=>click*|*0.011659441246818066;244=>click*|*0.011042783249187078;245=>click*|*0.014083114850647503;246=>click*|*0.01458785734187337;247=>click*|*0.015520328928654382;248=>click*|*0.015472497489174118;249=>click*|*0.014786670025072493;250=>click*|*0.015859934783181255;251=>click*|*0.016655333262172473;252=>click*|*0.016589947321412668;253=>click*|*0.016589888565875992;254=>click*|*0.016156330532866085;255=>click*|*0.01595708119981923;256=>click*|*0.015957027119122072;257=>click*|*0.015956973040821807;258=>click*|*0.013324689945286258;259=>click*|*0.017550137498391665;260=>click*|*0.019824245900820707;261=>click*|*0.021824231533407387;262=>click*|*0.02429840833075924;263=>click*|*0.02566563601701073;264=>click*|*0.02681973138669167;265=>click*|*0.026819758409655173;266=>click*|*0.028895944699393637;267=>click*|*0.0281146925211254;268=>click*|*0.028114697671635182;269=>click*|*0.028114702822115183;270=>click*|*0.028255155424215684;271=>click*|*0.029369684338589025;272=>click*|*0.057653097050784155;273=>click*|*0.025391598864270525;274=>click*|*0.0069193389476940965;275=>click*|*0.013075800819224341;276=>click*|*0.01684258585301378;277=>click*|*0.017383161385624082;278=>click*|*0.017383222952628265;279=>click*|*0.017716846584151263;280=>click*|*0.017716909872678065;281=>click*|*0.017716973162105153;282=>click*|*0.017769892516818778;283=>click*|*0.017769955996395307;284=>click*|*0.018862547004886477;285=>click*|*0.01930031695888831;286=>click*|*0.01930038826052432;287=>click*|*0.01998154213696351;288=>click*|*0.021462807795994673;289=>click*|*0.02206617925009908;290=>click*|*0.022168472092517627;291=>click*|*0.024272306824507688;292=>click*|*0.025621122316022635;293=>click*|*0.025370287095669786;294=>click*|*0.024997161345646328;295=>click*|*0.025156697760554146;296=>click*|*0.019505593699327778;297=>click*|*0.011805443624938829;298=>click*|*0.01864329700527625;299=>click*|*0.018643308957830413;300=>click*|*0.018643320910459685;301=>click*|*0.014895929327445595;302=>click*|*0.005510874246879247;303=>click*|*0.00739307216033224;304=>click*|*0.01213697342854431;305=>click*|*0.012934761062006025;306=>click*|*0.01335458936995048;307=>click*|*0.012275991388682574;308=>click*|*0.011506301539675945;309=>click*|*0.013929120617917115;310=>click*|*0.013763663175710412;311=>click*|*0.01315554847157374;312=>click*|*0.01286410904073644;313=>click*|*0.014765042381693074;314=>click*|*0.015347911843153308;315=>click*|*0.015326618935302799;316=>click*|*0.015326567931757623;317=>click*|*0.016189208084942543;318=>click*|*0.01618915124585332;319=>click*|*0.016189094402352618;320=>click*|*0.016189037561792467;321=>click*|*0.016188980719761648;322=>click*|*0.01616878801301368;323=>click*|*0.0161687312436451;324=>click*|*0.016168674470350468;325=>click*|*0.016168617698527985;326=>click*|*0.016168560929649894;327=>click*|*0.013228922617029428;328=>click*|*0.008967385760152337;329=>click*|*0.009376363413825141;330=>click*|*0.012580954785870485;331=>click*|*0.014950949374185833;332=>click*|*0.01800335361574502;333=>click*|*0.01937706633184403;334=>click*|*0.021645707542816126;335=>click*|*0.013640942169526047;336=>click*|*0.01168926465063219;337=>click*|*0.014313225760314558;338=>click*|*0.014313182495366478;339=>click*|*0.014313139229938637;340=>click*|*0.014313095964508247;341=>click*|*0.016357389238664508;342=>click*|*0.016357332800281392;343=>click*|*0.01005474385748452;344=>click*|*0.011107924930822001;345=>click*|*0.015684437611561772;346=>click*|*0.031645793890400176;347=>click*|*0.031645757172323825;348=>click*|*0.029346669696526845;349=>click*|*0.01590745344174269;350=>click*|*0.021570494309946987;351=>click*|*0.020851453102176513;352=>click*|*0.01485954340001471;353=>click*|*0.01772127195348872;354=>click*|*0.017721254637991155;355=>click*|*0.029106884526738857;356=>click*|*0.028392024258169894;357=>click*|*0.01884307951540779;358=>click*|*0.013033437170801711;359=>click*|*0.013499888555311885;360=>click*|*0.015317240070494068;361=>click*|*0.01602697187650777;362=>click*|*0.016026916086768896;363=>click*|*0.01120659013047044;364=>click*|*0.007479554715964618'; l = '0=>(40.714106271717064, -79.92961540818214);1=>(40.714124569111185, -79.92918089032173);2=>(40.71414286650025, -79.92876246571541);3=>(40.71415913084186, -79.92839232087135);4=>(40.714100172584594, -79.92826089262962);5=>(40.71397209067336, -79.92821529507637);6=>(40.71381554578057, -79.92820993065834);7=>(40.713620372411704, -79.92820993065834);8=>(40.71340486781896, -79.92820993065834);9=>(40.71318123023992, -79.92819920182228);10=>(40.71295759190972, -79.92818847298622);11=>(40.71281121005048, -79.928148239851);12=>(40.71272988665627, -79.92802485823631);13=>(40.71267092713338, -79.92782101035118);14=>(40.71260993446854, -79.9275179207325);15=>(40.712526577736234, -79.92713168263435);16=>(40.71243305542454, -79.92669180035591);17=>(40.71234156607948, -79.92620095610619);18=>(40.71224397730619, -79.92572620511055);19=>(40.71211182561435, -79.92550626397133);20=>(40.71194307768811, -79.92527291178703);21=>(40.711778395564636, -79.92497250437737);22=>(40.711705203379005, -79.92447897791862);23=>(40.71163404423252, -79.92392912507057);24=>(40.71156491813167, -79.9234114587307);25=>(40.71149172571141, -79.92291525006294);26=>(40.711355506270564, -79.92266848683357);27=>(40.71115829255646, -79.92259338498116);28=>(40.71096107825826, -79.92251828312874);29=>(40.71075369764453, -79.9224565923214);30=>(40.71054631638492, -79.92239490151405);31=>(40.71033893447946, -79.92233321070671);32=>(40.710131551928114, -79.92227151989937);33=>(40.709934334588965, -79.92219910025597);34=>(40.709787946083225, -79.92204621434212);35=>(40.70966392223628, -79.9217726290226);36=>(40.70952973224008, -79.92148026823997);37=>(40.70939554197342, -79.92118790745735);38=>(40.70926338462837, -79.92086067795753);39=>(40.709153592172996, -79.92046639323235);40=>(40.70909869587741, -79.92031887173653);41=>(40.708986869950174, -79.920224994421);42=>(40.70884454577117, -79.92018207907677);43=>(40.70867375635484, -79.92016598582268);44=>(40.70848263434577, -79.92015793919563);45=>(40.70829151178819, -79.92014989256859);46=>(40.708100388682084, -79.92014184594154);47=>(40.70789909886024, -79.92012843489647);48=>(40.70768560899042, -79.9201150238514);49=>(40.707472118436165, -79.92010161280632);50=>(40.707258627197504, -79.92008820176125);51=>(40.70704513527442, -79.92007479071617);52=>(40.70683164266693, -79.9200613796711);53=>(40.70661814937505, -79.92005065083504);54=>(40.706402622119484, -79.92002382874489);55=>(40.70617692773631, -79.92000237107277);56=>(40.70594716600202, -79.92000505328178);57=>(40.70571740347506, -79.91998627781868);58=>(40.70548764015543, -79.91996750235558);59=>(40.70527210924126, -79.91990312933922);60=>(40.70508097746969, -79.91980120539665);61=>(40.70489187847507, -79.91965636610985);62=>(40.704688545623725, -79.91951152682304);63=>(40.70447301212353, -79.91943642497063);64=>(40.70426154461527, -79.91941228508949);65=>(40.70404397638196, -79.9193961918354);66=>(40.70382234072197, -79.9193774163723);67=>(40.70359867095955, -79.91941228508949);68=>(40.70340956775627, -79.91952762007713);69=>(40.703344499863256, -79.91956785321236);70=>(40.70318792998515, -79.91973951458931);71=>(40.702990692082395, -79.91979852318764);72=>(40.702787353426835, -79.91981729865074);73=>(40.7025657135852, -79.91981729865074);74=>(40.702346106409195, -79.91979315876961);75=>(40.702126498509145, -79.91979047656059);76=>(40.70190485646845, -79.91976901888847);77=>(40.70168118026683, -79.91976365447044);78=>(40.70144733616204, -79.9197556078434);79=>(40.70121349123629, -79.91974756121635);80=>(40.70097964548957, -79.91973951458931);81=>(40.70073563166118, -79.9197207391262);82=>(40.700491616938926, -79.9197019636631);83=>(40.700241500920896, -79.91969391703606);84=>(40.69999138396374, -79.91968587040901);85=>(40.69974126606745, -79.91967782378197);86=>(40.699497247702574, -79.91962686181068);87=>(40.699263395930785, -79.91952493786812);88=>(40.69904987837869, -79.91934522986412);89=>(40.6988444941828, -79.91911724209785);90=>(40.69862487473812, -79.91889998316765);91=>(40.6984052545694, -79.91868272423744);92=>(40.6981856336766, -79.91846546530724);93=>(40.69795991144899, -79.91826698184013);94=>(40.69773418845652, -79.91806849837303);95=>(40.69753286730446, -79.91782709956169);96=>(40.6973417133243, -79.9175776541233);97=>(40.69715665948052, -79.91732284426689);98=>(40.696971605122734, -79.91705998778343);99=>(40.69678044953209, -79.916802495718);100=>(40.69659336055056, -79.91654232144356);101=>(40.696406271043614, -79.91628214716911);102=>(40.696219181011266, -79.91602197289467);103=>(40.69602395606956, -79.91576179862022);104=>(40.69582873055573, -79.91550162434578);105=>(40.69563350446986, -79.91524145007133);106=>(40.695438277811895, -79.91498127579689);107=>(40.695243050581865, -79.91472110152245);108=>(40.69504782277975, -79.914460927248);109=>(40.69485259440558, -79.91420075297356);110=>(40.6946573654593, -79.91394057869911);111=>(40.694462135940974, -79.91368040442467);112=>(40.69426690585058, -79.91342023015022);113=>(40.69406150690875, -79.91317346692085);114=>(40.69384187169613, -79.91294547915459);115=>(40.69359783172183, -79.91275772452354);116=>(40.69337819498071, -79.91257801651955);117=>(40.693160591199124, -79.91240367293358);118=>(40.69294298670685, -79.91222932934761);119=>(40.692735549987155, -79.91205498576164);120=>(40.692528112621666, -79.91188064217567);121=>(40.69232270831946, -79.91169556975365);122=>(40.692117303384066, -79.91151317954063);123=>(40.69190376292843, -79.91133883595467);124=>(40.69169022178843, -79.9111644923687);125=>(40.69147667996409, -79.91099014878273);126=>(40.69126313745537, -79.91081580519676);127=>(40.6910495942623, -79.9106414616108);128=>(40.690815712837065, -79.91049662232399);129=>(40.690583864353115, -79.9104456603527);130=>(40.69034794752387, -79.91041079163551);131=>(40.690234056341815, -79.91043493151665);132=>(40.69024422520527, -79.91011574864388);133=>(40.690260495383576, -79.90974828600883);134=>(40.69027676555789, -79.9093808233738);135=>(40.69029303572824, -79.90901336073875);136=>(40.690309305894615, -79.90864589810371);137=>(40.690317440976344, -79.90824893116951);138=>(40.69032557605705, -79.90784928202629);139=>(40.690333711136745, -79.90744963288307);140=>(40.69035404883168, -79.90700975060463);141=>(40.690372352751815, -79.90654841065407);142=>(40.690372352751815, -79.9060682952404);143=>(40.690372352751815, -79.90558817982674);144=>(40.690380487825834, -79.90508392453194);145=>(40.69038862289883, -79.90457966923714);146=>(40.69040692680947, -79.90405395627022);147=>(40.690429298248986, -79.90356847643852);148=>(40.690506581345886, -79.90332707762718);149=>(40.69066521479023, -79.9030239880085);150=>(40.690856387926516, -79.9027369916439);151=>(40.69104756051432, -79.90244999527931);152=>(40.69123873255367, -79.90216299891472);153=>(40.6914258365717, -79.90185990929604);154=>(40.69161294006436, -79.90155681967735);155=>(40.69180004303164, -79.90125373005867);156=>(40.69198714547351, -79.90095064043999);157=>(40.69217424738999, -79.9006475508213);158=>(40.692223056499195, -79.90040615200996);159=>(40.6922250902113, -79.90004405379295);160=>(40.69222915763533, -79.89968195557594);161=>(40.692241359905935, -79.89927962422371);162=>(40.692241359905935, -79.89912942051888);163=>(40.69238371956444, -79.89912137389183);164=>(40.692526078918796, -79.89911332726479);165=>(40.69267047166749, -79.89909186959267);166=>(40.692800628243255, -79.89904090762138);167=>(40.692930784564744, -79.8989899456501);168=>(40.69305077219838, -79.8989175260067);169=>(40.69317889434832, -79.89880755543709);170=>(40.693335487752535, -79.89869490265846);171=>(40.693492080788715, -79.89858224987984);172=>(40.69364867345684, -79.89847227931023);173=>(40.693805265756964, -79.89835157990456);174=>(40.69397812695959, -79.89822819828987);175=>(40.69415098771371, -79.89810481667519);176=>(40.694323848019366, -79.8979814350605);177=>(40.69449670787652, -79.89785805344582);178=>(40.69466956728521, -79.89773467183113);179=>(40.69485056077367, -79.89762470126152);180=>(40.69503155377043, -79.89751473069191);181=>(40.69521254627549, -79.8974047601223);182=>(40.6953935382889, -79.89730820059776);183=>(40.695574529810585, -79.89721164107323);184=>(40.695755520840585, -79.89711508154869);185=>(40.695952780167254, -79.89703461527824);186=>(40.69615003890984, -79.8969541490078);187=>(40.696347297068385, -79.89687368273735);188=>(40.696556756123144, -79.89680394530296);189=>(40.69676621451935, -79.89673420786858);190=>(40.69697567225701, -79.89665642380714);191=>(40.697054981325586, -79.89663228392601);192=>(40.69719733069906, -79.89665374159813);193=>(40.69733967976835, -79.89667519927025);194=>(40.6974820285335, -79.89669665694237);195=>(40.69764267891739, -79.89673689007759);196=>(40.69780332891386, -79.89677712321281);197=>(40.697963978522914, -79.89681735634804);198=>(40.698124627744576, -79.89685758948326);199=>(40.69830154479359, -79.8969005048275);200=>(40.69846219320118, -79.89694073796272);201=>(40.69870824887183, -79.89698097109795);202=>(40.69897870570925, -79.89701315760612);203=>(40.69924916144859, -79.8970453441143);204=>(40.69953588400325, -79.89709094166756);205=>(40.699816504882975, -79.89716872572899);206=>(40.70009712458056, -79.89722236990929);207=>(40.70030453837984, -79.89728942513466);208=>(40.70052415228687, -79.89744767546654);209=>(40.70076409998723, -79.8976381123066);210=>(40.701028448147945, -79.89778831601143);211=>(40.701307029305084, -79.89789828658104);212=>(40.701585609297126, -79.89800825715065);213=>(40.701799118721304, -79.89800825715065);214=>(40.70201872770076, -79.89794388413429);215=>(40.702238335956146, -79.89787951111794);216=>(40.70248234427958, -79.89781513810158);217=>(40.70274058544825, -79.89781782031059);218=>(40.702998825615694, -79.89782050251961);219=>(40.70325706478191, -79.89779368042946);220=>(40.70349903600538, -79.8977293074131);221=>(40.70369423904086, -79.89761129021645);222=>(40.703885374792065, -79.89749863743782);223=>(40.70407650999476, -79.8973859846592);224=>(40.70425341123616, -79.8972786962986);225=>(40.7043449116939, -79.89724919199944);226=>(40.7044465787217, -79.89751473069191);227=>(40.704548245594346, -79.89778026938438);228=>(40.704674312300874, -79.89809945225716);229=>(40.70480037876878, -79.89841863512993);230=>(40.704926444998044, -79.8987378180027);231=>(40.70507284419065, -79.89913210272789);232=>(40.705219243061464, -79.89952638745308);233=>(40.70538394140645, -79.89996626973152);234=>(40.70554253942777, -79.90045174956322);235=>(40.70569503716904, -79.90097478032112);236=>(40.7058353347826, -79.9015112221241);237=>(40.70597563210061, -79.90204766392708);238=>(40.706103729393725, -79.90259483456612);239=>(40.70619522730939, -79.90315541625023);240=>(40.706300958077584, -79.90369185805321);241=>(40.70637822276357, -79.90390911698341);242=>(40.70648801979475, -79.90407809615135);243=>(40.70664254864305, -79.90413174033165);244=>(40.7068418089971, -79.90418806672096);245=>(40.70705123505315, -79.90422293543816);246=>(40.70727489322074, -79.9042497575283);247=>(40.70749855063716, -79.90426316857338);248=>(40.70771204110666, -79.90424439311028);249=>(40.70793976351976, -79.90428194403648);250=>(40.70817765128041, -79.90433290600777);251=>(40.70841350497338, -79.9043919146061);252=>(40.70864935783104, -79.90445092320442);253=>(40.708875043835135, -79.90453138947487);254=>(40.709100729074365, -79.90459576249123);255=>(40.709326413548716, -79.90466013550758);256=>(40.709552097258225, -79.90472450852394);257=>(40.70973914984315, -79.90478619933128);258=>(40.709708652174925, -79.90511879324913);259=>(40.709625291810525, -79.90548089146614);260=>(40.709517533136086, -79.90587249398232);261=>(40.70943417253246, -79.90632310509682);262=>(40.70935081182446, -79.90680053830147);263=>(40.70928371654467, -79.90730479359627);264=>(40.70921662119728, -79.90780904889107);265=>(40.70916375814868, -79.9083562195301);266=>(40.709151558977666, -79.90889266133308);267=>(40.70913935980441, -79.90942910313606);268=>(40.709127160628924, -79.90996554493904);269=>(40.70911496145119, -79.91050466895103);270=>(40.709121061040335, -79.91106525063515);271=>(40.7090885298918, -79.91216495633125);272=>(40.709055998727365, -79.91264775395393);273=>(40.7090336335426, -79.91277649998665);274=>(40.708866911019435, -79.9128945171833);275=>(40.708647324620294, -79.91303399205208);276=>(40.708411471755454, -79.91314932703972);277=>(40.70817561805528, -79.91326466202736);278=>(40.707937730287384, -79.91339072585106);279=>(40.7076998416697, -79.91351678967476);280=>(40.707461952202216, -79.91364285349846);281=>(40.70722406188497, -79.91377159953117);282=>(40.706986170717904, -79.91390034556389);283=>(40.706746245432306, -79.91407200694084);284=>(40.70650021945371, -79.91424635052681);285=>(40.706254192566206, -79.91442069411278);286=>(40.7060223978076, -79.91464868187904);287=>(40.705800768731336, -79.91493567824364);288=>(40.70558117222191, -79.91524145007133);289=>(40.70536157498842, -79.91554990410805);290=>(40.70513994371307, -79.91590932011604);291=>(40.70490001177619, -79.91628214716911);292=>(40.70465397897724, -79.91664156317711);293=>(40.70441607862966, -79.9170009791851);294=>(40.70420257759421, -79.91738989949226);295=>(40.70403584297631, -79.91769030690193);296=>(40.70400940940098, -79.91791293025017);297=>(40.70396670898792, -79.91826429963112);298=>(40.70392400854748, -79.91861566901207);299=>(40.70388130807966, -79.91896703839302);300=>(40.70387927472337, -79.9192513525486);301=>(40.70390570835035, -79.91935059428215);302=>(40.704011442753306, -79.91937205195427);303=>(40.704186310820596, -79.91939350962639);304=>(40.70437337847733, -79.91940155625343);305=>(40.70456451227957, -79.91943910717964);306=>(40.7047353122345, -79.919503480196);307=>(40.70488171184724, -79.91960808634758);308=>(40.705054544309185, -79.91974487900734);309=>(40.70523144295283, -79.91986557841301);310=>(40.70541647436467, -79.91992458701134);311=>(40.70560150526246, -79.91995140910149);312=>(40.705815001813455, -79.91996213793755);313=>(40.70603663084235, -79.91998091340065);314=>(40.706258259133705, -79.91999164223671);315=>(40.70647988668753, -79.92000237107277);316=>(40.706713713123634, -79.92002114653587);317=>(40.70694753873879, -79.92003992199898);318=>(40.70718136353293, -79.92005869746208);319=>(40.70741518750611, -79.92007747292519);320=>(40.707649010658294, -79.92009624838829);321=>(40.70788283298949, -79.92010697722435);322=>(40.708116654499726, -79.92011770606041);323=>(40.708350475188944, -79.92012843489647);324=>(40.708584295057165, -79.92013916373253);325=>(40.70881811410443, -79.92014989256859);326=>(40.70900516875112, -79.92020353674889);327=>(40.70911089505814, -79.92030277848244);328=>(40.70917799051204, -79.9204583466053);329=>(40.70924101951325, -79.92068365216255);330=>(40.709320313978395, -79.92094919085503);331=>(40.709450438024284, -79.92124691605568);332=>(40.7095988604537, -79.92156073451042);333=>(40.70975338208352, -79.92192015051842);334=>(40.70988350528315, -79.9221159517765);335=>(40.710035993084155, -79.92221251130104);336=>(40.71023727644675, -79.9222768843174);337=>(40.71043855920092, -79.92234125733376);338=>(40.710639841346655, -79.92240563035011);339=>(40.71084112288396, -79.92247000336647);340=>(40.71107086773345, -79.92254510521889);341=>(40.711300611790236, -79.9226202070713);342=>(40.711422599462814, -79.92272481322289);343=>(40.71151409007058, -79.92289915680885);344=>(40.71155271940057, -79.92319419980049);345=>(40.711629977993276, -79.9237896502018);346=>(40.71170723649637, -79.9243851006031);347=>(40.7117885611396, -79.92493495345116);348=>(40.7118841174685, -79.92521122097969);349=>(40.712097593878035, -79.92551162838936);350=>(40.71228057311292, -79.92582812905312);351=>(40.71232936749063, -79.92610439658165);352=>(40.71239442660529, -79.92643162608147);353=>(40.71245948565639, -79.92675885558128);354=>(40.71256927266093, -79.92729529738426);355=>(40.71267702639678, -79.92781832814217);356=>(40.71281730930104, -79.92812678217888);357=>(40.71300231963587, -79.92817506194115);358=>(40.713197494816455, -79.92816433310509);359=>(40.713419099275846, -79.92816969752312);360=>(40.71365086828831, -79.92818042635918);361=>(40.71388263649399, -79.92819115519524);362=>(40.71404324732112, -79.9282206594944)'; p = p.split(';'); l = l.split(';'); n = p.length - 1; for (x in p) { t = p[x].split('=>'); k = t[0]; v = t[1]; lt = l[x].split('=>'); lk = lt[0]; lv = lt[1]; // window.userEvents[k] = v; if(x==0) { applyEvents(k,v,lv,x,'S'); } else if(n==x) { applyEvents(k,v,lv,x,'E'); } else { applyEvents(k,v,lv,x,''); } } window.eventOn = p.length - 1; } //////////////////////// // OPEN COURSES PAGE // /////////////////////// function coursePage(url) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Your browser does not support AJAX! \n\n Please download firefox it does, you are being redirected to their website."); window.location="http://www.getfirefox.com"; return; } document.getElementById('popupInner').innerHTML = 'Loading
Loading...
'; xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlHttp.send(null); } ///////////////////////// // IN ARRARY FUNCTION // //////////////////////// function in_array(needle, haystack, strict) { // http://kevin.vanzonneveld.net // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // * example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']); // * returns 1: true var found = false, key, strict = !!strict; for (key in haystack) { if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) { found = true; break; } } return found; } //////////////////// // Delete Course // /////////////////// function deleteCourse(q) { if(confirm('Are you sure you want to delete this course?')) { coursePage(q); } return false; } ///////////////// // OPEN POPUP // //////////////// function openPopup() { coverPage(); document.getElementById('popupInner').innerHTML = 'Loading
Loading...
'; document.getElementById('popup').style.display='block'; } ///////////////// // COVER PAGE // //////////////// function coverPage() { document.getElementById('cover').style.height=getPageSizeWithScroll('height')+'px'; document.getElementById('cover').style.display='block'; //alert(document.getElementById('cover').offsetRight+' '+document.getElementById('cover').style.width+' '+document.body.clientWidth); } //////////////////////////// // CLOSE COVER AND POPUP // /////////////////////////// function closeWindow() { document.getElementById('popup').style.display='none'; document.getElementById('cover').style.display='none'; return false; } /////////////////////////////// // GET BROWSER WIDTH HEIGHT // ////////////////////////////// function getPageSizeWithScroll(which) { if (window.innerHeight && window.scrollMaxY) {// Firefox yWithScroll = window.innerHeight + window.scrollMaxY; xWithScroll = window.innerWidth + window.scrollMaxX; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac yWithScroll = document.body.scrollHeight; xWithScroll = document.body.scrollWidth; } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari yWithScroll = document.body.offsetHeight; xWithScroll = document.body.offsetWidth; } arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll); //alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll + ' yscroll bar is: ' + document.body.scrollLeft); if(which=='width') { return xWithScroll; } if(which=='height') { return yWithScroll; } } ///////////////////////// // SET OBJECT TO FADE // //////////////////////// var TimeToFade = 1000.0; function fade(eid) { var element = document.getElementById(eid); if(element == null) return; if(element.FadeState == null) { if(element.style.opacity == null || element.style.opacity == '' || element.style.opacity == '1') { element.FadeState = 2; } else { element.FadeState = -2; } } if(element.FadeState == 1 || element.FadeState == -1) { element.FadeState = element.FadeState == 1 ? -1 : 1; element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft; } else { element.FadeState = element.FadeState == 2 ? -1 : 1; element.FadeTimeLeft = TimeToFade; setTimeout("animateFade(" + new Date().getTime() + ",'" + eid + "')", 33); } return false; } ////////////////////////// // ANIMATE FADE OBJECT // ///////////////////////// function animateFade(lastTick, eid) { var curTick = new Date().getTime(); var elapsedTicks = curTick - lastTick; var element = document.getElementById(eid); if(element.FadeTimeLeft <= elapsedTicks) { element.style.opacity = element.FadeState == 1 ? '1' : '0'; element.style.filter = 'alpha(opacity = ' + (element.FadeState == 1 ? '100' : '0') + ')'; element.FadeState = element.FadeState == 1 ? 2 : -2; if(element.style.filter==0 || element.style.opacity==0) { document.getElementById(eid).style.display='none'; } return; } element.FadeTimeLeft -= elapsedTicks; var newOpVal = element.FadeTimeLeft/TimeToFade; if(element.FadeState == 1) newOpVal = 1 - newOpVal; element.style.opacity = newOpVal; element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')'; setTimeout("animateFade(" + curTick + ",'" + eid + "')", 33); } ////////////////////////////// // CHANGE OPACITY FUNCTION // ///////////////////////////// function changeOpac(object,opacity) { var object = document.getElementById(object); object.style.opacity = (opacity / 100); object.style.MozOpacity = (opacity / 100); object.style.KhtmlOpacity = (opacity / 100); object.style.filter = "alpha(opacity=" + opacity + ")"; } //////////////////// // INITIATE AJAX // /////////////////// var xmlHttp; function ajaxINT(type,v) { window.ajaxType = type; xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Your browser does not support AJAX! \n\n Please download firefox it does, you are being redirected to their website."); window.location="http://www.getfirefox.com"; return; } var url,query; if(type=='save') { url ="/user/includes/gmap.save.php"; query = 'miles='+v+'&courseId=10'; } if(type=='doSave') { url ="/user/includes/gmap.save.php"; query = v; } if(type=='open') { url ="/user/includes/gmap.open.php"; query = v; } xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("POST",url,true); xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlHttp.send(query); } /////////////////////////////// // ON AJAX RESULTS RETURNED // ////////////////////////////// function stateChanged() { if (xmlHttp.readyState==4) { if(xmlHttp.status==200) { if(window.ajaxType=='doSave') { if(xmlHttp.responseText=='success') { document.getElementById('statusInner').innerHTML = '
Success - course has been saved!'; document.getElementById('popupStatus').FadeState = ''; document.getElementById('popupStatus').style.display='block'; fade('popupStatus'); setTimeout("fade('popupStatus')",5000); closeWindow(); } else if(xmlHttp.responseText=='no auth') { alert("Error - Your not logged in any more! \n\n Please login and try again."); document.getElementById('saveButton').style.display='block'; document.getElementById('processing').style.display='none'; } else { alert("Error - there was a problem saving!\n\nPlease try again.\n\n"+xmlHttp.responseText); document.getElementById('saveButton').style.display='block'; document.getElementById('processing').style.display='none'; } } else { document.getElementById('popupInner').innerHTML = xmlHttp.responseText; } } } } ///////////////////////////// // SET UP AJAX CONNECTION // //////////////////////////// function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } /////////////////// // MILE MARKERS // ////////////////// window.mileMarkers = 'off'; function markMiles() { if(window.mileMarkers=='off') { window.mileMarkers = 'on'; window['milesState'] = 'on'; document.getElementById('miles').src = '/images/map/miles_over.png'; milesOn(); } else { window.mileMarkers = 'off'; window['milesState'] = 'over'; document.getElementById('miles').src = '/images/map/miles.png'; milesOff(); } } /////////////////////////// // TURN ON MILE MARKERS // ////////////////////////// window.mileArr = new Array(); function milesOn() { var i,x,d,m,c,n,poly,point,icon,marker,dLeft; n = window.eventOn; m = 1; window.mLeft = 0; if(window.undoWas) { n = n-1; } for(x in window.polylineArr) { if(x<=n) { poly = window.polylineArr[x]; d = poly.Distance(); dLeft = d; c = 1; for (i=(1609.344-window.mLeft); id || m==window.mileArr.length) { window.mLeft += d; } else { window.mLeft = dLeft; } } } } //////////////////////////// // TURN OFF MILE MARKERS // /////////////////////////// function milesOff() { var x; for(x in window.mileArr) { map.removeOverlay(window.mileArr[x]); } } ///////////////////////// // REMOVE MILE MARKER // //////////////////////// window.markerUndone = ''; function removeMileMarker(o,d) { if(window.mileMarkers=='on') { o +=''; o = o.split('.'); o = o[0]; d +=''; d = d.split('.'); d = (d[0] *1)+1; window.markerUndone = d; while (o>=d) { map.removeOverlay(window.mileArr[d]); d++; } } } ////////////////////// // ADD MILE MARKER // ///////////////////// function addMileMarker(o,d) { if(window.mileMarkers=='on') { o +=''; o = o.split('.'); o = o[0]; d +=''; d = d.split('.'); d = (d[0] *1)+1; while (o>=d) { map.addOverlay(window.mileArr[d]); d++; } } } ////////////////////////// // PROCESS MILE MARKER // ///////////////////////// function processMiles() { var m = window.mileArr.length; if(window.markerUndone!='') { m = 0; window.markerUndone = ''; milesOff(); } if(window.mileMarkers=='on' & m!=0) { var i,x,d,c,n,poly,icon,marker,dLeft; n = window.eventOn; poly = window.polylineArr[n]; d = poly.Distance(); dLeft = d; for (i=(1609.344-window.mLeft); id || m==window.mileArr.length) { window.mLeft += d; } else { window.mLeft = dLeft; } } if(window.mileMarkers=='on' && m==0) { milesOn(); } } ////////////////// // ADD SLASHES // ////////////////// function addslashes(str) { str=str.replace(/\'/g,'\\\''); str=str.replace(/\"/g,'\\"'); str=str.replace(/\\/g,'\\\\'); str=str.replace(/\0/g,'\\0'); return str; } //////////////////////////// // REMOVE KEY FROM ARRAY // /////////////////////////// function removeKey(arrayName,key) { var x; var tmpArray = new Array(); for(x in arrayName) { if(x!=key) { tmpArray[x] = arrayName[x]; } } return tmpArray; } /*********************************************************************\ * * * epolys.js by Mike Williams * * * * A Google Maps API Extension * * * * Adds various Methods to GPolygon and GPolyline * * * * .Contains(latlng) returns true is the poly contains the specified * * GLatLng * * * * .Area() returns the approximate area of a poly that is * * not self-intersecting * * * * .Distance() returns the length of the poly path * * * * .Bounds() returns a GLatLngBounds that bounds the poly * * * * .GetPointAtDistance() returns a GLatLng at the specified distance * * along the path. * * The distance is specified in metres * * Reurns null if the path is shorter than that * * * * .GetIndexAtDistance() returns the vertex number at the specified * * distance along the path. * * The distance is specified in metres * * Reurns null if the path is shorter than that * * * * .Bearing(v1?,v2?) returns the bearing between two vertices * * if v1 is null, returns bearing from first to last * * if v2 is null, returns bearing from v1 to next * * * * * *********************************************************************** * * * This Javascript is provided by Mike Williams * * Blackpool Community Church Javascript Team * * http://www.commchurch.freeserve.co.uk/ * * http://econym.googlepages.com/index.htm * * * * This work is licenced under a Creative Commons Licence * * http://creativecommons.org/licenses/by/2.0/uk/ * * * *********************************************************************** * * * Version 1.1 6-Jun-2007 * * Version 1.2 1-Jul-2007 - fix: Bounds was omitting vertex zero * * add: Bearing * * * \*********************************************************************/ // === A method for testing if a point is inside a polygon // === Returns true if poly contains point // === Algorithm shamelessly stolen from http://alienryderflex.com/polygon/ GPolygon.prototype.Contains = function(point) { var j=0; var oddNodes = false; var x = point.lng(); var y = point.lat(); for (var i=0; i < this.getVertexCount(); i++) { j++; if (j == this.getVertexCount()) {j = 0;} if (((this.getVertex(i).lat() < y) && (this.getVertex(j).lat() >= y)) || ((this.getVertex(j).lat() < y) && (this.getVertex(i).lat() >= y))) { if ( this.getVertex(i).lng() + (y - this.getVertex(i).lat()) / (this.getVertex(j).lat()-this.getVertex(i).lat()) * (this.getVertex(j).lng() - this.getVertex(i).lng())= this.getVertexCount()) || (v2 < 0) || (v2 >= this.getVertexCount())) { return; } var from = this.getVertex(v1); var to = this.getVertex(v2); if (from.equals(to)) { return 0; } var lat1 = from.latRadians(); var lon1 = from.lngRadians(); var lat2 = to.latRadians(); var lon2 = to.lngRadians(); var angle = - Math.atan2( Math.sin( lon1 - lon2 ) * Math.cos( lat2 ), Math.cos( lat1 ) * Math.sin( lat2 ) - Math.sin( lat1 ) * Math.cos( lat2 ) * Math.cos( lon1 - lon2 ) ); if ( angle < 0.0 ) angle += Math.PI * 2.0; angle = angle * 180.0 / Math.PI; return parseFloat(angle.toFixed(1)); } // === Copy all the above functions to GPolyline === GPolyline.prototype.Contains = GPolygon.prototype.Contains; GPolyline.prototype.Area = GPolygon.prototype.Area; GPolyline.prototype.Distance = GPolygon.prototype.Distance; GPolyline.prototype.Bounds = GPolygon.prototype.Bounds; GPolyline.prototype.GetPointAtDistance = GPolygon.prototype.GetPointAtDistance; GPolyline.prototype.GetIndexAtDistance = GPolygon.prototype.GetIndexAtDistance; GPolyline.prototype.Bearing = GPolygon.prototype.Bearing;