OpenLayers.Map.prototype.zoomTo=function(_1){
if(this.isValidZoomLevel(_1)){
if(this.popups.length>0){
var _2=this.popups[0];
this.setCenter(_2.lonlat,_1);
this.adjustForBubble(_2.lonlat,_2.bubbleSize,_2.bubbleMargin,_2.bubbleOffset);
}else{
this.setCenter(null,_1);
}
}
};
OpenLayers.Map.prototype.removePopups=function(){
this.popups.each(function(p){
this.removePopup(p);
}.bind(this));
};
OpenLayers.Map.prototype.adjustForBubble=function(_4,_5,_6,_7){
var _8=this.getPixelFromLonLat(_4);
var _9=_8.y+_7.y-_6.top;
var _a=_8.x+_7.x-_6.left;
var _b=_8.y+_6.bottom;
var _c=_8.x+_7.x+_5.w+_6.right;
var _d=new OpenLayers.Bounds(_a,_b,_c,_9);
var _e=this.getExtent();
var _f=this.getPixelFromLonLat(new OpenLayers.LonLat(_e.right,_e.bottom));
var _10=new OpenLayers.Bounds(0,_f.y,_f.x,0);
var _11=0;
if(_d.left<_10.left){
_11=_10.left-_d.left;
}else{
if(_d.right>_10.right){
_11=_10.right-_d.right;
}
}
var _12=0;
if(_d.bottom>_10.bottom){
_12=_10.bottom-_d.bottom;
}else{
if(_d.top<_10.top){
_12=_10.top-_d.top;
}
}
if(_11==0&&_12==0){
return;
}
if(Math.abs(_11)>1000||Math.abs(_12)>1000){
var _13=_d.getCenterPixel();
var _14=this.getLonLatFromPixel(_13);
this.setCenter(_14);
}else{
this.pan(-_11,-_12);
}
};
OpenLayers.Layer.Markers.prototype.addMarker=function(_15){
if(this.map.baseLayer.projection.toString()=="EPSG:900913"){
_15.lonlat.transform(new OpenLayers.Projection("EPSG:4326"),this.map.baseLayer.projection);
}
this.markers.push(_15);
if(this.opacity!=null){
_15.setOpacity(this.opacity);
}
if(this.map&&this.map.getExtent()){
_15.map=this.map;
this.drawMarker(_15);
}
};
OpenLayers.Layer.KaMap.prototype.initGriddedTiles=OpenLayers.Layer.Grid.prototype.initGriddedTiles=OpenLayers.Layer.WMS.prototype.initGriddedTiles=function(_16){
var _17=this.map.getSize();
var _18=Math.ceil(_17.h/this.tileSize.h)+Math.max(1,2*this.buffer)+1;
var _19=Math.ceil(_17.w/this.tileSize.w)+Math.max(1,2*this.buffer);
var _1a=this.map.getMaxExtent();
var _1b=this.map.getResolution();
var _1c=this.calculateGridLayout(_16,_1a,_1b);
var _1d=Math.round(_1c.tileoffsetx);
var _1e=Math.round(_1c.tileoffsety);
var _1f=_1c.tileoffsetlon;
var _20=_1c.tileoffsetlat;
var _21=_1c.tilelon;
var _22=_1c.tilelat;
this.origin=new OpenLayers.Pixel(_1d,_1e);
var _23=_1d;
var _24=_1f;
var _25=0;
var _26=parseInt(this.map.layerContainerDiv.style.left);
var _27=parseInt(this.map.layerContainerDiv.style.top);
do{
var row=this.grid[_25++];
if(!row){
row=[];
this.grid.push(row);
}
_1f=_24;
_1d=_23;
var _29=0;
do{
var _2a=new OpenLayers.Bounds(_1f,_20,_1f+_21,_20+_22);
var x=_1d;
x-=_26;
var y=_1e;
y-=_27;
var px=new OpenLayers.Pixel(x,y);
var _2e=row[_29++];
if(!_2e){
_2e=this.addTile(_2a,px);
this.addTileMonitoringHooks(_2e);
row.push(_2e);
}else{
_2e.moveTo(_2a,px,false);
}
_1f+=_21;
_1d+=this.tileSize.w;
}while((_1f<=_16.right+_21*this.buffer)||_29<_19);
_20-=_22;
_1e+=this.tileSize.h;
}while((_20>=_16.bottom-_22*this.buffer)||_25<_18);
this.removeExcessTiles(_25,_29);
this.spiralTileLoad();
};
OpenLayers.Popup=OpenLayers.Class.create();
OpenLayers.Popup.WIDTH=200;
OpenLayers.Popup.HEIGHT=200;
OpenLayers.Popup.COLOR="white";
OpenLayers.Popup.OPACITY=1;
OpenLayers.Popup.BORDER="0px";
OpenLayers.Popup.prototype={events:null,id:"",lonlat:null,div:null,size:null,contentHTML:"",backgroundColor:"",opacity:"",border:"",contentDiv:null,padding:5,map:null,initialize:function(id,_30,_31,_32,_33){
if(id==null){
id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");
}
this.id=id;
this.lonlat=_30;
this.size=(_31!=null)?_31:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);
if(_32!=null){
this.contentHTML=_32;
}
this.backgroundColor=OpenLayers.Popup.COLOR;
this.opacity=OpenLayers.Popup.OPACITY;
this.border=OpenLayers.Popup.BORDER;
this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"");
this.div.className="olPopup";
var id=this.div.id+"_contentDiv";
this.contentDiv=OpenLayers.Util.createDiv(id,null,this.size.clone(),null,"relative",null,"");
this.contentDiv.className="olPopupContent";
this.div.appendChild(this.contentDiv);
if(_33==true){
var _34=new OpenLayers.Size(17,17);
var img=OpenLayers.Util.getImagesLocation()+"close.gif";
var _36=OpenLayers.Util.createAlphaImageDiv(this.id+"_close",null,_34,img);
_36.style.right=this.padding+"px";
_36.style.top=this.padding+"px";
this.div.appendChild(_36);
var _37=function(e){
this.hide();
OpenLayers.Event.stop(e);
};
OpenLayers.Event.observe(_36,"click",_37.bindAsEventListener(this));
}
this.registerEvents();
},destroy:function(){
if(this.map!=null){
this.map.removePopup(this);
this.map=null;
}
this.events.destroy();
this.events=null;
this.div=null;
},draw:function(px){
if(px==null){
if((this.lonlat!=null)&&(this.map!=null)){
px=this.map.getLayerPxFromLonLat(this.lonlat);
}
}
this.setContentHTML();
this.moveTo(px);
return this.div;
},updatePosition:function(){
if((this.lonlat)&&(this.map)){
var px=this.map.getLayerPxFromLonLat(this.lonlat);
this.moveTo(px);
}
},moveTo:function(px){
if((px!=null)&&(this.div!=null)){
this.div.style.left=px.x+"px";
this.div.style.top=px.y+"px";
}
},visible:function(){
return OpenLayers.Element.visible(this.div);
},toggle:function(){
OpenLayers.Element.toggle(this.div);
},show:function(){
OpenLayers.Element.show(this.div);
},hide:function(){
this.map.events.triggerEvent("popupclose",this);
},setSize:function(_3c){
if(_3c!=undefined){
this.size=_3c;
}
if(this.div!=null){
this.div.style.width=this.size.w+"px";
this.div.style.height=this.size.h+"px";
}
if(this.contentDiv!=null){
this.contentDiv.style.width=this.size.w+"px";
this.contentDiv.style.height=this.size.h+"px";
}
},setBackgroundColor:function(_3d){
if(_3d!=undefined){
this.backgroundColor=_3d;
}
if(this.div!=null){
this.div.style.backgroundColor=this.backgroundColor;
}
},setOpacity:function(_3e){
if(_3e!=undefined){
this.opacity=_3e;
}
if(this.div!=null){
this.div.style.opacity=this.opacity;
this.div.style.filter="alpha(opacity="+this.opacity*100+")";
}
},setBorder:function(_3f){
if(_3f!=undefined){
this.border=_3f;
}
if(this.div!=null){
this.div.style.border=this.border;
}
},setContentHTML:function(_40){
if(_40!=null){
this.contentHTML=_40;
}
if(this.contentDiv!=null){
this.contentDiv.innerHTML=this.contentHTML;
}
},registerEvents:function(){
this.events=new OpenLayers.Events(this,this.div,null,true);
this.events.register("mousedown",this,this.onmousedown);
this.events.register("mousemove",this,this.onmousemove);
this.events.register("mouseup",this,this.onmouseup);
this.events.register("click",this,this.onclick);
this.events.register("mouseout",this,this.onmouseout);
this.events.register("dblclick",this,this.ondblclick);
},onmousedown:function(evt){
this.mousedown=true;
OpenLayers.Event.stop(evt,true);
},onmousemove:function(evt){
if(this.mousedown){
OpenLayers.Event.stop(evt,true);
}
},onmouseup:function(evt){
if(this.mousedown){
this.mousedown=false;
OpenLayers.Event.stop(evt,true);
}
},onclick:function(evt){
OpenLayers.Event.stop(evt,true);
},onmouseout:function(evt){
this.mousedown=false;
},ondblclick:function(evt){
OpenLayers.Event.stop(evt,true);
},CLASS_NAME:"OpenLayers.Popup"};
OpenLayers.Popup.Anchored=OpenLayers.Class.create();
OpenLayers.Popup.Anchored.prototype=OpenLayers.Class.inherit(OpenLayers.Popup,{relativePosition:null,anchor:null,initialize:function(id,_48,_49,_4a,_4b,_4c){
var _4d=new Array(id,_48,_49,_4a,_4c);
OpenLayers.Popup.prototype.initialize.apply(this,_4d);
this.anchor=(_4b!=null)?_4b:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)};
},draw:function(px){
if(px==null){
if((this.lonlat!=null)&&(this.map!=null)){
px=this.map.getLayerPxFromLonLat(this.lonlat);
}
}
this.relativePosition=this.calculateRelativePosition(px);
return OpenLayers.Popup.prototype.draw.apply(this,arguments);
},calculateRelativePosition:function(px){
var _50=this.map.getLonLatFromLayerPx(px);
var _51=this.map.getExtent();
var _52=_51.determineQuadrant(_50);
return OpenLayers.Bounds.oppositeQuadrant(_52);
},moveTo:function(px){
var _54=px.offset(this.anchor.bubbleOffset);
var _55=new Array(_54);
OpenLayers.Popup.prototype.moveTo.apply(this,_55);
},setSize:function(_56){
OpenLayers.Popup.prototype.setSize.apply(this,arguments);
if((this.lonlat)&&(this.map)){
var px=this.map.getLayerPxFromLonLat(this.lonlat);
this.moveTo(px);
}
},calculateNewPx:function(px){
var _59=px.offset(this.anchor.offset);
var top=(this.relativePosition.charAt(0)=="t");
_59.y+=(top)?-this.size.h:this.anchor.size.h;
var _5b=(this.relativePosition.charAt(1)=="l");
_59.x+=(_5b)?-this.size.w:this.anchor.size.w;
return _59;
},CLASS_NAME:"OpenLayers.Popup.Anchored"});
OpenLayers.Popup.AnchoredBubble=OpenLayers.Class.create();
OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;
OpenLayers.Popup.AnchoredBubble.prototype=OpenLayers.Class.inherit(OpenLayers.Popup.Anchored,{rounded:false,initialize:function(id,_5d,_5e,_5f,_60,_61){
OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);
},draw:function(px){
OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);
this.setContentHTML();
this.map.events.triggerEvent("popupopen",this);
return this.div;
},setSize:function(_63){
OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);
if(this.contentDiv!=null){
var _64=this.size.clone();
this.contentDiv.style.height=_64.h+"px";
this.contentDiv.style.width=_64.w+"px";
}
},setBackgroundColor:function(_65){
if(_65!=undefined){
this.backgroundColor=_65;
}
if(this.div!=null){
if(this.contentDiv!=null){
this.div.style.background="transparent";
}
}
},setOpacity:function(_66){
if(_66!=undefined){
this.opacity=_66;
}
if(this.div!=null){
if(this.contentDiv!=null){
OpenLayers.Rico.Corner.changeOpacity(this.contentDiv,this.opacity);
}
}
},setBorder:function(_67){
this.border=0;
},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});
OpenLayers.Feature.prototype.popupClass=OpenLayers.Popup.AnchoredBubble;
Prototype.Browser.IE6=Prototype.Browser.IE&&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==6;
if(Prototype.Browser.IE6){
OpenLayers.Util.onImageLoadError=function(){
this._attempts=(this._attempts)?(this._attempts+1):1;
if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){
src=this.src;
if(src.indexOf("&ra=")==-1){
src=src+"&ra="+(Math.floor(Math.random()*90)+10);
}else{
src=src.replace(/\&ra=../,"&ra="+(Math.floor(Math.random()*90)+10));
}
this.src=src;
}else{
this.style.backgroundColor=OpenLayers.Util.onImageLoadErrorColor;
}
this.style.display="";
};
OpenLayers.Util.createAlphaImageDiv=function(id,px,sz,_6b,_6c,_6d,_6e,_6f,_70){
var div=OpenLayers.Util.createDiv();
var img=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);
div.appendChild(img);
div.unselectable="on";
if(_70){
img.style.display="none";
OpenLayers.Event.observe(img,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,div));
OpenLayers.Event.observe(img,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,div));
}
OpenLayers.Util.modifyAlphaImageDiv(div,id,px,sz,_6b,_6c,_6d,_6e,_6f);
return div;
};
}
OpenLayers.Event={observers:false,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(_73){
return _73.target||_73.srcElement;
},isLeftClick:function(_74){
return (((_74.which)&&(_74.which==1))||((_74.button)&&(_74.button==1)));
},isRightClick:function(_75){
return (((_75.which)&&(_75.which==3))||((_75.button)&&(_75.button==2)));
},stop:function(_76,_77){
if(!_77){
if(_76.preventDefault){
_76.preventDefault();
}else{
_76.returnValue=false;
}
}
if(_76.stopPropagation){
_76.stopPropagation();
}else{
_76.cancelBubble=true;
}
},findElement:function(_78,_79){
var _7a=OpenLayers.Event.element(_78);
while(_7a.parentNode&&(!_7a.tagName||(_7a.tagName.toUpperCase()!=_79.toUpperCase()))){
_7a=_7a.parentNode;
}
return _7a;
},observe:function(_7b,_7c,_7d,_7e){
var _7f=OpenLayers.Util.getElement(_7b);
_7e=_7e||false;
if(_7c=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||_7f.attachEvent)){
_7c="keydown";
}
if(!this.observers){
this.observers={};
}
if(!_7f._eventCacheID){
var _80="eventCacheID_";
if(_7f.id){
_80=_7f.id+"_"+_80;
}
_7f._eventCacheID=OpenLayers.Util.createUniqueID(_80);
}
var _81=_7f._eventCacheID;
if(!this.observers[_81]){
this.observers[_81]=[];
}
this.observers[_81].push({"element":_7f,"name":_7c,"observer":_7d,"useCapture":_7e});
if(_7f.addEventListener){
_7f.addEventListener(_7c,_7d,_7e);
}else{
if(_7f.attachEvent){
_7f.attachEvent("on"+_7c,_7d);
}
}
},stopObservingElement:function(_82){
var _83=OpenLayers.Util.getElement(_82);
var _84=_83._eventCacheID;
this._removeElementObservers(OpenLayers.Event.observers[_84]);
},_removeElementObservers:function(_85){
if(_85){
for(var i=_85.length-1;i>=0;i--){
var _87=_85[i];
var _88=new Array(_87.element,_87.name,_87.observer,_87.useCapture);
var _89=OpenLayers.Event.stopObserving.apply(this,_88);
}
}
},stopObserving:function(_8a,_8b,_8c,_8d){
_8d=_8d||false;
var _8e=OpenLayers.Util.getElement(_8a);
var _8f=_8e._eventCacheID;
if(_8b=="keypress"){
if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||_8e.detachEvent){
_8b="keydown";
}
}
var _90=false;
var _91=OpenLayers.Event.observers[_8f];
if(_91){
var i=0;
while(!_90&&i<_91.length){
var _93=_91[i];
if((_93.name==_8b)&&(_93.observer==_8c)&&(_93.useCapture==_8d)){
_91.splice(i,1);
if(_91.length==0){
delete OpenLayers.Event.observers[_8f];
}
_90=true;
break;
}
i++;
}
}
if(_90){
if(_8e.removeEventListener){
_8e.removeEventListener(_8b,_8c,_8d);
}else{
if(_8e&&_8e.detachEvent){
_8e.detachEvent("on"+_8b,_8c);
}
}
}
return _90;
},unloadCache:function(){
if(OpenLayers.Event&&OpenLayers.Event.observers){
for(var _94 in OpenLayers.Event.observers){
var _95=OpenLayers.Event.observers[_94];
OpenLayers.Event._removeElementObservers.apply(this,[_95]);
}
OpenLayers.Event.observers=false;
}
},CLASS_NAME:"OpenLayers.Event"};
OpenLayers.Event.observe(window,"unload",OpenLayers.Event.unloadCache,false);
if(window.Event){
OpenLayers.Util.applyDefaults(window.Event,OpenLayers.Event);
}else{
var Event=OpenLayers.Event;
}
OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:["mouseover","mouseout","mousedown","mouseup","mousemove","click","dblclick","rightclick","dblrightclick","resize","focus","blur"],listeners:null,object:null,element:null,eventTypes:null,eventHandler:null,fallThrough:null,includeXY:true,initialize:function(_96,_97,_98,_99,_9a){
OpenLayers.Util.extend(this,_9a);
this.object=_96;
this.element=_97;
this.fallThrough=_99;
this.listeners={};
this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,this);
this.eventTypes=[];
if(_98!=null){
for(var i=0,len=_98.length;i<len;i++){
this.addEventType(_98[i]);
}
}
if(this.element!=null){
this.attachToElement(_97);
}
},destroy:function(){
if(this.element){
OpenLayers.Event.stopObservingElement(this.element);
}
this.element=null;
this.listeners=null;
this.object=null;
this.eventTypes=null;
this.fallThrough=null;
this.eventHandler=null;
},addEventType:function(_9d){
if(!this.listeners[_9d]){
this.eventTypes.push(_9d);
this.listeners[_9d]=[];
}
},attachToElement:function(_9e){
for(var i=0,len=this.BROWSER_EVENTS.length;i<len;i++){
var _a1=this.BROWSER_EVENTS[i];
this.addEventType(_a1);
OpenLayers.Event.observe(_9e,_a1,this.eventHandler);
}
OpenLayers.Event.observe(_9e,"dragstart",OpenLayers.Event.stop);
},on:function(_a2){
for(var _a3 in _a2){
if(_a3!="scope"){
this.register(_a3,_a2.scope,_a2[_a3]);
}
}
},register:function(_a4,obj,_a6){
if((_a6!=null)&&(OpenLayers.Util.indexOf(this.eventTypes,_a4)!=-1)){
if(obj==null){
obj=this.object;
}
var _a7=this.listeners[_a4];
_a7.push({obj:obj,func:_a6});
}
},registerPriority:function(_a8,obj,_aa){
if(_aa!=null){
if(obj==null){
obj=this.object;
}
var _ab=this.listeners[_a8];
if(_ab!=null){
_ab.unshift({obj:obj,func:_aa});
}
}
},un:function(_ac){
for(var _ad in _ac){
if(_ad!="scope"){
this.unregister(_ad,_ac.scope,_ac[_ad]);
}
}
},unregister:function(_ae,obj,_b0){
if(obj==null){
obj=this.object;
}
var _b1=this.listeners[_ae];
if(_b1!=null){
for(var i=0,len=_b1.length;i<len;i++){
if(_b1[i].obj==obj&&_b1[i].func==_b0){
_b1.splice(i,1);
break;
}
}
}
},remove:function(_b4){
if(this.listeners[_b4]!=null){
this.listeners[_b4]=[];
}
},triggerEvent:function(_b5,evt){
if(evt==null){
evt={};
}
evt.object=this.object;
evt.element=this.element;
if(!evt.type){
evt.type=_b5;
}
var _b7=(this.listeners[_b5])?this.listeners[_b5].slice():null;
if((_b7!=null)&&(_b7.length>0)){
var _b8;
for(var i=0,len=_b7.length;i<len;i++){
var _bb=_b7[i];
_b8=_bb.func.apply(_bb.obj,[evt]);
if((_b8!=undefined)&&(_b8==false)){
break;
}
}
if(!this.fallThrough){
OpenLayers.Event.stop(evt,true);
}
}
return _b8;
},handleBrowserEvent:function(evt){
if(this.includeXY){
evt.xy=this.getMousePosition(evt);
}
this.triggerEvent(evt.type,evt);
},clearMouseCache:function(){
if(this.element){
this.element.scrolls=null;
this.element.lefttop=null;
this.element.offsets=null;
}
},getMousePosition:function(evt){
if(!this.includeXY){
this.clearMouseCache();
}else{
if(!this.element.hasScrollEvent){
OpenLayers.Event.observe(window,"scroll",OpenLayers.Function.bind(this.clearMouseCache,this));
this.element.hasScrollEvent=true;
}
}
if(!this.element.scrolls){
this.element.scrolls=[];
this.element.scrolls[0]=(document.documentElement.scrollLeft||document.body.scrollLeft);
this.element.scrolls[1]=(document.documentElement.scrollTop||document.body.scrollTop);
}
if(!this.element.lefttop){
this.element.lefttop=[];
this.element.lefttop[0]=(document.documentElement.clientLeft||0);
this.element.lefttop[1]=(document.documentElement.clientTop||0);
}
if(!this.element.offsets){
this.element.offsets=OpenLayers.Util.pagePosition(this.element);
this.element.offsets[0]+=this.element.scrolls[0];
this.element.offsets[1]+=this.element.scrolls[1];
}
return new OpenLayers.Pixel((evt.clientX+this.element.scrolls[0])-this.element.offsets[0]-this.element.lefttop[0],(evt.clientY+this.element.scrolls[1])-this.element.offsets[1]-this.element.lefttop[1]);
},CLASS_NAME:"OpenLayers.Events"});
if(ace.util.numberFormat){
OpenLayers.LonLat.prototype.toShortString=function(){
return (this.lon.toString().replace(",",".")+", "+this.lat.toString().replace(",","."));
};
}
OpenLayers.LonLat.prototype.projCode="";
OpenLayers.LonLat.prototype.initialize=function(lon,lat){
this.lon=parseFloat(lon);
this.lat=parseFloat(lat);
var _c0=new OpenLayers.Bounds(-180,-90,180,90);
this.projCode=_c0.containsLonLat(this)?"EPSG:4326":"EPSG:900913";
};
OpenLayers.LonLat.prototype.transform=function(_c1,_c2){
if(this.projCode!=_c2.projCode){
var _c3=OpenLayers.Projection.transform({"x":this.lon,"y":this.lat},_c1,_c2);
this.lon=_c3.x;
this.lat=_c3.y;
}
return this;
};
OpenLayers.Bounds.prototype.projCode="";
OpenLayers.Bounds.prototype.initialize=function(_c4,_c5,_c6,top,_c8){
if(_c4!=null){
this.left=parseFloat(_c4);
}
if(_c5!=null){
this.bottom=parseFloat(_c5);
}
if(_c6!=null){
this.right=parseFloat(_c6);
}
if(top!=null){
this.top=parseFloat(top);
}
if(!_c8){
var _c9=new OpenLayers.Bounds(-180,-90,180,90,true);
this.projCode=this.intersectsBounds(_c9)?"EPSG:4326":"EPSG:900913";
}
};
OpenLayers.Bounds.prototype.transform=function(_ca,_cb){
if(this.projCode!=_cb.projCode){
var ll=OpenLayers.Projection.transform({"x":this.left,"y":this.bottom},_ca,_cb);
var lr=OpenLayers.Projection.transform({"x":this.right,"y":this.bottom},_ca,_cb);
var ul=OpenLayers.Projection.transform({"x":this.left,"y":this.top},_ca,_cb);
var ur=OpenLayers.Projection.transform({"x":this.right,"y":this.top},_ca,_cb);
this.left=Math.min(ll.x,ul.x);
this.bottom=Math.min(ll.y,lr.y);
this.right=Math.max(lr.x,ur.x);
this.top=Math.max(ul.y,ur.y);
}
return this;
};
OpenLayers.Geometry.Point.prototype.projCode="";
OpenLayers.Geometry.Point.prototype.initialize=function(x,y){
OpenLayers.Geometry.prototype.initialize.apply(this,arguments);
this.x=parseFloat(x);
this.y=parseFloat(y);
if(x&&y){
this.projCode=((this.x>=-180&&this.x<=180)&&(this.y>=-90&&this.y<=90))?"EPSG:4326":"EPSG:900913";
}
};
OpenLayers.Geometry.Point.prototype.transform=function(_d2,_d3){
if((this.projCode!=_d3.projCode)&&(_d2&&_d3)){
OpenLayers.Projection.transform(this,_d2,_d3);
this.projCode=_d3.projCode;
}
return this;
};
OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:true,"double":false,pixelTolerance:0,stopSingle:false,stopDouble:false,timerId:null,down:null,initialize:function(_d4,_d5,_d6){
OpenLayers.Handler.prototype.initialize.apply(this,arguments);
if(this.pixelTolerance!=null){
this.mousedown=function(evt){
this.down=evt.xy;
return true;
};
}
},mousedown:null,dblclick:function(evt){
if(this.passesTolerance(evt)){
if(this["double"]){
this.callback("dblclick",[evt]);
document.fire("w2gi:track",{action:"mapzoom",value:1});
}
this.clearTimer();
}
return !this.stopDouble;
},click:function(evt){
if(this.passesTolerance(evt)){
if(this.timerId!=null){
this.clearTimer();
}else{
var _da=this.single?OpenLayers.Util.extend({},evt):null;
this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,_da),this.delay);
}
}
return !this.stopSingle;
},passesTolerance:function(evt){
var _dc=true;
if(this.pixelTolerance!=null&&this.down){
var dpx=Math.sqrt(Math.pow(this.down.x-evt.xy.x,2)+Math.pow(this.down.y-evt.xy.y,2));
if(dpx>this.pixelTolerance){
_dc=false;
}
}
return _dc;
},clearTimer:function(){
if(this.timerId!=null){
window.clearTimeout(this.timerId);
this.timerId=null;
}
},delayedCall:function(evt){
this.timerId=null;
if(evt){
this.callback("click",[evt]);
}
},deactivate:function(){
var _df=false;
if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){
this.clearTimer();
this.down=null;
_df=true;
}
return _df;
},CLASS_NAME:"OpenLayers.Handler.Click"});
OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,initialize:function(_e0,_e1,_e2){
OpenLayers.Handler.prototype.initialize.apply(this,arguments);
this.wheelListener=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this);
},destroy:function(){
OpenLayers.Handler.prototype.destroy.apply(this,arguments);
this.wheelListener=null;
},onWheelEvent:function(e){
if(!this.map||!this.checkModifiers(e)){
return;
}
var _e4=false;
var _e5=false;
var _e6=false;
var _e7=OpenLayers.Event.element(e);
while((_e7!=null)&&!_e6&&!_e4){
if(!_e4){
try{
if(_e7.currentStyle){
_e8=_e7.currentStyle["overflow"];
}else{
var _e9=document.defaultView.getComputedStyle(_e7,null);
var _e8=_e9.getPropertyValue("overflow");
}
_e4=(_e8&&(_e8=="auto")||(_e8=="scroll"));
}
catch(err){
}
}
if(!_e5){
for(var i=0;i<this.map.layers.length;i++){
if(_e7==this.map.layers[i].div||_e7==this.map.layers[i].pane){
_e5=true;
break;
}
}
}
_e6=(_e7==this.map.div);
_e7=_e7.parentNode;
}
if(!_e4&&_e6){
if(_e5){
this.wheelZoom(e);
}
OpenLayers.Event.stop(e);
}
},wheelZoom:function(e){
document.fire("w2gi:track",{action:"mapzoom",value:1});
var _ec=0;
if(!e){
e=window.event;
}
if(e.wheelDelta){
_ec=e.wheelDelta/120;
if(window.opera&&window.opera.version()<9.2){
_ec=-_ec;
}
}else{
if(e.detail){
_ec=-e.detail/3;
}
}
if(_ec){
if(this.mousePosition){
e.xy=this.mousePosition;
}
if(!e.xy){
e.xy=this.map.getPixelFromLonLat(this.map.getCenter());
}
if(_ec<0){
this.callback("down",[e,_ec]);
}else{
this.callback("up",[e,_ec]);
}
}
},mousemove:function(evt){
this.mousePosition=evt.xy;
},activate:function(evt){
if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){
var _ef=this.wheelListener;
OpenLayers.Event.observe(window,"DOMMouseScroll",_ef);
OpenLayers.Event.observe(window,"mousewheel",_ef);
OpenLayers.Event.observe(document,"mousewheel",_ef);
return true;
}else{
return false;
}
},deactivate:function(evt){
if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){
var _f1=this.wheelListener;
OpenLayers.Event.stopObserving(window,"DOMMouseScroll",_f1);
OpenLayers.Event.stopObserving(window,"mousewheel",_f1);
OpenLayers.Event.stopObserving(document,"mousewheel",_f1);
return true;
}else{
return false;
}
},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});
OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,last:null,start:null,oldOnselectstart:null,initialize:function(_f2,_f3,_f4){
OpenLayers.Handler.prototype.initialize.apply(this,arguments);
},down:function(evt){
},move:function(evt){
},up:function(evt){
},out:function(evt){
},mousedown:function(evt){
var _fa=true;
this.dragging=false;
if(this.checkModifiers(evt)&&OpenLayers.Event.isLeftClick(evt)){
this.started=true;
this.start=evt.xy;
this.last=evt.xy;
this.map.div.style.cursor="move";
this.down(evt);
this.callback("down",[evt.xy]);
OpenLayers.Event.stop(evt);
if(!this.oldOnselectstart){
this.oldOnselectstart=(document.onselectstart)?document.onselectstart:function(){
return true;
};
document.onselectstart=function(){
return false;
};
}
_fa=!this.stopDown;
}else{
this.started=false;
this.start=null;
this.last=null;
}
return _fa;
},mousemove:function(evt){
if(this.started){
if(evt.xy.x!=this.last.x||evt.xy.y!=this.last.y){
this.dragging=true;
this.move(evt);
this.callback("move",[evt.xy]);
if(!this.oldOnselectstart){
this.oldOnselectstart=document.onselectstart;
document.onselectstart=function(){
return false;
};
}
this.last=evt.xy;
}
}
return true;
},mouseup:function(evt){
if(this.started){
var _fd=(this.start!=this.last);
this.started=false;
this.dragging=false;
this.map.div.style.cursor="";
this.up(evt);
this.callback("up",[evt.xy]);
if(_fd){
this.callback("done",[evt.xy]);
var ll=evt.xy.x+","+evt.xy.y;
document.fire("w2gi:track",{action:"mappan",value:ll});
}
document.onselectstart=this.oldOnselectstart;
}
return true;
},mouseout:function(evt){
if(this.started&&OpenLayers.Util.mouseLeft(evt,this.map.div)){
var _100=(this.start!=this.last);
this.started=false;
this.dragging=false;
this.map.div.style.cursor="";
this.out(evt);
this.callback("out",[]);
if(_100){
this.callback("done",[evt.xy]);
}
if(document.onselectstart){
document.onselectstart=this.oldOnselectstart;
}
}
return true;
},click:function(evt){
return (this.start==this.last);
},activate:function(){
var _102=false;
if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){
this.dragging=false;
_102=true;
}
return _102;
},deactivate:function(){
var _103=false;
if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){
this.started=false;
this.dragging=false;
this.start=null;
this.last=null;
_103=true;
}
return _103;
},CLASS_NAME:"OpenLayers.Handler.Drag"});
OpenLayers.Control.PanZoom=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,buttons:null,position:null,initialize:function(_104){
this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,OpenLayers.Control.PanZoom.Y);
OpenLayers.Control.prototype.initialize.apply(this,arguments);
},destroy:function(){
OpenLayers.Control.prototype.destroy.apply(this,arguments);
while(this.buttons.length){
var btn=this.buttons.shift();
btn.map=null;
OpenLayers.Event.stopObservingElement(btn);
}
this.buttons=null;
this.position=null;
},draw:function(px){
OpenLayers.Control.prototype.draw.apply(this,arguments);
px=this.position;
this.buttons=[];
var sz=new OpenLayers.Size(18,18);
var _108=new OpenLayers.Pixel(px.x+sz.w/2,px.y);
this._addButton("panup","north-mini.png",_108,sz);
px.y=_108.y+sz.h;
this._addButton("panleft","west-mini.png",px,sz);
this._addButton("panright","east-mini.png",px.add(sz.w,0),sz);
this._addButton("pandown","south-mini.png",_108.add(0,sz.h*2),sz);
this._addButton("zoomin","zoom-plus-mini.png",_108.add(0,sz.h*3+5),sz);
this._addButton("zoomworld","zoom-world-mini.png",_108.add(0,sz.h*4+5),sz);
this._addButton("zoomout","zoom-minus-mini.png",_108.add(0,sz.h*5+5),sz);
return this.div;
},_addButton:function(id,img,xy,sz){
var _10d=OpenLayers.Util.getImagesLocation()+img;
var btn=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_PanZoom_"+id,xy,sz,_10d,"absolute");
this.div.appendChild(btn);
OpenLayers.Event.observe(btn,"mousedown",OpenLayers.Function.bindAsEventListener(this.buttonDown,btn));
OpenLayers.Event.observe(btn,"dblclick",OpenLayers.Function.bindAsEventListener(this.doubleClick,btn));
OpenLayers.Event.observe(btn,"click",OpenLayers.Function.bindAsEventListener(this.doubleClick,btn));
btn.action=id;
btn.map=this.map;
btn.slideFactor=this.slideFactor;
this.buttons.push(btn);
return btn;
},doubleClick:function(evt){
OpenLayers.Event.stop(evt);
return false;
},buttonDown:function(evt){
if(!OpenLayers.Event.isLeftClick(evt)){
return;
}
switch(this.action){
case "panup":
this.map.pan(0,-this.slideFactor);
document.fire("w2gi:track",{action:"mappan",value:-this.slideFactor});
break;
case "pandown":
this.map.pan(0,this.slideFactor);
document.fire("w2gi:track",{action:"mappan",value:this.slideFactor});
break;
case "panleft":
this.map.pan(-this.slideFactor,0);
document.fire("w2gi:track",{action:"mappan",value:-this.slideFactor});
break;
case "panright":
this.map.pan(this.slideFactor,0);
document.fire("w2gi:track",{action:"mappan",value:this.slideFactor});
break;
case "zoomin":
this.map.zoomIn();
document.fire("w2gi:track",{action:"mapzoom",value:1});
break;
case "zoomout":
this.map.zoomOut();
document.fire("w2gi:track",{action:"mapzoom",value:1});
break;
case "zoomworld":
this.map.zoomToMaxExtent();
document.fire("w2gi:track",{action:"mapzoom",value:1});
break;
}
OpenLayers.Event.stop(evt);
},CLASS_NAME:"OpenLayers.Control.PanZoom"});
OpenLayers.Control.PanZoom.X=4;
OpenLayers.Control.PanZoom.Y=4;
OpenLayers.Control.PanZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{zoomStopWidth:18,zoomStopHeight:11,slider:null,sliderEvents:null,zoomBarDiv:null,divEvents:null,zoomWorldIcon:false,initialize:function(){
OpenLayers.Control.PanZoom.prototype.initialize.apply(this,arguments);
},destroy:function(){
this.div.removeChild(this.slider);
this.slider=null;
this.sliderEvents.destroy();
this.sliderEvents=null;
this.div.removeChild(this.zoombarDiv);
this.zoomBarDiv=null;
this.divEvents.destroy();
this.divEvents=null;
this.map.events.un({"zoomend":this.moveZoomBar,"changebaselayer":this.redraw,scope:this});
OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments);
},setMap:function(map){
OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments);
this.map.events.register("changebaselayer",this,this.redraw);
},redraw:function(){
if(this.div!=null){
this.div.innerHTML="";
}
this.draw();
},draw:function(px){
OpenLayers.Control.prototype.draw.apply(this,arguments);
px=this.position.clone();
this.buttons=[];
var sz=new OpenLayers.Size(18,18);
var _114=new OpenLayers.Pixel(px.x+sz.w/2,px.y);
var _115=sz.w;
if(this.zoomWorldIcon){
_114=new OpenLayers.Pixel(px.x+sz.w,px.y);
}
this._addButton("panup","north-mini.png",_114,sz);
px.y=_114.y+sz.h;
this._addButton("panleft","west-mini.png",px,sz);
if(this.zoomWorldIcon){
this._addButton("zoomworld","zoom-world-mini.png",px.add(sz.w,0),sz);
_115*=2;
}
this._addButton("panright","east-mini.png",px.add(_115,0),sz);
this._addButton("pandown","south-mini.png",_114.add(0,sz.h*2),sz);
this._addButton("zoomin","zoom-plus-mini.png",_114.add(0,sz.h*3+5),sz);
_114=this._addZoomBar(_114.add(0,sz.h*4+5));
this._addButton("zoomout","zoom-minus-mini.png",_114,sz);
return this.div;
},_addZoomBar:function(_116){
var _117=OpenLayers.Util.getImagesLocation();
var id="OpenLayers_Control_PanZoomBar_Slider"+this.map.id;
var _119=this.map.getNumZoomLevels()-1-this.map.getZoom();
var _11a=OpenLayers.Util.createAlphaImageDiv(id,_116.add(-1,_119*this.zoomStopHeight),new OpenLayers.Size(20,9),_117+"slider.png","absolute");
this.slider=_11a;
this.sliderEvents=new OpenLayers.Events(this,_11a,null,true);
this.sliderEvents.on({"mousedown":this.zoomBarDown,"mousemove":this.zoomBarDrag,"mouseup":this.zoomBarUp,"dblclick":this.doubleClick,"click":this.doubleClick});
var sz=new OpenLayers.Size();
sz.h=this.zoomStopHeight*this.map.getNumZoomLevels();
sz.w=this.zoomStopWidth;
var div=null;
if(OpenLayers.Util.alphaHack()){
var id="OpenLayers_Control_PanZoomBar"+this.map.id;
div=OpenLayers.Util.createAlphaImageDiv(id,_116,new OpenLayers.Size(sz.w,this.zoomStopHeight),_117+"zoombar.png","absolute",null,"crop");
div.style.height=sz.h;
}else{
div=OpenLayers.Util.createDiv("OpenLayers_Control_PanZoomBar_Zoombar"+this.map.id,_116,sz,_117+"zoombar.png");
}
this.zoombarDiv=div;
this.divEvents=new OpenLayers.Events(this,div,null,true);
this.divEvents.on({"mousedown":this.divClick,"mousemove":this.passEventToSlider,"dblclick":this.doubleClick,"click":this.doubleClick});
this.div.appendChild(div);
this.startTop=parseInt(div.style.top);
this.div.appendChild(_11a);
this.map.events.register("zoomend",this,this.moveZoomBar);
_116=_116.add(0,this.zoomStopHeight*this.map.getNumZoomLevels());
return _116;
},passEventToSlider:function(evt){
this.sliderEvents.handleBrowserEvent(evt);
},divClick:function(evt){
if(!OpenLayers.Event.isLeftClick(evt)){
return;
}
var y=evt.xy.y;
var top=OpenLayers.Util.pagePosition(evt.object)[1];
var _121=(y-top)/this.zoomStopHeight;
if(!this.map.fractionalZoom){
_121=Math.floor(_121);
}
var zoom=(this.map.getNumZoomLevels()-1)-_121;
zoom=Math.min(Math.max(zoom,0),this.map.getNumZoomLevels()-1);
this.map.zoomTo(zoom);
OpenLayers.Event.stop(evt);
},zoomBarDown:function(evt){
if(!OpenLayers.Event.isLeftClick(evt)){
return;
}
this.map.events.on({"mousemove":this.passEventToSlider,"mouseup":this.passEventToSlider,scope:this});
this.mouseDragStart=evt.xy.clone();
this.zoomStart=evt.xy.clone();
this.div.style.cursor="move";
this.zoombarDiv.offsets=null;
OpenLayers.Event.stop(evt);
},zoomBarDrag:function(evt){
if(this.mouseDragStart!=null){
var _125=this.mouseDragStart.y-evt.xy.y;
var _126=OpenLayers.Util.pagePosition(this.zoombarDiv);
if((evt.clientY-_126[1])>0&&(evt.clientY-_126[1])<parseInt(this.zoombarDiv.style.height)-2){
var _127=parseInt(this.slider.style.top)-_125;
this.slider.style.top=_127+"px";
}
this.mouseDragStart=evt.xy.clone();
OpenLayers.Event.stop(evt);
}
},zoomBarUp:function(evt){
if(!OpenLayers.Event.isLeftClick(evt)){
return;
}
if(this.zoomStart){
this.div.style.cursor="";
this.map.events.un({"mouseup":this.passEventToSlider,"mousemove":this.passEventToSlider,scope:this});
var _129=this.zoomStart.y-evt.xy.y;
var _12a=this.map.zoom;
if(this.map.fractionalZoom){
_12a+=_129/this.zoomStopHeight;
_12a=Math.min(Math.max(_12a,0),this.map.getNumZoomLevels()-1);
}else{
_12a+=Math.round(_129/this.zoomStopHeight);
}
document.fire("w2gi:track",{action:"mapzoom",value:_12a});
this.map.zoomTo(_12a);
this.moveZoomBar();
this.mouseDragStart=null;
OpenLayers.Event.stop(evt);
}
},moveZoomBar:function(){
var _12b=((this.map.getNumZoomLevels()-1)-this.map.getZoom())*this.zoomStopHeight+this.startTop+1;
this.slider.style.top=_12b+"px";
},CLASS_NAME:"OpenLayers.Control.PanZoomBar"});
OpenLayers.Control.LayerSwitcher=OpenLayers.Class(OpenLayers.Control,{layerStates:null,layersDiv:null,baseLayersDiv:null,baseLayers:null,dataLbl:null,dataLayersDiv:null,dataLayers:null,buttonWidth:120,transChange:false,initialize:function(_12c){
OpenLayers.Control.prototype.initialize.apply(this,arguments);
this.layerStates=[];
},destroy:function(){
OpenLayers.Event.stopObservingElement(this.div);
this.clearLayersArray("base");
this.clearLayersArray("data");
this.map.events.un({"addlayer":this.redraw,"changelayer":this.redraw,"removelayer":this.redraw,"changebaselayer":this.redraw,scope:this});
OpenLayers.Control.prototype.destroy.apply(this,arguments);
},setMap:function(map){
OpenLayers.Control.prototype.setMap.apply(this,arguments);
this.map.events.on({"addlayer":this.redraw,"changelayer":this.redraw,"removelayer":this.redraw,"changebaselayer":this.redraw,scope:this});
},draw:function(){
OpenLayers.Control.prototype.draw.apply(this);
this.loadContents();
this.redraw();
return this.div;
},clearLayersArray:function(_12e){
var _12f=this[_12e+"Layers"];
if(_12f){
for(var i=0,len=_12f.length;i<len;i++){
var _132=_12f[i];
OpenLayers.Event.stopObservingElement(_132.labelSpan);
}
}
this[_12e+"LayersDiv"].innerHTML="";
this[_12e+"Layers"]=[];
},checkRedraw:function(){
var _133=false;
if(!this.layerStates.length||(this.map.layers.length!=this.layerStates.length)){
_133=true;
}else{
for(var i=0,len=this.layerStates.length;i<len;i++){
var _136=this.layerStates[i];
var _137=this.map.layers[i];
if((_136.name!=_137.name)||(_136.inRange!=_137.inRange)||(_136.id!=_137.id)||(_136.visibility!=_137.visibility)){
_133=true;
break;
}
}
}
return _133;
},redraw:function(){
if(!this.checkRedraw()){
return this.div;
}
this.clearLayersArray("base");
this.clearLayersArray("data");
var _138=false;
var _139=false;
var len=this.map.layers.length;
this.layerStates=new Array(len);
for(var i=0;i<len;i++){
var _13c=this.map.layers[i];
this.layerStates[i]={"name":_13c.name,"visibility":_13c.visibility,"inRange":_13c.inRange,"id":_13c.id};
}
var _13d=this.map.layers.slice();
var _13e=-1;
for(var i=0,len=_13d.length;i<len;i++){
var _13c=_13d[i];
var _13f=_13c.isBaseLayer;
if(_13f){
_13e=_13e+1;
}
if(_13c.displayInLayerSwitcher){
if(_13f){
_139=true;
}else{
_138=true;
}
var _140=(_13f)?(_13c==this.map.baseLayer):_13c.getVisibility();
var _141=document.createElement("input");
_141.id=this.id+"_input_"+_13c.name;
_141.name=(_13f)?"baseLayers":_13c.name;
_141.type=(_13f)?"radio":"checkbox";
_141.value=_13c.name;
_141.checked=_140;
_141.defaultChecked=_140;
if(!_13f&&!_13c.inRange){
_141.disabled=true;
}
var _142={"inputElem":_141,"layer":_13c,"layerSwitcher":this};
var _143=document.createElement("span");
if(!_13f&&!_13c.inRange){
_143.style.color="gray";
}
OpenLayers.Event.observe(_143,"click",OpenLayers.Function.bindAsEventListener(this.onInputClick,_142));
var _144=(_13f)?this.baseLayers:this.dataLayers;
_144.push({"layer":_13c,"inputElem":_141,"labelSpan":_143});
var _145=(_13f)?this.baseLayersDiv:this.dataLayersDiv;
_145.appendChild(_143);
_143.className="labSpanInactive";
_143.style.position="absolute";
_143.style.left=""+_13e*this.buttonWidth+"px";
if(_140){
_143.className="labSpanActive";
}
var _146=document.createElement("span");
_146.className="labelText";
if(_13c.options.displayName&&_13c.options.displayName!=null&&_13c.options.displayName!=""){
_146.innerHTML=_13c.options.displayName;
}else{
if(_13c.name=="Google Hybrid"){
_146.innerHTML="Aerial View";
}else{
if(_13c.name=="SlippyMap Navteq"||_13c.name=="SlippyMap W2GI"){
_146.innerHTML="Street View "+(_13e+1);
}else{
_146.innerHTML=_13c.name;
}
}
}
_143.appendChild(_146);
}
}
return this.div;
},onInputClick:function(e){
if(!this.inputElem.disabled){
if(this.inputElem.type=="radio"){
this.inputElem.checked=true;
this.layer.map.setBaseLayer(this.layer);
}else{
this.inputElem.checked=!this.inputElem.checked;
this.layerSwitcher.updateMap();
}
}
OpenLayers.Event.stop(e);
},onLayerClick:function(e){
this.updateMap();
},updateMap:function(){
for(var i=0,len=this.baseLayers.length;i<len;i++){
var _14b=this.baseLayers[i];
if(_14b.inputElem.checked){
this.map.setBaseLayer(_14b.layer,false);
}
}
for(var i=0,len=this.dataLayers.length;i<len;i++){
var _14b=this.dataLayers[i];
_14b.layer.setVisibility(_14b.inputElem.checked);
}
},loadContents:function(){
this.div.id="layerSwitcherMain";
this.layersDiv=document.createElement("div");
this.layersDiv.id="layerSwitcherMain_layersDiv";
this.baseLayersDiv=document.createElement("div");
this.baseLayersDiv.id="layerSwitcherMain_baseLayersDiv";
this.dataLayersDiv=document.createElement("span");
this.dataLayersDiv.style.display="none";
this.layersDiv.appendChild(this.baseLayersDiv);
this.div.appendChild(this.layersDiv);
OpenLayers.Event.observe(this.div,"mouseup",OpenLayers.Function.bindAsEventListener(this.mouseUp,this));
OpenLayers.Event.observe(this.div,"click",this.ignoreEvent);
OpenLayers.Event.observe(this.div,"mousedown",OpenLayers.Function.bindAsEventListener(this.mouseDown,this));
OpenLayers.Event.observe(this.div,"dblclick",this.ignoreEvent);
var _14c=OpenLayers.Util.getImagesLocation();
var sz=new OpenLayers.Size(18,18);
},ignoreEvent:function(evt){
OpenLayers.Event.stop(evt);
},mouseDown:function(evt){
this.isMouseDown=true;
this.ignoreEvent(evt);
},mouseUp:function(evt){
if(this.isMouseDown){
this.isMouseDown=false;
this.ignoreEvent(evt);
}
},CLASS_NAME:"OpenLayers.Control.LayerSwitcher"});
OpenLayers.Renderer.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(_151){
if(!this.supported()){
return;
}
if(!document.namespaces.olv){
document.namespaces.add("olv",this.xmlns);
var _152=document.createStyleSheet();
_152.addRule("olv\\:shape","behavior: url(#default#VML); "+"position: absolute; display: inline-block;");
_152.addRule("olv\\:rect","behavior: url(#default#VML); "+"position: absolute; display: inline-block;");
_152.addRule("olv\\:oval","behavior: url(#default#VML); "+"position: absolute; display: inline-block;");
_152.addRule("olv\\:fill","behavior: url(#default#VML); "+"position: absolute; display: inline-block;");
_152.addRule("olv\\:stroke","behavior: url(#default#VML); "+"position: absolute; display: inline-block;");
_152.addRule("olv\\:imagedata","behavior: url(#default#VML); "+"position: absolute; display: inline-block;");
_152.addRule("olv\\:group","behavior: url(#default#VML); "+"position: absolute; display: inline-block;");
}
OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);
this.offset={x:0,y:0};
},destroy:function(){
OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments);
},supported:function(){
return !!(document.namespaces);
},setExtent:function(_153,_154){
OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);
var _155=this.getResolution();
var left=_153.left/_155;
var top=_153.top/_155-this.size.h;
if(_154){
this.offset={x:left,y:top};
left=0;
top=0;
}else{
left=left-this.offset.x;
top=top-this.offset.y;
}
var org=left+" "+top;
this.root.setAttribute("coordorigin",org);
var size=this.size.w+" "+this.size.h;
this.root.setAttribute("coordsize",size);
this.root.style.flip="y";
return true;
},setSize:function(size){
if(OpenLayers.Renderer){
OpenLayers.Renderer.prototype.setSize.apply(this,arguments);
if(this.size&&this.size.w&&this.size.h&&this.rendererRoot&&this.root){
this.rendererRoot.style.width=this.size.w+"px";
this.rendererRoot.style.height=this.size.h+"px";
this.root.style.width=this.size.w+"px";
this.root.style.height=this.size.h+"px";
}
}
},getNodeType:function(_15b,_15c){
var _15d=null;
switch(_15b.CLASS_NAME){
case "OpenLayers.Geometry.Point":
if(_15c.externalGraphic){
_15d="olv:rect";
}else{
if(this.isComplexSymbol(_15c.graphicName)){
_15d="olv:shape";
}else{
_15d="olv:oval";
}
}
break;
case "OpenLayers.Geometry.Rectangle":
_15d="olv:rect";
break;
case "OpenLayers.Geometry.LineString":
case "OpenLayers.Geometry.LinearRing":
case "OpenLayers.Geometry.Polygon":
case "OpenLayers.Geometry.Curve":
case "OpenLayers.Geometry.Surface":
_15d="olv:shape";
break;
default:
break;
}
return _15d;
},setStyle:function(node,_15f,_160,_161){
_15f=_15f||node._style;
_160=_160||node._options;
var _162=1;
if(node._geometryClass=="OpenLayers.Geometry.Point"){
if(_15f.externalGraphic){
var _163=_15f.graphicWidth||_15f.graphicHeight;
var _164=_15f.graphicHeight||_15f.graphicWidth;
_163=_163?_163:_15f.pointRadius*2;
_164=_164?_164:_15f.pointRadius*2;
var _165=this.getResolution();
var _166=(_15f.graphicXOffset!=undefined)?_15f.graphicXOffset:-(0.5*_163);
var _167=(_15f.graphicYOffset!=undefined)?_15f.graphicYOffset:-(0.5*_164);
node.style.left=((_161.x/_165-this.offset.x)+_166).toFixed();
node.style.top=((_161.y/_165-this.offset.y)-(_167+_164)).toFixed();
node.style.width=_163+"px";
node.style.height=_164+"px";
node.style.flip="y";
_15f.fillColor="none";
_160.isStroked=false;
}else{
if(this.isComplexSymbol(_15f.graphicName)){
var _168=this.importSymbol(_15f.graphicName);
var _169=_168.extent;
var _163=_169.getWidth();
var _164=_169.getHeight();
node.setAttribute("path",_168.path);
node.setAttribute("coordorigin",_169.left+","+_169.bottom);
node.setAttribute("coordsize",_163+","+_164);
node.style.left=_169.left+"px";
node.style.top=_169.bottom+"px";
node.style.width=_163+"px";
node.style.height=_164+"px";
this.drawCircle(node,_161,_15f.pointRadius);
node.style.flip="y";
}else{
this.drawCircle(node,_161,_15f.pointRadius);
}
}
}
if(_160.isFilled){
node.setAttribute("fillcolor",_15f.fillColor);
}else{
node.setAttribute("filled","false");
}
var _16a=node.getElementsByTagName("fill");
var fill=(_16a.length==0)?null:_16a[0];
if(!_160.isFilled){
if(fill){
node.removeChild(fill);
}
}else{
if(!fill){
fill=this.createNode("olv:fill",node.id+"_fill");
}
fill.setAttribute("opacity",_15f.fillOpacity);
if(node._geometryClass=="OpenLayers.Geometry.Point"&&_15f.externalGraphic){
if(_15f.graphicOpacity){
fill.setAttribute("opacity",_15f.graphicOpacity);
}
fill.setAttribute("src",_15f.externalGraphic);
fill.setAttribute("type","frame");
if(!(_15f.graphicWidth&&_15f.graphicHeight)){
fill.aspect="atmost";
}
}
if(fill.parentNode!=node){
node.appendChild(fill);
}
}
if(typeof _15f.rotation!="undefined"){
if(_15f.externalGraphic){
this.graphicRotate(node,_166,_167);
fill.setAttribute("opacity",0);
}else{
node.style.rotation=_15f.rotation;
}
}
if(_160.isStroked){
node.setAttribute("strokecolor",_15f.strokeColor);
node.setAttribute("strokeweight",_15f.strokeWidth+"px");
}else{
node.setAttribute("stroked","false");
}
var _16c=node.getElementsByTagName("stroke");
var _16d=(_16c.length==0)?null:_16c[0];
if(!_160.isStroked){
if(_16d){
node.removeChild(_16d);
}
}else{
if(!_16d){
_16d=this.createNode("olv:stroke",node.id+"_stroke");
node.appendChild(_16d);
}
_16d.setAttribute("opacity",_15f.strokeOpacity);
_16d.setAttribute("endcap",!_15f.strokeLinecap||_15f.strokeLinecap=="butt"?"flat":_15f.strokeLinecap);
_16d.setAttribute("dashstyle",this.dashStyle(_15f));
}
if(_15f.cursor!="inherit"&&_15f.cursor!=null){
node.style.cursor=_15f.cursor;
}
return node;
},graphicRotate:function(node,_16f,_170){
var _171=_171||node._style;
var _172=node._options;
var _173,size;
if(!(_171.graphicWidth&&_171.graphicHeight)){
var img=new Image();
img.onreadystatechange=OpenLayers.Function.bind(function(){
if(img.readyState=="complete"||img.readyState=="interactive"){
_173=img.width/img.height;
size=Math.max(_171.pointRadius*2,_171.graphicWidth||0,_171.graphicHeight||0);
_16f=_16f*_173;
_171.graphicWidth=size*_173;
_171.graphicHeight=size;
this.graphicRotate(node,_16f,_170);
}
},this);
img.src=_171.externalGraphic;
return;
}else{
size=Math.max(_171.graphicWidth,_171.graphicHeight);
_173=_171.graphicWidth/_171.graphicHeight;
}
var _176=Math.round(_171.graphicWidth||size*_173);
var _177=Math.round(_171.graphicHeight||size);
node.style.width=_176+"px";
node.style.height=_177+"px";
var _178=document.getElementById(node.id+"_image");
if(!_178){
_178=this.createNode("olv:imagedata",node.id+"_image");
node.appendChild(_178);
}
_178.style.width=_176+"px";
_178.style.height=_177+"px";
_178.src=_171.externalGraphic;
_178.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader("+"src='', sizingMethod='scale')";
var _179=_171.rotation*Math.PI/180;
var _17a=Math.sin(_179);
var _17b=Math.cos(_179);
var _17c="progid:DXImageTransform.Microsoft.Matrix(M11="+_17b+",M12="+(-_17a)+",M21="+_17a+",M22="+_17b+",SizingMethod='auto expand')\n";
var _17d=_171.graphicOpacity||_171.fillOpacity;
if(_17d&&_17d!=1){
_17c+="progid:DXImageTransform.Microsoft.BasicImage(opacity="+_17d+")\n";
}
node.style.filter=_17c;
var _17e=new OpenLayers.Geometry.Point(-_16f,-_170);
var _17f=new OpenLayers.Bounds(0,0,_176,_177).toGeometry();
_17f.rotate(_171.rotation,_17e);
var _180=_17f.getBounds();
node.style.left=Math.round(parseInt(node.style.left)+_180.left)+"px";
node.style.top=Math.round(parseInt(node.style.top)-_180.bottom)+"px";
},postDraw:function(node){
var _182=node._style.fillColor;
var _183=node._style.strokeColor;
if(_182=="none"&&node.getAttribute("fillcolor")!=_182){
node.setAttribute("fillcolor",_182);
}
if(_183=="none"&&node.getAttribute("strokecolor")!=_183){
node.setAttribute("strokecolor",_183);
}
},setNodeDimension:function(node,_185){
var bbox=_185.getBounds();
if(bbox){
var _187=this.getResolution();
var _188=new OpenLayers.Bounds((bbox.left/_187-this.offset.x).toFixed(),(bbox.bottom/_187-this.offset.y).toFixed(),(bbox.right/_187-this.offset.x).toFixed(),(bbox.top/_187-this.offset.y).toFixed());
node.style.left=_188.left+"px";
node.style.top=_188.top+"px";
node.style.width=_188.getWidth()+"px";
node.style.height=_188.getHeight()+"px";
node.coordorigin=_188.left+" "+_188.top;
node.coordsize=_188.getWidth()+" "+_188.getHeight();
}
},dashStyle:function(_189){
var dash=_189.strokeDashstyle;
switch(dash){
case "solid":
case "dot":
case "dash":
case "dashdot":
case "longdash":
case "longdashdot":
return dash;
default:
var _18b=dash.split(/[ ,]/);
if(_18b.length==2){
if(1*_18b[0]>=2*_18b[1]){
return "longdash";
}
return (_18b[0]==1||_18b[1]==1)?"dot":"dash";
}else{
if(_18b.length==4){
return (1*_18b[0]>=2*_18b[1])?"longdashdot":"dashdot";
}
}
return "solid";
}
},createNode:function(type,id){
var node=document.createElement(type);
if(id){
node.setAttribute("id",id);
}
node.setAttribute("unselectable","on",0);
node.onselectstart=function(){
return (false);
};
return node;
},nodeTypeCompare:function(node,type){
var _191=type;
var _192=_191.indexOf(":");
if(_192!=-1){
_191=_191.substr(_192+1);
}
var _193=node.nodeName;
_192=_193.indexOf(":");
if(_192!=-1){
_193=_193.substr(_192+1);
}
return (_191==_193);
},createRenderRoot:function(){
return this.nodeFactory(this.container.id+"_vmlRoot","div");
},createRoot:function(){
return this.nodeFactory(this.container.id+"_root","olv:group");
},drawPoint:function(node,_195){
return this.drawCircle(node,_195,1);
},drawCircle:function(node,_197,_198){
if(!isNaN(_197.x)&&!isNaN(_197.y)){
var _199=this.getResolution();
node.style.left=((_197.x/_199-this.offset.x).toFixed()-_198)+"px";
node.style.top=((_197.y/_199-this.offset.y).toFixed()-_198)+"px";
var _19a=_198*2;
node.style.width=_19a+"px";
node.style.height=_19a+"px";
return node;
}
return false;
},drawLineString:function(node,_19c){
return this.drawLine(node,_19c,false);
},drawLinearRing:function(node,_19e){
return this.drawLine(node,_19e,true);
},drawLine:function(node,_1a0,_1a1){
this.setNodeDimension(node,_1a0);
var _1a2=this.getResolution();
var _1a3=_1a0.components.length;
var _1a4=new Array(_1a3);
var comp,x,y;
for(var i=0;i<_1a3;i++){
comp=_1a0.components[i];
x=(comp.x/_1a2-this.offset.x);
y=(comp.y/_1a2-this.offset.y);
_1a4[i]=" "+x.toFixed()+","+y.toFixed()+" l ";
}
var end=(_1a1)?" x e":" e";
node.path="m"+_1a4.join("")+end;
return node;
},drawPolygon:function(node,_1ab){
this.setNodeDimension(node,_1ab);
var _1ac=this.getResolution();
var path=[];
var _1ae,i,j,len,ilen,comp,x,y;
for(j=0,len=_1ab.components.length;j<len;j++){
_1ae=_1ab.components[j];
path.push("m");
for(i=0,ilen=_1ae.components.length;i<ilen;i++){
comp=_1ae.components[i];
x=comp.x/_1ac-this.offset.x;
y=comp.y/_1ac-this.offset.y;
path.push(" "+x.toFixed()+","+y.toFixed());
if(i==0){
path.push(" l");
}
}
path.push(" x ");
}
path.push("e");
node.path=path.join("");
return node;
},drawRectangle:function(node,_1b7){
var _1b8=this.getResolution();
node.style.left=(_1b7.x/_1b8-this.offset.x)+"px";
node.style.top=(_1b7.y/_1b8-this.offset.y)+"px";
node.style.width=_1b7.width/_1b8+"px";
node.style.height=_1b7.height/_1b8+"px";
return node;
},drawSurface:function(node,_1ba){
this.setNodeDimension(node,_1ba);
var _1bb=this.getResolution();
var path=[];
var comp,x,y;
for(var i=0,len=_1ba.components.length;i<len;i++){
comp=_1ba.components[i];
x=comp.x/_1bb-this.offset.x;
y=comp.y/_1bb-this.offset.y;
if((i%3)==0&&(i/3)==0){
path.push("m");
}else{
if((i%3)==1){
path.push(" c");
}
}
path.push(" "+x+","+y);
}
path.push(" x e");
node.path=path.join("");
return node;
},importSymbol:function(_1c2){
var id=this.container.id+"-"+_1c2;
var _1c4=this.symbolCache[id];
if(_1c4){
return _1c4;
}
var _1c5=OpenLayers.Renderer.symbol[_1c2];
if(!_1c5){
throw new Error(_1c2+" is not a valid symbol name");
return;
}
var _1c6=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);
var _1c7=["m"];
for(var i=0;i<_1c5.length;i=i+2){
x=_1c5[i];
y=_1c5[i+1];
_1c6.left=Math.min(_1c6.left,x);
_1c6.bottom=Math.min(_1c6.bottom,y);
_1c6.right=Math.max(_1c6.right,x);
_1c6.top=Math.max(_1c6.top,y);
_1c7.push(x);
_1c7.push(y);
if(i==0){
_1c7.push("l");
}
}
_1c7.push("x e");
var path=_1c7.join(" ");
_1c4={path:path,extent:_1c6};
this.symbolCache[id]=_1c4;
return _1c4;
},CLASS_NAME:"OpenLayers.Renderer.VML"});
OpenLayers.Icon.IconFromTemplate=OpenLayers.Class.create();
OpenLayers.Icon.IconFromTemplate.prototype=OpenLayers.Class.inherit(OpenLayers.Icon,{bubbleid:null,initialize:function(_1ca){
var img=_1ca.getElementsByTagName("img")[0];
var url=img._src?img._src:img.src;
var size=this._getIconSize(_1ca);
OpenLayers.Icon.prototype.initialize.apply(this,[url,size,null,calculateOffset]);
this.bubbleid=_1ca.getAttribute("bubbleid");
var text=_1ca.getElementsByTagName("div")[0];
if(text){
this.imageDiv.appendChild(text);
}
Element.extend(this.imageDiv);
this.imageDiv.addClassName("icon");
function calculateOffset(){
return new OpenLayers.Pixel(_1ca.readAttribute("offsetx"),_1ca.readAttribute("offsety"));
};
},_getIconSize:function(_1cf){
return new OpenLayers.Size(_1cf.readAttribute("width"),_1cf.readAttribute("height"));
},CLASS_NAME:"OpenLayers.Icon.IconFromTemplate"});
OpenLayers.Control.MapSlider=OpenLayers.Class.create();
OpenLayers.Control.MapSlider.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{panelWidth:null,panelHeight:null,mapMarginLeft:null,mapMarginRight:null,mapMarginTop:null,mapMarginBottom:null,panel:null,effectType:"slide",location:"left",blockMoreEffects:false,initialize:function(_1d0,_1d1,_1d2){
OpenLayers.Control.prototype.initialize.apply(this,arguments);
if(_1d0){
this.location=_1d0;
}
if(_1d1){
this.effectType=_1d1;
}
if(_1d2){
this.panel=_1d2;
}
},destroy:function(){
this.panelWidth=null;
this.mapMarginLeft=null;
this.mapMarginRight=null;
this.mapMarginTop=null;
this.mapMarginBottom=null;
this.effectType=null;
this.location=null;
this.panel=null;
},setMap:function(map){
OpenLayers.Control.prototype.setMap.apply(this,arguments);
if(this.panel==null){
this.panel=this.map.smap.locator.panel;
}
this.panelWidth=this.panel.getStyle("width");
this.panelHeight=this.panel.getStyle("height");
this.mapMarginLeft=$(this.map.div).getStyle("marginLeft");
this.mapMarginRight=$(this.map.div).getStyle("marginRight");
this.mapMarginTop=$(this.map.div).getStyle("marginTop");
this.mapMarginBottom=$(this.map.div).getStyle("marginBottom");
},_setPosition:function(){
switch(this.location){
case "left":
this.div.style.left=0+"px";
this.div.style.top=this.map.size.h/2+"px";
break;
case "right":
this.div.style.right=0+"px";
this.div.style.top=this.map.size.h/2+"px";
break;
case "top":
this.div.style.left=this.map.size.w/2+"px";
this.div.style.top=0+"px";
break;
case "bottom":
this.div.style.left=this.map.size.w/2+"px";
this.div.style.bottom=0+"px";
break;
}
},draw:function(){
OpenLayers.Control.prototype.draw.apply(this,arguments);
this._addSlider();
this._addObservers.bind(this).defer();
this._setPosition();
return this.div;
},_addSlider:function(){
var sz=new OpenLayers.Size(20,20);
this.hideArrow=document.createElement("div");
this.showArrow=document.createElement("div");
Element.extend(this.hideArrow);
Element.extend(this.showArrow);
this.hideArrow.style.position="relative";
this.showArrow.style.position="relative";
this.hideArrow.className="olMapSliderHidePanel";
this.showArrow.className="olMapSliderShowPanel";
this.div.appendChild(this.hideArrow);
this.div.appendChild(this.showArrow);
this.showArrow.hide();
},_addObservers:function(){
OpenLayers.Event.observe(window,"resize",this._updateSize.bindAsEventListener(this));
OpenLayers.Event.observe(this.hideArrow,"click",this._hide.bindAsEventListener(this));
OpenLayers.Event.observe(this.showArrow,"click",this._show.bindAsEventListener(this));
},_hide:function(_1d5){
OpenLayers.Event.stop(_1d5);
if(this.blockMoreEffects==true){
return;
}else{
this.blockMoreEffects=true;
}
switch(this.effectType){
case "slide":
this._hideSlide();
break;
case "appear":
this._hideAppear();
break;
case "blind":
this._hideBlind();
break;
default:
break;
}
this.hideArrow.hide();
this.showArrow.show();
},_show:function(_1d6){
if(this.blockMoreEffects==true){
return;
}else{
this.blockMoreEffects=true;
}
OpenLayers.Event.stop(_1d6);
switch(this.effectType){
case "slide":
this._showSlide();
break;
case "appear":
this._showAppear();
break;
case "blind":
this._showBlind();
break;
default:
break;
}
this.showArrow.hide();
this.hideArrow.show();
},_hideSlide:function(){
switch(this.location){
case "left":
new Effect.Morph(this.panel,{style:{width:"0px"},duration:0.8});
new Effect.Morph(this.map.div,{style:{marginLeft:"0px"},afterFinish:function(){
this.panel.style.display="none";
this._unblock();
}.bind(this)});
break;
case "right":
new Effect.Morph(this.panel,{style:{width:"0px"},duration:0.8});
new Effect.Morph(this.map.div,{style:{marginRight:"0px"},afterFinish:function(){
this.panel.style.display="none";
this._unblock();
}.bind(this)});
break;
case "top":
new Effect.Morph(this.panel,{style:{width:"0px"},duration:0.8});
new Effect.Morph(this.map.div,{style:{marginTop:"0px"},delay:0.8,afterFinish:function(){
this.panel.style.display="none";
this._unblock();
}.bind(this)});
break;
case "bottom":
new Effect.Morph(this.panel,{style:{width:"0px"},duration:0.8});
new Effect.Morph(this.map.div,{style:{marginBottom:"0px"},delay:0.8,afterFinish:function(){
this.panel.style.display="none";
this._unblock();
}.bind(this)});
break;
default:
break;
}
},_showSlide:function(){
switch(this.location){
case "left":
this.panel.style.display="block";
new Effect.Morph(this.map.div,{style:{marginLeft:this.mapMarginLeft},duration:0.8});
new Effect.Morph(this.panel,{style:{width:this.panelWidth},duration:0.8,afterFinish:this._unblock.bind(this)});
break;
case "right":
this.panel.style.display="block";
new Effect.Morph(this.map.div,{style:{marginRight:this.mapMarginRight},duration:0.8});
new Effect.Morph(this.panel,{style:{width:this.panelWidth},duration:0.8,afterFinish:this._unblock.bind(this)});
break;
case "top":
new Effect.Morph(this.map.div,{style:{marginTop:this.mapMarginTop},duration:0.8,afterFinish:function(){
this.panel.style.display="block";
}.bind(this)});
new Effect.Morph(this.panel,{style:{width:this.panelWidth},duration:0.8,delay:0.8,afterFinish:this._unblock.bind(this)});
break;
case "bottom":
new Effect.Morph(this.map.div,{style:{marginBottom:this.mapMarginBottom},duration:0.8,afterFinish:function(){
this.panel.style.display="block";
}.bind(this)});
new Effect.Morph(this.panel,{style:{width:this.panelWidth},duration:0.8,delay:0.8,afterFinish:this._unblock.bind(this)});
default:
break;
}
},_hideAppear:function(){
switch(this.location){
case "left":
new Effect.Opacity(this.panel,{duration:0.8,from:1,to:0});
new Effect.Morph(this.panel,{style:{width:"0px"},delay:0.8});
new Effect.Morph(this.map.div,{style:{marginLeft:"0px"},delay:0.8,afterFinish:this._unblock.bind(this)});
break;
case "right":
new Effect.Opacity(this.panel,{duration:0.8,from:1,to:0});
new Effect.Morph(this.panel,{style:{width:"0px"},delay:0.8});
new Effect.Morph(this.map.div,{style:{marginRight:"0px"},delay:0.8,afterFinish:this._unblock.bind(this)});
break;
case "top":
new Effect.Opacity(this.panel,{duration:0.8,from:1,to:0,afterFinish:function(){
this.panel.style.display="none";
}.bind(this)});
new Effect.Morph(this.map.div,{style:{marginTop:"0px"},delay:0.8,afterFinish:this._unblock.bind(this)});
break;
case "bottom":
new Effect.Opacity(this.panel,{duration:0.8,from:1,to:0,afterFinish:function(){
this.panel.style.display="none";
}.bind(this)});
new Effect.Morph(this.map.div,{style:{marginBottom:"0px"},delay:0.8,afterFinish:this._unblock.bind(this)});
break;
}
},_showAppear:function(){
switch(this.location){
case "left":
new Effect.Morph(this.panel,{style:{width:this.panelWidth},duration:0.8});
new Effect.Morph(this.map.div,{style:{marginLeft:this.mapMarginLeft},duration:0.8});
new Effect.Opacity(this.panel,{duration:0.8,from:0,to:1,delay:0.8,afterFinish:this._unblock.bind(this)});
break;
case "right":
new Effect.Morph(this.panel,{style:{width:this.panelWidth},duration:0.8});
new Effect.Morph(this.map.div,{style:{marginRight:this.mapMarginRight},duration:0.8});
new Effect.Opacity(this.panel,{duration:0.8,from:0,to:1,delay:0.8,afterFinish:this._unblock.bind(this)});
break;
case "top":
new Effect.Morph(this.map.div,{style:{marginTop:this.mapMarginTop},afterFinish:function(){
this.panel.style.display="block";
}.bind(this)});
new Effect.Opacity(this.panel,{duration:0.8,from:0,to:1,delay:0.8,afterFinish:this._unblock.bind(this)});
break;
case "bottom":
new Effect.Morph(this.map.div,{style:{marginBottom:this.mapMarginBottom},afterFinish:function(){
this.panel.style.display="block";
}.bind(this)});
new Effect.Opacity(this.panel,{duration:0.8,from:0,to:1,delay:0.8,afterFinish:this._unblock.bind(this)});
break;
}
},_hideBlind:function(){
switch(this.location){
case "left":
new Effect.BlindUp(this.panel,{duration:0.8});
new Effect.Morph(this.map.div,{style:{marginLeft:"0px"},delay:0.8,afterFinish:this._unblock.bind(this)});
break;
case "right":
new Effect.BlindUp(this.panel,{duration:0.8});
new Effect.Morph(this.map.div,{style:{marginRight:"0px"},delay:0.8,afterFinish:this._unblock.bind(this)});
break;
case "top":
Effect.BlindUp(this.panel,{duration:0.8});
new Effect.Morph(this.map.div,{style:{marginTop:"0px"},duration:0.8,afterFinish:this._unblock.bind(this)});
break;
case "bottom":
Effect.BlindUp(this.panel,{duration:0.8});
new Effect.Morph(this.map.div,{style:{marginBottom:"0px"},duration:0.8,afterFinish:this._unblock.bind(this)});
break;
}
},_showBlind:function(){
switch(this.location){
case "left":
new Effect.BlindDown(this.panel,{duration:0.8,delay:0.8});
new Effect.Morph(this.map.div,{duration:0.8,style:{marginLeft:this.mapMarginLeft},afterFinish:this._unblock.bind(this)});
break;
case "right":
new Effect.BlindDown(this.panel,{duration:0.8,delay:0.8});
new Effect.Morph(this.map.div,{duration:0.8,style:{marginRight:this.mapMarginRight},afterFinish:this._unblock.bind(this)});
break;
case "top":
Effect.BlindDown(this.panel,{duration:0.8});
new Effect.Morph(this.map.div,{style:{marginTop:this.mapMarginTop},duration:0.8,afterFinish:this._unblock.bind(this)});
break;
case "bottom":
Effect.BlindDown(this.panel,{duration:0.8});
new Effect.Morph(this.map.div,{style:{marginBottom:this.mapMarginBottom},duration:0.8,afterFinish:this._unblock.bind(this)});
break;
}
},_unblock:function(){
this.blockMoreEffects=false;
},_updateSize:function(e){
this._setPosition();
},CLASS_NAME:"OpenLayers.Control.MapSlider"});
OpenLayers.Marker.DragabbleMarker=OpenLayers.Class.create();
OpenLayers.Marker.DragabbleMarker.prototype=OpenLayers.Class.inherit(OpenLayers.Marker,{mouseDragStart:null,mouseDragStartLonLat:null,geocoderAddresses:null,geocoderAddress:null,reverseGeocoderAddress:null,sphericalMercator:false,initialize:function(_1d8,icon,_1da){
OpenLayers.Marker.prototype.initialize.apply(this,arguments);
var _1db=_1da?_1da:false;
if(!_1db){
this._registerObservers();
}
},setSphericalMercator:function(_1dc){
this.sphericalMercator=_1dc;
},destroy:function(){
OpenLayers.Marker.prototype.destroy.apply(this,arguments);
this.mouseDragStart=null;
this.mouseDragStartLonLat=null;
this.geocoderAddresses=null;
this.geocoderAddress=null;
this.reverseGeocoderAddress=null;
},reverseGeocode:function(_1dd,_1de){
var _1df=(_1de&&_1de.country)?_1de.country:"";
var _1e0=new OpenLayers.LonLat(this.lonlat.lon,this.lonlat.lat);
if(this.sphericalMercator){
_1e0.transform(new OpenLayers.Projection("EPSG:900913"),new OpenLayers.Projection("EPSG:4326"));
}
var _1e1={longitude:_1e0.lon,latitude:+_1e0.lat,country:_1df};
ace.geo.reverse(_1e1,processResponse.bind(this),_1de);
function processResponse(_1e2){
this.reverseGeocoderAddress=_1e2;
this.geocoderAddress=null;
var _1e3=new OpenLayers.LonLat(_1e2.LONGITUDE,_1e2.LATITUDE);
if(this.sphericalMercator){
_1e3.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));
}
this.lonlat=_1e3;
this.country=_1e2.COUNTRY;
if(!_1dd){
return true;
}
try{
return _1dd(this);
}
catch(e){
ace.util.alert(e,{height:100});
}
};
},geocode:function(_1e4,_1e5,_1e6){
if(_1e4==""){
return;
}
ace.geo.code(_1e4,processResponse.bind(this),_1e6);
function processResponse(_1e7){
this.geocoderAddresses=_1e7;
this.reverseGeocoderAddress=null;
if(!_1e5){
return true;
}
try{
return _1e5(this);
}
catch(e){
ace.util.alert(e,{height:100});
}
};
},moveToLonLat:function(_1e8){
var px=this.map.getLayerPxFromLonLat(_1e8||this.lonlat);
this.moveTo(px);
},getAddress:function(){
if(this.geocoderAddress){
return this.geocoderAddress;
}
if(this.geocoderAddresses){
return this.geocoderAddresses[0];
}
if(this.reverseGeocoderAddress){
return this.reverseGeocoderAddress;
}
return {LONGITUDE:""+this.lonlat.lon,LATITUDE:""+this.lonlat.lat};
},_registerObservers:function(){
this.events.register("mousedown",this,this._markerDown);
this.events.registerPriority("mouseup",this,this._markerUp);
},_markerDown:function(evt){
this.map.events.registerPriority("mousemove",this,this._markerDrag);
this.mouseDragStartLonLat=this.map.getLonLatFromPixel(evt.xy);
evt.xy.x-=(this.map.div.offsets[0]-this.icon.imageDiv.offsets[0]);
evt.xy.y-=(this.map.div.offsets[1]-this.icon.imageDiv.offsets[1]);
this.mouseDragStart=evt.xy;
OpenLayers.Event.stop(evt);
},_markerDrag:function(evt){
if(!this.mouseDragStart){
return;
}
var _1ec=this.mouseDragStart.x-evt.xy.x;
var _1ed=this.mouseDragStart.y-evt.xy.y;
var _1ee=this.icon.imageDiv.style;
var newX=parseInt(_1ee.left)-_1ec;
var newY=parseInt(_1ee.top)-_1ed;
_1ee.left=newX+"px";
_1ee.top=newY+"px";
this.mouseDragStart=evt.xy;
OpenLayers.Event.stop(evt);
},_markerUp:function(evt){
if(!OpenLayers.Event.isLeftClick(evt)){
return;
}
this.map.events.unregister("mousemove",this,this._markerDrag);
this.geocoderAddress=null;
this.reverseGeocoderAddress=null;
var _1f2=this.map.getLonLatFromPixel(evt.xy);
var _1f3=_1f2.lon-this.mouseDragStartLonLat.lon;
var _1f4=_1f2.lat-this.mouseDragStartLonLat.lat;
this.lonlat=this.lonlat.add(_1f3,_1f4);
this.mouseDragStart=null;
OpenLayers.Event.stop(evt);
},CLASS_NAME:"OpenLayers.Marker.DragabbleMarker"});
var SlippyMap={locator:null,load:function(_1f5,_1f6,_1f7){
ace.template.initialize();
ace.util.checkNumberFormat();
SlippyMap.locator=new SlippyMap.Locator(_1f5,_1f6,_1f7);
},unload:function(){
if(SlippyMap.locator){
SlippyMap.locator.destroy();
SlippyMap.locator=null;
}
if(ace.template){
ace.template.destroy();
}
if(ace.cache){
ace.cache.destroy();
}
},VERSION_NUMBER:"1.74.4"};
SlippyMap.Popup=Class.create({smap:null,initialize:function(smap){
this.smap=smap;
this.smap.map.events.register("popupopen",this,this._popupOpen);
this.smap.map.events.register("popupclose",this,this._popupClose);
},destroy:function(){
this.smap.map.events.unregister("popupclose",this,this._popupClose);
this.smap.map.events.unregister("popupopen",this,this._popupOpen);
this.smap=null;
},_popupOpen:function(_1f9){
this._addObservers.bind(this,_1f9).defer();
var _1fa=this.smap.locator.panel.down();
ace.table.updateActiveRow(_1fa,_1f9.recnum);
var _1fb=ace.util.getCookie("locationuid");
var _1fc=$(_1f9.div).down(".make_default_loc");
if(_1fb&&_1fc){
if(_1fc.readAttribute("uid")==_1fb){
_1fc.checked=true;
}
}
},_popupClose:function(_1fd){
this.smap.map.removePopup(_1fd);
var _1fe=_1fd.recnum;
var _1ff=this.smap.proximityLayer.features[_1fe];
if(_1ff.popup){
_1ff.popup.destroy();
_1ff.popup=null;
}
var _200=this.smap.locator.panel.down();
ace.table.updateActiveRow(_200);
},_addObservers:function(_201){
var _202=$$(".bubble_close");
var _203=$$(".tab_label");
if(_202){
_202.each(function(e){
e.observe("click",_201.hide.bind(_201));
});
}
var form=Element.extend(_201.div.getElementsByTagName("form")[0]);
_203.each(function(_206){
Event.observe(_206,"click",this._selectTab.bind(this,_206,_201.div,form));
}.bind(this));
if(form){
if(form.visible()){
var _207=setInterval(function(){
Form.focusFirstElement(form);
clearInterval(_207);
},500);
}
this._addFormObservers(form);
}
_201.div.observe("click",function(_208){
if(!(_208.target.type&&_208.target.type=="checkbox")){
_208.stop();
}
var _209=$(_208.target).readAttribute("action");
switch(_209){
case "more_info":
var _20a=_208.target.readAttribute("recnum");
ace.table.oldrecords=ace.table.records.clone();
ace.table.selected=_20a;
var pois=ace.table.records.slice(_20a-1,_20a);
pois[0].RECNUM=1;
pois[0].POINUM=1;
this.smap.locator.clear();
ace.table.updateFromRecords(this.smap.locator.panel,pois,{NAME:"more_info"});
this.smap.proximityLayer.addPOIMarker(pois[0]);
this.smap.zoomToPOI(pois,1);
break;
case "make_default_loc":
this.smap.locator.proximitySearch._makeDefaultLocation(_208.target,_208.target.readAttribute("uid"));
break;
}
}.bind(this));
},_addFormObservers:function(form){
var from=form.getElementsByTagName("input")[0];
var _20e=form.getElementsByTagName("input")[1];
Event.observe(_20e,"click",function(_20f){
this.smap.locator.directionsSearch.bubbleSearch(_20f);
}.bind(this));
Event.observe(from,"keypress",function(_210){
if(_210.keyCode==Event.KEY_RETURN){
this.smap.locator.directionsSearch.bubbleSearch(_210);
}
}.bind(this));
var link=form.getElementsByTagName("a")[0];
if(link){
Event.observe(link,"click",function(_212){
_212.stop();
var dir=ace.util.select(form,"dir")[0];
if(link.innerHTML=="To"){
link.innerHTML="From";
dir.innerHTML="Get directions to:";
}else{
link.innerHTML="To";
dir.innerHTML="Get directions from:";
}
from.focus();
});
}
},_selectTab:function(_214,div,form){
var _217=$$(".tab_label").reject(function(e){
return !e.descendantOf("templates");
}).length;
var _219=$$(".tab_label").indexOf(_214)-_217;
var tabs=$$(".bubble_tab").reject(function(e){
return e.descendantOf("templates");
});
var _21c=$$(".bubble_tab_dual").reject(function(e){
return e.descendantOf("templates");
});
var _21e=$$(".tab_content").reject(function(e){
return e.descendantOf("templates");
});
tabs.each(function(tab,_221){
if(_219==_221){
_21e[_221].addClassName("activetabcontent");
_21e[_221].removeClassName("nonactivetabcontent");
tab.addClassName("activetab");
tab.removeClassName("nonactivetab");
if(form&&form.visible()){
Form.focusFirstElement(form);
}
}else{
_21e[_221].removeClassName("activetabcontent");
_21e[_221].addClassName("nonactivetabcontent");
tab.addClassName("nonactivetab");
tab.removeClassName("activetab");
}
}.bind(this));
_21c.each(function(tab,_223){
var id=tab.id;
if(_219==_223){
if(_21e.length==_21c.length){
_21e[_223].addClassName("activetabcontent");
_21e[_223].removeClassName("nonactivetabcontent");
}
tab.addClassName("active"+id);
tab.removeClassName("nonactivetab");
if(form&&form.visible()){
Form.focusFirstElement(form);
}
}else{
if(_21e.length==_21c.length){
_21e[_223].removeClassName("activetabcontent");
_21e[_223].addClassName("nonactivetabcontent");
}
tab.addClassName("nonactivetab");
tab.removeClassName("active"+id);
}
}.bind(this));
}});
SlippyMap.Util={addHistory:function(_225,_226){
if(!SlippyMap.locator){
return;
}
var _227="";
($("locator_search"))?_227="locator_search":_227="product_search";
var _228=$(_227).visible()?_227:"driving_directions";
var _229={formID:_228,qs:Form.serialize($(_228)),update:function(){
var form=$(this.formID);
if(!form.visible()){
var _22b=(this.formID==_227)?"driving_directions":_227;
$(_22b).hide();
form.show();
Form.focusFirstElement(form);
}
Form.deserialize(form,this.qs);
}};
var _22c={xml_request:_225,processResponse:_226,center:SlippyMap.locator.smap.map.getCenter(),zoom:SlippyMap.locator.smap.map.getZoom(),update:function(){
SlippyMap.locator.clear();
var _22d=ace.cache.get(this.xml_request);
if(_22d){
this.processResponse(_22d);
}
}};
ace.history.add([_229,_22c]);
},isSearchFormValid:function(form){
var _22f=true;
if(!form){
return null;
}
$(form).getInputs("text","addressline").each(function(e){
e.value=e.value.strip();
if(e.value==""){
_22f=false;
throw $break;
}
}.bind(this));
return _22f;
},lowerCaseObject:function(_231){
var obj={};
for(var key in _231){
obj[key.toLowerCase()]=_231[key];
}
return obj;
},getAddressline:function(_234){
var _235="";
var city="";
var _237="";
var _238="";
if(_234.ADDRESS1){
var _235=_234.ADDRESS1.blank()?"":_234.ADDRESS1.trim()+", ";
}
if(_234.CITY){
var city=_234.CITY.empty()?"":_234.CITY+", ";
}
if(_234.COUNTRY){
var _237=(_234.COUNTRY!="US")?_234.PROVINCE+" ":_234.STATE+" ";
}
if(_234.POSTALCODE){
var _238=_234.POSTALCODE.empty()?"":_234.POSTALCODE;
}
return _235+city+_237+_238;
}};
SlippyMap.IconBar=Class.create({initialize:function(_239){
this.locator=_239;
this._addObservers();
},destroy:function(){
this._removeObservers();
},printURL:function(page){
var url=location.href.substring(0,location.href.lastIndexOf("/")+1)+page;
var purl=url;
var form=this._getForm();
if(SlippyMap.Util.isSearchFormValid(form)){
var qs=Form.serialize(form);
url+="?form="+form.readAttribute("id")+"&"+qs;
if(this.locator.uid){
url+="&uid="+this.locator.uid;
}
if(this.locator.locatorType&&this.locator.locatorType=="product"&&this.locator.panel.innerHTML.length<10){
url=page+"?uid="+this.locator.uid;
}
}
return url;
},ddSendEmail:function(){
var url=this.locator.directionsSearch.mapurl;
url=url.gsub("getdirectionsmap","emaildirectionstart");
return url;
},ddSendSMS:function(){
var url=this.locator.directionsSearch.mapurl;
url=url.gsub("getdirectionsmap","smsdirectionstart");
return url;
},_addObservers:function(){
var _241=$("icon_bar");
if(!_241){
return;
}
var _242=$("page_print");
if(_242){
_242.observe("click",this._printPage);
}
var _243=$("page_email");
if(_243){
_243.observe("click",this._emailPage.bind(this));
}
var _244=$("page_link");
if(_244){
_244.observe("click",this._linkToPage.bind(this));
}
},_removeObservers:function(){
var _245=$("icon_bar");
if(!_245){
return;
}
var _246=$("page_print");
if(_246){
_246.stopObserving();
}
var _247=$("page_email");
if(_247){
_247.stopObserving();
}
var _248=$("page_link");
if(_248){
_248.stopObserving();
}
},_printPage:function(){
print();
},_emailPage:function(_249){
var form=this._getForm();
var url=this._getURL(form);
var _24c=$("page_email").getAttribute("subject");
location.href="mailto:?subject="+_24c+"&body="+encodeURIComponent(url);
},_linkToPage:function(){
var form=this._getForm();
var url=this._getURL(form);
var msg="<div id=\"LB_msg\">"+"<span>Paste this link into an email message or IM</span>"+"<p>"+"<input type=\"text\" onClick=\"activate(this)\" size=\"60\" value=\""+url+"\" />"+"</div>"+"</p>";
ace.util.alert(msg,{width:425,height:120});
},_getURL:function(form){
var _251=location.href.indexOf("?");
var url=(_251>0)?location.href.substring(0,_251):location.href;
_251=location.href.indexOf("#");
url=(_251>0)?url.substring(0,_251):url;
if(SlippyMap.Util.isSearchFormValid(form)){
var qs=Form.serialize(form);
url+="?form="+form.readAttribute("id")+"&"+qs;
}
return url;
},_getForm:function(){
var form=$("locator_search");
if(!form||!form.visible()){
form=$("driving_directions");
}
return form;
}});
SlippyMap.Locator=Class.create({panel:null,whereamiDiv:null,sku:null,uid:null,smap:null,iconBar:null,proximitySearch:null,directionsSearch:null,initialize:function(_255,_256,_257){
Object.extend(this,_257||{});
this.mapID=_255;
this.panel=$(_256);
if(_257.whereamiDiv&&_257.whereamiDiv!=null){
this.whereamiDiv=_257.whereamiDiv;
}
if(_257.ddpanel&&_257.ddpanel!=""){
this.ddpanel=_257.ddpanel;
}
(_257.formdataid)?this.formdataid=_257.formdataid:this.formdataid="locatorsearch";
this._setURLParams(false);
this._custom=new Custom(this);
if(_257.locatorType&&_257.locatorType!="product"&&(_257.onlineStores||_257.onlinePanel)){
this.productSearch=new SlippyMap.Search.ProximitySearch.Product(this);
}
if(_257.locatorType&&_257.locatorType=="product"){
this.iconBar=new SlippyMap.IconBar(this);
this.smap=new SlippyMap.Smap(this,_255,_257);
this.searchFormId="product_search";
this.proximitySearch=new SlippyMap.Search.ProximitySearch.Product(this);
this.directionsSearch=new SlippyMap.Search.DirectionsSearch(this);
}else{
if(!_257.locatorType||(_257.locatorType&&_257.locatorType=="locator")){
this.iconBar=new SlippyMap.IconBar(this);
this.smap=new SlippyMap.Smap(this,_255,_257);
this.searchFormId="locator_search";
this.proximitySearch=new SlippyMap.Search.ProximitySearch(this);
this.directionsSearch=new SlippyMap.Search.DirectionsSearch(this);
}
}
this._load(_257);
},destroy:function(){
this.panel.stopObserving();
this.panel=null;
this.smap.destroy();
this.smap=null;
this.iconBar.destroy();
this.iconBar=null;
this.proximitySearch.destroy();
this.proximitySearch=null;
this.directionsSearch.destroy();
this.directionsSearch=null;
},clear:function(){
this.panel.innerHTML="";
this.smap.clear();
ace.table.records.clear();
},_setURLParams:function(_258){
var _259=ace.util.retrieveGetVals();
this.url_params={prox:{},prod:{},etail:{}};
if(this.extra_params){
Object.extend(this.url_params,this.extra_params);
}
this.proximityExclude=["form","addressline"];
this.productExclude=["form","addressline"];
this.etailerExclude=["form","addressline"];
this.proximityNoStay=["geoip","clientkey"];
this.productNoStay=["geoip"];
this.etailerNoStay=["geoip"];
$H(_259).each(function(e){
if(_258){
if(e.key&&this.proximityExclude.indexOf(e.key)==-1&&this.proximityNoStay.indexOf(e.key)==-1){
this.url_params.prox[e.key]=e.value;
}
if(e.key&&this.productExclude.indexOf(e.key)==-1&&this.productNoStay.indexOf(e.key)==-1){
this.url_params.prod[e.key]=e.value;
}
if(e.key&&this.etailerExclude.indexOf(e.key)==-1&&this.etailerNoStay.indexOf(e.key)==-1){
this.url_params.etail[e.key]=e.value;
}
}else{
if(e.key&&this.proximityExclude.indexOf(e.key)==-1){
this.url_params.prox[e.key]=e.value;
}
if(e.key&&this.productExclude.indexOf(e.key)==-1){
this.url_params.prod[e.key]=e.value;
}
if(e.key&&this.etailerExclude.indexOf(e.key)==-1){
this.url_params.etail[e.key]=e.value;
}
}
}.bind(this));
},clearLocator:function(){
this.clear();
this.smap.proximityLayer.addCenterMarker(this.smap.map.center);
},displayInitialPOIs:function(xml){
ace.table.updateFromResponseXML(this.panel,xml);
var _25c=this.smap.zoomToPOIs();
this.smap.proximityLayer.update(_25c.getCenterLonLat());
},_load:function(_25d){
document.fire("w2gi:locatorload",{"options":_25d});
this._deserializeSearchForm();
if(location.href.include(this.panel)||location.href.include("driving_directions")||location.href.include(this.searchFormId)){
this._displayBookmark();
}else{
if(this.geoip||this.defaultLocation||this.autosearch){
if(this.geoip){
var _25e=document.createElement("input");
_25e.setAttribute("type","hidden");
_25e.setAttribute("id","geoip_state");
_25e.setAttribute("name","geoip");
_25e.setAttribute("value","start");
var _25f=$("locator_search");
if(_25f){
_25f.appendChild(_25e);
}
}
var _260=ace.util.getCookie("locationuid");
if((_260&&_260!=null&&this.defaultLocation)){
this.url_params.prox.uid=_260;
_25d.geoip=false;
_25d.formdataid="getlist";
}
if(this.url_params.prox.uid&&(this.url_params.prox.uid=="undefined"||this.url_params.prox.uid==null)){
this.url_params.prox.uid="";
}
var _261=(this.locatorType&&this.locatorType=="product")?this.url_params.prod:this.url_params.prox;
if(!_261){
_261={};
}
var _262={formdataID:_25d.formdataid,geoip:_25d.geoip,alertError:false,onError:this._bookmarkError.bind(this)};
if(this.autosearch){
_25d.formdataid="getlist";
_262.formdataID="getlist";
_262.objectName="StoreLocator";
_262.tagName="where";
}
if(this.defaultLocation){
Object.extend(_262,{"tagName":"where",objectName:"StoreLocator"});
}
if(_25d.formdataid&&_25d.formdataid!=null){
this.proximitySearch.search(_261,_262);
}else{
this.proximitySearch.search(_261,{"formdataID":this.formdataid,geoip:_25d.geoip,alertError:false,onError:this._bookmarkError.bind(this)});
}
}else{
var xml=ace.xml.getXML()[0];
if(xml){
if(xml.getElementsByTagName("poi").length>0){
this.displayInitialPOIs(xml);
this._addHistory();
}else{
this._bookmarkError();
}
}else{
this._bookmarkError();
}
if(this.proximitySearch){
var _264=this.panel.down("form");
if($(this.panel)&&_264){
Form.focusFirstElement(_264);
}
}
}
}
this._setURLParams(true);
},_deserializeSearchForm:function(){
var _265=$(this.searchFormId);
if(_265){
var _266=Object.toQueryString(this.url_params.prox);
Form.deserialize($(this.searchFormId),_266);
}
var _267=$("getlist_search");
if(_267){
Form.deserialize(_267,_266);
}
},_bookmarkError:function(xml){
if(this.proximitySearch){
var _269=$("geoip_state");
if(_269){
if(_269.value=="start"){
_269.setAttribute("value","1");
}else{
_269.setAttribute("value","0");
}
}
var lon=(this.defaultLon)?this.defaultLon:-98.15261705337687;
var lat=(this.defaultLat)?this.defaultLat:40.53681640918523;
var zoom=(this.defaultZoom)?this.defaultZoom:1;
var _26d=new OpenLayers.LonLat(lon,lat);
this.smap.map.setCenter(_26d,zoom);
if(this.whereamiDiv&&this.whereamiDiv!=null){
this.proximitySearch._updateLocation({});
}
var _26e=this.panel.down("form");
if($(this.panel)&&_26e){
Form.focusFirstElement(_26e);
}
}
document.fire("w2gi:proximitySearchError",{"xml":xml});
},_displayBookmark:function(){
var _26f=location.href.indexOf("?");
if(_26f!=-1){
if(!this.searchFormId){
this.searchFormId="locator_search";
}
var _270=ace.util.retrieveGetVals();
var _271=$("orig_country");
var _272=$("dest_country");
if(_271&&_272&&_270["dest_country"]&&_270["orig_country"]){
_271.value=_270["orig_country"];
_272.value=_270["dest_country"];
}
var _273=location.href.include(this.searchFormId)?this.searchFormId:"driving_directions";
if(_273){
var form=$(_273);
if(!form.visible()){
var _275=(_273==this.searchFormId)?"driving_directions":this.searchFormId;
if($(_275)){
$(_275).hide();
}
form.show();
}
Form.focusFirstElement(form);
var url=location.href.sub("form="+_273+"&","");
var qs=url.substring(url.indexOf("?")+1);
var _278=qs.split("&");
_278.each(function(e,i){
if(e.indexOf("addressline")!=-1){
_278[i]=e.gsub(/\+/," ");
}
}.bind(this));
qs=_278.join("&");
var _27b=(this.locatorType&&this.locatorType=="product")?this.url_params.prod:this.url_params.prox;
if(!_27b){
_27b={};
}
Form.deserialize(form,qs);
var _27c=(url.include("geoip=1"))?1:0;
if(this.lateDeserialize){
this._deserializeSearchForm();
}
var opts={onError:this._bookmarkError.bind(this),"geoip":_27c};
if(_273==this.searchFormId){
this.proximitySearch.search(form,opts);
}else{
if(this.directionsSearch){
this.directionsSearch.search(form);
}
}
}
}
},_addHistory:function(){
formHistory={qs:($(this.panel)&&$(this.panel).getInputs)?Form.serializeElements($(this.panel).getInputs("text","addressline")):"",update:function(){
var form=$(this.panel);
if(!form.visible()){
$("driving_directions").hide();
form.show();
Form.focusFirstElement(form);
}
Form.deserialize(form,this.qs);
}};
poiHistory={update:function(){
SlippyMap.locator.clear();
var xml=ace.xml.getXML()[0].getElementsByTagName("poi");
SlippyMap.locator.displayInitialPOIs(xml);
}};
ace.history.add([formHistory,poiHistory]);
}});
SlippyMap.Smap=Class.create({locator:null,map:null,popup:null,proximityLayer:null,routeLayer:null,routeMarkerLayer:null,slider:null,copyrightBottom:null,initialize:function(_280,_281,_282){
this.locator=_280;
var opts={scales:[50000000,20000000,10000000,4000000,1000000,500000,150000,100000,50000,25000,15000,6000],smap:this};
Object.extend(opts,_282||{});
var _284;
if(_282){
_284={highlight:(_282.highlight)?_282.highlight:false,highlightEffect:(_282.highlightEffect)?_282.highlightEffect:false};
}
this.map=this._initOpenLayers(_281,opts);
this.popup=new SlippyMap.Popup(this);
if(this.map.routeStyle&&this._isVectorLayerSupported()){
this.routeLayer=new SlippyMap.Layer.RouteVectorLayer(this,"Route vector");
}else{
this.routeLayer=new SlippyMap.Layer.RouteImageLayer(this,"Route image");
}
this.routeMarkerLayer=new SlippyMap.Layer.RouteMarkerLayer(this,"Route markers");
this.proximityLayer=new SlippyMap.Layer.ProximityLayer(this,"Proximity markers",_284);
this._addCopyright(this.map.div);
this.map.events.register("changebaselayer",this,this._updateCopyrightPosition);
this.map.events.register("click",this,this._closePopup);
this.copyrightBottom=$("w2gi_copyright").getStyle("bottom");
this._addAjaxActivityIndicator(this.map.div);
if(!this.map.disableClickTrack){
document.observe("w2gi:track",function(_285){
_285.stop();
ace.click.track(_285.memo);
});
}
if(Prototype.Browser.IE||Prototype.Browser.Gecko){
document.fire("w2gi:track",{action:"mapstartview",value:new Date().toString()});
window.onbeforeunload=function(){
document.fire("w2gi:track",{action:"mapendview",value:new Date().toString()});
};
}
},destroy:function(){
this.popup.destroy();
this.routeLayer.destroy();
this.routeMarkerLayer.destroy();
this.proximityLayer.destroy();
this.map.events.unregister("click",this,this._closePopup);
this.map.events.unregister("changebaselayer",this,this._updateCopyrightPosition);
if(!this.map.disableClickTrack){
document.stopObserving("w2gi:track");
}
},clear:function(){
this.proximityLayer.clear();
this.routeLayer.clear();
this.routeMarkerLayer.clear();
this.map.removePopups();
},zoomToPOIs:function(_286){
var _287=this.getPOIBounds(ace.table.records);
var _288;
if(this.locator.proximitySearch){
_288=this.locator.proximitySearch.centerPoint?this.locator.proximitySearch.centerPoint.clone():_287.getCenterLonLat();
}else{
_288=this.locator.productSearch.centerPoint?this.locator.productSearch.centerPoint.clone():_287.getCenterLonLat();
}
if(_288){
if(this.map.baseLayer.projection.toString()=="EPSG:900913"){
_288.transform(new OpenLayers.Projection("EPSG:4326"),this.map.baseLayer.projection);
}
}
if(!_286){
_287.extend(_288);
}
_287=this.padBounds(_287);
this.map.zoomToExtent(_287);
return _287;
},zoomToPOI:function(pois,_28a){
var _28b=this.getPOIBounds(pois);
if(!_28a){
_28b.extend(this.locator.proximitySearch.centerPoint);
}
this.map.zoomToExtent(_28b);
return _28b;
},findControl:function(_28c){
return this.map.controls.find(function(_28d){
return _28d.CLASS_NAME==_28c;
});
},padBounds:function(_28e){
var _28f=0.0125;
return new OpenLayers.Bounds(_28e.left-_28f,_28e.bottom-_28f,_28e.right+_28f,_28e.top+_28f);
},getPOIBounds:function(pois){
var _291=180;
var _292=-180;
var _293=90;
var _294=-90;
for(var i=0,len=pois.length;i<len;i++){
var lon=parseFloat(pois[i].LONGITUDE);
var lat=parseFloat(pois[i].LATITUDE);
if(isNaN(lon)||isNaN(lon)){
continue;
}
_291=Math.min(_291,lon);
_292=Math.max(_292,lon);
_293=Math.min(_293,lat);
_294=Math.max(_294,lat);
}
var _299=new OpenLayers.Bounds(_291,_293,_292,_294);
if(this.map.baseLayer.projection.toString()=="EPSG:900913"){
_299.transform(new OpenLayers.Projection("EPSG:4326"),this.map.baseLayer.projection);
}
return _299;
},_initOpenLayers:function(_29a,_29b){
var _29c=this._getSources();
var _29d=this._getLayers(_29c);
if(_29d[0].options){
Object.extend(_29b,_29d[0].options);
}
var map=new OpenLayers.Map(_29a,_29b);
map.addLayers(_29d);
return map;
},_updateCopyrightPosition:function(){
var _29f=this.map.baseLayer.CLASS_NAME;
switch(_29f){
case "OpenLayers.Layer.Yahoo":
$("w2gi_copyright").setStyle({bottom:"30px"});
break;
case "OpenLayers.Layer.VirtualEarth":
$("w2gi_copyright").setStyle({bottom:"50px"});
break;
default:
$("w2gi_copyright").setStyle({bottom:this.copyrightBottom});
}
(this.map.baseLayer.name=="SlippyMap Navteq")?$("navteq_copyright").show():$("navteq_copyright").hide();
(this.map.baseLayer.name=="SlippyMap Navteq")?$("navteqfooter").show():$("navteqfooter").hide();
((this.map.baseLayer.name=="SlippyMap Navteq")||(this.map.baseLayer.name=="SlippyMap W2GI"))?$("w2gi_copyright").show():$("w2gi_copyright").hide();
},_closePopup:function(){
var _2a0=this.map.popups[0];
if(_2a0){
this.map.events.triggerEvent("popupclose",_2a0);
}
},_getSources:function(){
var xml=ace.xml.getXML()[0].getElementsByTagName("sources")[0];
if(!xml){
xml=ace.xml.getXML()[0].getElementsByTagName("layer")[0];
}
return ace.xml.parse(xml);
},_getLayers:function(_2a2){
var _2a3=_2a2.map(function(_2a4){
var url=null;
var _2a6={};
var _2a7=_2a4.OPTIONS.evalJSON();
var _2a8=Object.extend(_2a6,_2a7);
switch(_2a4.NAME){
case "SlippyMap W2GI":
case "SlippyMap Navteq":
_2a6={g:"__base__",i:"PNG8",appkey:ace.xml.getXMLData("appkey")};
Object.extend(_2a8,_2a6);
url=$w(_2a4.IMAGEURL.gsub(","," "));
return new OpenLayers.Layer.KaMap(_2a4.NAME,url,_2a8,{buffer:0});
case "OpenLayers WMS":
url=$w(_2a4.IMAGEURL.gsub(","," "));
return new OpenLayers.Layer.WMS(_2a4.NAME,url,_2a8);
case "Google Satellite":
case "Google Normal":
case "Google Hybrid":
return new OpenLayers.Layer.Google(_2a4.NAME,_2a8);
case "Yahoo Regular":
case "Yahoo Satellite":
case "Yahoo Hybrid":
return new OpenLayers.Layer.Yahoo(_2a4.NAME,_2a8);
case "Virtual Earth Aerial":
case "Virtual Earth Road":
case "Virtual Earth Hybrid":
return new OpenLayers.Layer.VirtualEarth(_2a4.NAME,_2a8);
default:
throw new Error(_2a4.NAME+" - missing handler in Smap.js: _getLayers()");
}
});
return _2a3;
},_addCopyright:function(map){
var w2gi=new Element("div",{id:"w2gi_copyright"}).update("&#169; "+new Date().getFullYear()+" Where 2 Get It, Inc.");
var _2ab=new Element("div",{id:"navteq_copyright",style:"display: none;"}).update("&#169; "+new Date().getFullYear()+" NAVTEQ Corp.");
map.appendChild(w2gi);
map.appendChild(_2ab);
if(this.map.baseLayer&&this.map.baseLayer.name=="SlippyMap Navteq"){
_2ab.show();
if($("navteqfooter")){
$("navteqfooter").show();
}
}else{
if($("navteqfooter")){
$("navteqfooter").hide();
}
}
},_trackZoom:function(){
document.fire("w2gi:track",{action:"mapzoom",value:this.map.zoom});
},_trackPan:function(){
document.fire("w2gi:track",{action:"mappan",value:this.map.center.toShortString()});
},_addAjaxActivityIndicator:function(map){
var temp=$("ajax_activity");
if(!temp){
var img=new Element("img",{id:"ajax_activity",style:"display: none;",src:"/w2gi/images/indicator.gif"});
map.appendChild(img);
}
},_isVectorLayerSupported:function(){
return !!OpenLayers.Renderer.SVG.prototype.supported()||!!OpenLayers.Renderer.VML.prototype.supported();
}});
SlippyMap.Search=Class.create({locator:null,smap:null,searchForm:null,altSearchForm:null,initialize:function(_2af){
this.locator=_2af;
this.smap=_2af.smap;
this._addSearchObservers();
ace.util.loadLocale();
},destroy:function(){
this.altSearchForm=null;
this.searchForm=null;
},setBaseLayer:function(name){
if(this.smap.map.baseLayer.name!=name){
this.smap.map.setBaseLayer(this.layer);
return true;
}
return false;
},_addSearchObservers:function(){
if(!this.searchForm){
return;
}
var _2b1=this.searchForm.getInputs("text","addressline");
_2b1.each(function(_2b2){
Event.observe(_2b2,"keypress",function(_2b3){
if(_2b3.keyCode==Event.KEY_RETURN){
_2b3.stop();
this._search(_2b2.form);
var _2b4=$$(".pl_hide");
if(_2b4){
_2b4.each(function(e){
e.hide();
});
}
}
}.bind(this));
}.bind(this));
var _2b6=this.searchForm.getInputs("submit");
if(_2b6.size()==0){
_2b6=this.searchForm.select("#locator_submit");
}
if(_2b6.size()==0){
_2b6=this.searchForm.select("#directions_submit");
}
if(_2b6.size()!=0){
_2b6=_2b6[0];
Event.observe(_2b6,"click",function(_2b7){
_2b7.stop();
this._search(_2b6.form);
}.bind(this));
}
var _2b8=ace.util.select(this.searchForm,"search_toggle");
if(_2b8.size()>0){
_2b8=_2b8[0];
Event.observe(_2b8,"click",function(_2b9){
_2b9.stop();
this.searchForm.hide();
if(this.altSearchForm){
this.altSearchForm.show();
Form.focusFirstElement(this.altSearchForm);
}
}.bind(this));
}
},_validateSearchForm:function(form){
var _2bb=form.addressline;
var _2bc=this.locator.blankAddress?true:false;
if(!form){
return true;
}
if(!this._checkAddresses(_2bb)){
return false;
}
if(!_2bc&&!SlippyMap.Util.isSearchFormValid(form)){
var str=(custom_ob&&custom_ob.localeSwitch("validate_form"))?custom_ob.localeSwitch("validate_form"):"Please enter an address.";
ace.util.alert(str,{width:250,height:100});
return false;
}
return true;
},_checkAddresses:function(_2be){
var _2bf=true;
if(!_2be){
return true;
}
if(_2be.length){
i=_2be.length;
var e;
for(i;i>0;i--){
var e=_2be[i-1];
var _2c1="";
if(!e.include&&e.value){
_2c1=e.value;
}else{
_2c1=e;
}
if(!this._illegalStringCheck(_2c1)){
_2bf=false;
}
}
}else{
var e=_2be.value;
var _2c1="";
if(!e.include&&e.value){
_2c1=e.value;
}else{
_2c1=e;
}
if(!this._illegalStringCheck(_2c1)){
_2bf=false;
}
}
return _2bf;
},_illegalStringCheck:function(_2c2){
_2c2=(_2c2)?$(_2c2)+"":"";
if(_2c2&&_2c2.include&&(_2c2.include("!")||_2c2.include("$")||_2c2.include("%")||_2c2.include("^")||_2c2.include("*")||_2c2.include("(")||_2c2.include(")"))){
var str=(custom_ob&&custom_ob.localeSwitch("illegal_string"))?custom_ob.localeSwitch("illegal_string"):"Your search must not include !$%^*()";
ace.util.alert("Your search must not include !$%^*()");
return false;
}
return true;
},_addMapUrlImage:function(_2c4){
var img=$("map_url_image");
if(_2c4&&img){
var size=_2c4.match(/size=(\d+),(\d+)/);
if(size){
img.width=size[1];
img.height=size[2];
}
if(Prototype.Browser.IE6){
_2c4=_2c4.replace(/ /g,"%20");
}
img.src=_2c4;
}
},_customLayer:function(o){
var _2c8=custom.layerSwitchingRules;
var _2c9,_2ca=false;
var _2cb,_2cc=false;
for(var rule in _2c8){
_2c9=true;
for(var cond in _2c8[rule]){
_2cb=_2c8[rule][cond];
if(Object.isArray(_2cb)){
_2c9=(_2c9&&ace.util.evalExpression(o[cond.toUpperCase()],_2cb[1],_2cb[0]));
}else{
if(cond=="layer"){
_2cc=_2c8[rule][cond];
}
}
_2ca=_2c9;
if(!_2c9){
break;
}
}
if(_2ca){
return _2cc;
}
}
return false;
}});
if(!Custom){
var Custom=Class.create();
}
if(!custom_ob){
var custom_ob=null;
}
Custom.prototype={initialize:function(_2cf){
this.active_ob=null;
if(custom_ob&&custom_ob["name"]&&typeof custom_ob["name"]=="string"){
this.active_ob=new Custom[custom_ob["name"]](_2cf);
}else{
if(custom_ob&&custom_ob["name"]){
this.active_ob=[];
custom_ob["name"].each(function(e){
this.active_ob.push(new Custom[e](_2cf));
}.bind(this));
}
}
},VERSION_NUMBER:".3"};
SlippyMap.Search.ProximitySearch=Class.create(SlippyMap.Search,{cacheResults:false,searchRadius:null,dragStartCenter:null,centerPoint:null,layer:null,initialize:function(_2d1){
this.locator=_2d1;
var form=null;
if(this.locator.formdataid){
this.xmlId=this.locator.formdataid;
}else{
if($("locator_search")){
this.xmlId="locatorsearch";
}else{
this.xmlId="productsearch";
}
}
if($("locator_search")){
form=$("locator_search");
}else{
form=$("product_search");
}
this.searchForm=form;
this.altSearchForm=$("driving_directions");
this.searchedLonLat=false;
SlippyMap.Search.prototype.initialize.apply(this,arguments);
this._addListSearchObservers();
this.searchRadius=this._getSearchRadius(this.searchForm);
this.cacheResults=!this.smap.findControl("OpenLayers.Control.LocationManager");
if(_2d1.dynamicSearch){
this.smap.map.events.registerPriority("mousedown",this,this._onMapMouseDown);
this.smap.map.events.register("mouseup",this,this._onMapMouseUp);
}
this._addPanelObserver(this.smap.locator.panel);
(_2d1.pl_header&&_2d1.pl_header!="")?this._observeHeader(_2d1.pl_header):null;
this.locator.panel.observe("w2gi:sliceUpdated",function(_2d3){
_2d3.stop();
this._processSlice(_2d3.memo);
}.bind(this));
this.layer=this.smap.map.layers.find(function(_2d4){
return _2d4.name=="SlippyMap W2GI";
});
if($("search_country")){
var _2d5="US";
if(this.locator.COUNTRY){
_2d5=this.locator.COUNTRY;
}
if($("search_country").options&&$("search_country").options.length==0){
ace.collection.updateOptions("search_country","Country",_2d5);
}else{
if(this.locator.COUNTRY&&$("country").value&&$("search_country").value!=this.locator.COUNTRY){
$("search_country").value=this.locator.COUNTRY;
}
}
}
document.observe("w2gi:mapFormSearch",function(_2d6){
_2d6.stop();
if(this.locator.proximitySearch){
this._search(this.searchForm);
}
}.bind(this));
},destroy:function(){
if(this.locator.dynamicSearch){
this.smap.map.events.unregister("mousedown",this,this._onMapMouseDown);
this.smap.map.events.unregister("mouseup",this,this._onMapMouseUp);
}
this.cacheResults=null;
this.searchRadius=null;
this.dragStartCenter=null;
this.centerPoint=null;
SlippyMap.Search.prototype.destroy.apply(this,arguments);
},search:function(form,_2d8){
this.dynamicSearch=(_2d8&&_2d8.dynamicSearch)?true:false;
this.geoip=(_2d8&&_2d8.geoip&&_2d8.geoip==true)?true:false;
var opts={onHistory:SlippyMap.Util.addHistory,onError:function(xml){
var code=xml.getElementsByTagName("response")[0].getAttribute("code");
document.fire("w2gi:proximitySearchError",{"xml":xml});
if(code!=1){
if(this.locator.whereamiDiv&&this.locator.whereamiDiv!=null){
this._updateLocation({});
}
}
this.smap.locator.clearLocator.bind(this.smap.locator);
}.bind(this)};
Object.extend(opts,_2d8||{});
if(this.locator.extraOps){
Object.extend(opts,this.locator.extraOps);
}
ace.table.update(this.locator.panel,form,this._processResponse.bind(this),opts);
},_addListSearchObservers:function(){
var _2dc=$("getlist_search");
if(!_2dc){
return;
}
var _2dd=_2dc.getInputs();
_2dd.each(function(_2de){
Event.observe(_2de,"keypress",function(_2df){
if(_2df.keyCode==Event.KEY_RETURN){
_2df.stop();
this.search(_2de.form);
}
}.bind(this));
}.bind(this));
var _2e0=_2dc.getInputs("submit");
if(_2e0.size()==0){
_2e0=_2dc.select("#getlist_search");
}
if(_2e0.size()!=0){
_2e0=_2e0[0];
Event.observe(_2e0,"click",function(_2e1){
_2e1.stop();
this.search(_2e0.form);
}.bind(this));
}
},_observeHeader:function(_2e2){
$(_2e2).observe("click",function(e){
var _2e4="";
if(e.target){
_2e4=$(e.target).readAttribute("action");
}
switch(_2e4){
case "toggle_loc_search":
var winW=630;
if(parseInt(navigator.appVersion)>3){
if(navigator.appName=="Netscape"){
winW=window.innerWidth;
winH=window.innerHeight;
}
if(navigator.appName.indexOf("Microsoft")!=-1){
winW=document.body.offsetWidth;
winH=document.body.offsetHeight;
}
}
var _2e6=$("search_bar").getStyle("width");
_2e6=_2e6.substr(0,_2e6.length-2)*1;
var left=(winW-_2e6)/2;
if(left>0){
$("search_bar").setStyle({"left":left+"px"});
}
$("search_bar").toggle();
break;
}
}.bind(this));
},_addPanelObserver:function(_2e8){
Event.observe(_2e8,"click",function(_2e9){
if(!(_2e9.target.type&&_2e9.target.type=="checkbox")){
_2e9.stop();
}
if(!this.searchForm.visible()){
return;
}
var _2ea=_2e9.element().readAttribute("action");
switch(_2ea){
case "search_address":
var _2eb=_2e9.element().readAttribute("recnum");
var poi=ace.table.getRecord(_2eb);
var _2ed=this.searchForm.getInputs("text","addressline")[0];
_2ed.value=(poi.ADDRESS1?poi.ADDRESS1+", ":"")+(poi.CITY?poi.CITY+",":"")+(poi.STATE?" "+poi.STATE:"")+(poi.PROVINCE?" "+poi.PROVINCE:"")+(poi.POSTALCODE?" "+poi.POSTALCODE:"");
var _2ee={latitude:poi.LATITUDE,longitude:poi.LONGITUDE,country:poi.COUNTRY};
Object.extend(_2ee,this.locator.url_params.prox);
if(this.searchForm){
Object.extend(_2ee,this.searchForm.serialize(true));
}
this.search(_2ee,{formdataID:this.xmlId});
break;
case "map_view":
$(this.locator.mapID).toggle();
break;
}
}.bind(this));
},_search:function(form){
if(Object.isElement(form)&&!this._validateSearchForm(form)){
return;
}
this.searchRadius=this._getSearchRadius(form);
var _2f0=this._getNoChecks(form);
var _2f1=(this.locatorType&&this.locatorType=="product")?this.locator.url_params.prod:this.locator.url_params.prox;
var _2f2=form.serialize(true);
Object.extend(_2f1,_2f2);
if(this.locator.searchLimit&&this.locator.searchLimit>0){
Object.extend(_2f1,{"limit":this.locator.searchLimit});
}
var _2f3={formdataID:this.locator.formdataid,alertError:true};
if(this.locator.like){
Object.extend(_2f3,{"like":this.locator.like});
}
Object.extend(_2f1,_2f0);
this.search(_2f1,_2f3);
},_getNoChecks:function(form){
var _2f5=form.getInputs("checkbox");
var ret={};
_2f5.each(function(e,i){
if(!e.checked){
ret[e.name]="";
}
}.bind(this));
return ret;
},_onMapMouseDown:function(evt){
if(!this.searchRadius){
this.searchRadius=this._getSearchRadius(this.searchForm);
}
if(!this.dragStartCenter){
var _2fa=this.smap.map.center.clone();
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_2fa.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
this.dragStartCenter=_2fa;
}
},_onMapMouseUp:function(evt){
if(this.smap.routeMarkerLayer.layer.markers.length>0){
return;
}
if(!this.dragStartCenter){
return;
}
var _2fc=this.smap.map.center.clone();
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_2fc.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
var _2fd=Math.max(Math.abs(_2fc.lon-this.dragStartCenter.lon),Math.abs(_2fc.lat-this.dragStartCenter.lat));
var _2fe=(_2fd*69.04)/2;
var _2ff=this.searchRadius;
if(this.searchRadius.indexOf("|")){
var arr=this.searchRadius.split("|");
_2ff=arr[0];
}
var _301=parseFloat(_2ff)/2;
if(_2fe>_301){
this.searchLonLat(_2fc,{onError:this.locator.clearLocator.bind(this.locator),alertError:false});
this.dragStartCenter=null;
}
},searchLonLat:function(_302,_303){
var _304={longitude:_302.lon,latitude:_302.lat,searchradius:this.searchRadius};
if(this.searchForm){
Object.extend(_304,this.searchForm.serialize(true));
}
Object.extend(_304,this.locator.url_params.prox);
var opts=Object.extend({formdataID:this.xmlId,dynamicSearch:true},_303||{});
this.search(_304,opts);
this._updateAddressline(_304);
this.searchedLonLat=true;
},_getSearchRadius:function(form){
if(form.searchradius&&this.searchRadius){
return form.searchradius.value;
}
var _307=ace.xml.getNodeValue(ace.xml.getXML(form)[0].getElementsByTagName("searchradius")[0]);
if(_307){
return _307;
}
var _308=this.smap.map.calculateBounds();
if(!_308){
return null;
}
var _309=Math.min(Math.abs(_308.top-_308.bottom),Math.abs(_308.left-_308.right));
return ""+((_309*69.04)/2);
},_updateAddressline:function(_30a){
ace.geo.reverse(_30a,function(_30b){
var _30c=SlippyMap.Util.getAddressline(_30b);
this.searchForm.addressline.value=_30c;
if(this.locator.whereamiDiv&&this.locator.whereamiDiv!=null){
var _30d={"COUNTRY":_30b.COUNTRY||null,"CITY":_30b.CITY||null,"POSTALCODE":_30b.POSTALCODE||null,"PROVINCE":_30b.PROVINCE||null,"STATE":_30b.STATE||null};
this._updateLocation(_30d);
}
}.bind(this));
},_processResponse:function(_30e){
var name=ace.xml.getCollectionName(_30e);
var _310=_30e.getElementsByTagName("collection")[0].getAttribute("country");
var city=_30e.getElementsByTagName("collection")[0].getAttribute("city");
var _312=_30e.getElementsByTagName("collection")[0].getAttribute("postalcode");
var _313=_30e.getElementsByTagName("collection")[0].getAttribute("state");
var _314=_30e.getElementsByTagName("collection")[0].getAttribute("province");
var _315=_30e.getElementsByTagName("collection")[0].getAttribute("mapurl");
var _316=$("geoip_state");
if(_316){
if(_316.value=="start"){
_316.setAttribute("value","1");
}else{
_316.setAttribute("value","0");
}
}
var _317={"COUNTRY":_310||null,"CITY":city||null,"POSTALCODE":_312||null,"PROVINCE":_314||null,"STATE":_313||null};
document.fire("w2gi:proximityresponse",{"responseXML":_30e,"geoipData":_317});
Object.extend(this.locator,_317||{});
this.smap.clear();
var _318=$A(ace.xml.parse(_30e));
var _319=false,_31a="";
if(!(typeof (custom)=="undefined"||custom===null)&&custom.layerSwitchingRules){
if(_318.any(function(o){
return (_31a=this._customLayer(o));
}.bind(this))){
_319=true;
}
}
var _31c=this.smap.map.layers.find(function(_31d){
return _31d.name=="Proximity markers";
});
if(this.smap.map.layers[0].projection.toString()=="EPSG:4326"){
_31c.projection=new OpenLayers.Projection("EPSG:4326");
_31c.maxExtent=new OpenLayers.Bounds(-165,15,-50,75);
_31c.units="degrees";
_31c.maxResolution=1.40625;
this.layer=this.smap.map.layers.find(function(_31e){
return _31e.name=="SlippyMap W2GI";
});
if((_319&&_31a=="SlippyMap Navteq")||(!_319&&_318.any(function(o){
return (o.COUNTRY=="CA");
}.bind(this)))){
this.layer=this.smap.map.layers.find(function(_320){
return _320.name=="SlippyMap Navteq";
});
}else{
if((_319&&_31a=="Google Normal")||(!_319&&_318.any(function(o){
return (o.COUNTRY!="US"&&o.COUNTRY!="CA"&&o.COUNTRY.length>0);
}))){
this.layer=this.smap.map.layers.find(function(_322){
return _322.name=="Google Normal";
});
if(this.layer){
if(_31c.projection.toString()!="EPSG:900913"){
_31c.projection=new OpenLayers.Projection("EPSG:900913");
_31c.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_31c.units="m";
_31c.maxResolution=156543.0339;
}
}
}
}
}else{
this.layer=this.smap.map.baseLayer;
if(!this.layer){
this.layer=this.smap.map.layers.find(function(_323){
return _323.name.gsub(0,8)!="SlippyMap";
});
}
if(this.layer){
if(_31c.projection.toString()!="EPSG:900913"){
_31c.projection=new OpenLayers.Projection("EPSG:900913");
_31c.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_31c.units="m";
_31c.maxResolution=156543.0339;
}
}
}
switch(name){
case "poi":
this.centerPoint=this._getCenterPoint(_30e);
if(this.locator.defaultLocation){
this.locator.defaultLocation=false;
this.locator.uid="";
}
var _324=ace.util.getCookie("locationuid");
if(_324&&$(_324)){
$(_324).checked=true;
}
if(this.layer){
this.smap.map.setBaseLayer(this.layer);
}
var _325=0;
if(this.centerPoint){
_325=this.centerPoint.clone();
}
this.smap.zoomToPOIs();
this.smap.proximityLayer.update(_325);
break;
case "multiple_address":
if(this.layer){
this.smap.map.setBaseLayer(this.layer);
}
this.smap.clear();
//this.smap.zoomToPOIs();
break;
default:
throw new Error("Can't process collection: "+colName);
}
if(this.locator.updateEtailersIframe&&this.locator.updateEtailersIframe!=null&&$(this.locator.updateEtailersIframe)){
this._updateEtailerIframe(_317);
}
if(this.locator.whereamiDiv&&this.locator.whereamiDiv!=null&&!this.searchedLonLat){
this._updateLocation(_317);
}else{
this.searchedLonLat=false;
}
if(this.geoip&&this.searchForm.addressline){
var _326=city+" "+_313+" "+_312;
this.searchForm.addressline.value=_326;
}
if(this.locator.location_address_id&&this.locator.location_address_id!=""){
var data=_318[0];
var _328=data.ADDRESS1+" "+data.CITY+" "+data.STATE+" "+data.POSTALCODE;
$(this.locator.location_address_id).value=_328;
if($("location_country")){
$("location_country").value=data.COUNTRY;
}
if($("location_lat")){
$("location_lat").value=data.LATITUDE;
}
if($("location_long")){
$("location_long").value=data.LONGITUDE;
}
}
if($("search_country")&&_317.COUNTRY){
$("search_country").value=_317.COUNTRY;
}
if(_315){
this._addMapUrlImage(_315);
}
this.locator._setURLParams(true);
return this.cacheResults;
},_updateEtailerIframe:function(_329){
if(_329.COUNTRY){
var _32a=$(this.locator.updateEtailersIframe);
_32a.src=_32a.src.substr(0,_32a.src.length-2)+_329.COUNTRY;
}
},_updateLocation:function(_32b){
if(!_32b.COUNTRY&&!_32b.STATE&&!_32b.PROVINCE&&!_32b.CITY&&!_32b.POSTALCODE){
ace.template.updateLocation(this.locator.whereamiDiv,"location_none",_32b);
}else{
if(!_32b.CITY){
ace.template.updateLocation(this.locator.whereamiDiv,"location_nc",_32b);
}else{
ace.template.updateLocation(this.locator.whereamiDiv,"location_us",_32b);
}
}
},_getCenterPoint:function(_32c){
var _32d=ace.xml.getCollection(_32c,"poi")||ace.xml.getCollection(_32c,"multiple_address");
var _32e=_32d.getAttribute("centerpoint");
if(_32e){
return OpenLayers.LonLat.fromString(_32e);
}else{
return 0;
}
},_processSlice:function(_32f){
var _330=this.smap.getPOIBounds(_32f);
if(this.locator.proximitySearch.centerPoint==0){
var _331=(_330.left-_330.right)/2+_330.right;
var vert=(_330.top-_330.bottom)/2+_330.bottom;
var _333=_331+","+vert;
this.locator.proximitySearch.centerPoint=OpenLayers.LonLat.fromString(_333);
}
var _334=this.locator.proximitySearch.centerPoint.clone();
var _335=this.locator.proximitySearch.centerPoint.clone();
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_334.transform(new OpenLayers.Projection("EPSG:4326"),this.smap.map.baseLayer.projection);
}
_330.extend(_334);
_330=this.smap.padBounds(_330);
var view=this.smap.map.calculateBounds();
if(!view.containsBounds(_330)){
this.smap.map.zoomToExtent(_330);
}
this.smap.clear();
this.smap.proximityLayer.update(_335);
},_makeDefaultLocation:function(e,uid){
var name="locationuid";
var _33a=uid;
var _33b=1000;
var _33c=(this.locator.clientCookie&&this.locator.clientCookie.domain)?this.locator.clientCookie.domain:"";
var _33d=0;
var _33e="";
if(this.locator.clientCookie&&this.locator.clientCookie.value){
var temp=ace.table.records.find(function(e){
return e.UID==uid;
}.bind(this));
if(temp){
_33e=temp[this.locator.clientCookie.value.toUpperCase()];
}
}
var _341=(this.locator.clientCookie&&this.locator.clientCookie.name)?this.locator.clientCookie.name:"locationuid";
if(!(this.locator.clientCookie&&this.locator.clientCookie.value&&_33e&&_33e!="")){
_33e=uid;
}
var _342=(this.locator.clientCookie&&this.locator.clientCookie.expires)?this.locator.clientCookie.expires:1000;
var _343=(this.locator.clientCookie&&this.locator.clientCookie.domain)?this.locator.clientCookie.domain:"";
if(!e.checked){
ace.util.deleteCookie(name,_33c);
if(this.locator.clientCookie&&ace.util.getCookie(_341)){
ace.util.deleteCookie(_341,_33c);
}
return;
}
if(this.locator.clientCookie){
ace.util.setCookie(_341,_33e,_342,null,_33c,_33d);
}
ace.util.setCookie(name,_33a,_33b,null,_33c,_33d);
var _344=ace.util.getCookie(name);
if(!_344){
ace.util.alert("You must have cookies enabled to save your default location.");
}
$$(".make_default_loc").each(function(e){
var euid=e.getAttribute("uid");
if(euid=="#{UID}"){
return;
}
if(euid!=uid){
e.checked=false;
}
}.bind(this));
}});
SlippyMap.Search.ProximitySearch.Product=Class.create(SlippyMap.Search.ProximitySearch,{cacheResults:false,searchRadius:null,dragStartCenter:null,centerPoint:null,layer:null,initialize:function(_347){
this.locator=_347;
this.searchForm=$("product_search");
this.altSearchForm=$("driving_directions");
if(_347.locatorType&&_347.locatorType=="product"){
SlippyMap.Search.ProximitySearch.prototype.initialize.apply(this,arguments);
}
if(_347.onlinePanel&&_347.onlinePanel!=""){
this._fillOnlinePanel();
}
if(_347.onlineStores&&_347.onlineStores!=""){
this._fillOnlineStores();
}
},destroy:function(){
SlippyMap.Search.ProximitySearch.prototype.destroy.apply(this,arguments);
this.cacheResults=null;
this.dragStartCenter=null;
this.centerPoint=null;
},search:function(form,_349){
SlippyMap.Search.ProximitySearch.prototype.search.apply(this,arguments);
},_fillOnlineStores:function(){
var _34a=this.locator.url_params.etail;
if(!_34a.currency){
_34a.currency="auto";
}
var _34b={formdataID:"onlinestoresearch",like:1,alertError:false};
if(this.locator.useDiv){
ace.div.update(this.locator.onlineStores,_34a,null,_34b);
}else{
ace.table.update(this.locator.onlineStores,_34a,null,_34b);
}
},_fillOnlinePanel:function(){
var _34c=this.locator.url_params.etail;
if(!_34c.currency){
_34c.currency="auto";
}
var _34d={formdataID:"onlineetailersearch",like:1,alertError:false,onError:this._prodError.bind(this)};
if(this.locator.synchronous){
Object.extend(_34d,{"asynchronous":false});
}
if(this.locator.useDiv){
ace.div.update("online_comp_panel",_34c,this._processProducts.bind(this),_34d);
}else{
ace.table.update("online_comp_panel",_34c,this._processProducts.bind(this),_34d);
}
},_processProducts:function(xml){
document.fire("w2gi:onlineProductSearch",{"responseXML":xml});
},_prodError:function(xml){
document.fire("w2gi:onlineProductSearch",{"responseXML":xml});
},_search:function(form){
SlippyMap.Search.ProximitySearch.prototype._search.apply(this,arguments);
}});
SlippyMap.Search.DirectionsSearch=Class.create(SlippyMap.Search,{responseXML:null,bounds:null,formData:null,layer:null,includeATW:null,mapurl:null,initialize:function(_351){
this.locator=_351;
this.searchForm=$("driving_directions");
this.altSearchForm=$(_351.searchFormId);
this.formData=ace.xml.getFormData(this.searchForm,"drivingdirections");
SlippyMap.Search.prototype.initialize.apply(this,arguments);
this._addReverseSearchInputsObservers();
if(this.locator.ddpanel&&this.locator.ddpanel!=""){
this.ddpanel=this.locator.ddpanel;
}else{
this.ddpanel=this.locator.panel;
}
this._addPanelObserver(this.ddpanel);
this.layer=this.smap.map.layers.find(function(_352){
return _352.name=="SlippyMap Navteq";
});
},destroy:function(){
SlippyMap.Search.prototype.destroy.apply(this,arguments);
this.bounds=null;
this.includeATW=null;
},search:function(form,_354){
this.searchFromMarker=false;
var _355=Form.getInputs(form,"text","addressline");
var _356=Form.getInputs(form,"hidden","addressline");
if(_356.size()==1){
_355.push(_356[0]);
}
var _357=Form.serializeElements(_355,true);
var _358=_357.addressline;
var _359={};
if($("location_lat")&&$("location_long")&&$("location_action")){
this.locator.lat=$("location_lat").value;
this.locator.lon=$("location_long").value;
this.locator.action=$("location_action").value;
}else{
if($("longitude")&&$("latitude")&&$("dest_longitude")&&$("dest_latitude")){
_358[2]={};
_358[2].latitude=$("longitude").value;
_358[2].longitude=$("latitude").value;
_358[2].dest_longitude=$("dest_longitude").value;
_358[2].dest_latitude=$("dest_latitude").value;
}
}
if(this.locator.lat&&this.locator.lat!=null&&this.locator.action&&this.locator.action!=null){
Object.extend(_358,{"latitude":this.locator.lat,"longitude":this.locator.lon,"action":this.locator.action});
_359={"uid":this.locator.uid,"action":this.locator.action};
}else{
_359={"action":"From"};
}
this.includeATW=Form.getInputs(form,"checkbox","includeATW")[0]&&(Form.getInputs(form,"checkbox","includeATW")[0].getValue()=="on");
ace.directions.search(this.ddpanel,this.formData,this.includeATW,_358,_359,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory},form);
},bubbleSearch:function(_35a){
if(!(_35a.target.type&&_35a.target.type=="checkbox")){
_35a.stop();
}
this.searchFromMarker=false;
var form=_35a.element().form;
var _35c=Form.getInputs(form,"text","addressline")[0];
_35c.value=_35c.value.strip();
if(_35c.value.empty()){
return;
}
var _35d=_35a.element().readAttribute("recnum");
var poi=ace.table.getRecord(_35d);
var _35f=(form.getElementsByTagName("a")[0].innerHTML=="To")?false:true;
var _360=Form.serialize(form,true);
var _361=_35f?[poi,_360]:[_360,poi];
var _362={uid:poi.UID,action:_35f?"From":"To"};
this.includeATW=Form.getInputs(form,"checkbox","includeATW")[0]&&(Form.getInputs(form,"checkbox","includeATW")[0].getValue()=="on");
ace.directions.search(this.ddpanel,this.formData,this.includeATW,_361,_362,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory},form);
this._updateSearchForm(_35f,_35c.value,poi);
},markerSearch:function(_363,_364,_365){
this.searchFromMarker=true;
var _366=new OpenLayers.LonLat(_363.lonlat.lon,_363.lonlat.lat);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_366.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
var _367={LONGITUDE:_366.lon,LATITUDE:_366.lat,COUNTRY:_363.country};
var _368=(_364<=0)?[_367,_365]:[_365,_367];
ace.directions.search(this.ddpanel,this.formData,this.includeATW,_368,false,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory});
this._updateAddressline(_363.getAddress(),_364);
},processResponse:function(_369){
this.smap.clear();
if($("getlist_search")){
$("getlist_search").hide();
}
if(!this.searchForm.visible()){
this.altSearchForm.hide();
this.searchForm.show();
if($("findlocation")&&$("drivedirections")&&($("findlocation").hasClassName("active")||$("drivedirections").hasClassName("active"))){
$("findlocation","drivedirections").invoke("toggleClassName","active");
}
if($("loc")&&$("dd")&&($("loc").hasClassName("current")||$("dd").hasClassName("current"))){
$("loc","dd").invoke("toggleClassName","current");
}
}
var xml=ace.xml.getCollection(_369,"maneuvers");
var _36b=this.smap.map.layers.find(function(_36c){
return _36c.name=="Route markers";
});
var _36d=this.smap.map.layers.find(function(_36e){
return _36e.name=="Route vector";
});
if(!_36d){
_36d=this.smap.map.layers.find(function(_36f){
return _36f.name=="Route image";
});
}
if(xml){
this.bounds=this.smap.padBounds(this._getRouteBounds(xml));
var _370=this._getIconAddresses(_369);
this.mapurl=_369.getElementsByTagName("collection")[0].getAttribute("mapurl");
["A","B"].each(function(_371,_372){
_370[_372].POINUM=_371;
_370[_372].RECNUM=_371;
});
if(this.smap.map.layers[0].projection.toString()=="EPSG:4326"){
this.layer=this.smap.map.layers.find(function(_373){
return _373.name=="SlippyMap Navteq";
});
_36d.projection=new OpenLayers.Projection("EPSG:4326");
_36d.maxExtent=new OpenLayers.Bounds(-165,15,-50,75);
_36d.units="degrees";
_36d.maxResolution=1.40625;
_36b.projection=new OpenLayers.Projection("EPSG:4326");
_36b.maxExtent=new OpenLayers.Bounds(-165,15,-50,75);
_36b.units="degrees";
_36b.maxResolution=1.40625;
if(_370.any(function(o){
return (o.COUNTRY!="US"&&o.COUNTRY!="CA");
})){
this.layer=this.smap.map.layers.find(function(_375){
return _375.name=="Google Normal";
});
_36d.projection=new OpenLayers.Projection("EPSG:900913");
_36d.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_36d.units="m";
_36d.maxResolution=156543.0339;
_36b.projection=new OpenLayers.Projection("EPSG:900913");
_36b.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_36b.units="m";
_36b.maxResolution=156543.0339;
this.bounds.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));
}
}else{
this.layer=this.smap.map.baseLayer;
if(this.layer.name.gsub(0,8)=="SlippyMap"){
this.layer=this.smap.map.layers.find(function(_376){
return _376.name=="Google Normal";
});
}
_36d.projection=new OpenLayers.Projection("EPSG:900913");
_36d.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_36d.units="m";
_36d.maxResolution=156543.0339;
_36b.projection=new OpenLayers.Projection("EPSG:900913");
_36b.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_36b.units="m";
_36b.maxResolution=156543.0339;
this.bounds.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));
}
this.smap.map.setBaseLayer(this.layer);
this.smap.map.zoomToExtent(this.bounds);
this._updateCountrySelects(_370);
this.smap.routeMarkerLayer.addEndMarkers(_370);
this.smap.routeLayer.addRoute();
var _377=ace.xml.getCollection(_369,"pois");
if(_377&&_377.childNodes&&_377.childNodes.length!=0){
var pois=ace.xml.parse(_377);
pois.each(function(poi,_37a){
poi.POINUM=_37a+1;
poi.RECNUM=ace.table.records.length+1;
ace.table.records.push(poi);
}.bind(this));
var _37b=this.ddpanel.down();
this._addAlongTheWayInfo(_37b,pois);
}
this._addReverseSearchObservers();
this._updatePanelAddressline(_370);
if(this.mapurl){
this._addMapUrlImage(this.mapurl);
}
}else{
this.responseXML=ace.util.cleanWhitespace(_369);
this.smap.routeLayer.clear();
this.smap.routeMarkerLayer.clear();
//this.smap.zoomToPOIs(true);
var _370=this._getAddressesFromMultiple();
this._updateCountrySelects(_370);
}
return true;
},_addAlongTheWayInfo:function(_37c,pois){
this.smap.proximityLayer.addPOIMarkers(pois,false);
var _37e=this._getManeuverPOIs(pois);
this._updatePanel(_37c,_37e);
},_getManeuverPOIs:function(pois){
var _380={};
for(var i=0,len=pois.length;i<len;i++){
var poi=pois[i];
_380[poi.MANEUVER]?_380[poi.MANEUVER].push(poi):_380[poi.MANEUVER]=[poi];
}
return _380;
},_updatePanel:function(_384,_385){
var rows=ace.util.select(_384,"maneuver_pois");
for(maneuver in _385){
var _387=parseInt(maneuver)-1;
var _388=ace.template.getTemplate("along_the_way");
_384=ace.template.getTableTemplate(_388,_385[maneuver]);
rows[_387].update(_384).show();
}
},_updateCountrySelects:function(_389){
if($("orig_country")&&_389[0]&&_389[0].COUNTRY){
$("orig_country").value=_389[0].COUNTRY;
}
if($("dest_country")&&_389[1]&&_389[1].COUNTRY){
$("dest_country").value=_389[1].COUNTRY;
}
},_updatePanelAddressline:function(_38a){
var _38b=ace.util.select($(this.ddpanel),"addressline");
if(_38b.length>0){
var _38c=ace.util.select($(this.ddpanel),"ddendpoint");
for(var i=0;i<_38b.length;i++){
if(_38c&&_38c.length==2){
var _38e=null;
if(i==0){
_38e=ace.template.getTemplate("ddstarticon",{});
}else{
_38e=ace.template.getTemplate("ddendicon",{});
}
if(_38e!=null){
_38c[i].update(_38e);
}
}
var _38f=$(_38a[i]);
var _390=$(_38b[i]);
var _391=_38f.ADDRESS1.blank()?"":_38f.ADDRESS1.trim();
var _392=_390.getElementsBySelector(".address_line1");
if(_391&&_392.length>0){
_392[0].update(_391);
}
var city=_38f.CITY.empty()?"":_38f.CITY+", ";
var _394=ace.util.select(_390,"address_city");
if(city&&_394.length>0){
_394[0].update(city);
}
var _395=(_38f.COUNTRY!="US")?_38f.PROVINCE+" ":_38f.STATE+" ";
var _396=ace.util.select(_390,"address_state");
if(_395&&_396.length>0){
_396[0].update(_395);
}
var _397=_38f.POSTALCODE.empty()?"":_38f.POSTALCODE;
var _398=ace.util.select(_390,"address_zip");
if(_397&&_398.length>0){
_398[0].update(_397);
}
if(i==0&&$("latitude")&&$("longitude")){
$("latitude").value=_38f.LATITUDE;
$("longitude").value=_38f.LONGITUDE;
}
if(i==1&&$("dest_latitude")&&$("dest_longitude")){
$("dest_latitude").value=_38f.LATITUDE;
$("dest_longitude").value=_38f.LONGITUDE;
}
}
}
},_addPanelObserver:function(_399){
Event.observe(_399,"click",function(_39a){
if(!(_39a.target.type&&_39a.target.type=="checkbox")){
_39a.stop();
}
if(!this.searchForm||!this.searchForm.visible()){
return;
}
var _39b=_39a.element().readAttribute("action");
switch(_39b){
case "search_address":
var _39c=_39a.element().readAttribute("recnum");
var _39d=parseInt(_39c)-1;
var _39e=this._getMultipleAddresses();
var _39f=_39e.addresses[_39d];
var _3a0=ace.xml.parseNode(_39f);
var _3a1=this.searchForm.getInputs("text","addressline")[_39e.index];
if(_3a1){
_3a1.value=this._getSelectedInput(_39f);
}
ace.directions.addresses[_39e.index]=_3a0;
ace.directions.search(_399,this.formData,this.includeATW,ace.directions.addresses,false,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory});
break;
}
}.bind(this));
},_search:function(form){
if(!this._validateSearchForm(form)){
return;
}
this.search(form);
},_updateSearchForm:function(_3a3,_3a4,poi){
var _3a6=poi.ADDRESS1+", "+poi.CITY+", "+poi.STATE+" "+poi.POSTALCODE;
var _3a7=this.searchForm.getInputs("text","addressline");
var _3a8=this.searchForm.getInputs("hidden","addressline");
var _3a9=this.searchForm.getInputs("checkbox","includeATW");
if(_3a9&&_3a9[0]){
_3a9[0].checked=(this.includeATW)?"checked":"";
}
if(_3a7[0]){
_3a7[0].value=_3a3?_3a6:_3a4;
}
if(_3a7[1]){
_3a7[1].value=_3a3?_3a4:_3a6;
}else{
if(_3a8[0]){
_3a8[0].value=_3a3?_3a6:_3a4;
}
}
var uid=this.searchForm.getInputs("hidden","uid");
var _3ab=this.searchForm.getInputs("hidden","action");
var lon=this.searchForm.getInputs("hidden","lon");
var lat=this.searchForm.getInputs("hidden","lat");
if(uid&&uid.size()>0){
uid[0].value=poi.UID;
}
if(_3ab&&_3ab.size()>0){
_3ab[0].value=_3a3?"From":"To";
}
if(lon&&lon.size()>0){
lon[0].value=poi.LONGITUDE;
}
if(lat&&lat.size()>0){
lat[0].value=poi.LATITUDE;
}
},_updateAddressline:function(_3ae,_3af){
var _3b0=this.searchForm.getInputs("text","addressline")[_3af];
if(!_3b0){
_3b0=this.searchForm.getInputs("hidden","addressline")[0];
}
if(_3b0){
_3b0.value=SlippyMap.Util.getAddressline(_3ae);
}
},_addReverseSearchInputsObservers:function(){
if(this.searchForm){
var _3b1=this.searchForm.getElementsByTagName("img")[0];
if(_3b1){
Event.observe(_3b1,"click",this._reverseSearchInputs.bind(this));
}
}
},_reverseSearch:function(){
this._reverseSearchInputs();
ace.directions.search(this.ddpanel,this.formData,this.includeATW,false,false,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory},this.searchForm);
document.fire("w2gi:track",{action:"clickonreversedd",value:"1"});
},_reverseSearchP:function(){
ace.directions.search(this.ddpanel,this.formData,this.includeATW,false,false,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory},this.searchForm);
document.fire("w2gi:track",{action:"clickonreversedd",value:"1"});
},_reverseSearchInputs:function(){
var _3b2=this.searchForm.getInputs("text","addressline");
var _3b3=_3b2.pluck("value").reverse();
_3b2.each(function(e,_3b5){
e.value=_3b3[_3b5];
});
},_reverseSearchAction:function(){
if($("location_action")){
$("location_action").value=($("location_action").value=="To")?"From":"To";
}
},_getMultipleAddresses:function(){
var _3b6=null;
var _3b7=this.responseXML.cloneNode(true);
var _3b8=$A(this.responseXML.getElementsByTagName("collection")[0].childNodes);
_3b8.each(function(e,_3ba){
if(e.tagName=="collection"&&e.getAttribute("name")=="multiple_address"){
_3b6={addresses:e.getElementsByTagName("address"),index:_3ba};
e.removeAttribute("name");
throw $break;
}
});
return _3b6;
},_getAddressesFromMultiple:function(){
var _3bb=[];
var _3bc=ace.xml.getCollection(this.responseXML);
var _3bd=$A(_3bc.getElementsByTagName("collection")[0].childNodes);
_3bd.each(function(e,_3bf){
if(e.tagName=="collection"&&e.getAttribute("name")=="multiple_address"){
_3bb.push(ace.xml.parseNode(e.getElementsByTagName("address")[0]));
}else{
_3bb.push(ace.xml.parseNode(e));
}
});
return _3bb;
},_getSelectedInput:function(_3c0){
var _3c1=_3c0.getElementsByTagName("address1")[0].firstChild;
var _3c2=_3c1?_3c1.nodeValue:"";
var _3c3=(_3c0.getElementsByTagName("state")[0].firstChild)?_3c0.getElementsByTagName("state")[0].firstChild.nodeValue:"";
var _3c4=(_3c0.getElementsByTagName("province")[0].firstChild)?_3c0.getElementsByTagName("province")[0].firstChild.nodeValue:"";
var _3c5=(_3c0.getElementsByTagName("postalcode")[0].firstChild)?_3c0.getElementsByTagName("postalcode")[0].firstChild.nodeValue:"";
var city=(_3c0.getElementsByTagName("city")[0].firstChild)?_3c0.getElementsByTagName("city")[0].firstChild.nodeValue:"";
var _3c7=((_3c2=="")?"":_3c2+", ");
_3c7+=city+", ";
_3c7+=_3c3+" "+_3c4+" "+_3c5;
return _3c7;
},_addReverseSearchObservers:function(){
ace.util.select(this.ddpanel,"reverse_directions").each(function(e){
Event.observe(e,"click",this._reverseSearch.bind(this));
}.bind(this));
ace.util.select(this.ddpanel,"reverse_directions_p").each(function(e){
Event.observe(e,"click",this._reverseSearchP.bind(this));
}.bind(this));
},_getIconAddresses:function(_3ca){
var xml=ace.xml.getCollection(_3ca,"address").getElementsByTagName("address");
return ace.xml.parseNodes(xml);
},_getRouteBounds:function(xml){
var _3cd=xml.getAttribute("bounds");
return new OpenLayers.Bounds.fromString(_3cd);
}});
SlippyMap.Layer=Class.create({smap:null,layer:null,initialize:function(smap){
this.smap=smap;
},destroy:function(){
this.smap=null;
this.layer=null;
}});
SlippyMap.Layer.ProximityLayer=Class.create(SlippyMap.Layer,{features:null,highlight:null,highlightEffect:null,initialize:function(smap,name,_3d1){
if(_3d1){
this.highlight=(_3d1.highlight==true)?true:false;
this.highlightEffect=(_3d1.highlightEffect)?_3d1.highlightEffect:false;
}
this.features={};
this.layer=new OpenLayers.Layer.Markers(name,{projection:smap.map.layers[0].projection});
smap.map.addLayer(this.layer);
SlippyMap.Layer.prototype.initialize.apply(this,arguments);
this._addPanelObserver(this.smap.locator.panel);
if(this.smap.locator.ddpanel&&this.smap.locator.ddpanel!=""){
this._addPanelObserver(this.smap.locator.ddpanel);
}
},destroy:function(){
SlippyMap.Layer.prototype.destroy.apply(this,arguments);
this.features=null;
},clear:function(){
this.layer.clearMarkers();
for(recnum in this.features){
this.features[recnum].destroy();
}
this.features={};
},update:function(_3d2){
this.addCenterMarker(_3d2);
this.addPOIMarkers();
},addPOIMarkers:function(pois,_3d4){
pois=pois||ace.table.getSlice()||ace.table.records;
for(var i=pois.length-1;i>=0;i--){
this.addPOIMarker(pois[i],false,_3d4);
}
},addPOIMarker:function(poi,_3d7,_3d8){
var _3d9=null;
if(_3d7){
var _3da=new OpenLayers.LonLat(poi.LONGITUDE,poi.LATITUDE);
var _3db=ace.template.getIconTemplate("dragabble_icon",poi);
var icon=new OpenLayers.Icon.IconFromTemplate(_3db);
_3d9=new OpenLayers.Marker.DragabbleMarker(_3da,icon);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_3d9.setSphericalMercator(true);
}
if(!_3d8){
_3d9.events.register("click",this,function(evt){
OpenLayers.Event.stop(evt);
});
}
}else{
var _3de=this._createFeature(poi);
_3d9=_3de.createMarker();
this.features[poi.RECNUM]=_3de;
if(!_3d8){
this._bindMarkerClick(_3d9,_3de,poi.UID);
}
}
_3d9.recnum=poi.RECNUM;
if(this.highlight){
this._bindMarkerOver(_3d9);
}
this.layer.addMarker(_3d9);
return _3d9;
},removePOIMarker:function(_3df){
var _3e0=this.getPOIMarker(_3df);
this.layer.removeMarker(_3e0);
if(this.features[_3df]){
this.features[_3df].destroy();
delete this.features[_3df];
}
return _3e0;
},replacePOIMarker:function(_3e1,_3e2){
this.removePOIMarker(_3e1);
var poi=ace.table.getRecord(_3e1);
var ret=this.addPOIMarker(poi,_3e2);
for(i in this.layer.markers){
var m=this.layer.markers[i];
if(m&&m.icon){
if(m.recnum==_3e1){
m.icon.imageDiv.style.zIndex=4500;
}else{
m.icon.imageDiv.style.zIndex=3500;
}
}
}
return ret;
},getPOIMarker:function(_3e6){
return this.layer.markers.find(function(_3e7){
return _3e7.recnum==_3e6;
});
},addCenterMarker:function(_3e8){
var _3e9=ace.template.getTemplate("center_marker");
if(!_3e9){
return null;
}
if(!_3e8){
return null;
}
var icon=new OpenLayers.Icon.IconFromTemplate(_3e9);
var _3eb=new OpenLayers.Marker.DragabbleMarker(_3e8,icon);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_3eb.setSphericalMercator(true);
}
_3eb.events.register("mouseup",this.smap.locator.proximitySearch,function(evt){
OpenLayers.Event.stop(evt);
var _3ed=evt.object.lonlat;
this.smap.map.setCenter(_3ed);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_3ed.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
this.searchLonLat(_3ed,{onError:this.locator.clearLocator.bind(this.locator)});
document.fire("w2gi:track",{action:"centermarkerdrag",value:_3ed.toShortString()});
});
this.layer.addMarker(_3eb);
return _3eb;
},_addPanelObserver:function(_3ee){
$(_3ee).observe("click",function(_3ef){
if(!(_3ef.target.type&&_3ef.target.type=="checkbox")){
_3ef.stop();
}
var _3f0=_3ef.element().readAttribute("action");
if(_3f0){
var i=_3f0.lastIndexOf("/");
if(i!=-1){
_3f0=_3f0.substring(i+1,_3f0.length);
}
}
var _3f2;
switch(_3f0){
case "open_bubble":
_3f2=_3ef.element().readAttribute("recnum");
if(this._markerClick(this.features[_3f2])){
var _3f3=ace.table.getRecord(_3f2);
document.fire("w2gi:track",{action:"clickondealer-panel",value:_3f3.UID});
}
break;
case "sort_table":
var _3f4=_3ef.element().readAttribute("sort_field");
var _3f5=_3ef.element().readAttribute("field_type");
ace.table.sortRecords(_3f4,_3f5);
ace.table.updateFromRecords(_3ee);
this.smap.clear();
this.update(this.smap.locator.proximitySearch.centerPoint);
break;
case "more_info":
_3f2=_3ef.element().readAttribute("recnum");
ace.table.oldrecords=ace.table.records.clone();
ace.table.selected=_3f2;
var pois=ace.table.records.slice(_3f2-1,_3f2);
pois[0].RECNUM=1;
pois[0].POINUM=1;
this.smap.locator.clear();
ace.table.updateFromRecords(this.smap.locator.panel,pois,{NAME:"more_info"});
this.addPOIMarker(pois[0]);
this.smap.zoomToPOI(pois,1);
break;
case "show_all":
this.smap.locator.clear();
ace.table.records=ace.table.oldrecords.clone();
ace.table.records[ace.table.selected-1].RECNUM=ace.table.selected;
ace.table.records[ace.table.selected-1].POINUM=ace.table.selected;
ace.table.updateFromRecords(this.smap.locator.panel,ace.table.records,{NAME:"poi"});
this.addPOIMarkers();
this.smap.zoomToPOIs();
break;
case "make_default_loc":
this.smap.locator.proximitySearch._makeDefaultLocation(_3ef.element(),_3ef.element().readAttribute("uid"));
break;
}
}.bind(this));
if(this.highlight){
_3ee.observe("mouseover",function(_3f7){
_3f7.stop();
var _3f8=_3f7.element().readAttribute("recnum");
if(_3f8){
this._markerOver(_3f8);
}
}.bind(this));
_3ee.observe("mouseout",function(_3f9){
_3f9.stop();
this._markerOver();
}.bind(this));
}
},_markerClick:function(_3fa){
this.smap.locator.proximitySearch.dragStartCenter=null;
if(_3fa&&_3fa.popup&&_3fa.popup.visible()){
this.smap.map.events.triggerEvent("popupclose",_3fa.popup);
return false;
}else{
for(i in this.layer.markers){
var m=this.layer.markers[i];
if(m&&m.icon){
if(m.recnum==_3fa.marker.recnum){
m.icon.imageDiv.style.zIndex=4500;
}else{
m.icon.imageDiv.style.zIndex=3500;
}
}
}
this._clearPopups();
this._addBubbleData(_3fa.data);
var _3fc=_3fa.createPopup();
_3fc.recnum=_3fa.data.recnum;
_3fc.bubbleSize=_3fa.data.icon.bubbleSize;
_3fc.bubbleMargin=_3fa.data.icon.bubbleMargin;
_3fc.bubbleOffset=_3fa.data.icon.bubbleOffset;
this.smap.map.addPopup(_3fc,true);
this.smap.map.adjustForBubble(_3fa.marker.lonlat,_3fc.bubbleSize,_3fc.bubbleMargin,_3fc.bubbleOffset);
return true;
}
},_markerOver:function(_3fd){
var _3fe;
var _3ff=this.smap.locator.panel.down();
ace.table.highlightRow(_3ff,_3fd);
var poi;
if(_3fd){
if((markerOld=this.getPOIMarker(_3fd))&&(!markerOld.highlighted)){
poi=ace.table.getRecord(_3fd);
var _401=this._createFeature(poi,"alt_icon");
_3fe=_401.createMarker();
_3fe.recnum=poi.RECNUM;
_3fe.highlighted=true;
if(this.highlight){
this._bindMarkerOver(_3fe);
}
this._bindMarkerClick(_3fe,_401);
this.layer.removeMarker(markerOld);
this.layer.addMarker(_3fe);
if(this.highlightEffect){
this.highlightEffect(_3fe.events.element);
}
}
}else{
if(_3fe=this.layer.markers.find(function(_402){
return _402.highlighted==true;
})){
poi=ace.table.getRecord(_3fe.recnum);
this.layer.removeMarker(_3fe);
this.addPOIMarker(poi,false,false);
}
}
},_addBubbleData:function(data){
var poi=ace.table.getRecord(data.recnum);
this._setBubbleCountry(data.bubbleID,poi);
var _405=ace.template.getTemplate(data.bubbleID,poi);
var _406=_405.style;
data.popupContentHTML=_405.innerHTML;
data.popupSize=new OpenLayers.Size(_406.width,_406.height);
data.icon.bubbleSize=data.popupSize;
data.icon.bubbleMargin=new OpenLayers.Bounds(_406.marginLeft,_406.marginBottom,_406.marginRight,_406.marginTop);
data.icon.bubbleOffset=new OpenLayers.Pixel(_405.readAttribute("offsetx"),_405.readAttribute("offsety"));
},_setBubbleCountry:function(_407,poi){
var _409=ace.template.templates[_407].select("#bubble_country")[0];
if(_409&&_409.options){
for(var i=0;i<_409.options.length;i++){
if(_409.options[i].value==poi.COUNTRY){
$(_409.options[i]).setAttribute("selected","selected");
}else{
$(_409.options[i]).removeAttribute("selected");
}
}
}
return;
},_clearPopups:function(){
for(recnum in this.features){
var _40b=this.features[recnum];
if(_40b.popup){
_40b.popup.destroy();
_40b.popup=null;
break;
}
}
},_createFeature:function(poi,_40d){
var _40e=new OpenLayers.LonLat(poi.LONGITUDE,poi.LATITUDE);
var data=this._getFeatureData(poi,_40d);
return new OpenLayers.Feature(this,_40e,data);
},_getFeatureData:function(poi,_411){
var _412=ace.template.getIconTemplate(_411||poi.ICON,poi);
var data={};
data.recnum=poi.RECNUM;
data.icon=new OpenLayers.Icon.IconFromTemplate(_412);
data.bubbleID=_412.readAttribute("bubbleid");
return data;
},_bindMarkerOver:function(_414){
_414.events.register("mouseover",this,function(_415){
OpenLayers.Event.stop(_415);
this._markerOver(_414.recnum);
});
_414.events.register("mouseout",this,function(_416){
OpenLayers.Event.stop(_416);
this._markerOver();
});
},_bindMarkerClick:function(_417,_418,uID){
_417.events.register("click",this,function(evt){
OpenLayers.Event.stop(evt);
if(this._markerClick(_418)){
document.fire("w2gi:track",{action:"clickondealer-map",value:uID});
}
});
}});
SlippyMap.Layer.RouteVectorLayer=Class.create(SlippyMap.Layer,{initialize:function(smap,name){
this.layer=new OpenLayers.Layer.Vector(name,{projection:smap.map.layers[0].projection});
smap.map.addLayer(this.layer);
SlippyMap.Layer.prototype.initialize.apply(this,arguments);
},destroy:function(){
SlippyMap.Layer.prototype.destroy.apply(this,arguments);
},clear:function(){
this.layer.destroyFeatures();
},addRoute:function(){
var _41d={strokeColor:"blue",strokeOpacity:1,strokeWidth:5,pointRadius:6,pointerEvents:"visiblePainted"};
Object.extend(_41d,this.layer.map.routeStyle||{});
var _41e=this._getPointList();
var _41f=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(_41e),null,_41d);
this.layer.addFeatures([_41f]);
},_getPointList:function(){
var _420=ace.table.records.pluck("SEGMENT_GEOMETRY");
var _421=[];
for(var i=0,leni=_420.length;i<leni;i++){
if(_420[i].length<=0){
continue;
}
var _424=_420[i].substring(11,_420[i].length-1).split(",");
for(var j=0,lenj=_424.length;j<lenj;j++){
var _427=_424[j].split(" ");
myPoint=new OpenLayers.Geometry.Point(_427[0],_427[1]);
if(this.layer.projection.toString()=="EPSG:900913"){
myPoint.transform(new OpenLayers.Projection("EPSG:4326"),this.layer.projection);
}
_421.push(myPoint);
}
}
return _421;
}});
SlippyMap.Layer.RouteImageLayer=Class.create(SlippyMap.Layer,{initialize:function(smap,name){
this.layer=new OpenLayers.Layer.Markers(name);
smap.map.addLayer(this.layer);
SlippyMap.Layer.prototype.initialize.apply(this,arguments);
this.smap.map.events.register("zoomend",this,this._zoomend);
this.smap.map.events.register("moveend",this,this._moveend);
},destroy:function(){
this.smap.map.events.unregister("zoomend",this,this._zoomend);
this.smap.map.events.unregister("moveend",this,this._moveend);
SlippyMap.Layer.prototype.destroy.apply(this,arguments);
},clear:function(){
this.layer.clearMarkers();
},addRoute:function(){
var _42a=this._getImageParams();
ace.request(_42a,this._processResponse.bind(this),{formdataID:"get_route_image",onHistory:false});
},_getFullRouteMarkers:function(){
return this.layer.markers.findAll(function(_42b){
return _42b.isFullImage;
});
},_processResponse:function(_42c){
this.layer.clearMarkers();
var _42d=ace.xml.parse(_42c);
var _42e=this._getRouteImage(_42d[0]);
_42e.isFullImage=this._viewContainsRoute();
this.layer.addMarker(_42e);
return true;
},_getRouteImage:function(_42f){
var size=new OpenLayers.Size(_42f.WIDTH,_42f.HEIGHT);
var _431=new OpenLayers.Icon(_42f.URL,size,null,function(){
return new OpenLayers.Pixel(0,0);
});
var x=_42f.OFFSET_X;
var y=_42f.MAX_Y;
var _434=new OpenLayers.LonLat(x,y);
return new OpenLayers.Marker(_434,_431);
},_getImageParams:function(){
var _435=this.smap.map.getExtent();
var _436=this.smap.map.getSize().w;
var _437=this.smap.map.getSize().h;
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_435.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
return {routeid:0,bounds:_435.left+","+_435.bottom+","+_435.right+","+_435.top,height:_437,width:_436};
},_zoomend:function(){
if(this.layer.markers.length<=0){
return;
}
if(!this._routeIntersectsView()){
return;
}
this.addRoute();
},_moveend:function(){
if(this.layer.markers.length<=0){
return;
}
if(this._getFullRouteMarkers().length>0){
return;
}
if(!this._routeIntersectsView()){
return;
}
this.addRoute();
},_routeIntersectsView:function(){
var view=this.smap.map.getExtent();
return view.intersectsBounds(this.smap.locator.directionsSearch.bounds);
},_viewContainsRoute:function(){
var view=this.smap.map.getExtent();
return view.containsBounds(this.smap.locator.directionsSearch.bounds);
}});
SlippyMap.Layer.RouteMarkerLayer=Class.create(SlippyMap.Layer,{initialize:function(smap,name){
this.layer=new OpenLayers.Layer.Markers(name,{projection:smap.map.layers[0].projection});
smap.map.addLayer(this.layer);
SlippyMap.Layer.prototype.initialize.apply(this,arguments);
},destroy:function(){
SlippyMap.Layer.prototype.destroy.apply(this,arguments);
},clear:function(){
this.layer.clearMarkers();
},addEndMarkers:function(_43c){
_43c.each(function(_43d,_43e){
var _43f=null;
if(_43e<=0){
_43f=ace.template.getTemplate("ddstarticon",_43d);
}else{
_43f=ace.template.getTemplate("ddendicon",_43d);
}
if(_43f==null){
_43f=ace.template.getIconTemplate("default",_43d);
}
var icon=new OpenLayers.Icon.IconFromTemplate(_43f);
var _441=new OpenLayers.LonLat(_43d.LONGITUDE,_43d.LATITUDE);
var _442=new OpenLayers.Marker.DragabbleMarker(_441,icon,this.smap.locator.disableDynamicRoutes);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_442.setSphericalMercator(true);
}
var _443=(_43e<=0)?_43c.last():_43c.first();
if(!this.smap.locator.disableDynamicRoutes){
_442.events.register("mouseup",_442,this._mouseUp.bind(this,_442,_43e,_443));
}
this.layer.addMarker(_442);
}.bind(this));
},_mouseUp:function(_444,_445,_446){
_444.reverseGeocode(function(_447){
var _448=new OpenLayers.LonLat(_447.lonlat.lon,_447.lonlat.lat);
this.smap.locator.directionsSearch.markerSearch(_447,_445,_446);
_447.moveToLonLat();
document.fire("w2gi:track",{action:"routemarkerdrag",value:_448.toShortString()});
}.bind(this));
}});

