Date.prototype.formatDate=function(n,u){var v=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var m=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];var p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var q=["January","February","March","April","May","June","July","August","September","October","November","December"];var o={a:function(){return w.getHours()>11?"pm":"am";},A:function(){return(this.a().toUpperCase());},B:function(){var c=(w.getTimezoneOffset()+60)*60;var b=(w.getHours()*3600)+(w.getMinutes()*60)+w.getSeconds()+c;var a=Math.floor(b/86.4);if(a>1000){a-=1000;}if(a<0){a+=1000;}if((String(a)).length==1){a="00"+a;}if((String(a)).length==2){a="0"+a;}return a;},c:function(){return(this.Y()+"-"+this.m()+"-"+this.d()+"T"+this.H()+":"+this.i()+":"+this.s()+this.P());},d:function(){var a=String(this.j());return(a.length==1?"0"+a:a);},D:function(){return m[w.getDay()];},F:function(){return q[w.getMonth()];},g:function(){if(w.getHours()==0){return 12;}else{return w.getHours()>12?w.getHours()-12:w.getHours();}},G:function(){return w.getHours();},h:function(){var a=String(this.g());return(a.length==1?"0"+a:a);},H:function(){var a=String(this.G());return(a.length==1?"0"+a:a);},i:function(){var a=String(w.getMinutes());return(a.length==1?"0"+a:a);},I:function(){var a=new Date("January 1 "+this.Y()+" 00:00:00");return(a.getTimezoneOffset()==w.getTimezoneOffset()?0:1);},j:function(){return w.getDate();},l:function(){return v[w.getDay()];},L:function(){var a=this.Y();if((a%4==0&&a%100!=0)||(a%4==0&&a%100==0&&a%400==0)){return 1;}else{return 0;}},m:function(){var a=String(this.n());return(a.length==1?"0"+a:a);},M:function(){return p[w.getMonth()];},n:function(){return w.getMonth()+1;},N:function(){var a=this.w();return(a==0?7:a);},O:function(){var b=Math.abs(w.getTimezoneOffset());var c=String(Math.floor(b/60));var a=String(b%60);c.length==1?c="0"+c:1;a.length==1?a="0"+a:1;return w.getTimezoneOffset()<0?"+"+c+a:"-"+c+a;},P:function(){var a=this.O();return(a.substr(0,3)+":"+a.substr(3,2));},r:function(){var a;a=this.D()+", "+this.d()+" "+this.M()+" "+this.Y()+" "+this.H()+":"+this.i()+":"+this.s()+" "+this.O();return a;},s:function(){var a=String(w.getSeconds());return(a.length==1?"0"+a:a);},S:function(){switch(w.getDate()){case 1:return("st");case 2:return("nd");case 3:return("rd");case 21:return("st");case 22:return("nd");case 23:return("rd");case 31:return("st");default:return("th");}},t:function(){var a=[null,31,28,31,30,31,30,31,31,30,31,30,31];if(this.L()==1&&this.n()==2){return 29;}return a[this.n()];},U:function(){return Math.round(w.getTime()/1000);},w:function(){return w.getDay();},W:function(){var c=this.N();var a=this.z();var b=364+this.L()-a;if(b<=2&&c<=(3-b)){return 1;}if(a<=2&&c>=5){return new Date(this.Y()-1,11,31).formatDate("W");}var d=new Date(this.Y(),0,1).getDay();d=d!=0?d-1:6;if(d<=3){return(1+Math.floor((a+d)/7));}else{return(1+Math.floor((a-(7-d))/7));}},y:function(){var a=String(this.Y());return a.substring(a.length-2,a.length);},Y:function(){if(w.getFullYear){var a=new Date("January 1 2001 00:00:00 +0000");var b=a.getFullYear();if(b==2001){return w.getFullYear();}}var b=w.getYear();var c=b%100;c+=(c<38)?2000:1900;return c;},z:function(){var a="January 1 "+this.Y()+" 00:00:00 GMT"+this.O();var b=new Date(a);var c=w.getTime()-b.getTime();return Math.floor(c/1000/60/60/24);},Z:function(){return(w.getTimezoneOffset()*-60);}};function s(a){if(o[a]!=undefined){return o[a]();}else{return a;}}var w;if(u){var w=new Date(u);}else{var w=this;}var t=n.split("");var r=0;while(r<t.length){if(t[r]=="%"){t.splice(r,1);}else{t[r]=s(t[r]);}r++;}return t.join("");};Date.DATE_ATOM="Y-m-d%TH:i:sP";Date.DATE_ISO8601="Y-m-d%TH:i:sO";Date.DATE_RFC2822="D, d M Y H:i:s O";Date.DATE_W3C="Y-m-d%TH:i:sP";var map;var gmarkers=[];var points=[];var htmls=[];var i=0;var to_htmls=[];var from_htmls=[];function createMap(d){map=new GMap2(document.getElementById(d));var c=map.getDefaultUI();map.setUI(c);return map;}function createMarker(f,h,g){var e;if(g){e=new GMarker(f,{icon:g});}else{e=new GMarker(f);}GEvent.addListener(e,"click",function(){e.openInfoWindowHtml(h);});gmarkers[gmarkers.length]=e;htmls[h.length]=h;return e;}function openInfoWindow(b){gmarkers[b].openInfoWindowHtml(htmls[b]);}function getLatLngBounds(){var o;var m;var a;var b;for(var n=0;n<gmarkers.length;n++){var l=gmarkers[n].getLatLng();if(o==undefined){o=l.lng();}if(m==undefined){m=l.lng();}if(a==undefined){a=l.lat();}if(b==undefined){b=l.lat();}o=Math.min(o,l.lng());m=Math.max(m,l.lng());a=Math.min(a,l.lat());b=Math.max(b,l.lat());}var p=new GLatLng(a,o,false);var q=new GLatLng(b,m,false);return new GLatLngBounds(p,q);}function getZoomLevel(){return map.getBoundsZoomLevel(getLatLngBounds());}function tohere(b){gmarkers[b].openInfoWindowHtml(to_htmls[b]);}function fromhere(b){gmarkers[b].openInfoWindowHtml(from_htmls[b]);}function PopupMarker(g,e){this.latlng_=g;e=e||{};this.text_=e.text||"";if(e.text){e.text=undefined;}this.opts_=e;this.popupStyle_=e.style||"normal";this.chart_=e.chart||{};var h=navigator.userAgent.toLowerCase();this._is_ie=((h.indexOf("msie")!==-1)&&(h.indexOf("opera")===-1));this._is_ie67=(h.indexOf("msie 6")!==-1||h.indexOf("msie 7"));this._is_ie8=(this._is_ie===true&&this._is_ie67===false);this._is_gecko=(h.indexOf("gecko")!==-1);this._is_opera=(h.indexOf("opera")!==-1);this.color_=e.textColor||"000000";this.bgcolor_=e.bgColor||"CCCCFF";var f=0;this.popupImgSrc_="http://chart.apis.google.com/chart?chst=d_bubble_icon_text_small&chld=petrol|bb|%20|"+this.bgcolor_;this.popupTbl={};this.popupTbl.leftTop={"left":0,"top":f,"width":21,"height":7};this.popupTbl.leftTopFill={"left":18,"top":6,"width":3,"height":1};this.popupTbl.rightTop={"left":46,"top":f,"width":6,"height":7};this.popupTbl.rightTopImg={"left":-46,"top":0,"width":6,"height":7};this.popupTbl.centerTopFill={"left":21,"top":f,"width":0,"height":7};f+=this.popupTbl.leftTop.height;this.popupTbl.leftBody={"left":12,"top":f,"width":(8+(this._is_ie67?1:0)),"height":0};this.popupTbl.centerBodyFill={"left":21,"top":f,"width":40,"height":15};this.popupTbl.rightBody={"left":19,"top":f,"width":4,"height":0};this.popupTbl.leftBottom={"left":0,"top":f,"width":21,"height":20};this.popupTbl.leftBottomImg={"left":0,"top":-23,"width":21,"height":20};this.popupTbl.leftBottomFill={"left":13,"top":0,"width":1,"height":6};this.popupTbl.rightBottom={"left":19,"top":f,"width":6,"height":(6+(!this._is_ie67?-1:0))};this.popupTbl.rightBottomImg={"left":-46,"top":-23,"width":6,"height":6};this.popupTbl.centerBottomFill={"left":21,"top":f,"width":0,"height":5};GMarker.apply(this,arguments);}PopupMarker.prototype=new GMarker(new GLatLng(0,0));PopupMarker.prototype.initialize=function(d){GMarker.prototype.initialize.apply(this,arguments);this.map_=d;this.container_=document.createElement("div");d.getPane(G_MAP_MARKER_PANE).appendChild(this.container_);this.container_.style.zIndex=this.getZIndex(this.latlng_.lat());this.container_.style.position="absolute";if(this.popupStyle_==="chart"){this.makeChartPopup_();}else{this.makeNormalPopup_();}var c=this;GEvent.bindDom(this.container_,"mousedown",this,function(a){return GEvent.trigger(c,"mousedown");});GEvent.bindDom(this.container_,"mouseup",this,function(a){return GEvent.trigger(c,"mouseup");});GEvent.bindDom(this.container_,"mouseover",this,function(a){return GEvent.trigger(c,"mouseover");});GEvent.bindDom(this.container_,"mouseout",this,function(a){return GEvent.trigger(c,"mouseout",a);});GEvent.bind(this,"dragstart",this,function(a){c.hidePopup();});GEvent.bind(this,"dragend",this,function(a){c.showPopup();});};PopupMarker.prototype.makeNormalPopup_=function(){this.leftTop_=this.makeImgDiv_(this.popupImgSrc_,this.popupTbl.leftTop);this.leftTop_.appendChild(this.fillDiv_(this.popupTbl.leftTopFill));this.container_.appendChild(this.leftTop_);this.leftBody_=this.fillDiv_(this.popupTbl.leftBody);this.leftBody_.style.borderWidth="0 0 0 1px";this.leftBody_.style.borderStyle="none none none solid";
this.leftBody_.style.borderColor="#000000";this.container_.appendChild(this.leftBody_);this.leftBottom_=this.makeImgDiv_(this.popupImgSrc_,this.popupTbl.leftBottomImg);this.leftBottom_.style.left=this.popupTbl.leftBottom.left+"px";this.leftBottom_.style.top=this.popupTbl.leftBottom.top+"px";this.leftBottom_.style.width=this.popupTbl.leftBottom.width+"px";this.leftBottom_.style.height=this.popupTbl.leftBottom.height+"px";this.leftBottom_.appendChild(this.fillDiv_(this.popupTbl.leftBottomFill));this.container_.appendChild(this.leftBottom_);this.bodyContainer_=document.createElement("div");this.bodyContainer_.style.position="absolute";this.bodyContainer_.style.backgroundColor="#"+this.bgcolor_;this.bodyContainer_.style.overflow="hidden";this.bodyContainer_.style.left=this.popupTbl.centerBodyFill.left+"px";this.bodyContainer_.style.top=this.popupTbl.centerBodyFill.top+"px";this.bodyContainer_.style.width=this.popupTbl.centerBodyFill.width+"px";this.bodyContainer_.style.height=this.popupTbl.centerBodyFill.height+"px";this.container_.appendChild(this.bodyContainer_);this.rightTop_=this.makeImgDiv_(this.popupImgSrc_,this.popupTbl.rightTopImg);this.rightTop_.style.left=this.popupTbl.rightTop.left+"px";this.rightTop_.style.top=this.popupTbl.rightTop.top+"px";this.rightTop_.style.width=this.popupTbl.rightTop.width+"px";this.rightTop_.style.height=this.popupTbl.rightTop.height+"px";this.container_.appendChild(this.rightTop_);this.rightBottom_=this.makeImgDiv_(this.popupImgSrc_,this.popupTbl.rightBottomImg);this.rightBottom_.style.left=this.popupTbl.rightBottom.left+"px";this.rightBottom_.style.top=this.popupTbl.rightBottom.top+"px";this.rightBottom_.style.width=this.popupTbl.rightBottom.width+"px";this.rightBottom_.style.height=this.popupTbl.rightBottom.height+"px";this.container_.appendChild(this.rightBottom_);this.rightBody_=this.fillDiv_(this.popupTbl.rightBody);this.rightBody_.style.borderWidth="0 1px 0 0";this.rightBody_.style.borderStyle="none solid none none";this.rightBody_.style.borderColor="#000000";this.container_.appendChild(this.rightBody_);this.centerBottom_=this.fillDiv_(this.popupTbl.centerBottomFill);this.centerBottom_.style.borderWidth="0 0 1px 0";this.centerBottom_.style.borderStyle="none none solid none";this.centerBottom_.style.borderColor="#000000";this.container_.appendChild(this.centerBottom_);this.centerTop_=this.fillDiv_(this.popupTbl.centerTopFill);this.centerTop_.style.borderColor="#000000";this.centerTop_.style.borderWidth="1px 0 0 0";this.centerTop_.style.borderStyle="solid none none none";this.container_.appendChild(this.centerTop_);};PopupMarker.prototype.makeChartPopup_=function(){this.chartImg_=this.makeImgDiv_("http://www.google.com/mapfiles/transparent.png",{"left":0,"top":0,"width":0,"height":0});this.chartImg_.firstChild.style.MozUserSelect="none";this.chartImg_.firstChild.style.KhtmlUserSelect="none";this.chartImg_.firstChild.style.WebkitUserSelect="none";this.chartImg_.firstChild.style.userSelect="none";this.container_.appendChild(this.chartImg_);};PopupMarker.prototype.redraw=function(b){GMarker.prototype.redraw.apply(this,arguments);if(b){if(this.popupStyle_==="chart"){this.redrawChartImg_(this.text_);}else{this.redrawNormalPopup_(this.text_,b);}this.latlng_=this.getLatLng();this.container_.style.zIndex=this.getZIndex(this.latlng_.lat());}};PopupMarker.prototype.copy=function(){this.opts_.text=this.text_;return new PopupMarker(this.latlng_,this.opts_);};PopupMarker.prototype.hide=function(){GMarker.prototype.hide.apply(this,arguments);this.container_.style.visibility="hidden";};PopupMarker.prototype.show=function(){GMarker.prototype.show.apply(this,arguments);};PopupMarker.prototype.showPopup=function(){this.show();if(this.popupStyle_==="chart"){this.redrawChartImg_(this.text_);}else{this.redrawNormalPopup_(this.text_);}var b=this.map_.getInfoWindow();if(!b.isHidden()||this.isNull(this.text_)){return;}this.container_.style.visibility="visible";};PopupMarker.prototype.hidePopup=function(){this.container_.style.visibility="hidden";};PopupMarker.prototype.remove=function(){GEvent.clearInstanceListeners(this.container_);while(this.container_.firstChild){this.container_.removeChild(this.container_.firstChild);}this.container_.parentNode.removeChild(this.container_);GMarker.prototype.remove.apply(this,arguments);delete arguments.callee;};PopupMarker.prototype.setText=function(b){this.text_=b;};PopupMarker.prototype.redrawNormalPopup_=function(l,n){if(this.beforeNormalPopupText_!==l){while(this.bodyContainer_.firstChild){this.bodyContainer_.removeChild(this.bodyContainer_.firstChild);}var h=this.getTextCanvas_(l);while(this.bodyContainer_.firstChild){this.bodyContainer_.removeChild(this.bodyContainer_.firstChild);}this.bodyContainer_.appendChild(h.ele);var o=0;var m=this.popupTbl.centerTopFill.left;var j=(this.popupTbl.centerTopFill.left+h.size.width);this.centerTop_.style.width=h.size.width+"px";this.rightTop_.style.left=j+"px";o=this.popupTbl.leftTop.height;this.leftBody_.style.top=o+"px";this.leftBody_.style.height=h.size.height+"px";this.bodyContainer_.style.left=m+"px";this.bodyContainer_.style.top=o+"px";this.bodyContainer_.style.width=(h.size.width+(this._is_ie?1:0))+"px";this.bodyContainer_.style.height=(h.size.height+(this._is_ie?1:0))+"px";this.rightBody_.style.left=(j+(this._is_ie?1:0))+"px";this.rightBody_.style.top=o+"px";this.rightBody_.style.height=(h.size.height+(!this._is_ie?1:0))+"px";o+=h.size.height;this.leftBottom_.style.top=o+"px";this.centerBottom_.style.top=o+"px";this.centerBottom_.style.left=m+"px";this.centerBottom_.style.width=h.size.width+"px";this.rightBottom_.style.top=(o+(!this._is_ie?1:0))+"px";this.rightBottom_.style.left=j+"px";this.size_=new GSize(j+this.popupTbl.rightTop.width,o+this.popupTbl.leftBottom.height);this.container_.style.width=this.size_.width+"px";this.container_.style.height=this.size_.height+"px";this.normalPopupCache_=this.container_.innerHTML;this.beforeNormalPopupText_=l;}else{if(n===true){this.container_.innerHTML=this.normalPopupCache_;}}var k=this.map_.fromLatLngToDivPixel(this.latlng_);this.container_.style.left=k.x+"px";this.container_.style.top=(k.y-this.size_.height)+"px";};PopupMarker.prototype.setChartStyle=function(b){this.chart_.chartStyle=b;};PopupMarker.prototype.setChartIcon=function(b){this.chart_.icon=b;};PopupMarker.prototype.setChartTextColor=function(b){this.chart_.textColor=b;};PopupMarker.prototype.setChartBgColor=function(b){this.chart_.bgColor=b;};PopupMarker.prototype.redrawChartImg_=function(p){p=p.toString();this.chart_.shapeStyle="bb";this.chart_.textColor=this.chart_.textColor||"000000";this.chart_.bgColor=this.chart_.bgColor||"FFFFFF";this.chart_.textColor=this.chart_.textColor.replace("#","");this.chart_.bgColor=this.chart_.bgColor.replace("#","");var q="chst="+this.chart_.chartStyle;switch(this.chart_.chartStyle){case"d_bubble_icon_text_small":case"d_bubble_icon_text_big":q=q+"&chld="+this.chart_.icon+"|"+this.chart_.shapeStyle+"|"+p+"|"+this.chart_.bgColor+"|"+this.chart_.textColor;break;case"d_bubble_icon_texts_big":p=p.replace(/[\r]/,"");p=p.replace(/[\n]/,"|");q=q+"&chld="+this.chart_.icon+"|"+this.chart_.shapeStyle+"|"+this.chart_.bgColor+"|"+this.chart_.textColor+"|"+p;break;case"d_bubble_texts_big":p=p.replace(/[\r]/,"");p=p.replace(/[\n]/,"|");q=q+"&chld="+this.chart_.shapeStyle+"|"+this.chart_.bgColor+"|"+this.chart_.textColor+"|"+p;break;}var l=this.map_.fromLatLngToDivPixel(this.latlng_);var j=new Image();j.src="http://chart.apis.google.com/chart?"+q;var m=this;var n=this._is_ie;var k=100;var o=function(){k--;if(k===0){return;}if(j.complete===true){m.size_={"width":j.width,"height":j.height};if(n===true){m.chartImg_.firstChild.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://chart.apis.google.com/chart?"+q+"')";}else{m.chartImg_.removeChild(m.chartImg_.firstChild);m.chartImg_.appendChild(j);}m.chartImg_.firstChild.style.width=m.size_.width+"px";m.chartImg_.firstChild.style.height=m.size_.height+"px";m.container_.style.left=l.x+"px";
m.container_.style.top=(l.y-m.size_.height)+"px";m.container_.style.width=m.size_.width+"px";m.container_.style.height=m.size_.height+"px";m.beforeParams=q;}else{var a=arguments.callee;setTimeout(a,10);}};o();};PopupMarker.prototype.isNull=function(b){if(!b&&b!==0||b===undefined||b===""||b===null||typeof b==="undefined"){return true;}return false;};PopupMarker.prototype.getTextCanvas_=function(m){m=m.toString();var n=this.map_.getContainer();var l=document.createElement("div");l.style.color="#"+this.color_;n.appendChild(l);var q=function(e){var a=document.createElement("span");l.appendChild(a);a.innerHTML=e;var b=a.getElementsByTagName("*");for(var c=0;c<b.length;c++){if(b[c].nodeType===1){b[c].style.margin=0;}}a.style.whiteSpace="nowrap";var d={};d.width=a.offsetWidth;d.height=a.offsetHeight;a.style.display="block";return d;};var p;var j=m.split(/\n/i);var k=new GSize(1,1);for(var o=0;o<j.length;o++){p=q(j[o]);if(p.width>k.width){k.width=p.width;}k.height+=p.height;}l.style.width=k.width+"px";l.style.height=k.height+"px";n.removeChild(l);return{ele:l,size:k};};PopupMarker.prototype.makeImgDiv_=function(e,g){var h=document.createElement("div");h.style.position="absolute";h.style.overflow="hidden";if(g.width){h.style.width=g.width+"px";}if(g.height){h.style.height=g.height+"px";}var f=null;if(!this._is_ie||this._is_ie8){f=new Image();f.src=e;}else{f=document.createElement("div");if(g.width){f.style.width=g.width+"px";}if(g.height){f.style.height=g.height+"px";}}f.style.position="relative";f.style.left=g.left+"px";f.style.top=g.top+"px";f.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+e+"')";h.appendChild(f);return h;};PopupMarker.prototype.fillDiv_=function(d){var c=document.createElement("div");c.style.position="absolute";c.style.backgroundColor="#"+this.bgcolor_;c.style.fontSize="1px";c.style.lineHeight="1px";c.style.overflow="hidden";c.style.left=d.left+"px";c.style.top=d.top+"px";c.style.width=d.width+"px";c.style.height=d.height+"px";return c;};PopupMarker.prototype.getZIndex=function(b){return this.opts_.zIndexProcess?this.opts_.zIndexProcess(this):GOverlay.getZIndex(b);};
