function getInternetExplorerVersion(){var c=-1;if(navigator.appName=="Microsoft Internet Explorer"){var a=navigator.userAgent;var b=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(b.exec(a)!=null){c=parseFloat(RegExp.$1)}}return c}function checkVersion(){var b="You're not using Internet Explorer.";var a=getInternetExplorerVersion();if(a>-1){if(a>=8){b="You're using a recent copy of Internet Explorer."}else{b="You should upgrade your copy of Internet Explorer."}}alert(b)}(function(g){if(!g||!(g.toJSON||Object.toJSON||window.JSON)){throw new Error("jQuery, MooTools or Prototype needs to be loaded before jStorage!")}var h={},e={jStorage:"{}"},i=null,k=0,n=g.toJSON||Object.toJSON||(window.JSON&&(JSON.encode||JSON.stringify)),f=g.evalJSON||(window.JSON&&(JSON.decode||JSON.parse))||function(p){return String(p).evalJSON()},j=false,m,d={isXML:function(q){var p=(q?q.ownerDocument||q:0).documentElement;return p?p.nodeName!=="HTML":false},encode:function(q){if(!this.isXML(q)){return false}try{return new XMLSerializer().serializeToString(q)}catch(p){try{return q.xml}catch(r){}}return false},decode:function(q){var p=("DOMParser" in window&&(new DOMParser()).parseFromString)||(window.ActiveXObject&&function(s){var t=new ActiveXObject("Microsoft.XMLDOM");t.async="false";t.loadXML(s);return t}),r;if(!p){return false}r=p.call("DOMParser" in window&&(new DOMParser())||window,q,"text/xml");return this.isXML(r)?r:false}};function l(){var p=false;if("localStorage" in window){try{window.localStorage.setItem("_tmptest","tmpval");p=true;window.localStorage.removeItem("_tmptest")}catch(q){}}if(p){try{if(window.localStorage){e=window.localStorage;j="localStorage"}}catch(u){}}else{if("globalStorage" in window){try{if(window.globalStorage){e=window.globalStorage[window.location.hostname];j="globalStorage"}}catch(t){}}else{i=document.createElement("link");if(i.addBehavior){i.style.behavior="url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(i);i.load("jStorage");var s="{}";try{s=i.getAttribute("jStorage")}catch(r){}e.jStorage=s;j="userDataBehavior"}else{i=null;return}}}b();o()}function b(){if(e.jStorage){try{h=f(String(e.jStorage))}catch(p){e.jStorage="{}"}}else{e.jStorage="{}"}k=e.jStorage?String(e.jStorage).length:0}function c(){try{e.jStorage=n(h);if(i){i.setAttribute("jStorage",e.jStorage);i.save("jStorage")}k=e.jStorage?String(e.jStorage).length:0}catch(p){}}function a(p){if(!p||(typeof p!="string"&&typeof p!="number")){throw new TypeError("Key name must be string or numeric")}if(p=="__jstorage_meta"){throw new TypeError("Reserved key name")}return true}function o(){var t,p,r,q=Infinity,s=false;clearTimeout(m);if(!h.__jstorage_meta||typeof h.__jstorage_meta.TTL!="object"){return}t=+new Date();r=h.__jstorage_meta.TTL;for(p in r){if(r.hasOwnProperty(p)){if(r[p]<=t){delete r[p];delete h[p];s=true}else{if(r[p]<q){q=r[p]}}}}if(q!=Infinity){m=setTimeout(o,q-t)}if(s){c()}}g.jStorage={version:"0.1.6.1",set:function(p,q){a(p);if(d.isXML(q)){q={_is_xml:true,xml:d.encode(q)}}else{if(typeof q=="function"){q=null}else{if(q&&typeof q=="object"){q=f(n(q))}}}h[p]=q;c();return q},get:function(p,q){a(p);if(p in h){if(h[p]&&typeof h[p]=="object"&&h[p]._is_xml&&h[p]._is_xml){return d.decode(h[p].xml)}else{return h[p]}}return typeof(q)=="undefined"?null:q},deleteKey:function(p){a(p);if(p in h){delete h[p];if(h.__jstorage_meta&&typeof h.__jstorage_meta.TTL=="object"&&p in h.__jstorage_meta.TTL){delete h.__jstorage_meta.TTL[p]}c();return true}return false},setTTL:function(q,p){var r=+new Date();a(q);p=Number(p)||0;if(q in h){if(!h.__jstorage_meta){h.__jstorage_meta={}}if(!h.__jstorage_meta.TTL){h.__jstorage_meta.TTL={}}if(p>0){h.__jstorage_meta.TTL[q]=r+p}else{delete h.__jstorage_meta.TTL[q]}c();o();return true}return false},flush:function(){h={};c();return true},storageObj:function(){function p(){}p.prototype=h;return new p()},index:function(){var p=[],q;for(q in h){if(h.hasOwnProperty(q)&&q!="__jstorage_meta"){p.push(q)}}return p},storageSize:function(){return k},currentBackend:function(){return j},storageAvailable:function(){return !!j},reInit:function(){var p,r;if(i&&i.addBehavior){p=document.createElement("link");i.parentNode.replaceChild(p,i);i=p;i.style.behavior="url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(i);i.load("jStorage");r="{}";try{r=i.getAttribute("jStorage")}catch(q){}e.jStorage=r;j="userDataBehavior"}b()}};l()})(window.jQuery||window.$);stringToBoolean=function(a){switch(a.toLowerCase()){case"true":case"yes":case"1":return true;case"false":case"no":case"0":case null:return false;default:return Boolean(a)}};jQuery.cookie=function(d,e,b){if(arguments.length>1&&String(e)!=="[object Object]"){b=jQuery.extend({},b);if(e===null||e===undefined){b.expires=-1}if(typeof b.expires==="number"){var g=b.expires,c=b.expires=new Date();c.setDate(c.getDate()+g)}e=String(e);return(document.cookie=[encodeURIComponent(d),"=",b.raw?e:encodeURIComponent(e),b.expires?"; expires="+b.expires.toUTCString():"",b.path?"; path="+b.path:"",b.domain?"; domain="+b.domain:"",b.secure?"; secure":""].join(""))}b=e||{};var a,f=b.raw?function(h){return h}:decodeURIComponent;return(a=new RegExp("(?:^|; )"+encodeURIComponent(d)+"=([^;]*)").exec(document.cookie))?f(a[1]):null};function addStringMethods(){function c(){return this.replace(/[^a-zA-Z 0-9]+/g,"")}function a(){return this.replace(/^\s+/,"")}function b(){var d=this.otClean();d=d.otLtrim();return d}String.prototype.otClean=c;String.prototype.otLtrim=a;String.prototype.otCleanAll=b}function addDateProto(){Date.prototype.format=function(e){var d="";var c=Date.replaceChars;for(var b=0;b<e.length;b++){var a=e.charAt(b);if(b-1>=0&&e.charAt(b-1)=="\\"){d+=a}else{if(c[a]){d+=c[a].call(this)}else{if(a!="\\"){d+=a}}}}return d};Date.replaceChars={shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longMonths:["January","February","March","April","May","June","July","August","September","October","November","December"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],d:function(){return(this.getDate()<10?"0":"")+this.getDate()},D:function(){return Date.replaceChars.shortDays[this.getDay()]},j:function(){return this.getDate()},l:function(){return Date.replaceChars.longDays[this.getDay()]},N:function(){return this.getDay()+1},S:function(){return(this.getDate()%10==1&&this.getDate()!=11?"st":(this.getDate()%10==2&&this.getDate()!=12?"nd":(this.getDate()%10==3&&this.getDate()!=13?"rd":"th")))},w:function(){return this.getDay()},z:function(){var a=new Date(this.getFullYear(),0,1);return Math.ceil((this-a)/86400000)},W:function(){var a=new Date(this.getFullYear(),0,1);return Math.ceil((((this-a)/86400000)+a.getDay()+1)/7)},F:function(){return Date.replaceChars.longMonths[this.getMonth()]},m:function(){return(this.getMonth()<9?"0":"")+(this.getMonth()+1)},M:function(){return Date.replaceChars.shortMonths[this.getMonth()]},n:function(){return this.getMonth()+1},t:function(){var a=new Date();return new Date(a.getFullYear(),a.getMonth(),0).getDate()},L:function(){var a=this.getFullYear();return(a%400==0||(a%100!=0&&a%4==0))},o:function(){var a=new Date(this.valueOf());a.setDate(a.getDate()-((this.getDay()+6)%7)+3);return a.getFullYear()},Y:function(){return this.getFullYear()},y:function(){return(""+this.getFullYear()).substr(2)},a:function(){return this.getHours()<12?"am":"pm"},A:function(){return this.getHours()<12?"AM":"PM"},B:function(){return Math.floor((((this.getUTCHours()+1)%24)+this.getUTCMinutes()/60+this.getUTCSeconds()/3600)*1000/24)},g:function(){return this.getHours()%12||12},G:function(){return this.getHours()},h:function(){return((this.getHours()%12||12)<10?"0":"")+(this.getHours()%12||12)},H:function(){return(this.getHours()<10?"0":"")+this.getHours()},i:function(){return(this.getMinutes()<10?"0":"")+this.getMinutes()},s:function(){return(this.getSeconds()<10?"0":"")+this.getSeconds()},u:function(){var a=this.getMilliseconds();return(a<10?"00":(a<100?"0":""))+a},e:function(){return"Not Yet Supported"},I:function(){return"Not Yet Supported"},O:function(){return(-this.getTimezoneOffset()<0?"-":"+")+(Math.abs(this.getTimezoneOffset()/60)<10?"0":"")+(Math.abs(this.getTimezoneOffset()/60))+"00"},P:function(){return(-this.getTimezoneOffset()<0?"-":"+")+(Math.abs(this.getTimezoneOffset()/60)<10?"0":"")+(Math.abs(this.getTimezoneOffset()/60))+":00"},T:function(){var b=this.getMonth();this.setMonth(0);var a=this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/,"$1");this.setMonth(b);return a},Z:function(){return -this.getTimezoneOffset()*60},c:function(){return this.format("Y-m-d\\TH:i:sP")},r:function(){return this.toString()},U:function(){return this.getTime()/1000}}}function addruler(){var a=map.getCenter();rulerData.rulerStart=new google.maps.Marker({position:a,map:map,draggable:true,icon:new google.maps.MarkerImage("http://chart.googleapis.com/chart?chst=d_bubble_text_small&chld=bb|Start|FFFF88|000000",null,null,new google.maps.Point(0,42)),});rulerData.rulerEnd=new google.maps.Marker({position:a,map:map,draggable:true,icon:new google.maps.MarkerImage("http://chart.googleapis.com/chart?chst=d_bubble_text_small&chld=bb|End|FFFF88|000000",null,null,new google.maps.Point(0,42)),});rulerData.rulerpoly=new google.maps.Polyline({path:[rulerData.rulerStart.position,rulerData.rulerEnd.position],strokeColor:"#00008B",strokeOpacity:0.7,strokeWeight:5});rulerData.rulerpoly.setMap(map);google.maps.event.addListener(rulerData.rulerStart,"drag",function(){var c,b,d=new Array();rulerData.rulerpoly.setPath([rulerData.rulerStart.getPosition(),rulerData.rulerEnd.getPosition()]);c=distance(rulerData.rulerStart.getPosition().lat(),rulerData.rulerStart.getPosition().lng(),rulerData.rulerEnd.getPosition().lat(),rulerData.rulerEnd.getPosition().lng());d=calcFrameStyle(rulerData.rulerStart,rulerData.rulerEnd);b=new google.maps.MarkerImage("http://chart.googleapis.com/chart?chst=d_bubble_text_small&chld="+d.frame1_name+"|"+c+"|FFFF88|000000",null,null,new google.maps.Point(d.frame1_offsetX,d.frame1_offsetY));rulerData.rulerStart.setIcon(b);b=new google.maps.MarkerImage("http://chart.googleapis.com/chart?chst=d_bubble_text_small&chld="+d.frame2_name+"|"+c+"|FFFF88|000000",null,null,new google.maps.Point(d.frame2_offsetX,d.frame2_offsetY));rulerData.rulerEnd.setIcon(b)});google.maps.event.addListener(rulerData.rulerEnd,"drag",function(){var c,b,d;rulerData.rulerpoly.setPath([rulerData.rulerStart.getPosition(),rulerData.rulerEnd.getPosition()]);c=distance(rulerData.rulerStart.getPosition().lat(),rulerData.rulerStart.getPosition().lng(),rulerData.rulerEnd.getPosition().lat(),rulerData.rulerEnd.getPosition().lng());d=calcFrameStyle(rulerData.rulerStart,rulerData.rulerEnd);b=new google.maps.MarkerImage("http://chart.googleapis.com/chart?chst=d_bubble_text_small&chld="+d.frame1_name+"|"+c+"|FFFF88|000000",null,null,new google.maps.Point(d.frame1_offsetX,d.frame1_offsetY));rulerData.rulerStart.setIcon(b);b=new google.maps.MarkerImage("http://chart.googleapis.com/chart?chst=d_bubble_text_small&chld="+d.frame2_name+"|"+c+"|FFFF88|000000",null,null,new google.maps.Point(d.frame2_offsetX,d.frame2_offsetY));rulerData.rulerEnd.setIcon(b)});google.maps.event.addListener(rulerData.rulerStart,"rightclick",function(){deleteruler()});google.maps.event.addListener(rulerData.rulerEnd,"rightclick",function(){deleteruler()});google.maps.event.addListener(rulerData.rulerpoly,"rightclick",function(){deleteruler()})}function calcFrameStyle(g,e){var f=g.getPosition().lat(),c=g.getPosition().lng(),d=e.getPosition().lat(),b=e.getPosition().lng(),a=new Array();if(f<=d){if(c<=b){a.frame1_name="bbtr";a.frame1_offsetX=67;a.frame1_offsetY=0;a.frame2_name="bb";a.frame2_offsetX=0;a.frame2_offsetY=45}else{a.frame1_name="bbtl";a.frame1_offsetX=0;a.frame1_offsetY=0;a.frame2_name="bbbr";a.frame2_offsetX=64;a.frame2_offsetY=39}}else{if(c<=b){a.frame1_name="bbbr";a.frame1_offsetX=67;a.frame1_offsetY=39;a.frame2_name="bbtl";a.frame2_offsetX=2;a.frame2_offsetY=3}else{a.frame1_name="bb";a.frame1_offsetX=2;a.frame1_offsetY=41;a.frame2_name="bbtr";a.frame2_offsetX=64;a.frame2_offsetY=3}}return a}function deleteruler(){rulerData.rulerStart.setMap(null);rulerData.rulerEnd.setMap(null);rulerData.rulerpoly.setMap(null);rulerData.visible=false}function distance(f,i,e,h){var g,k,b,m,l,j;g=6371;k=(e-f)*Math.PI/180;b=(h-i)*Math.PI/180;m=Math.sin(k/2)*Math.sin(k/2)+Math.cos(f*Math.PI/180)*Math.cos(e*Math.PI/180)*Math.sin(b/2)*Math.sin(b/2);l=2*Math.atan2(Math.sqrt(m),Math.sqrt(1-m));j=g*l;if(j>1){return j.toFixed(1)+"km"}else{if(j<=1){return Math.round(j*1000)+"m"}}return j}function Label(b){var a,c;this.setValues(b);a=this.span_=document.createElement("span");a.style.cssText='position: relative; left: 0%; top: -8px; white-space: nowrap; border: 1px solid blue; font-family: verdana; font-weight: normal;font-size: 0.7em;padding-left: 1px;padding-right:1px;padding-bottom:1px;background-color: #ddd; opacity: 1.0; filter: alpha(opacity=100); -ms-filter: "alpha(opacity=100)"; -khtml-opacity: 1.0; -moz-opacity: 1.0; -moz-border-radius: 4px; border-radius: 4px;';c=this.div_=document.createElement("div");c.appendChild(a);c.style.cssText="position: absolute; display: none"}Label.prototype=new google.maps.OverlayView;Label.prototype.onAdd=function(){var b=this.getPanes().overlayLayer,a;b.appendChild(this.div_);a=this;this.listeners_=[google.maps.event.addListener(this,"position_changed",function(){a.draw()}),google.maps.event.addListener(this,"text_changed",function(){a.draw()})]};Label.prototype.onRemove=function(){this.div_.parentNode.removeChild(this.div_);var a;for(a=0,I=this.listeners_.length;a<I;++a){google.maps.event.removeListener(this.listeners_[a])}};Label.prototype.hide=function(){if(this.div_){this.div_.style.visibility="hidden"}};Label.prototype.show=function(){if(this.div_){this.div_.style.visibility="visible"}};Label.prototype.draw=function(){var b,a,d;b=this.getProjection();a=b.fromLatLngToDivPixel(this.get("position"));d=this.div_;d.style.left=a.x+"px";d.style.top=a.y+"px";d.style.display="block";var c=this.get("zIndex");d.style.zIndex=c;this.span_.innerHTML=this.get("text").toString()};function getCount(f,k){var h,c,j,i,a,d,b;h=new Date();c=f.getTime()-h.getTime();delete h;if(c>=0){j=0;i=0;a=0;d=0;b="Refresh in&nbsp;";c=Math.floor(c/1000);j=Math.floor(c/86400);c=c%86400;i=Math.floor(c/3600);c=c%3600;a=Math.floor(c/60);c=c%60;d=Math.floor(c);if(j>0&&i>0){b+=j+" "+((j==1)?"day":"days")+"&nbsp;";b+=i+" "+((i==1)?"hour":"hours")}else{if(j>0&&i==0){i=i+24;b+=i+" "+((i==1)?"hour":"hours")+"&nbsp;";b+=a+" "+((a==1)?"min":"mins")}else{if(j==0&&i>0){b+=i+" "+((i==1)?"hour":"hours")+"&nbsp;";b+=a+" "+((a==1)?"min":"mins")}else{if(i==0&&a>0){b+=a+" "+((a==1)?"min":"mins")+"&nbsp;";b+=d+" "+((d==1)?"sec":"secs")}else{b+=d+" "+((d==1)?"sec":"secs")}}}}try{document.getElementById(k).innerHTML=b;if($("#countbox1").css("display")!=="none"){setTimeout(function(){getCount(f,k)},1000)}else{dbg("Not setting timer for refresh")}}catch(g){dbg("function getCount(): Refresh timer update not set at end of function (probably unpatched IE7)")}}};
