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;
};
}
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 _75=new OpenLayers.Bounds(-180,-90,180,90);
this.projCode=_75.containsLonLat(this)?"EPSG:4326":"EPSG:900913";
};
OpenLayers.LonLat.prototype.transform=function(_76,_77){
if(this.projCode!=_77.projCode){
var _78=OpenLayers.Projection.transform({"x":this.lon,"y":this.lat},_76,_77);
this.lon=_78.x;
this.lat=_78.y;
}
return this;
};
OpenLayers.Bounds.prototype.projCode="";
OpenLayers.Bounds.prototype.initialize=function(_79,_7a,_7b,top,_7d){
if(_79!=null){
this.left=parseFloat(_79);
}
if(_7a!=null){
this.bottom=parseFloat(_7a);
}
if(_7b!=null){
this.right=parseFloat(_7b);
}
if(top!=null){
this.top=parseFloat(top);
}
if(!_7d){
var _7e=new OpenLayers.Bounds(-180,-90,180,90,true);
this.projCode=this.intersectsBounds(_7e)?"EPSG:4326":"EPSG:900913";
}
};
OpenLayers.Bounds.prototype.transform=function(_7f,_80){
if(this.projCode!=_80.projCode){
var ll=OpenLayers.Projection.transform({"x":this.left,"y":this.bottom},_7f,_80);
var lr=OpenLayers.Projection.transform({"x":this.right,"y":this.bottom},_7f,_80);
var ul=OpenLayers.Projection.transform({"x":this.left,"y":this.top},_7f,_80);
var ur=OpenLayers.Projection.transform({"x":this.right,"y":this.top},_7f,_80);
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(_87,_88){
if((this.projCode!=_88.projCode)&&(_87&&_88)){
OpenLayers.Projection.transform(this,_87,_88);
this.projCode=_88.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(_89,_8a,_8b){
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 _8f=this.single?OpenLayers.Util.extend({},evt):null;
this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,_8f),this.delay);
}
}
return !this.stopSingle;
},passesTolerance:function(evt){
var _91=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){
_91=false;
}
}
return _91;
},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 _94=false;
if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){
this.clearTimer();
this.down=null;
_94=true;
}
return _94;
},CLASS_NAME:"OpenLayers.Handler.Click"});
OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,initialize:function(_95,_96,_97){
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 _99=false;
var _9a=false;
var _9b=false;
var _9c=OpenLayers.Event.element(e);
while((_9c!=null)&&!_9b&&!_99){
if(!_99){
try{
if(_9c.currentStyle){
_9d=_9c.currentStyle["overflow"];
}else{
var _9e=document.defaultView.getComputedStyle(_9c,null);
var _9d=_9e.getPropertyValue("overflow");
}
_99=(_9d&&(_9d=="auto")||(_9d=="scroll"));
}
catch(err){
}
}
if(!_9a){
for(var i=0;i<this.map.layers.length;i++){
if(_9c==this.map.layers[i].div||_9c==this.map.layers[i].pane){
_9a=true;
break;
}
}
}
_9b=(_9c==this.map.div);
_9c=_9c.parentNode;
}
if(!_99&&_9b){
if(_9a){
this.wheelZoom(e);
}
OpenLayers.Event.stop(e);
}
},wheelZoom:function(e){
document.fire("w2gi:track",{action:"mapzoom",value:1});
var _a1=0;
if(!e){
e=window.event;
}
if(e.wheelDelta){
_a1=e.wheelDelta/120;
if(window.opera&&window.opera.version()<9.2){
_a1=-_a1;
}
}else{
if(e.detail){
_a1=-e.detail/3;
}
}
if(_a1){
if(this.mousePosition){
e.xy=this.mousePosition;
}
if(!e.xy){
e.xy=this.map.getPixelFromLonLat(this.map.getCenter());
}
if(_a1<0){
this.callback("down",[e,_a1]);
}else{
this.callback("up",[e,_a1]);
}
}
},mousemove:function(evt){
this.mousePosition=evt.xy;
},activate:function(evt){
if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){
var _a4=this.wheelListener;
OpenLayers.Event.observe(window,"DOMMouseScroll",_a4);
OpenLayers.Event.observe(window,"mousewheel",_a4);
OpenLayers.Event.observe(document,"mousewheel",_a4);
return true;
}else{
return false;
}
},deactivate:function(evt){
if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){
var _a6=this.wheelListener;
OpenLayers.Event.stopObserving(window,"DOMMouseScroll",_a6);
OpenLayers.Event.stopObserving(window,"mousewheel",_a6);
OpenLayers.Event.stopObserving(document,"mousewheel",_a6);
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(_a7,_a8,_a9){
OpenLayers.Handler.prototype.initialize.apply(this,arguments);
},down:function(evt){
},move:function(evt){
},up:function(evt){
},out:function(evt){
},mousedown:function(evt){
var _af=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;
};
}
_af=!this.stopDown;
}else{
this.started=false;
this.start=null;
this.last=null;
}
return _af;
},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 _b2=(this.start!=this.last);
this.started=false;
this.dragging=false;
this.map.div.style.cursor="";
this.up(evt);
this.callback("up",[evt.xy]);
if(_b2){
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 _b5=(this.start!=this.last);
this.started=false;
this.dragging=false;
this.map.div.style.cursor="";
this.out(evt);
this.callback("out",[]);
if(_b5){
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 _b7=false;
if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){
this.dragging=false;
_b7=true;
}
return _b7;
},deactivate:function(){
var _b8=false;
if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){
this.started=false;
this.dragging=false;
this.start=null;
this.last=null;
_b8=true;
}
return _b8;
},CLASS_NAME:"OpenLayers.Handler.Drag"});
OpenLayers.Control.PanZoom=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,buttons:null,position:null,initialize:function(_b9){
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 _bd=new OpenLayers.Pixel(px.x+sz.w/2,px.y);
this._addButton("panup","north-mini.png",_bd,sz);
px.y=_bd.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",_bd.add(0,sz.h*2),sz);
this._addButton("zoomin","zoom-plus-mini.png",_bd.add(0,sz.h*3+5),sz);
this._addButton("zoomworld","zoom-world-mini.png",_bd.add(0,sz.h*4+5),sz);
this._addButton("zoomout","zoom-minus-mini.png",_bd.add(0,sz.h*5+5),sz);
return this.div;
},_addButton:function(id,img,xy,sz){
var _c2=OpenLayers.Util.getImagesLocation()+img;
var btn=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_PanZoom_"+id,xy,sz,_c2,"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 _c9=new OpenLayers.Pixel(px.x+sz.w/2,px.y);
var _ca=sz.w;
if(this.zoomWorldIcon){
_c9=new OpenLayers.Pixel(px.x+sz.w,px.y);
}
this._addButton("panup","north-mini.png",_c9,sz);
px.y=_c9.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);
_ca*=2;
}
this._addButton("panright","east-mini.png",px.add(_ca,0),sz);
this._addButton("pandown","south-mini.png",_c9.add(0,sz.h*2),sz);
this._addButton("zoomin","zoom-plus-mini.png",_c9.add(0,sz.h*3+5),sz);
_c9=this._addZoomBar(_c9.add(0,sz.h*4+5));
this._addButton("zoomout","zoom-minus-mini.png",_c9,sz);
return this.div;
},_addZoomBar:function(_cb){
var _cc=OpenLayers.Util.getImagesLocation();
var id="OpenLayers_Control_PanZoomBar_Slider"+this.map.id;
var _ce=this.map.getNumZoomLevels()-1-this.map.getZoom();
var _cf=OpenLayers.Util.createAlphaImageDiv(id,_cb.add(-1,_ce*this.zoomStopHeight),new OpenLayers.Size(20,9),_cc+"slider.png","absolute");
this.slider=_cf;
this.sliderEvents=new OpenLayers.Events(this,_cf,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,_cb,new OpenLayers.Size(sz.w,this.zoomStopHeight),_cc+"zoombar.png","absolute",null,"crop");
div.style.height=sz.h;
}else{
div=OpenLayers.Util.createDiv("OpenLayers_Control_PanZoomBar_Zoombar"+this.map.id,_cb,sz,_cc+"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(_cf);
this.map.events.register("zoomend",this,this.moveZoomBar);
_cb=_cb.add(0,this.zoomStopHeight*this.map.getNumZoomLevels());
return _cb;
},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 _d6=(y-top)/this.zoomStopHeight;
if(!this.map.fractionalZoom){
_d6=Math.floor(_d6);
}
var _d7=(this.map.getNumZoomLevels()-1)-_d6;
_d7=Math.min(Math.max(_d7,0),this.map.getNumZoomLevels()-1);
this.map.zoomTo(_d7);
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 _da=this.mouseDragStart.y-evt.xy.y;
var _db=OpenLayers.Util.pagePosition(this.zoombarDiv);
if((evt.clientY-_db[1])>0&&(evt.clientY-_db[1])<parseInt(this.zoombarDiv.style.height)-2){
var _dc=parseInt(this.slider.style.top)-_da;
this.slider.style.top=_dc+"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 _de=this.zoomStart.y-evt.xy.y;
var _df=this.map.zoom;
if(this.map.fractionalZoom){
_df+=_de/this.zoomStopHeight;
_df=Math.min(Math.max(_df,0),this.map.getNumZoomLevels()-1);
}else{
_df+=Math.round(_de/this.zoomStopHeight);
}
document.fire("w2gi:track",{action:"mapzoom",value:_df});
this.map.zoomTo(_df);
this.moveZoomBar();
this.mouseDragStart=null;
OpenLayers.Event.stop(evt);
}
},moveZoomBar:function(){
var _e0=((this.map.getNumZoomLevels()-1)-this.map.getZoom())*this.zoomStopHeight+this.startTop+1;
this.slider.style.top=_e0+"px";
},CLASS_NAME:"OpenLayers.Control.PanZoomBar"});
OpenLayers.Icon.IconFromTemplate=OpenLayers.Class.create();
OpenLayers.Icon.IconFromTemplate.prototype=OpenLayers.Class.inherit(OpenLayers.Icon,{bubbleid:null,initialize:function(_e1){
var img=_e1.getElementsByTagName("img")[0];
var url=img._src?img._src:img.src;
var _e4=this._getIconSize(_e1);
OpenLayers.Icon.prototype.initialize.apply(this,[url,_e4,null,calculateOffset]);
this.bubbleid=_e1.getAttribute("bubbleid");
var _e5=_e1.getElementsByTagName("div")[0];
if(_e5){
this.imageDiv.appendChild(_e5);
}
Element.extend(this.imageDiv);
this.imageDiv.addClassName("icon");
function calculateOffset(){
return new OpenLayers.Pixel(_e1.readAttribute("offsetx"),_e1.readAttribute("offsety"));
};
},_getIconSize:function(_e6){
return new OpenLayers.Size(_e6.readAttribute("width"),_e6.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(_e7,_e8,_e9){
OpenLayers.Control.prototype.initialize.apply(this,arguments);
if(_e7){
this.location=_e7;
}
if(_e8){
this.effectType=_e8;
}
if(_e9){
this.panel=_e9;
}
},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(_ec){
OpenLayers.Event.stop(_ec);
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(_ed){
if(this.blockMoreEffects==true){
return;
}else{
this.blockMoreEffects=true;
}
OpenLayers.Event.stop(_ed);
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(_ef,_f0,_f1){
OpenLayers.Marker.prototype.initialize.apply(this,arguments);
var _f2=_f1?_f1:false;
if(!_f2){
this._registerObservers();
}
},setSphericalMercator:function(_f3){
this.sphericalMercator=_f3;
},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(_f4,_f5){
var _f6=(_f5&&_f5.country)?_f5.country:"";
var _f7=new OpenLayers.LonLat(this.lonlat.lon,this.lonlat.lat);
if(this.sphericalMercator){
_f7.transform(new OpenLayers.Projection("EPSG:900913"),new OpenLayers.Projection("EPSG:4326"));
}
var _f8={longitude:_f7.lon,latitude:+_f7.lat,country:_f6};
ace.geo.reverse(_f8,processResponse.bind(this),_f5);
function processResponse(_f9){
this.reverseGeocoderAddress=_f9;
this.geocoderAddress=null;
var _fa=new OpenLayers.LonLat(_f9.LONGITUDE,_f9.LATITUDE);
if(this.sphericalMercator){
_fa.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));
}
this.lonlat=_fa;
this.country=_f9.COUNTRY;
if(!_f4){
return true;
}
try{
return _f4(this);
}
catch(e){
ace.util.alert(e,{height:100});
}
};
},geocode:function(_fb,_fc,_fd){
if(_fb==""){
return;
}
ace.geo.code(_fb,processResponse.bind(this),_fd);
function processResponse(_fe){
this.geocoderAddresses=_fe;
this.reverseGeocoderAddress=null;
if(!_fc){
return true;
}
try{
return _fc(this);
}
catch(e){
ace.util.alert(e,{height:100});
}
};
},moveToLonLat:function(_ff){
var px=this.map.getLayerPxFromLonLat(_ff||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 _103=this.mouseDragStart.x-evt.xy.x;
var _104=this.mouseDragStart.y-evt.xy.y;
var _105=this.icon.imageDiv.style;
var newX=parseInt(_105.left)-_103;
var newY=parseInt(_105.top)-_104;
_105.left=newX+"px";
_105.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 _109=this.map.getLonLatFromPixel(evt.xy);
var _10a=_109.lon-this.mouseDragStartLonLat.lon;
var _10b=_109.lat-this.mouseDragStartLonLat.lat;
this.lonlat=this.lonlat.add(_10a,_10b);
this.mouseDragStart=null;
OpenLayers.Event.stop(evt);
},CLASS_NAME:"OpenLayers.Marker.DragabbleMarker"});
var SlippyMap={locator:null,load:function(_10c,_10d,_10e){
ace.template.initialize();
ace.util.checkNumberFormat();
SlippyMap.locator=new SlippyMap.Locator(_10c,_10d,_10e);
},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.73.1"};
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(_110){
this._addObservers.bind(this,_110).defer();
var _111=this.smap.locator.panel.down();
ace.table.updateActiveRow(_111,_110.recnum);
var _112=ace.util.getCookie("locationuid");
var _113=$(_110.div).down(".make_default_loc");
if(_112&&_113){
if(_113.readAttribute("uid")==_112){
_113.checked=true;
}
}
},_popupClose:function(_114){
this.smap.map.removePopup(_114);
var _115=_114.recnum;
var _116=this.smap.proximityLayer.features[_115];
if(_116.popup){
_116.popup.destroy();
_116.popup=null;
}
var _117=this.smap.locator.panel.down();
ace.table.updateActiveRow(_117);
},_addObservers:function(_118){
var _119=ace.util.select(_118.div,"bubble_close")[0];
var _11a=ace.util.select(_118.div,"tab_label");
if(_119){
_119.observe("click",_118.hide.bind(_118));
}
var form=Element.extend(_118.div.getElementsByTagName("form")[0]);
_11a.each(function(_11c){
Event.observe(_11c,"click",this._selectTab.bind(this,_11c,_118.div,form));
}.bind(this));
if(form){
if(form.visible()){
var _11d=setInterval(function(){
Form.focusFirstElement(form);
clearInterval(_11d);
},500);
}
this._addFormObservers(form);
}
_118.div.observe("click",function(_11e){
if(!(_11e.target.type&&_11e.target.type=="checkbox")){
_11e.stop();
}
var _11f=$(_11e.target).readAttribute("action");
switch(_11f){
case "more_info":
var _120=_11e.target.readAttribute("recnum");
ace.table.oldrecords=ace.table.records.clone();
ace.table.selected=_120;
var pois=ace.table.records.slice(_120-1,_120);
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(_11e.target,_11e.target.readAttribute("uid"));
break;
}
}.bind(this));
},_addFormObservers:function(form){
var from=form.getElementsByTagName("input")[0];
var _124=form.getElementsByTagName("input")[1];
Event.observe(_124,"click",function(_125){
this.smap.locator.directionsSearch.bubbleSearch(_125);
}.bind(this));
Event.observe(from,"keypress",function(_126){
if(_126.keyCode==Event.KEY_RETURN){
this.smap.locator.directionsSearch.bubbleSearch(_126);
}
}.bind(this));
var link=form.getElementsByTagName("a")[0];
if(link){
Event.observe(link,"click",function(_128){
_128.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(_12a,div,form){
var _12d=ace.util.select(div,"tab_label").indexOf(_12a);
var _12e=ace.util.select(div,"tab_content");
var tabs=ace.util.select(div,"bubble_tab");
var _130=ace.util.select(div,"bubble_tab_dual");
tabs.each(function(tab,_132){
if(_12d==_132){
_12e[_132].addClassName("activetabcontent");
_12e[_132].removeClassName("nonactivetabcontent");
tab.addClassName("activetab");
tab.removeClassName("nonactivetab");
if(form&&form.visible()){
Form.focusFirstElement(form);
}
}else{
_12e[_132].removeClassName("activetabcontent");
_12e[_132].addClassName("nonactivetabcontent");
tab.addClassName("nonactivetab");
tab.removeClassName("activetab");
}
}.bind(this));
_130.each(function(tab,_134){
var id=tab.id;
if(_12d==_134){
if(_12e.length==_130.length){
_12e[_134].addClassName("activetabcontent");
_12e[_134].removeClassName("nonactivetabcontent");
}
tab.addClassName("active"+id);
tab.removeClassName("nonactivetab");
if(form&&form.visible()){
Form.focusFirstElement(form);
}
}else{
if(_12e.length==_130.length){
_12e[_134].removeClassName("activetabcontent");
_12e[_134].addClassName("nonactivetabcontent");
}
tab.addClassName("nonactivetab");
tab.removeClassName("active"+id);
}
}.bind(this));
}});
SlippyMap.Util={addHistory:function(_136,_137){
if(!SlippyMap.locator){
return;
}
var _138="";
($("locator_search"))?_138="locator_search":_138="product_search";
var _139=$(_138).visible()?_138:"driving_directions";
var _13a={formID:_139,qs:Form.serialize($(_139)),update:function(){
var form=$(this.formID);
if(!form.visible()){
var _13c=(this.formID==_138)?"driving_directions":_138;
$(_13c).hide();
form.show();
Form.focusFirstElement(form);
}
Form.deserialize(form,this.qs);
}};
var _13d={xml_request:_136,processResponse:_137,center:SlippyMap.locator.smap.map.getCenter(),zoom:SlippyMap.locator.smap.map.getZoom(),update:function(){
SlippyMap.locator.clear();
var _13e=ace.cache.get(this.xml_request);
if(_13e){
this.processResponse(_13e);
}
}};
ace.history.add([_13a,_13d]);
},isSearchFormValid:function(form){
var _140=true;
if(!form){
return null;
}
$(form).getInputs("text","addressline").each(function(e){
e.value=e.value.strip();
if(e.value==""){
_140=false;
throw $break;
}
}.bind(this));
return _140;
},lowerCaseObject:function(_142){
var obj={};
for(var key in _142){
obj[key.toLowerCase()]=_142[key];
}
return obj;
},getAddressline:function(_145){
var _146="";
var city="";
var _148="";
var _149="";
if(_145.ADDRESS1){
var _146=_145.ADDRESS1.blank()?"":_145.ADDRESS1.trim()+", ";
}
if(_145.CITY){
var city=_145.CITY.empty()?"":_145.CITY+", ";
}
if(_145.COUNTRY){
var _148=(_145.COUNTRY!="US")?_145.PROVINCE+" ":_145.STATE+" ";
}
if(_145.POSTALCODE){
var _149=_145.POSTALCODE.empty()?"":_145.POSTALCODE;
}
return _146+city+_148+_149;
}};
SlippyMap.IconBar=Class.create({initialize:function(_14a){
this.locator=_14a;
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 _152=$("icon_bar");
if(!_152){
return;
}
var _153=$("page_print");
if(_153){
_153.observe("click",this._printPage);
}
var _154=$("page_email");
if(_154){
_154.observe("click",this._emailPage.bind(this));
}
var _155=$("page_link");
if(_155){
_155.observe("click",this._linkToPage.bind(this));
}
},_removeObservers:function(){
var _156=$("icon_bar");
if(!_156){
return;
}
var _157=$("page_print");
if(_157){
_157.stopObserving();
}
var _158=$("page_email");
if(_158){
_158.stopObserving();
}
var _159=$("page_link");
if(_159){
_159.stopObserving();
}
},_printPage:function(){
print();
},_emailPage:function(_15a){
var form=this._getForm();
var url=this._getURL(form);
var _15d=$("page_email").getAttribute("subject");
location.href="mailto:?subject="+_15d+"&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 _162=location.href.indexOf("?");
var url=(_162>0)?location.href.substring(0,_162):location.href;
_162=location.href.indexOf("#");
url=(_162>0)?url.substring(0,_162):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(_166,_167,_168){
Object.extend(this,_168||{});
this.mapID=_166;
this.panel=$(_167);
if(_168.whereamiDiv&&_168.whereamiDiv!=null){
this.whereamiDiv=_168.whereamiDiv;
}
if(_168.ddpanel&&_168.ddpanel!=""){
this.ddpanel=_168.ddpanel;
}
(_168.formdataid)?this.formdataid=_168.formdataid:this.formdataid="locatorsearch";
this._setURLParams(false);
this._custom=new Custom(this);
if(_168.locatorType&&_168.locatorType!="product"&&(_168.onlineStores||_168.onlinePanel)){
this.productSearch=new SlippyMap.Search.ProximitySearch.Product(this);
}
if(_168.locatorType&&_168.locatorType=="product"){
this.iconBar=new SlippyMap.IconBar(this);
this.smap=new SlippyMap.Smap(this,_166,_168);
this.searchFormId="product_search";
this.proximitySearch=new SlippyMap.Search.ProximitySearch.Product(this);
this.directionsSearch=new SlippyMap.Search.DirectionsSearch(this);
}else{
if(!_168.locatorType||(_168.locatorType&&_168.locatorType=="locator")){
this.iconBar=new SlippyMap.IconBar(this);
this.smap=new SlippyMap.Smap(this,_166,_168);
this.searchFormId="locator_search";
this.proximitySearch=new SlippyMap.Search.ProximitySearch(this);
this.directionsSearch=new SlippyMap.Search.DirectionsSearch(this);
}
}
this._load(_168);
},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(_169){
var _16a=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(_16a).each(function(e){
if(_169){
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 _16d=this.smap.zoomToPOIs();
this.smap.proximityLayer.update(_16d.getCenterLonLat());
},_load:function(_16e){
document.fire("w2gi:locatorload",{"options":_16e});
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 _16f=document.createElement("input");
_16f.setAttribute("type","hidden");
_16f.setAttribute("id","geoip_state");
_16f.setAttribute("name","geoip");
_16f.setAttribute("value","start");
var _170=$("locator_search");
if(_170){
_170.appendChild(_16f);
}
}
var _171=ace.util.getCookie("locationuid");
if((_171&&_171!=null&&this.defaultLocation)){
this.url_params.prox.uid=_171;
_16e.geoip=false;
_16e.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 _172=(this.locatorType&&this.locatorType=="product")?this.url_params.prod:this.url_params.prox;
if(!_172){
_172={};
}
var _173={formdataID:_16e.formdataid,geoip:_16e.geoip,alertError:false,onError:this._bookmarkError.bind(this)};
if(this.autosearch){
_16e.formdataid="getlist";
_173.formdataID="getlist";
_173.objectName="StoreLocator";
_173.tagName="where";
}
if(this.defaultLocation){
Object.extend(_173,{"tagName":"where",objectName:"StoreLocator"});
}
if(_16e.formdataid&&_16e.formdataid!=null){
this.proximitySearch.search(_172,_173);
}else{
this.proximitySearch.search(_172,{"formdataID":this.formdataid,geoip:_16e.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 _175=this.panel.down("form");
if($(this.panel)&&_175){
Form.focusFirstElement(_175);
}
}
}
}
this._setURLParams(true);
},_deserializeSearchForm:function(){
var _176=$(this.searchFormId);
if(_176){
var _177=Object.toQueryString(this.url_params.prox);
Form.deserialize($(this.searchFormId),_177);
}
var _178=$("getlist_search");
if(_178){
Form.deserialize(_178,_177);
}
},_bookmarkError:function(xml){
if(this.proximitySearch){
var _17a=$("geoip_state");
if(_17a){
if(_17a.value=="start"){
_17a.setAttribute("value","1");
}else{
_17a.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 _17e=new OpenLayers.LonLat(lon,lat);
this.smap.map.setCenter(_17e,zoom);
if(this.whereamiDiv&&this.whereamiDiv!=null){
this.proximitySearch._updateLocation({});
}
var _17f=this.panel.down("form");
if($(this.panel)&&_17f){
Form.focusFirstElement(_17f);
}
}
document.fire("w2gi:proximitySearchError",{"xml":xml});
},_displayBookmark:function(){
var _180=location.href.indexOf("?");
if(_180!=-1){
if(!this.searchFormId){
this.searchFormId="locator_search";
}
var _181=ace.util.retrieveGetVals();
var _182=$("orig_country");
var _183=$("dest_country");
if(_182&&_183&&_181["dest_country"]&&_181["orig_country"]){
_182.value=_181["orig_country"];
_183.value=_181["dest_country"];
}
var _184=location.href.include(this.searchFormId)?this.searchFormId:"driving_directions";
if(_184){
var form=$(_184);
if(!form.visible()){
var _186=(_184==this.searchFormId)?"driving_directions":this.searchFormId;
if($(_186)){
$(_186).hide();
}
form.show();
}
Form.focusFirstElement(form);
var url=location.href.sub("form="+_184+"&","");
var qs=url.substring(url.indexOf("?")+1);
var _189=qs.split("&");
_189.each(function(e,i){
if(e.indexOf("addressline")!=-1){
_189[i]=e.gsub(/\+/," ");
}
}.bind(this));
qs=_189.join("&");
var _18c=(this.locatorType&&this.locatorType=="product")?this.url_params.prod:this.url_params.prox;
if(!_18c){
_18c={};
}
Form.deserialize(form,qs);
var _18d=(url.include("geoip=1"))?1:0;
if(this.lateDeserialize){
this._deserializeSearchForm();
}
var opts={onError:this._bookmarkError.bind(this),"geoip":_18d};
if(_184==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(_191,_192,_193){
this.locator=_191;
var opts={scales:[50000000,20000000,10000000,4000000,1000000,500000,150000,100000,50000,25000,15000,6000],smap:this};
Object.extend(opts,_193||{});
var _195;
if(_193){
_195={highlight:(_193.highlight)?_193.highlight:false,highlightEffect:(_193.highlightEffect)?_193.highlightEffect:false};
}
this.map=this._initOpenLayers(_192,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",_195);
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(_196){
_196.stop();
ace.click.track(_196.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(_197){
var _198=this.getPOIBounds(ace.table.records);
var _199;
if(this.locator.proximitySearch){
_199=this.locator.proximitySearch.centerPoint?this.locator.proximitySearch.centerPoint.clone():_198.getCenterLonLat();
}else{
_199=this.locator.productSearch.centerPoint?this.locator.productSearch.centerPoint.clone():_198.getCenterLonLat();
}
if(_199){
if(this.map.baseLayer.projection.toString()=="EPSG:900913"){
_199.transform(new OpenLayers.Projection("EPSG:4326"),this.map.baseLayer.projection);
}
}
if(!_197){
_198.extend(_199);
}
_198=this.padBounds(_198);
this.map.zoomToExtent(_198);
return _198;
},zoomToPOI:function(pois,_19b){
var _19c=this.getPOIBounds(pois);
if(!_19b){
_19c.extend(this.locator.proximitySearch.centerPoint);
}
this.map.zoomToExtent(_19c);
return _19c;
},findControl:function(_19d){
return this.map.controls.find(function(_19e){
return _19e.CLASS_NAME==_19d;
});
},padBounds:function(_19f){
var _1a0=0.0125;
return new OpenLayers.Bounds(_19f.left-_1a0,_19f.bottom-_1a0,_19f.right+_1a0,_19f.top+_1a0);
},getPOIBounds:function(pois){
var _1a2=180;
var _1a3=-180;
var _1a4=90;
var _1a5=-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;
}
_1a2=Math.min(_1a2,lon);
_1a3=Math.max(_1a3,lon);
_1a4=Math.min(_1a4,lat);
_1a5=Math.max(_1a5,lat);
}
var _1aa=new OpenLayers.Bounds(_1a2,_1a4,_1a3,_1a5);
if(this.map.baseLayer.projection.toString()=="EPSG:900913"){
_1aa.transform(new OpenLayers.Projection("EPSG:4326"),this.map.baseLayer.projection);
}
return _1aa;
},_initOpenLayers:function(_1ab,_1ac){
var _1ad=this._getSources();
var _1ae=this._getLayers(_1ad);
if(_1ae[0].options){
Object.extend(_1ac,_1ae[0].options);
}
var map=new OpenLayers.Map(_1ab,_1ac);
map.addLayers(_1ae);
return map;
},_updateCopyrightPosition:function(){
var _1b0=this.map.baseLayer.CLASS_NAME;
switch(_1b0){
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 _1b1=this.map.popups[0];
if(_1b1){
this.map.events.triggerEvent("popupclose",_1b1);
}
},_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(_1b3){
var _1b4=_1b3.map(function(_1b5){
var url=null;
var _1b7={};
var _1b8=_1b5.OPTIONS.evalJSON();
var _1b9=Object.extend(_1b7,_1b8);
switch(_1b5.NAME){
case "SlippyMap W2GI":
case "SlippyMap Navteq":
_1b7={g:"__base__",i:"PNG8",appkey:ace.xml.getXMLData("appkey")};
Object.extend(_1b9,_1b7);
url=$w(_1b5.IMAGEURL.gsub(","," "));
return new OpenLayers.Layer.KaMap(_1b5.NAME,url,_1b9,{buffer:0});
case "OpenLayers WMS":
url=$w(_1b5.IMAGEURL.gsub(","," "));
return new OpenLayers.Layer.WMS(_1b5.NAME,url,_1b9);
case "Google Satellite":
case "Google Normal":
case "Google Hybrid":
return new OpenLayers.Layer.Google(_1b5.NAME,_1b9);
case "Yahoo Regular":
case "Yahoo Satellite":
case "Yahoo Hybrid":
return new OpenLayers.Layer.Yahoo(_1b5.NAME,_1b9);
case "Virtual Earth Aerial":
case "Virtual Earth Road":
case "Virtual Earth Hybrid":
return new OpenLayers.Layer.VirtualEarth(_1b5.NAME,_1b9);
default:
throw new Error(_1b5.NAME+" - missing handler in Smap.js: _getLayers()");
}
});
return _1b4;
},_addCopyright:function(map){
var w2gi=new Element("div",{id:"w2gi_copyright"}).update("&#169; "+new Date().getFullYear()+" Where 2 Get It, Inc.");
var _1bc=new Element("div",{id:"navteq_copyright",style:"display: none;"}).update("&#169; "+new Date().getFullYear()+" NAVTEQ Corp.");
map.appendChild(w2gi);
map.appendChild(_1bc);
if(this.map.baseLayer&&this.map.baseLayer.name=="SlippyMap Navteq"){
_1bc.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(_1c0){
this.locator=_1c0;
this.smap=_1c0.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 _1c2=this.searchForm.getInputs("text","addressline");
_1c2.each(function(_1c3){
Event.observe(_1c3,"keypress",function(_1c4){
if(_1c4.keyCode==Event.KEY_RETURN){
_1c4.stop();
this._search(_1c3.form);
var _1c5=$$(".pl_hide");
if(_1c5){
_1c5.each(function(e){
e.hide();
});
}
}
}.bind(this));
}.bind(this));
var _1c7=this.searchForm.getInputs("submit");
if(_1c7.size()==0){
_1c7=this.searchForm.select("#locator_submit");
}
if(_1c7.size()==0){
_1c7=this.searchForm.select("#directions_submit");
}
if(_1c7.size()!=0){
_1c7=_1c7[0];
Event.observe(_1c7,"click",function(_1c8){
_1c8.stop();
this._search(_1c7.form);
}.bind(this));
}
var _1c9=ace.util.select(this.searchForm,"search_toggle");
if(_1c9.size()>0){
_1c9=_1c9[0];
Event.observe(_1c9,"click",function(_1ca){
_1ca.stop();
this.searchForm.hide();
if(this.altSearchForm){
this.altSearchForm.show();
Form.focusFirstElement(this.altSearchForm);
}
}.bind(this));
}
},_validateSearchForm:function(form){
var _1cc=form.addressline;
var _1cd=this.locator.blankAddress?true:false;
if(!form){
return true;
}
if(!this._checkAddresses(_1cc)){
return false;
}
if(!_1cd&&!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(_1cf){
var _1d0=true;
if(!_1cf){
return true;
}
if(_1cf.length){
i=_1cf.length;
var e;
for(i;i>0;i--){
var e=_1cf[i-1];
var _1d2="";
if(!e.include&&e.value){
_1d2=e.value;
}else{
_1d2=e;
}
if(!this._illegalStringCheck(_1d2)){
_1d0=false;
}
}
}else{
var e=_1cf.value;
var _1d2="";
if(!e.include&&e.value){
_1d2=e.value;
}else{
_1d2=e;
}
if(!this._illegalStringCheck(_1d2)){
_1d0=false;
}
}
return _1d0;
},_illegalStringCheck:function(_1d3){
_1d3=(_1d3)?$(_1d3)+"":"";
if(_1d3&&_1d3.include&&(_1d3.include("!")||_1d3.include("$")||_1d3.include("%")||_1d3.include("^")||_1d3.include("*")||_1d3.include("(")||_1d3.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(_1d5){
var img=$("map_url_image");
if(_1d5&&img){
var size=_1d5.match(/size=(\d+),(\d+)/);
if(size){
img.width=size[1];
img.height=size[2];
}
if(Prototype.Browser.IE6){
_1d5=_1d5.replace(/ /g,"%20");
}
img.src=_1d5;
}
},_customLayer:function(o){
var _1d9=custom.layerSwitchingRules;
var _1da,_1db=false;
var _1dc,_1dd=false;
for(var rule in _1d9){
_1da=true;
for(var cond in _1d9[rule]){
_1dc=_1d9[rule][cond];
if(Object.isArray(_1dc)){
_1da=(_1da&&ace.util.evalExpression(o[cond.toUpperCase()],_1dc[1],_1dc[0]));
}else{
if(cond=="layer"){
_1dd=_1d9[rule][cond];
}
}
_1db=_1da;
if(!_1da){
break;
}
}
if(_1db){
return _1dd;
}
}
return false;
}});
if(!Custom){
var Custom=Class.create();
}
if(!custom_ob){
var custom_ob=null;
}
Custom.prototype={initialize:function(_1e0){
this.active_ob=null;
if(custom_ob&&custom_ob["name"]&&typeof custom_ob["name"]=="string"){
this.active_ob=new Custom[custom_ob["name"]](_1e0);
}else{
if(custom_ob&&custom_ob["name"]){
this.active_ob=[];
custom_ob["name"].each(function(e){
this.active_ob.push(new Custom[e](_1e0));
}.bind(this));
}
}
},VERSION_NUMBER:".3"};
SlippyMap.Search.ProximitySearch=Class.create(SlippyMap.Search,{cacheResults:false,searchRadius:null,dragStartCenter:null,centerPoint:null,layer:null,initialize:function(_1e2){
this.locator=_1e2;
var form=null;
if($("locator_search")){
this.xmlId="locatorsearch";
form=$("locator_search");
}else{
if(this.locator.formdataid){
this.xmlId=this.locator.formdataid;
}else{
this.xmlId="productsearch";
}
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(_1e2.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);
(_1e2.pl_header&&_1e2.pl_header!="")?this._observeHeader(_1e2.pl_header):null;
this.locator.panel.observe("w2gi:sliceUpdated",function(_1e4){
_1e4.stop();
this._processSlice(_1e4.memo);
}.bind(this));
this.layer=this.smap.map.layers.find(function(_1e5){
return _1e5.name=="SlippyMap W2GI";
});
if($("search_country")){
var _1e6="US";
if(this.locator.COUNTRY){
_1e6=this.locator.COUNTRY;
}
if($("search_country").options&&$("search_country").options.length==0){
ace.collection.updateOptions("search_country","Country",_1e6);
}else{
if(this.locator.COUNTRY&&$("country").value&&$("search_country").value!=this.locator.COUNTRY){
$("search_country").value=this.locator.COUNTRY;
}
}
}
document.observe("w2gi:mapFormSearch",function(_1e7){
_1e7.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,_1e9){
this.dynamicSearch=(_1e9&&_1e9.dynamicSearch)?true:false;
this.geoip=(_1e9&&_1e9.geoip&&_1e9.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,_1e9||{});
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 _1ed=$("getlist_search");
if(!_1ed){
return;
}
var _1ee=_1ed.getInputs();
_1ee.each(function(_1ef){
Event.observe(_1ef,"keypress",function(_1f0){
if(_1f0.keyCode==Event.KEY_RETURN){
_1f0.stop();
this.search(_1ef.form);
}
}.bind(this));
}.bind(this));
var _1f1=_1ed.getInputs("submit");
if(_1f1.size()==0){
_1f1=_1ed.select("#getlist_search");
}
if(_1f1.size()!=0){
_1f1=_1f1[0];
Event.observe(_1f1,"click",function(_1f2){
_1f2.stop();
this.search(_1f1.form);
}.bind(this));
}
},_observeHeader:function(_1f3){
$(_1f3).observe("click",function(e){
var _1f5="";
if(e.target){
_1f5=$(e.target).readAttribute("action");
}
switch(_1f5){
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 _1f7=$("search_bar").getStyle("width");
_1f7=_1f7.substr(0,_1f7.length-2)*1;
var left=(winW-_1f7)/2;
if(left>0){
$("search_bar").setStyle({"left":left+"px"});
}
$("search_bar").toggle();
break;
}
}.bind(this));
},_addPanelObserver:function(_1f9){
Event.observe(_1f9,"click",function(_1fa){
if(!(_1fa.target.type&&_1fa.target.type=="checkbox")){
_1fa.stop();
}
if(!this.searchForm.visible()){
return;
}
var _1fb=_1fa.element().readAttribute("action");
switch(_1fb){
case "search_address":
var _1fc=_1fa.element().readAttribute("recnum");
var poi=ace.table.getRecord(_1fc);
var _1fe=this.searchForm.getInputs("text","addressline")[0];
_1fe.value=(poi.ADDRESS1?poi.ADDRESS1+", ":"")+(poi.CITY?poi.CITY+",":"")+(poi.STATE?" "+poi.STATE:"")+(poi.PROVINCE?" "+poi.PROVINCE:"")+(poi.POSTALCODE?" "+poi.POSTALCODE:"");
var _1ff={latitude:poi.LATITUDE,longitude:poi.LONGITUDE,country:poi.COUNTRY};
Object.extend(_1ff,this.locator.url_params.prox);
this.search(_1ff,{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 _201=this._getNoChecks(form);
var _202=(this.locatorType&&this.locatorType=="product")?this.locator.url_params.prod:this.locator.url_params.prox;
var _203=form.serialize(true);
Object.extend(_202,_203);
if(this.locator.searchLimit&&this.locator.searchLimit>0){
Object.extend(_202,{"limit":this.locator.searchLimit});
}
var _204={formdataID:this.locator.formdataid,alertError:true};
if(this.locator.like){
Object.extend(_204,{"like":this.locator.like});
}
Object.extend(_202,_201);
this.search(_202,_204);
},_getNoChecks:function(form){
var _206=form.getInputs("checkbox");
var ret={};
_206.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 _20b=this.smap.map.center.clone();
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_20b.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
this.dragStartCenter=_20b;
}
},_onMapMouseUp:function(evt){
if(this.smap.routeMarkerLayer.layer.markers.length>0){
return;
}
if(!this.dragStartCenter){
return;
}
var _20d=this.smap.map.center.clone();
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_20d.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
var _20e=Math.max(Math.abs(_20d.lon-this.dragStartCenter.lon),Math.abs(_20d.lat-this.dragStartCenter.lat));
var _20f=(_20e*69.04)/2;
var _210=this.searchRadius;
if(this.searchRadius.indexOf("|")){
var arr=this.searchRadius.split("|");
_210=arr[0];
}
var _212=parseFloat(_210)/2;
if(_20f>_212){
this.searchLonLat(_20d,{onError:this.locator.clearLocator.bind(this.locator),alertError:false});
this.dragStartCenter=null;
}
},searchLonLat:function(_213,_214){
var _215={longitude:_213.lon,latitude:_213.lat,searchradius:this.searchRadius};
Object.extend(_215,this.locator.url_params.prox);
var opts=Object.extend({formdataID:this.xmlId,dynamicSearch:true},_214||{});
this.search(_215,opts);
this._updateAddressline(_215);
this.searchedLonLat=true;
},_getSearchRadius:function(form){
if(form.searchradius&&this.searchRadius){
return form.searchradius.value;
}
var _218=ace.xml.getNodeValue(ace.xml.getXML(form)[0].getElementsByTagName("searchradius")[0]);
if(_218){
return _218;
}
var _219=this.smap.map.calculateBounds();
if(!_219){
return null;
}
var _21a=Math.min(Math.abs(_219.top-_219.bottom),Math.abs(_219.left-_219.right));
return ""+((_21a*69.04)/2);
},_updateAddressline:function(_21b){
ace.geo.reverse(_21b,function(_21c){
var _21d=SlippyMap.Util.getAddressline(_21c);
this.searchForm.addressline.value=_21d;
if(this.locator.whereamiDiv&&this.locator.whereamiDiv!=null){
var _21e={"COUNTRY":_21c.COUNTRY||null,"CITY":_21c.CITY||null,"POSTALCODE":_21c.POSTALCODE||null,"PROVINCE":_21c.PROVINCE||null,"STATE":_21c.STATE||null};
this._updateLocation(_21e);
}
}.bind(this));
},_processResponse:function(_21f){
var name=ace.xml.getCollectionName(_21f);
var _221=_21f.getElementsByTagName("collection")[0].getAttribute("country");
var city=_21f.getElementsByTagName("collection")[0].getAttribute("city");
var _223=_21f.getElementsByTagName("collection")[0].getAttribute("postalcode");
var _224=_21f.getElementsByTagName("collection")[0].getAttribute("state");
var _225=_21f.getElementsByTagName("collection")[0].getAttribute("province");
var _226=_21f.getElementsByTagName("collection")[0].getAttribute("mapurl");
var _227=$("geoip_state");
if(_227){
if(_227.value=="start"){
_227.setAttribute("value","1");
}else{
_227.setAttribute("value","0");
}
}
var _228={"COUNTRY":_221||null,"CITY":city||null,"POSTALCODE":_223||null,"PROVINCE":_225||null,"STATE":_224||null};
document.fire("w2gi:proximityresponse",{"responseXML":_21f,"geoipData":_228});
Object.extend(this.locator,_228||{});
this.smap.clear();
var _229=$A(ace.xml.parse(_21f));
var _22a=false,_22b="";
if(!(typeof (custom)=="undefined"||custom===null)&&custom.layerSwitchingRules){
if(_229.any(function(o){
return (_22b=this._customLayer(o));
}.bind(this))){
_22a=true;
}
}
var _22d=this.smap.map.layers.find(function(_22e){
return _22e.name=="Proximity markers";
});
if(this.smap.map.layers[0].projection.toString()=="EPSG:4326"){
_22d.projection=new OpenLayers.Projection("EPSG:4326");
_22d.maxExtent=new OpenLayers.Bounds(-165,15,-50,75);
_22d.units="degrees";
_22d.maxResolution=1.40625;
this.layer=this.smap.map.layers.find(function(_22f){
return _22f.name=="SlippyMap W2GI";
});
if((_22a&&_22b=="SlippyMap Navteq")||(!_22a&&_229.any(function(o){
return (o.COUNTRY=="CA");
}.bind(this)))){
this.layer=this.smap.map.layers.find(function(_231){
return _231.name=="SlippyMap Navteq";
});
}else{
if((_22a&&_22b=="Google Normal")||(!_22a&&_229.any(function(o){
return (o.COUNTRY!="US"&&o.COUNTRY!="CA"&&o.COUNTRY.length>0);
}))){
this.layer=this.smap.map.layers.find(function(_233){
return _233.name=="Google Normal";
});
if(this.layer){
if(_22d.projection.toString()!="EPSG:900913"){
_22d.projection=new OpenLayers.Projection("EPSG:900913");
_22d.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_22d.units="m";
_22d.maxResolution=156543.0339;
}
}
}
}
}else{
this.layer=this.smap.map.layers.find(function(_234){
return _234.name=="Google Normal";
});
if(this.layer){
if(_22d.projection.toString()!="EPSG:900913"){
_22d.projection=new OpenLayers.Projection("EPSG:900913");
_22d.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_22d.units="m";
_22d.maxResolution=156543.0339;
}
}
}
switch(name){
case "poi":
this.centerPoint=this._getCenterPoint(_21f);
if(this.locator.defaultLocation){
this.locator.defaultLocation=false;
this.locator.uid="";
}
var _235=ace.util.getCookie("locationuid");
if(_235&&$(_235)){
$(_235).checked=true;
}
if(this.layer){
this.smap.map.setBaseLayer(this.layer);
}
var _236=0;
if(this.centerPoint){
_236=this.centerPoint.clone();
}
this.smap.zoomToPOIs();
this.smap.proximityLayer.update(_236);
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(_228);
}
if(this.locator.whereamiDiv&&this.locator.whereamiDiv!=null&&!this.searchedLonLat){
this._updateLocation(_228);
}else{
this.searchedLonLat=false;
}
if(this.geoip&&this.searchForm.addressline){
var _237=city+" "+_224+" "+_223;
this.searchForm.addressline.value=_237;
}
if(this.locator.location_address_id&&this.locator.location_address_id!=""){
var data=_229[0];
var _239=data.ADDRESS1+" "+data.CITY+" "+data.STATE+" "+data.POSTALCODE;
$(this.locator.location_address_id).value=_239;
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")&&_228.COUNTRY){
$("search_country").value=_228.COUNTRY;
}
if(_226){
this._addMapUrlImage(_226);
}
this.locator._setURLParams(true);
return this.cacheResults;
},_updateEtailerIframe:function(_23a){
if(_23a.COUNTRY){
var _23b=$(this.locator.updateEtailersIframe);
_23b.src=_23b.src.substr(0,_23b.src.length-2)+_23a.COUNTRY;
}
},_updateLocation:function(_23c){
if(!_23c.COUNTRY&&!_23c.STATE&&!_23c.PROVINCE&&!_23c.CITY&&!_23c.POSTALCODE){
ace.template.updateLocation(this.locator.whereamiDiv,"location_none",_23c);
}else{
if(!_23c.CITY){
ace.template.updateLocation(this.locator.whereamiDiv,"location_nc",_23c);
}else{
ace.template.updateLocation(this.locator.whereamiDiv,"location_us",_23c);
}
}
},_getCenterPoint:function(_23d){
var _23e=ace.xml.getCollection(_23d,"poi")||ace.xml.getCollection(_23d,"multiple_address");
var _23f=_23e.getAttribute("centerpoint");
if(_23f){
return OpenLayers.LonLat.fromString(_23f);
}else{
return 0;
}
},_processSlice:function(_240){
var _241=this.smap.getPOIBounds(_240);
if(this.locator.proximitySearch.centerPoint==0){
var _242=(_241.left-_241.right)/2+_241.right;
var vert=(_241.top-_241.bottom)/2+_241.bottom;
var _244=_242+","+vert;
this.locator.proximitySearch.centerPoint=OpenLayers.LonLat.fromString(_244);
}
var _245=this.locator.proximitySearch.centerPoint.clone();
var _246=this.locator.proximitySearch.centerPoint.clone();
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_245.transform(new OpenLayers.Projection("EPSG:4326"),this.smap.map.baseLayer.projection);
}
_241.extend(_245);
_241=this.smap.padBounds(_241);
var view=this.smap.map.calculateBounds();
if(!view.containsBounds(_241)){
this.smap.map.zoomToExtent(_241);
}
this.smap.clear();
this.smap.proximityLayer.update(_246);
},_makeDefaultLocation:function(e,uid){
var name="locationuid";
var _24b=uid;
var _24c=1000;
var _24d=(this.locator.clientCookie&&this.locator.clientCookie.domain)?this.locator.clientCookie.domain:"";
var _24e=0;
var _24f="";
if(this.locator.clientCookie&&this.locator.clientCookie.value){
var temp=ace.table.records.find(function(e){
return e.UID==uid;
}.bind(this));
if(temp){
_24f=temp[this.locator.clientCookie.value.toUpperCase()];
}
}
var _252=(this.locator.clientCookie&&this.locator.clientCookie.name)?this.locator.clientCookie.name:"locationuid";
if(!(this.locator.clientCookie&&this.locator.clientCookie.value&&_24f&&_24f!="")){
_24f=uid;
}
var _253=(this.locator.clientCookie&&this.locator.clientCookie.expires)?this.locator.clientCookie.expires:1000;
var _254=(this.locator.clientCookie&&this.locator.clientCookie.domain)?this.locator.clientCookie.domain:"";
if(!e.checked){
ace.util.deleteCookie(name,_24d);
if(this.locator.clientCookie&&ace.util.getCookie(_252)){
ace.util.deleteCookie(_252,_24d);
}
return;
}
if(this.locator.clientCookie){
ace.util.setCookie(_252,_24f,_253,null,_24d,_24e);
}
ace.util.setCookie(name,_24b,_24c,null,_24d,_24e);
var _255=ace.util.getCookie(name);
if(!_255){
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(_258){
this.locator=_258;
this.searchForm=$("product_search");
this.altSearchForm=$("driving_directions");
if(_258.locatorType&&_258.locatorType=="product"){
SlippyMap.Search.ProximitySearch.prototype.initialize.apply(this,arguments);
}
if(_258.onlinePanel&&_258.onlinePanel!=""){
this._fillOnlinePanel();
}
if(_258.onlineStores&&_258.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,_25a){
SlippyMap.Search.ProximitySearch.prototype.search.apply(this,arguments);
},_fillOnlineStores:function(){
var _25b=this.locator.url_params.etail;
if(!_25b.currency){
_25b.currency="auto";
}
var _25c={formdataID:"onlinestoresearch",like:1,alertError:false};
if(this.locator.useDiv){
ace.div.update(this.locator.onlineStores,_25b,null,_25c);
}else{
ace.table.update(this.locator.onlineStores,_25b,null,_25c);
}
},_fillOnlinePanel:function(){
var _25d=this.locator.url_params.etail;
if(!_25d.currency){
_25d.currency="auto";
}
var _25e={formdataID:"onlineetailersearch",like:1,alertError:false,onError:this._prodError.bind(this)};
if(this.locator.synchronous){
Object.extend(_25e,{"asynchronous":false});
}
if(this.locator.useDiv){
ace.div.update("online_comp_panel",_25d,this._processProducts.bind(this),_25e);
}else{
ace.table.update("online_comp_panel",_25d,this._processProducts.bind(this),_25e);
}
},_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(_262){
this.locator=_262;
this.searchForm=$("driving_directions");
this.altSearchForm=$(_262.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(_263){
return _263.name=="SlippyMap Navteq";
});
},destroy:function(){
SlippyMap.Search.prototype.destroy.apply(this,arguments);
this.bounds=null;
this.includeATW=null;
},search:function(form,_265){
this.searchFromMarker=false;
var _266=Form.getInputs(form,"text","addressline");
var _267=Form.getInputs(form,"hidden","addressline");
if(_267.size()==1){
_266.push(_267[0]);
}
var _268=Form.serializeElements(_266,true);
var _269=_268.addressline;
var _26a={};
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;
}
if(this.locator.lat&&this.locator.lat!=null&&this.locator.action&&this.locator.action!=null){
Object.extend(_269,{"latitude":this.locator.lat,"longitude":this.locator.lon,"action":this.locator.action});
_26a={"uid":this.locator.uid,"action":this.locator.action};
}else{
_26a={"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,_269,_26a,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory},form);
},bubbleSearch:function(_26b){
if(!(_26b.target.type&&_26b.target.type=="checkbox")){
_26b.stop();
}
this.searchFromMarker=false;
var form=_26b.element().form;
var _26d=Form.getInputs(form,"text","addressline")[0];
_26d.value=_26d.value.strip();
if(_26d.value.empty()){
return;
}
var _26e=_26b.element().readAttribute("recnum");
var poi=ace.table.getRecord(_26e);
var _270=(form.getElementsByTagName("a")[0].innerHTML=="To")?false:true;
var _271=Form.serialize(form,true);
var _272=_270?[poi,_271]:[_271,poi];
var _273={uid:poi.UID,action:_270?"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,_272,_273,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory},form);
this._updateSearchForm(_270,_26d.value,poi);
},markerSearch:function(_274,_275,_276){
this.searchFromMarker=true;
var _277=new OpenLayers.LonLat(_274.lonlat.lon,_274.lonlat.lat);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_277.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
var _278={LONGITUDE:_277.lon,LATITUDE:_277.lat,COUNTRY:_274.country};
var _279=(_275<=0)?[_278,_276]:[_276,_278];
ace.directions.search(this.ddpanel,this.formData,this.includeATW,_279,false,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory});
this._updateAddressline(_274.getAddress(),_275);
},processResponse:function(_27a){
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(_27a,"maneuvers");
var _27c=this.smap.map.layers.find(function(_27d){
return _27d.name=="Route markers";
});
var _27e=this.smap.map.layers.find(function(_27f){
return _27f.name=="Route vector";
});
if(!_27e){
_27e=this.smap.map.layers.find(function(_280){
return _280.name=="Route image";
});
}
if(xml){
this.bounds=this.smap.padBounds(this._getRouteBounds(xml));
var _281=this._getIconAddresses(_27a);
this.mapurl=_27a.getElementsByTagName("collection")[0].getAttribute("mapurl");
["A","B"].each(function(_282,_283){
_281[_283].POINUM=_282;
_281[_283].RECNUM=_282;
});
if(this.smap.map.layers[0].projection.toString()=="EPSG:4326"){
this.layer=this.smap.map.layers.find(function(_284){
return _284.name=="SlippyMap Navteq";
});
_27e.projection=new OpenLayers.Projection("EPSG:4326");
_27e.maxExtent=new OpenLayers.Bounds(-165,15,-50,75);
_27e.units="degrees";
_27e.maxResolution=1.40625;
_27c.projection=new OpenLayers.Projection("EPSG:4326");
_27c.maxExtent=new OpenLayers.Bounds(-165,15,-50,75);
_27c.units="degrees";
_27c.maxResolution=1.40625;
if(_281.any(function(o){
return (o.COUNTRY!="US"&&o.COUNTRY!="CA");
})){
this.layer=this.smap.map.layers.find(function(_286){
return _286.name=="Google Normal";
});
_27e.projection=new OpenLayers.Projection("EPSG:900913");
_27e.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_27e.units="m";
_27e.maxResolution=156543.0339;
_27c.projection=new OpenLayers.Projection("EPSG:900913");
_27c.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_27c.units="m";
_27c.maxResolution=156543.0339;
this.bounds.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));
}
}else{
this.layer=this.smap.map.layers.find(function(_287){
return _287.name=="Google Normal";
});
_27e.projection=new OpenLayers.Projection("EPSG:900913");
_27e.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_27e.units="m";
_27e.maxResolution=156543.0339;
_27c.projection=new OpenLayers.Projection("EPSG:900913");
_27c.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_27c.units="m";
_27c.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(_281);
this.smap.routeMarkerLayer.addEndMarkers(_281);
this.smap.routeLayer.addRoute();
var _288=ace.xml.getCollection(_27a,"pois");
if(_288&&_288.childNodes&&_288.childNodes.length!=0){
var pois=ace.xml.parse(_288);
pois.each(function(poi,_28b){
ace.table.addRecord(poi);
});
var _28c=this.ddpanel.down();
this._addAlongTheWayInfo(_28c,pois);
}
this._addReverseSearchObservers();
this._updatePanelAddressline(_281);
if(this.mapurl){
this._addMapUrlImage(this.mapurl);
}
}else{
this.responseXML=ace.util.cleanWhitespace(_27a);
this.smap.routeLayer.clear();
this.smap.routeMarkerLayer.clear();
//this.smap.zoomToPOIs(true);
var _281=this._getAddressesFromMultiple();
this._updateCountrySelects(_281);
}
return true;
},_addAlongTheWayInfo:function(_28d,pois){
this.smap.proximityLayer.addPOIMarkers(pois,false);
var _28f=this._getManeuverPOIs(pois);
this._updatePanel(_28d,_28f);
},_getManeuverPOIs:function(pois){
var _291={};
for(var i=0,len=pois.length;i<len;i++){
var poi=pois[i];
_291[poi.MANEUVER]?_291[poi.MANEUVER].push(poi):_291[poi.MANEUVER]=[poi];
}
return _291;
},_updatePanel:function(_295,_296){
var rows=ace.util.select(_295,"maneuver_pois");
for(maneuver in _296){
var _298=parseInt(maneuver)-1;
var _299=ace.template.getTemplate("along_the_way");
_295=ace.template.getTableTemplate(_299,_296[maneuver]);
rows[_298].update(_295).show();
}
},_updateCountrySelects:function(_29a){
if($("orig_country")&&_29a[0]&&_29a[0].COUNTRY){
$("orig_country").value=_29a[0].COUNTRY;
}
if($("dest_country")&&_29a[1]&&_29a[1].COUNTRY){
$("dest_country").value=_29a[1].COUNTRY;
}
},_updatePanelAddressline:function(_29b){
var _29c=ace.util.select($(this.ddpanel),"addressline");
if(_29c.length>0){
var _29d=ace.util.select($(this.ddpanel),"ddendpoint");
for(var i=0;i<_29c.length;i++){
if(_29d&&_29d.length==2){
var _29f=null;
if(i==0){
_29f=ace.template.getTemplate("ddstarticon",{});
}else{
_29f=ace.template.getTemplate("ddendicon",{});
}
if(_29f!=null){
_29d[i].update(_29f);
}
}
var _2a0=$(_29b[i]);
var _2a1=$(_29c[i]);
var _2a2=_2a0.ADDRESS1.blank()?"":_2a0.ADDRESS1.trim();
var _2a3=_2a1.getElementsBySelector(".address_line1");
if(_2a2&&_2a3.length>0){
_2a3[0].update(_2a2);
}
var city=_2a0.CITY.empty()?"":_2a0.CITY+", ";
var _2a5=ace.util.select(_2a1,"address_city");
if(city&&_2a5.length>0){
_2a5[0].update(city);
}
var _2a6=(_2a0.COUNTRY!="US")?_2a0.PROVINCE+" ":_2a0.STATE+" ";
var _2a7=ace.util.select(_2a1,"address_state");
if(_2a6&&_2a7.length>0){
_2a7[0].update(_2a6);
}
var _2a8=_2a0.POSTALCODE.empty()?"":_2a0.POSTALCODE;
var _2a9=ace.util.select(_2a1,"address_zip");
if(_2a8&&_2a9.length>0){
_2a9[0].update(_2a8);
}
}
}
},_addPanelObserver:function(_2aa){
Event.observe(_2aa,"click",function(_2ab){
if(!(_2ab.target.type&&_2ab.target.type=="checkbox")){
_2ab.stop();
}
if(!this.searchForm||!this.searchForm.visible()){
return;
}
var _2ac=_2ab.element().readAttribute("action");
switch(_2ac){
case "search_address":
var _2ad=_2ab.element().readAttribute("recnum");
var _2ae=parseInt(_2ad)-1;
var _2af=this._getMultipleAddresses();
var _2b0=_2af.addresses[_2ae];
var _2b1=ace.xml.parseNode(_2b0);
var _2b2=this.searchForm.getInputs("text","addressline")[_2af.index];
if(_2b2){
_2b2.value=this._getSelectedInput(_2b0);
}
ace.directions.addresses[_2af.index]=_2b1;
ace.directions.search(_2aa,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(_2b4,_2b5,poi){
var _2b7=poi.ADDRESS1+", "+poi.CITY+", "+poi.STATE+" "+poi.POSTALCODE;
var _2b8=this.searchForm.getInputs("text","addressline");
var _2b9=this.searchForm.getInputs("hidden","addressline");
var _2ba=this.searchForm.getInputs("checkbox","includeATW");
if(_2ba&&_2ba[0]){
_2ba[0].checked=(this.includeATW)?"checked":"";
}
if(_2b8[0]){
_2b8[0].value=_2b4?_2b7:_2b5;
}
if(_2b8[1]){
_2b8[1].value=_2b4?_2b5:_2b7;
}else{
if(_2b9[0]){
_2b9[0].value=_2b4?_2b7:_2b5;
}
}
var uid=this.searchForm.getInputs("hidden","uid");
var _2bc=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(_2bc&&_2bc.size()>0){
_2bc[0].value=_2b4?"From":"To";
}
if(lon&&lon.size()>0){
lon[0].value=poi.LONGITUDE;
}
if(lat&&lat.size()>0){
lat[0].value=poi.LATITUDE;
}
},_updateAddressline:function(_2bf,_2c0){
var _2c1=this.searchForm.getInputs("text","addressline")[_2c0];
if(!_2c1){
_2c1=this.searchForm.getInputs("hidden","addressline")[0];
}
if(_2c1){
_2c1.value=SlippyMap.Util.getAddressline(_2bf);
}
},_addReverseSearchInputsObservers:function(){
if(this.searchForm){
var _2c2=this.searchForm.getElementsByTagName("img")[0];
if(_2c2){
Event.observe(_2c2,"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 _2c3=this.searchForm.getInputs("text","addressline");
var _2c4=_2c3.pluck("value").reverse();
_2c3.each(function(e,_2c6){
e.value=_2c4[_2c6];
});
},_reverseSearchAction:function(){
if($("location_action")){
$("location_action").value=($("location_action").value=="To")?"From":"To";
}
},_getMultipleAddresses:function(){
var _2c7=null;
var _2c8=this.responseXML.cloneNode(true);
var _2c9=$A(this.responseXML.getElementsByTagName("collection")[0].childNodes);
_2c9.each(function(e,_2cb){
if(e.tagName=="collection"&&e.getAttribute("name")=="multiple_address"){
_2c7={addresses:e.getElementsByTagName("address"),index:_2cb};
e.removeAttribute("name");
throw $break;
}
});
return _2c7;
},_getAddressesFromMultiple:function(){
var _2cc=[];
var _2cd=ace.xml.getCollection(this.responseXML);
var _2ce=$A(_2cd.getElementsByTagName("collection")[0].childNodes);
_2ce.each(function(e,_2d0){
if(e.tagName=="collection"&&e.getAttribute("name")=="multiple_address"){
_2cc.push(ace.xml.parseNode(e.getElementsByTagName("address")[0]));
}else{
_2cc.push(ace.xml.parseNode(e));
}
});
return _2cc;
},_getSelectedInput:function(_2d1){
var _2d2=_2d1.getElementsByTagName("address1")[0].firstChild;
var _2d3=_2d2?_2d2.nodeValue:"";
var _2d4=(_2d1.getElementsByTagName("state")[0].firstChild)?_2d1.getElementsByTagName("state")[0].firstChild.nodeValue:"";
var _2d5=(_2d1.getElementsByTagName("province")[0].firstChild)?_2d1.getElementsByTagName("province")[0].firstChild.nodeValue:"";
var _2d6=(_2d1.getElementsByTagName("postalcode")[0].firstChild)?_2d1.getElementsByTagName("postalcode")[0].firstChild.nodeValue:"";
var city=(_2d1.getElementsByTagName("city")[0].firstChild)?_2d1.getElementsByTagName("city")[0].firstChild.nodeValue:"";
var _2d8=((_2d3=="")?"":_2d3+", ");
_2d8+=city+", ";
_2d8+=_2d4+" "+_2d5+" "+_2d6;
return _2d8;
},_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(_2db){
var xml=ace.xml.getCollection(_2db,"address").getElementsByTagName("address");
return ace.xml.parseNodes(xml);
},_getRouteBounds:function(xml){
var _2de=xml.getAttribute("bounds");
return new OpenLayers.Bounds.fromString(_2de);
}});
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,_2e2){
if(_2e2){
this.highlight=(_2e2.highlight==true)?true:false;
this.highlightEffect=(_2e2.highlightEffect)?_2e2.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(_2e3){
this.addCenterMarker(_2e3);
this.addPOIMarkers();
},addPOIMarkers:function(pois,_2e5){
pois=pois||ace.table.getSlice()||ace.table.records;
for(var i=pois.length-1;i>=0;i--){
this.addPOIMarker(pois[i],false,_2e5);
}
},addPOIMarker:function(poi,_2e8,_2e9){
var _2ea=null;
if(_2e8){
var _2eb=new OpenLayers.LonLat(poi.LONGITUDE,poi.LATITUDE);
var _2ec=ace.template.getIconTemplate("dragabble_icon",poi);
var icon=new OpenLayers.Icon.IconFromTemplate(_2ec);
_2ea=new OpenLayers.Marker.DragabbleMarker(_2eb,icon);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_2ea.setSphericalMercator(true);
}
if(!_2e9){
_2ea.events.register("click",this,function(evt){
OpenLayers.Event.stop(evt);
});
}
}else{
var _2ef=this._createFeature(poi);
_2ea=_2ef.createMarker();
this.features[poi.RECNUM]=_2ef;
if(!_2e9){
this._bindMarkerClick(_2ea,_2ef,poi.UID);
}
}
_2ea.recnum=poi.RECNUM;
if(this.highlight){
this._bindMarkerOver(_2ea);
}
this.layer.addMarker(_2ea);
return _2ea;
},removePOIMarker:function(_2f0){
var _2f1=this.getPOIMarker(_2f0);
this.layer.removeMarker(_2f1);
if(this.features[_2f0]){
this.features[_2f0].destroy();
delete this.features[_2f0];
}
return _2f1;
},replacePOIMarker:function(_2f2,_2f3){
this.removePOIMarker(_2f2);
var poi=ace.table.getRecord(_2f2);
var ret=this.addPOIMarker(poi,_2f3);
for(i in this.layer.markers){
var m=this.layer.markers[i];
if(m&&m.icon){
if(m.recnum==_2f2){
m.icon.imageDiv.style.zIndex=4500;
}else{
m.icon.imageDiv.style.zIndex=3500;
}
}
}
return ret;
},getPOIMarker:function(_2f7){
return this.layer.markers.find(function(_2f8){
return _2f8.recnum==_2f7;
});
},addCenterMarker:function(_2f9){
var _2fa=ace.template.getTemplate("center_marker");
if(!_2fa){
return null;
}
if(!_2f9){
return null;
}
var icon=new OpenLayers.Icon.IconFromTemplate(_2fa);
var _2fc=new OpenLayers.Marker.DragabbleMarker(_2f9,icon);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_2fc.setSphericalMercator(true);
}
_2fc.events.register("mouseup",this.smap.locator.proximitySearch,function(evt){
OpenLayers.Event.stop(evt);
var _2fe=evt.object.lonlat;
this.smap.map.setCenter(_2fe);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_2fe.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
this.searchLonLat(_2fe,{onError:this.locator.clearLocator.bind(this.locator)});
document.fire("w2gi:track",{action:"centermarkerdrag",value:_2fe.toShortString()});
});
this.layer.addMarker(_2fc);
return _2fc;
},_addPanelObserver:function(_2ff){
$(_2ff).observe("click",function(_300){
if(!(_300.target.type&&_300.target.type=="checkbox")){
_300.stop();
}
var _301=_300.element().readAttribute("action");
if(_301){
var i=_301.lastIndexOf("/");
if(i!=-1){
_301=_301.substring(i+1,_301.length);
}
}
var _303;
switch(_301){
case "open_bubble":
_303=_300.element().readAttribute("recnum");
if(this._markerClick(this.features[_303])){
var _304=ace.table.getRecord(_303);
document.fire("w2gi:track",{action:"clickondealer-panel",value:_304.UID});
}
break;
case "sort_table":
var _305=_300.element().readAttribute("sort_field");
var _306=_300.element().readAttribute("field_type");
ace.table.sortRecords(_305,_306);
ace.table.updateFromRecords(_2ff);
this.smap.clear();
this.update(this.smap.locator.proximitySearch.centerPoint);
break;
case "more_info":
_303=_300.element().readAttribute("recnum");
ace.table.oldrecords=ace.table.records.clone();
ace.table.selected=_303;
var pois=ace.table.records.slice(_303-1,_303);
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(_300.element(),_300.element().readAttribute("uid"));
break;
}
}.bind(this));
if(this.highlight){
_2ff.observe("mouseover",function(_308){
_308.stop();
var _309=_308.element().readAttribute("recnum");
if(_309){
this._markerOver(_309);
}
}.bind(this));
_2ff.observe("mouseout",function(_30a){
_30a.stop();
this._markerOver();
}.bind(this));
}
},_markerClick:function(_30b){
this.smap.locator.proximitySearch.dragStartCenter=null;
if(_30b&&_30b.popup&&_30b.popup.visible()){
this.smap.map.events.triggerEvent("popupclose",_30b.popup);
return false;
}else{
for(i in this.layer.markers){
var m=this.layer.markers[i];
if(m&&m.icon){
if(m.recnum==_30b.marker.recnum){
m.icon.imageDiv.style.zIndex=4500;
}else{
m.icon.imageDiv.style.zIndex=3500;
}
}
}
this._clearPopups();
this._addBubbleData(_30b.data);
var _30d=_30b.createPopup();
_30d.recnum=_30b.data.recnum;
_30d.bubbleSize=_30b.data.icon.bubbleSize;
_30d.bubbleMargin=_30b.data.icon.bubbleMargin;
_30d.bubbleOffset=_30b.data.icon.bubbleOffset;
this.smap.map.addPopup(_30d,true);
this.smap.map.adjustForBubble(_30b.marker.lonlat,_30d.bubbleSize,_30d.bubbleMargin,_30d.bubbleOffset);
return true;
}
},_markerOver:function(_30e){
var _30f;
var _310=this.smap.locator.panel.down();
ace.table.highlightRow(_310,_30e);
var poi;
if(_30e){
if((markerOld=this.getPOIMarker(_30e))&&(!markerOld.highlighted)){
poi=ace.table.getRecord(_30e);
var _312=this._createFeature(poi,"alt_icon");
_30f=_312.createMarker();
_30f.recnum=poi.RECNUM;
_30f.highlighted=true;
if(this.highlight){
this._bindMarkerOver(_30f);
}
this._bindMarkerClick(_30f,_312);
this.layer.removeMarker(markerOld);
this.layer.addMarker(_30f);
if(this.highlightEffect){
this.highlightEffect(_30f.events.element);
}
}
}else{
if(_30f=this.layer.markers.find(function(_313){
return _313.highlighted==true;
})){
poi=ace.table.getRecord(_30f.recnum);
this.layer.removeMarker(_30f);
this.addPOIMarker(poi,false,false);
}
}
},_addBubbleData:function(data){
var poi=ace.table.getRecord(data.recnum);
this._setBubbleCountry(data.bubbleID,poi);
var _316=ace.template.getTemplate(data.bubbleID,poi);
var _317=_316.style;
data.popupContentHTML=_316.innerHTML;
data.popupSize=new OpenLayers.Size(_317.width,_317.height);
data.icon.bubbleSize=data.popupSize;
data.icon.bubbleMargin=new OpenLayers.Bounds(_317.marginLeft,_317.marginBottom,_317.marginRight,_317.marginTop);
data.icon.bubbleOffset=new OpenLayers.Pixel(_316.readAttribute("offsetx"),_316.readAttribute("offsety"));
},_setBubbleCountry:function(_318,poi){
var _31a=ace.template.templates[_318].select("#bubble_country")[0];
if(_31a&&_31a.options){
for(var i=0;i<_31a.options.length;i++){
if(_31a.options[i].value==poi.COUNTRY){
$(_31a.options[i]).setAttribute("selected","selected");
}else{
$(_31a.options[i]).removeAttribute("selected");
}
}
}
return;
},_clearPopups:function(){
for(recnum in this.features){
var _31c=this.features[recnum];
if(_31c.popup){
_31c.popup.destroy();
_31c.popup=null;
break;
}
}
},_createFeature:function(poi,_31e){
var _31f=new OpenLayers.LonLat(poi.LONGITUDE,poi.LATITUDE);
var data=this._getFeatureData(poi,_31e);
return new OpenLayers.Feature(this,_31f,data);
},_getFeatureData:function(poi,_322){
var _323=ace.template.getIconTemplate(_322||poi.ICON,poi);
var data={};
data.recnum=poi.RECNUM;
data.icon=new OpenLayers.Icon.IconFromTemplate(_323);
data.bubbleID=_323.readAttribute("bubbleid");
return data;
},_bindMarkerOver:function(_325){
_325.events.register("mouseover",this,function(_326){
OpenLayers.Event.stop(_326);
this._markerOver(_325.recnum);
});
_325.events.register("mouseout",this,function(_327){
OpenLayers.Event.stop(_327);
this._markerOver();
});
},_bindMarkerClick:function(_328,_329,uID){
_328.events.register("click",this,function(evt){
OpenLayers.Event.stop(evt);
if(this._markerClick(_329)){
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 _32e={strokeColor:"blue",strokeOpacity:1,strokeWidth:5,pointRadius:6,pointerEvents:"visiblePainted"};
Object.extend(_32e,this.layer.map.routeStyle||{});
var _32f=this._getPointList();
var _330=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(_32f),null,_32e);
this.layer.addFeatures([_330]);
},_getPointList:function(){
var _331=ace.table.records.pluck("SEGMENT_GEOMETRY");
var _332=[];
for(var i=0,leni=_331.length;i<leni;i++){
if(_331[i].length<=0){
continue;
}
var _335=_331[i].substring(11,_331[i].length-1).split(",");
for(var j=0,lenj=_335.length;j<lenj;j++){
var _338=_335[j].split(" ");
myPoint=new OpenLayers.Geometry.Point(_338[0],_338[1]);
if(this.layer.projection.toString()=="EPSG:900913"){
myPoint.transform(new OpenLayers.Projection("EPSG:4326"),this.layer.projection);
}
_332.push(myPoint);
}
}
return _332;
}});
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 _33b=this._getImageParams();
ace.request(_33b,this._processResponse.bind(this),{formdataID:"get_route_image",onHistory:false});
},_getFullRouteMarkers:function(){
return this.layer.markers.findAll(function(_33c){
return _33c.isFullImage;
});
},_processResponse:function(_33d){
this.layer.clearMarkers();
var _33e=ace.xml.parse(_33d);
var _33f=this._getRouteImage(_33e[0]);
_33f.isFullImage=this._viewContainsRoute();
this.layer.addMarker(_33f);
return true;
},_getRouteImage:function(_340){
var size=new OpenLayers.Size(_340.WIDTH,_340.HEIGHT);
var _342=new OpenLayers.Icon(_340.URL,size,null,function(){
return new OpenLayers.Pixel(0,0);
});
var x=_340.OFFSET_X;
var y=_340.MAX_Y;
var _345=new OpenLayers.LonLat(x,y);
return new OpenLayers.Marker(_345,_342);
},_getImageParams:function(){
var _346=this.smap.map.getExtent();
var _347=this.smap.map.getSize().w;
var _348=this.smap.map.getSize().h;
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_346.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
return {routeid:0,bounds:_346.left+","+_346.bottom+","+_346.right+","+_346.top,height:_348,width:_347};
},_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(_34d){
_34d.each(function(_34e,_34f){
var _350=null;
if(_34f<=0){
_350=ace.template.getTemplate("ddstarticon",_34e);
}else{
_350=ace.template.getTemplate("ddendicon",_34e);
}
if(_350==null){
_350=ace.template.getIconTemplate("default",_34e);
}
var icon=new OpenLayers.Icon.IconFromTemplate(_350);
var _352=new OpenLayers.LonLat(_34e.LONGITUDE,_34e.LATITUDE);
var _353=new OpenLayers.Marker.DragabbleMarker(_352,icon,this.smap.locator.disableDynamicRoutes);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_353.setSphericalMercator(true);
}
var _354=(_34f<=0)?_34d.last():_34d.first();
if(!this.smap.locator.disableDynamicRoutes){
_353.events.register("mouseup",_353,this._mouseUp.bind(this,_353,_34f,_354));
}
this.layer.addMarker(_353);
}.bind(this));
},_mouseUp:function(_355,_356,_357){
_355.reverseGeocode(function(_358){
var _359=new OpenLayers.LonLat(_358.lonlat.lon,_358.lonlat.lat);
this.smap.locator.directionsSearch.markerSearch(_358,_356,_357);
_358.moveToLonLat();
document.fire("w2gi:track",{action:"routemarkerdrag",value:_359.toShortString()});
}.bind(this));
}});


