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.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,_17,_18,_19,_1a){
if(id==null){
id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");
}
this.id=id;
this.lonlat=_17;
this.size=(_18!=null)?_18:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);
if(_19!=null){
this.contentHTML=_19;
}
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(_1a==true){
var _1b=new OpenLayers.Size(17,17);
var img=OpenLayers.Util.getImagesLocation()+"close.gif";
var _1d=OpenLayers.Util.createAlphaImageDiv(this.id+"_close",null,_1b,img);
_1d.style.right=this.padding+"px";
_1d.style.top=this.padding+"px";
this.div.appendChild(_1d);
var _1e=function(e){
this.hide();
OpenLayers.Event.stop(e);
};
OpenLayers.Event.observe(_1d,"click",_1e.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(_23){
if(_23!=undefined){
this.size=_23;
}
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(_24){
if(_24!=undefined){
this.backgroundColor=_24;
}
if(this.div!=null){
this.div.style.backgroundColor=this.backgroundColor;
}
},setOpacity:function(_25){
if(_25!=undefined){
this.opacity=_25;
}
if(this.div!=null){
this.div.style.opacity=this.opacity;
this.div.style.filter="alpha(opacity="+this.opacity*100+")";
}
},setBorder:function(_26){
if(_26!=undefined){
this.border=_26;
}
if(this.div!=null){
this.div.style.border=this.border;
}
},setContentHTML:function(_27){
if(_27!=null){
this.contentHTML=_27;
}
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,_2f,_30,_31,_32,_33){
var _34=new Array(id,_2f,_30,_31,_33);
OpenLayers.Popup.prototype.initialize.apply(this,_34);
this.anchor=(_32!=null)?_32:{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 _37=this.map.getLonLatFromLayerPx(px);
var _38=this.map.getExtent();
var _39=_38.determineQuadrant(_37);
return OpenLayers.Bounds.oppositeQuadrant(_39);
},moveTo:function(px){
var _3b=px.offset(this.anchor.bubbleOffset);
var _3c=new Array(_3b);
OpenLayers.Popup.prototype.moveTo.apply(this,_3c);
},setSize:function(_3d){
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 _40=px.offset(this.anchor.offset);
var top=(this.relativePosition.charAt(0)=="t");
_40.y+=(top)?-this.size.h:this.anchor.size.h;
var _42=(this.relativePosition.charAt(1)=="l");
_40.x+=(_42)?-this.size.w:this.anchor.size.w;
return _40;
},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,_44,_45,_46,_47,_48){
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(_4a){
OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);
if(this.contentDiv!=null){
var _4b=this.size.clone();
this.contentDiv.style.height=_4b.h+"px";
this.contentDiv.style.width=_4b.w+"px";
}
},setBackgroundColor:function(_4c){
if(_4c!=undefined){
this.backgroundColor=_4c;
}
if(this.div!=null){
if(this.contentDiv!=null){
this.div.style.background="transparent";
}
}
},setOpacity:function(_4d){
if(_4d!=undefined){
this.opacity=_4d;
}
if(this.div!=null){
if(this.contentDiv!=null){
OpenLayers.Rico.Corner.changeOpacity(this.contentDiv,this.opacity);
}
}
},setBorder:function(_4e){
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,_52,_53,_54,_55,_56,_57){
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(_57){
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,_52,_53,_54,_55,_56);
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 _5c=new OpenLayers.Bounds(-180,-90,180,90);
this.projCode=_5c.containsLonLat(this)?"EPSG:4326":"EPSG:900913";
};
OpenLayers.LonLat.prototype.transform=function(_5d,_5e){
if(this.projCode!=_5e.projCode){
var _5f=OpenLayers.Projection.transform({"x":this.lon,"y":this.lat},_5d,_5e);
this.lon=_5f.x;
this.lat=_5f.y;
}
return this;
};
OpenLayers.Bounds.prototype.projCode="";
OpenLayers.Bounds.prototype.initialize=function(_60,_61,_62,top,_64){
if(_60!=null){
this.left=parseFloat(_60);
}
if(_61!=null){
this.bottom=parseFloat(_61);
}
if(_62!=null){
this.right=parseFloat(_62);
}
if(top!=null){
this.top=parseFloat(top);
}
if(!_64){
var _65=new OpenLayers.Bounds(-180,-90,180,90,true);
this.projCode=this.intersectsBounds(_65)?"EPSG:4326":"EPSG:900913";
}
};
OpenLayers.Bounds.prototype.transform=function(_66,_67){
if(this.projCode!=_67.projCode){
var ll=OpenLayers.Projection.transform({"x":this.left,"y":this.bottom},_66,_67);
var lr=OpenLayers.Projection.transform({"x":this.right,"y":this.bottom},_66,_67);
var ul=OpenLayers.Projection.transform({"x":this.left,"y":this.top},_66,_67);
var ur=OpenLayers.Projection.transform({"x":this.right,"y":this.top},_66,_67);
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(_6e,_6f){
if((this.projCode!=_6f.projCode)&&(_6e&&_6f)){
OpenLayers.Projection.transform(this,_6e,_6f);
this.projCode=_6f.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(_70,_71,_72){
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 _76=this.single?OpenLayers.Util.extend({},evt):null;
this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,_76),this.delay);
}
}
return !this.stopSingle;
},passesTolerance:function(evt){
var _78=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){
_78=false;
}
}
return _78;
},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 _7b=false;
if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){
this.clearTimer();
this.down=null;
_7b=true;
}
return _7b;
},CLASS_NAME:"OpenLayers.Handler.Click"});
OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,initialize:function(_7c,_7d,_7e){
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 _80=false;
var _81=false;
var _82=false;
var _83=OpenLayers.Event.element(e);
while((_83!=null)&&!_82&&!_80){
if(!_80){
try{
if(_83.currentStyle){
_84=_83.currentStyle["overflow"];
}else{
var _85=document.defaultView.getComputedStyle(_83,null);
var _84=_85.getPropertyValue("overflow");
}
_80=(_84&&(_84=="auto")||(_84=="scroll"));
}
catch(err){
}
}
if(!_81){
for(var i=0;i<this.map.layers.length;i++){
if(_83==this.map.layers[i].div||_83==this.map.layers[i].pane){
_81=true;
break;
}
}
}
_82=(_83==this.map.div);
_83=_83.parentNode;
}
if(!_80&&_82){
if(_81){
this.wheelZoom(e);
}
OpenLayers.Event.stop(e);
}
},wheelZoom:function(e){
document.fire("w2gi:track",{action:"mapzoom",value:1});
var _88=0;
if(!e){
e=window.event;
}
if(e.wheelDelta){
_88=e.wheelDelta/120;
if(window.opera&&window.opera.version()<9.2){
_88=-_88;
}
}else{
if(e.detail){
_88=-e.detail/3;
}
}
if(_88){
if(this.mousePosition){
e.xy=this.mousePosition;
}
if(!e.xy){
e.xy=this.map.getPixelFromLonLat(this.map.getCenter());
}
if(_88<0){
this.callback("down",[e,_88]);
}else{
this.callback("up",[e,_88]);
}
}
},mousemove:function(evt){
this.mousePosition=evt.xy;
},activate:function(evt){
if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){
var _8b=this.wheelListener;
OpenLayers.Event.observe(window,"DOMMouseScroll",_8b);
OpenLayers.Event.observe(window,"mousewheel",_8b);
OpenLayers.Event.observe(document,"mousewheel",_8b);
return true;
}else{
return false;
}
},deactivate:function(evt){
if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){
var _8d=this.wheelListener;
OpenLayers.Event.stopObserving(window,"DOMMouseScroll",_8d);
OpenLayers.Event.stopObserving(window,"mousewheel",_8d);
OpenLayers.Event.stopObserving(document,"mousewheel",_8d);
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(_8e,_8f,_90){
OpenLayers.Handler.prototype.initialize.apply(this,arguments);
},down:function(evt){
},move:function(evt){
},up:function(evt){
},out:function(evt){
},mousedown:function(evt){
var _96=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;
};
}
_96=!this.stopDown;
}else{
this.started=false;
this.start=null;
this.last=null;
}
return _96;
},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 _99=(this.start!=this.last);
this.started=false;
this.dragging=false;
this.map.div.style.cursor="";
this.up(evt);
this.callback("up",[evt.xy]);
if(_99){
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 _9c=(this.start!=this.last);
this.started=false;
this.dragging=false;
this.map.div.style.cursor="";
this.out(evt);
this.callback("out",[]);
if(_9c){
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 _9e=false;
if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){
this.dragging=false;
_9e=true;
}
return _9e;
},deactivate:function(){
var _9f=false;
if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){
this.started=false;
this.dragging=false;
this.start=null;
this.last=null;
_9f=true;
}
return _9f;
},CLASS_NAME:"OpenLayers.Handler.Drag"});
OpenLayers.Control.PanZoom=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,buttons:null,position:null,initialize:function(_a0){
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 _a4=new OpenLayers.Pixel(px.x+sz.w/2,px.y);
this._addButton("panup","north-mini.png",_a4,sz);
px.y=_a4.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",_a4.add(0,sz.h*2),sz);
this._addButton("zoomin","zoom-plus-mini.png",_a4.add(0,sz.h*3+5),sz);
this._addButton("zoomworld","zoom-world-mini.png",_a4.add(0,sz.h*4+5),sz);
this._addButton("zoomout","zoom-minus-mini.png",_a4.add(0,sz.h*5+5),sz);
return this.div;
},_addButton:function(id,img,xy,sz){
var _a9=OpenLayers.Util.getImagesLocation()+img;
var btn=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_PanZoom_"+id,xy,sz,_a9,"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 _b0=new OpenLayers.Pixel(px.x+sz.w/2,px.y);
var _b1=sz.w;
if(this.zoomWorldIcon){
_b0=new OpenLayers.Pixel(px.x+sz.w,px.y);
}
this._addButton("panup","north-mini.png",_b0,sz);
px.y=_b0.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);
_b1*=2;
}
this._addButton("panright","east-mini.png",px.add(_b1,0),sz);
this._addButton("pandown","south-mini.png",_b0.add(0,sz.h*2),sz);
this._addButton("zoomin","zoom-plus-mini.png",_b0.add(0,sz.h*3+5),sz);
_b0=this._addZoomBar(_b0.add(0,sz.h*4+5));
this._addButton("zoomout","zoom-minus-mini.png",_b0,sz);
return this.div;
},_addZoomBar:function(_b2){
var _b3=OpenLayers.Util.getImagesLocation();
var id="OpenLayers_Control_PanZoomBar_Slider"+this.map.id;
var _b5=this.map.getNumZoomLevels()-1-this.map.getZoom();
var _b6=OpenLayers.Util.createAlphaImageDiv(id,_b2.add(-1,_b5*this.zoomStopHeight),new OpenLayers.Size(20,9),_b3+"slider.png","absolute");
this.slider=_b6;
this.sliderEvents=new OpenLayers.Events(this,_b6,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,_b2,new OpenLayers.Size(sz.w,this.zoomStopHeight),_b3+"zoombar.png","absolute",null,"crop");
div.style.height=sz.h;
}else{
div=OpenLayers.Util.createDiv("OpenLayers_Control_PanZoomBar_Zoombar"+this.map.id,_b2,sz,_b3+"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(_b6);
this.map.events.register("zoomend",this,this.moveZoomBar);
_b2=_b2.add(0,this.zoomStopHeight*this.map.getNumZoomLevels());
return _b2;
},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 _bd=(y-top)/this.zoomStopHeight;
if(!this.map.fractionalZoom){
_bd=Math.floor(_bd);
}
var _be=(this.map.getNumZoomLevels()-1)-_bd;
_be=Math.min(Math.max(_be,0),this.map.getNumZoomLevels()-1);
this.map.zoomTo(_be);
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 _c1=this.mouseDragStart.y-evt.xy.y;
var _c2=OpenLayers.Util.pagePosition(this.zoombarDiv);
if((evt.clientY-_c2[1])>0&&(evt.clientY-_c2[1])<parseInt(this.zoombarDiv.style.height)-2){
var _c3=parseInt(this.slider.style.top)-_c1;
this.slider.style.top=_c3+"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 _c5=this.zoomStart.y-evt.xy.y;
var _c6=this.map.zoom;
if(this.map.fractionalZoom){
_c6+=_c5/this.zoomStopHeight;
_c6=Math.min(Math.max(_c6,0),this.map.getNumZoomLevels()-1);
}else{
_c6+=Math.round(_c5/this.zoomStopHeight);
}
document.fire("w2gi:track",{action:"mapzoom",value:_c6});
this.map.zoomTo(_c6);
this.moveZoomBar();
this.mouseDragStart=null;
OpenLayers.Event.stop(evt);
}
},moveZoomBar:function(){
var _c7=((this.map.getNumZoomLevels()-1)-this.map.getZoom())*this.zoomStopHeight+this.startTop+1;
this.slider.style.top=_c7+"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(_c8){
var img=_c8.getElementsByTagName("img")[0];
var url=img._src?img._src:img.src;
var _cb=this._getIconSize(_c8);
OpenLayers.Icon.prototype.initialize.apply(this,[url,_cb,null,calculateOffset]);
this.bubbleid=_c8.getAttribute("bubbleid");
var _cc=_c8.getElementsByTagName("div")[0];
if(_cc){
this.imageDiv.appendChild(_cc);
}
Element.extend(this.imageDiv);
this.imageDiv.addClassName("icon");
function calculateOffset(){
return new OpenLayers.Pixel(_c8.readAttribute("offsetx"),_c8.readAttribute("offsety"));
};
},_getIconSize:function(_cd){
return new OpenLayers.Size(_cd.readAttribute("width"),_cd.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(_ce,_cf,_d0){
OpenLayers.Control.prototype.initialize.apply(this,arguments);
if(_ce){
this.location=_ce;
}
if(_cf){
this.effectType=_cf;
}
if(_d0){
this.panel=_d0;
}
},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(_d3){
OpenLayers.Event.stop(_d3);
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(_d4){
if(this.blockMoreEffects==true){
return;
}else{
this.blockMoreEffects=true;
}
OpenLayers.Event.stop(_d4);
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(_d6,_d7,_d8){
OpenLayers.Marker.prototype.initialize.apply(this,arguments);
var _d9=_d8?_d8:false;
if(!_d9){
this._registerObservers();
}
},setSphericalMercator:function(_da){
this.sphericalMercator=_da;
},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(_db,_dc){
var _dd=(_dc&&_dc.country)?_dc.country:"";
var _de=new OpenLayers.LonLat(this.lonlat.lon,this.lonlat.lat);
if(this.sphericalMercator){
_de.transform(new OpenLayers.Projection("EPSG:900913"),new OpenLayers.Projection("EPSG:4326"));
}
var _df={longitude:_de.lon,latitude:+_de.lat,country:_dd};
ace.geo.reverse(_df,processResponse.bind(this),_dc);
function processResponse(_e0){
this.reverseGeocoderAddress=_e0;
this.geocoderAddress=null;
var _e1=new OpenLayers.LonLat(_e0.LONGITUDE,_e0.LATITUDE);
if(this.sphericalMercator){
_e1.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));
}
this.lonlat=_e1;
this.country=_e0.COUNTRY;
if(!_db){
return true;
}
try{
return _db(this);
}
catch(e){
ace.util.alert(e,{height:100});
}
};
},geocode:function(_e2,_e3,_e4){
if(_e2==""){
return;
}
ace.geo.code(_e2,processResponse.bind(this),_e4);
function processResponse(_e5){
this.geocoderAddresses=_e5;
this.reverseGeocoderAddress=null;
if(!_e3){
return true;
}
try{
return _e3(this);
}
catch(e){
ace.util.alert(e,{height:100});
}
};
},moveToLonLat:function(_e6){
var px=this.map.getLayerPxFromLonLat(_e6||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 _ea=this.mouseDragStart.x-evt.xy.x;
var _eb=this.mouseDragStart.y-evt.xy.y;
var _ec=this.icon.imageDiv.style;
var _ed=parseInt(_ec.left)-_ea;
var _ee=parseInt(_ec.top)-_eb;
_ec.left=_ed+"px";
_ec.top=_ee+"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 _f0=this.map.getLonLatFromPixel(evt.xy);
var _f1=_f0.lon-this.mouseDragStartLonLat.lon;
var _f2=_f0.lat-this.mouseDragStartLonLat.lat;
this.lonlat=this.lonlat.add(_f1,_f2);
this.mouseDragStart=null;
OpenLayers.Event.stop(evt);
},CLASS_NAME:"OpenLayers.Marker.DragabbleMarker"});
var SlippyMap={locator:null,load:function(_f3,_f4,_f5){
ace.template.initialize();
ace.util.checkNumberFormat();
SlippyMap.locator=new SlippyMap.Locator(_f3,_f4,_f5);
},unload:function(){
SlippyMap.locator.destroy();
SlippyMap.locator=null;
ace.template.destroy();
ace.cache.destroy();
},VERSION_NUMBER:"1.71"};
SlippyMap.Popup=Class.create({smap:null,initialize:function(_f6){
this.smap=_f6;
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(_f7){
this._addObservers.bind(this,_f7).defer();
var _f8=this.smap.locator.panel.down();
ace.table.updateActiveRow(_f8,_f7.recnum);
var _f9=ace.util.getCookie("locationuid");
var _fa=$(_f7.div).down(".make_default_loc");
if(_f9&&_fa){
if(_fa.readAttribute("uid")==_f9){
_fa.checked=true;
}
}
},_popupClose:function(_fb){
this.smap.map.removePopup(_fb);
var _fc=_fb.recnum;
var _fd=this.smap.proximityLayer.features[_fc];
if(_fd.popup){
_fd.popup.destroy();
_fd.popup=null;
}
var _fe=this.smap.locator.panel.down();
ace.table.updateActiveRow(_fe);
},_addObservers:function(_ff){
var _100=ace.util.select(_ff.div,"bubble_close")[0];
var _101=ace.util.select(_ff.div,"tab_label");
if(_100){
_100.observe("click",_ff.hide.bind(_ff));
}
var form=Element.extend(_ff.div.getElementsByTagName("form")[0]);
_101.each(function(_103){
Event.observe(_103,"click",this._selectTab.bind(this,_103,_ff.div,form));
}.bind(this));
if(form){
if(form.visible()){
var _104=setInterval(function(){
Form.focusFirstElement(form);
clearInterval(_104);
},500);
}
this._addFormObservers(form);
}
_ff.div.observe("click",function(_105){
if(!(_105.target.type&&_105.target.type=="checkbox")){
_105.stop();
}
var _106=$(_105.target).readAttribute("action");
switch(_106){
case "more_info":
var _107=_105.target.readAttribute("recnum");
ace.table.oldrecords=ace.table.records.clone();
ace.table.selected=_107;
var pois=ace.table.records.slice(_107-1,_107);
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(_105.target,_105.target.readAttribute("uid"));
break;
}
}.bind(this));
},_addFormObservers:function(form){
var from=form.getElementsByTagName("input")[0];
var _10b=form.getElementsByTagName("input")[1];
Event.observe(_10b,"click",function(_10c){
this.smap.locator.directionsSearch.bubbleSearch(_10c);
}.bind(this));
Event.observe(from,"keypress",function(_10d){
if(_10d.keyCode==Event.KEY_RETURN){
this.smap.locator.directionsSearch.bubbleSearch(_10d);
}
}.bind(this));
var link=form.getElementsByTagName("a")[0];
if(link){
Event.observe(link,"click",function(_10f){
_10f.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(_111,div,form){
var _114=ace.util.select(div,"tab_label").indexOf(_111);
var _115=ace.util.select(div,"tab_content");
var tabs=ace.util.select(div,"bubble_tab");
var _117=ace.util.select(div,"bubble_tab_dual");
tabs.each(function(tab,_119){
if(_114==_119){
_115[_119].addClassName("activetabcontent");
_115[_119].removeClassName("nonactivetabcontent");
tab.addClassName("activetab");
tab.removeClassName("nonactivetab");
if(form&&form.visible()){
Form.focusFirstElement(form);
}
}else{
_115[_119].removeClassName("activetabcontent");
_115[_119].addClassName("nonactivetabcontent");
tab.addClassName("nonactivetab");
tab.removeClassName("activetab");
}
}.bind(this));
_117.each(function(tab,_11b){
var id=tab.id;
if(_114==_11b){
if(_115.length==_117.length){
_115[_11b].addClassName("activetabcontent");
_115[_11b].removeClassName("nonactivetabcontent");
}
tab.addClassName("active"+id);
tab.removeClassName("nonactivetab");
if(form&&form.visible()){
Form.focusFirstElement(form);
}
}else{
if(_115.length==_117.length){
_115[_11b].removeClassName("activetabcontent");
_115[_11b].addClassName("nonactivetabcontent");
}
tab.addClassName("nonactivetab");
tab.removeClassName("active"+id);
}
}.bind(this));
}});
SlippyMap.Util={addHistory:function(_11d,_11e){
if(!SlippyMap.locator){
return;
}
var _11f="";
($("locator_search"))?_11f="locator_search":_11f="product_search";
var _120=$(_11f).visible()?_11f:"driving_directions";
var _121={formID:_120,qs:Form.serialize($(_120)),update:function(){
var form=$(this.formID);
if(!form.visible()){
var _123=(this.formID==_11f)?"driving_directions":_11f;
$(_123).hide();
form.show();
Form.focusFirstElement(form);
}
Form.deserialize(form,this.qs);
}};
var _124={xml_request:_11d,processResponse:_11e,center:SlippyMap.locator.smap.map.getCenter(),zoom:SlippyMap.locator.smap.map.getZoom(),update:function(){
SlippyMap.locator.clear();
var _125=ace.cache.get(this.xml_request);
if(_125){
this.processResponse(_125);
}
}};
ace.history.add([_121,_124]);
},isSearchFormValid:function(form){
var _127=true;
if(!form){
return null;
}
$(form).getInputs("text","addressline").each(function(e){
e.value=e.value.strip();
if(e.value==""){
_127=false;
throw $break;
}
}.bind(this));
return _127;
},lowerCaseObject:function(_129){
var obj={};
for(var key in _129){
obj[key.toLowerCase()]=_129[key];
}
return obj;
},getAddressline:function(_12c){
var _12d="";
var city="";
var _12f="";
var _130="";
if(_12c.ADDRESS1){
var _12d=_12c.ADDRESS1.blank()?"":_12c.ADDRESS1.trim()+", ";
}
if(_12c.CITY){
var city=_12c.CITY.empty()?"":_12c.CITY+", ";
}
if(_12c.COUNTRY){
var _12f=(_12c.COUNTRY!="US")?_12c.PROVINCE+" ":_12c.STATE+" ";
}
if(_12c.POSTALCODE){
var _130=_12c.POSTALCODE.empty()?"":_12c.POSTALCODE;
}
return _12d+city+_12f+_130;
}};
SlippyMap.IconBar=Class.create({initialize:function(_131){
this.locator=_131;
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"&&$("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 _139=$("icon_bar");
if(!_139){
return;
}
var _13a=$("page_print");
if(_13a){
_13a.observe("click",this._printPage);
}
var _13b=$("page_email");
if(_13b){
_13b.observe("click",this._emailPage.bind(this));
}
var _13c=$("page_link");
if(_13c){
_13c.observe("click",this._linkToPage.bind(this));
}
},_removeObservers:function(){
var _13d=$("icon_bar");
if(!_13d){
return;
}
var _13e=$("page_print");
if(_13e){
_13e.stopObserving();
}
var _13f=$("page_email");
if(_13f){
_13f.stopObserving();
}
var _140=$("page_link");
if(_140){
_140.stopObserving();
}
},_printPage:function(){
print();
},_emailPage:function(_141){
var form=this._getForm();
var url=this._getURL(form);
var _144=$("page_email").getAttribute("subject");
location.href="mailto:?subject="+_144+"&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 _149=location.href.indexOf("?");
var url=(_149>0)?location.href.substring(0,_149):location.href;
_149=location.href.indexOf("#");
url=(_149>0)?url.substring(0,_149):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(_14d,_14e,_14f){
Object.extend(this,_14f||{});
this.mapID=_14d;
this.panel=$(_14e);
if(_14f.whereamiDiv&&_14f.whereamiDiv!=null){
this.whereamiDiv=_14f.whereamiDiv;
}
if(_14f.ddpanel&&_14f.ddpanel!=""){
this.ddpanel=_14f.ddpanel;
}
this.iconBar=new SlippyMap.IconBar(this);
this.smap=new SlippyMap.Smap(this,_14d,_14f);
this.directionsSearch=new SlippyMap.Search.DirectionsSearch(this);
(_14f.formdataid)?this.formdataid=_14f.formdataid:this.formdataid="locatorsearch";
if(_14f.locatorType&&_14f.locatorType=="product"){
this.proximitySearch=new SlippyMap.Search.ProximitySearch.Product(this);
this.searchFormId="product_search";
}else{
this.proximitySearch=new SlippyMap.Search.ProximitySearch(this);
this.searchFormId="locator_search";
}
var _150=this._retrieveGetVals();
var sku=_150["sku"];
this.sku=sku;
var uid=_150["uid"];
this.uid=uid;
var _153=_150["msrprange"];
this.msrprange=_153;
var _154=_150["enablemap"];
this.enablemap=_154;
var _155=_150["action"];
this.action=_155;
var lat=_150["lat"];
this.lat=lat;
var lon=_150["lon"];
this.lon=lon;
var _158=_150["currency"];
this.currency=_158;
this._load(_14f);
},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();
},_retrieveGetVals:function(){
var qs=location.search.split("&");
var _15a={};
for(var i=0;i<qs.length;i++){
temp=qs[i].split("=");
_15a[temp[0].replace(/^\?/,"")]=temp[1];
}
return _15a;
},clearLocator:function(){
this.clear();
this.smap.proximityLayer.addCenterMarker(this.smap.map.center);
},displayInitialPOIs:function(xml){
ace.table.updateFromResponseXML(this.panel,xml);
var _15d=this.smap.zoomToPOIs();
this.smap.proximityLayer.update(_15d.getCenterLonLat());
},_load:function(_15e){
if(location.href.include(this.panel)||location.href.include("driving_directions")||location.href.include(this.searchFormId)){
this._displayBookmark();
}else{
if(this.geoip||this.defaultLocation){
if(this.geoip){
var _15f=document.createElement("input");
_15f.setAttribute("type","hidden");
_15f.setAttribute("id","geoip_state");
_15f.setAttribute("name","geoip");
_15f.setAttribute("value","start");
var _160=$("locator_search");
if(_160){
_160.appendChild(_15f);
}
}
var _161=ace.util.getCookie("locationuid");
if(_161&&_161!=null&&this.defaultLocation){
this.uid=_161;
this.sku="";
this.msrprange="";
this.enablemap="";
this.geoip=false;
_15e.geoip=false;
_15e.formdataid="getlist";
}
if(this.uid=="undefined"||this.uid==null){
this.uid="";
}
var _162={"sku":this.sku,"uid":this.uid,"msrprange":this.msrprange,"enablemap":this.enablemap};
if(this.currency!=undefined){
Object.extend(_162,{"currency":this.currency});
}
var _163={formdataID:_15e.formdataid,geoip:_15e.geoip,alertError:false,onError:this._bookmarkError.bind(this)};
if(this.defaultLocation){
Object.extend(_163,{"tagName":"where",objectName:"StoreLocator"});
}
if(_15e.formdataid&&_15e.formdataid!=null){
this.proximitySearch.search(_162,_163);
}else{
this.proximitySearch.search(_162,{"formdataID":this.formdataid,geoip:_15e.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();
}
var _165=this.panel.down("form");
if($(this.panel)&&_165){
Form.focusFirstElement(_165);
}
}
}
},_bookmarkError:function(){
var lon=(this.defaultLon)?this.defaultLon:-98.15261705337687;
var lat=(this.defaultLat)?this.defaultLat:40.53681640918523;
var zoom=(this.defaultZoom)?this.defaultZoom:1;
var _169=new OpenLayers.LonLat(lon,lat);
this.smap.map.setCenter(_169,zoom);
if(this.whereamiDiv&&this.whereamiDiv!=null){
this.proximitySearch._updateLocation({});
}
var _16a=this.panel.down("form");
if($(this.panel)&&_16a){
Form.focusFirstElement(_16a);
}
},_displayBookmark:function(){
var _16b=location.href.indexOf("?");
if(_16b!=-1){
var _16c=ace.util.retrieveGetVals();
var _16d=$("orig_country");
var _16e=$("dest_country");
if(_16d&&_16e&&_16c["dest_country"]&&_16c["orig_country"]){
_16d.value=_16c["orig_country"];
_16e.value=_16c["dest_country"];
}
var _16f=location.href.include("locator_search")?"locator_search":"driving_directions";
if(_16f){
var form=$(_16f);
if(!form.visible()){
var _171=(_16f=="locator_search")?"driving_directions":"locator_search";
if($(_171)){
$(_171).hide();
}
form.show();
}
Form.focusFirstElement(form);
var url=location.href.sub("form="+_16f+"&","");
var qs=url.substring(url.indexOf("?")+1);
Form.deserialize(form,qs);
var _174=(url.include("geoip=1"))?1:0;
if(_16f=="locator_search"){
this.proximitySearch.search(form,{onError:this._bookmarkError.bind(this),"geoip":_174});
}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(_177,_178,_179){
this.locator=_177;
var opts={scales:[50000000,20000000,10000000,4000000,1000000,500000,150000,100000,50000,25000,15000,6000],smap:this};
Object.extend(opts,_179||{});
var _17b;
if(_179){
_17b={highlight:(_179.highlight)?_179.highlight:false,highlightEffect:(_179.highlightEffect)?_179.highlightEffect:false};
}
this.map=this._initOpenLayers(_178,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",_17b);
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(_17c){
_17c.stop();
ace.click.track(_17c.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(_17d){
var _17e=this.getPOIBounds(ace.table.records);
var _17f;
if(this.locator.proximitySearch){
_17f=this.locator.proximitySearch.centerPoint?this.locator.proximitySearch.centerPoint.clone():_17e.getCenterLonLat();
}else{
_17f=this.locator.productSearch.centerPoint?this.locator.productSearch.centerPoint.clone():_17e.getCenterLonLat();
}
if(_17f){
if(this.map.baseLayer.projection.toString()=="EPSG:900913"){
_17f.transform(new OpenLayers.Projection("EPSG:4326"),this.map.baseLayer.projection);
}
}
if(!_17d){
_17e.extend(_17f);
}
_17e=this.padBounds(_17e);
this.map.zoomToExtent(_17e);
return _17e;
},zoomToPOI:function(pois,_181){
var _182=this.getPOIBounds(pois);
if(!_181){
_182.extend(this.locator.proximitySearch.centerPoint);
}
this.map.zoomToExtent(_182);
return _182;
},findControl:function(_183){
return this.map.controls.find(function(_184){
return _184.CLASS_NAME==_183;
});
},padBounds:function(_185){
var _186=0.0125;
return new OpenLayers.Bounds(_185.left-_186,_185.bottom-_186,_185.right+_186,_185.top+_186);
},getPOIBounds:function(pois){
var _188=180;
var _189=-180;
var _18a=90;
var _18b=-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;
}
_188=Math.min(_188,lon);
_189=Math.max(_189,lon);
_18a=Math.min(_18a,lat);
_18b=Math.max(_18b,lat);
}
var _190=new OpenLayers.Bounds(_188,_18a,_189,_18b);
if(this.map.baseLayer.projection.toString()=="EPSG:900913"){
_190.transform(new OpenLayers.Projection("EPSG:4326"),this.map.baseLayer.projection);
}
return _190;
},_initOpenLayers:function(_191,_192){
var _193=this._getSources();
var _194=this._getLayers(_193);
if(_194[0].options){
Object.extend(_192,_194[0].options);
}
var map=new OpenLayers.Map(_191,_192);
map.addLayers(_194);
return map;
},_updateCopyrightPosition:function(){
var _196=this.map.baseLayer.CLASS_NAME;
switch(_196){
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 _197=this.map.popups[0];
if(_197){
this.map.events.triggerEvent("popupclose",_197);
}
},_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(_199){
var _19a=_199.map(function(_19b){
var url=null;
var _19d={};
var _19e=_19b.OPTIONS.evalJSON();
var _19f=Object.extend(_19d,_19e);
switch(_19b.NAME){
case "SlippyMap W2GI":
case "SlippyMap Navteq":
_19d={g:"__base__",i:"PNG8",appkey:ace.xml.getXMLData("appkey")};
Object.extend(_19f,_19d);
url=$w(_19b.IMAGEURL.gsub(","," "));
return new OpenLayers.Layer.KaMap(_19b.NAME,url,_19f,{buffer:1});
case "OpenLayers WMS":
url=$w(_19b.IMAGEURL.gsub(","," "));
return new OpenLayers.Layer.WMS(_19b.NAME,url,_19f);
case "Google Satellite":
case "Google Normal":
case "Google Hybrid":
return new OpenLayers.Layer.Google(_19b.NAME,_19f);
case "Yahoo Regular":
case "Yahoo Satellite":
case "Yahoo Hybrid":
return new OpenLayers.Layer.Yahoo(_19b.NAME,_19f);
case "Virtual Earth Aerial":
case "Virtual Earth Road":
case "Virtual Earth Hybrid":
return new OpenLayers.Layer.VirtualEarth(_19b.NAME,_19f);
default:
throw new Error(_19b.NAME+" - missing handler in Smap.js: _getLayers()");
}
});
return _19a;
},_addCopyright:function(map){
var w2gi=new Element("div",{id:"w2gi_copyright"}).update("&#169; "+new Date().getFullYear()+" Where 2 Get It, Inc.");
var _1a2=new Element("div",{id:"navteq_copyright",style:"display: none;"}).update("&#169; "+new Date().getFullYear()+" NAVTEQ Corp.");
map.appendChild(w2gi);
map.appendChild(_1a2);
if(this.map.baseLayer&&this.map.baseLayer.name=="SlippyMap Navteq"){
_1a2.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(_1a6){
this.locator=_1a6;
this.smap=_1a6.smap;
this._addSearchObservers();
},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 _1a8=this.searchForm.getInputs("text","addressline");
_1a8.each(function(_1a9){
Event.observe(_1a9,"keypress",function(_1aa){
if(_1aa.keyCode==Event.KEY_RETURN){
_1aa.stop();
this._search(_1a9.form);
var _1ab=$$(".pl_hide");
if(_1ab){
_1ab.each(function(e){
e.hide();
});
}
}
}.bind(this));
}.bind(this));
var _1ad=this.searchForm.getInputs("submit");
if(_1ad.size()==0){
_1ad=this.searchForm.select("#locator_submit");
}
if(_1ad.size()==0){
_1ad=this.searchForm.select("#directions_submit");
}
if(_1ad.size()!=0){
_1ad=_1ad[0];
Event.observe(_1ad,"click",function(_1ae){
_1ae.stop();
this._search(_1ad.form);
}.bind(this));
}
var _1af=ace.util.select(this.searchForm,"search_toggle");
if(_1af.size()>0){
_1af=_1af[0];
Event.observe(_1af,"click",function(_1b0){
_1b0.stop();
this.searchForm.hide();
if(this.altSearchForm){
this.altSearchForm.show();
Form.focusFirstElement(this.altSearchForm);
}
}.bind(this));
}
},_validateSearchForm:function(form){
var _1b2=form.addressline;
var _1b3=this.locator.blankAddress?true:false;
if(!form){
return true;
}
if(!this._checkAddresses(_1b2)){
return false;
}
if(!_1b3&&!SlippyMap.Util.isSearchFormValid(form)){
ace.util.alert("Please enter an address.",{width:250,height:100});
return false;
}
return true;
},_checkAddresses:function(_1b4){
var _1b5=true;
if(!_1b4){
return true;
}
if(_1b4.length){
i=_1b4.length;
var e;
for(i;i>0;i--){
var e=_1b4[i-1];
var _1b7="";
if(!e.include&&e.value){
_1b7=e.value;
}else{
_1b7=e;
}
if(!this._illegalStringCheck(_1b7)){
_1b5=false;
}
}
}else{
var e=_1b4.value;
var _1b7="";
if(!e.include&&e.value){
_1b7=e.value;
}else{
_1b7=e;
}
if(!this._illegalStringCheck(_1b7)){
_1b5=false;
}
}
return _1b5;
},_illegalStringCheck:function(_1b8){
if(_1b8.include("!")||_1b8.include("#")||_1b8.include("$")||_1b8.include("%")||_1b8.include("^")||_1b8.include("*")||_1b8.include("(")||_1b8.include(")")){
ace.util.alert("Your search must not include !#$%^*()");
return false;
}
return true;
},_addMapUrlImage:function(_1b9){
var img=$("map_url_image");
if(_1b9&&img){
var size=_1b9.match(/size=(\d+),(\d+)/);
if(size){
img.width=size[1];
img.height=size[2];
}
if(Prototype.Browser.IE6){
_1b9=_1b9.replace(/ /g,"%20");
}
img.src=_1b9;
}
}});
SlippyMap.Search.ProximitySearch=Class.create(SlippyMap.Search,{cacheResults:false,searchRadius:null,dragStartCenter:null,centerPoint:null,layer:null,initialize:function(_1bc){
this.locator=_1bc;
var form=null;
if($("locator_search")){
this.xmlId="locatorsearch";
form=$("locator_search");
}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.searchRadius=this._getSearchRadius(this.searchForm);
this.cacheResults=!this.smap.findControl("OpenLayers.Control.LocationManager");
if(_1bc.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);
(_1bc.pl_header&&_1bc.pl_header!="")?this._observeHeader(_1bc.pl_header):null;
this.locator.panel.observe("w2gi:sliceUpdated",function(_1be){
_1be.stop();
this._processSlice(_1be.memo);
}.bind(this));
this.layer=this.smap.map.layers.find(function(_1bf){
return _1bf.name=="SlippyMap W2GI";
});
if($("search_country")){
var _1c0="US";
if(this.locator.COUNTRY){
_1c0=this.locator.COUNTRY;
}
if($("search_country").options&&$("search_country").options.length==0){
ace.collection.updateOptions("search_country","Country",_1c0);
}else{
if(this.locator.COUNTRY&&$("country").value&&$("search_country").value!=this.locator.COUNTRY){
$("search_country").value=this.locator.COUNTRY;
}
}
}
},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,_1c2){
this.dynamicSearch=(_1c2&&_1c2.dynamicSearch)?true:false;
this.geoip=(_1c2&&_1c2.geoip&&_1c2.geoip==true)?true:false;
var opts={onHistory:SlippyMap.Util.addHistory,onError:function(xml){
var code=xml.getElementsByTagName("response")[0].getAttribute("code");
if(code!=1){
if(this.locator.whereamiDiv&&this.locator.whereamiDiv!=null){
this._updateLocation({});
}
}
this.smap.locator.clearLocator.bind(this.smap.locator);
}.bind(this)};
ace.table.update(this.locator.panel,form,this._processResponse.bind(this),Object.extend(opts,_1c2||{}));
},_observeHeader:function(_1c6){
$(_1c6).observe("click",function(e){
var _1c8="";
if(e.target){
_1c8=$(e.target).readAttribute("action");
}
switch(_1c8){
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 _1ca=$("search_bar").getStyle("width");
_1ca=_1ca.substr(0,_1ca.length-2)*1;
var left=(winW-_1ca)/2;
if(left>0){
$("search_bar").setStyle({"left":left+"px"});
}
$("search_bar").toggle();
break;
}
}.bind(this));
},_addPanelObserver:function(_1cc){
Event.observe(_1cc,"click",function(_1cd){
if(!(_1cd.target.type&&_1cd.target.type=="checkbox")){
_1cd.stop();
}
if(!this.searchForm.visible()){
return;
}
var _1ce=_1cd.element().readAttribute("action");
switch(_1ce){
case "search_address":
var _1cf=_1cd.element().readAttribute("recnum");
var poi=ace.table.getRecord(_1cf);
var _1d1=this.searchForm.getInputs("text","addressline")[0];
_1d1.value=(poi.ADDRESS1?poi.ADDRESS1:"")+(poi.CITY?", "+poi.CITY:"")+(poi.STATE?" "+poi.STATE:"")+(poi.PROVINCE?" "+poi.PROVINCE:"")+(poi.POSTALCODE?", "+poi.POSTALCODE:"");
var _1d2={latitude:poi.LATITUDE,longitude:poi.LONGITUDE,country:poi.COUNTRY};
this.search(_1d2,{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 _1d4={"sku":this.locator.sku,"uid":this.locator.uid};
var _1d5=form.serialize(true);
Object.extend(_1d4,_1d5);
if(this.locator.searchLimit&&this.locator.searchLimit>0){
Object.extend(_1d4,{"limit":this.locator.searchLimit});
}
var _1d6={formdataID:this.locator.formdataid,alertError:true};
if(this.locator.like){
Object.extend(_1d6,{"like":this.locator.like});
}
this.search(_1d4,_1d6);
},_onMapMouseDown:function(evt){
if(!this.searchRadius){
this.searchRadius=this._getSearchRadius(this.searchForm);
}
if(!this.dragStartCenter){
var _1d8=this.smap.map.center.clone();
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_1d8.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
this.dragStartCenter=_1d8;
}
},_onMapMouseUp:function(evt){
if(this.smap.routeMarkerLayer.layer.markers.length>0){
return;
}
if(!this.dragStartCenter){
return;
}
var _1da=this.smap.map.center.clone();
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_1da.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
var _1db=Math.max(Math.abs(_1da.lon-this.dragStartCenter.lon),Math.abs(_1da.lat-this.dragStartCenter.lat));
var _1dc=(_1db*69.04)/2;
var _1dd=this.searchRadius;
if(this.searchRadius.indexOf("|")){
var arr=this.searchRadius.split("|");
_1dd=arr[0];
}
var _1df=parseFloat(_1dd)/2;
if(_1dc>_1df){
this.searchLonLat(_1da,{onError:this.locator.clearLocator.bind(this.locator),alertError:false});
this.dragStartCenter=null;
}
},searchLonLat:function(_1e0,_1e1){
var _1e2={longitude:_1e0.lon,latitude:_1e0.lat,searchradius:this.searchRadius,"sku":this.locator.sku,"uid":this.locator.uid};
var opts=Object.extend({formdataID:this.xmlId,dynamicSearch:true},_1e1||{});
this.search(_1e2,opts);
this._updateAddressline(_1e2);
this.searchedLonLat=true;
},_getSearchRadius:function(form){
if(form.searchradius&&this.searchRadius){
return form.searchradius.value;
}
var _1e5=ace.xml.getNodeValue(ace.xml.getXML(form)[0].getElementsByTagName("searchradius")[0]);
if(_1e5){
return _1e5;
}
var _1e6=this.smap.map.calculateBounds();
if(!_1e6){
return null;
}
var _1e7=Math.min(Math.abs(_1e6.top-_1e6.bottom),Math.abs(_1e6.left-_1e6.right));
return ""+((_1e7*69.04)/2);
},_updateAddressline:function(_1e8){
ace.geo.reverse(_1e8,function(_1e9){
var _1ea=SlippyMap.Util.getAddressline(_1e9);
this.searchForm.addressline.value=_1ea;
if(this.locator.whereamiDiv&&this.locator.whereamiDiv!=null){
var _1eb={"COUNTRY":_1e9.COUNTRY||null,"CITY":_1e9.CITY||null,"POSTALCODE":_1e9.POSTALCODE||null,"PROVINCE":_1e9.PROVINCE||null,"STATE":_1e9.STATE||null};
this._updateLocation(_1eb);
}
}.bind(this));
},_processResponse:function(_1ec){
var name=ace.xml.getCollectionName(_1ec);
var _1ee=_1ec.getElementsByTagName("collection")[0].getAttribute("country");
var city=_1ec.getElementsByTagName("collection")[0].getAttribute("city");
var _1f0=_1ec.getElementsByTagName("collection")[0].getAttribute("postalcode");
var _1f1=_1ec.getElementsByTagName("collection")[0].getAttribute("state");
var _1f2=_1ec.getElementsByTagName("collection")[0].getAttribute("province");
var _1f3=_1ec.getElementsByTagName("collection")[0].getAttribute("mapurl");
var _1f4=$("geoip_state");
if(_1f4){
if(_1f4.value=="start"){
_1f4.setAttribute("value","1");
}else{
_1f4.setAttribute("value","0");
}
}
var _1f5={"COUNTRY":_1ee||null,"CITY":city||null,"POSTALCODE":_1f0||null,"PROVINCE":_1f2||null,"STATE":_1f1||null};
Object.extend(this.locator,_1f5||{});
this.smap.clear();
var _1f6=$A(ace.xml.parse(_1ec));
var _1f7=this.smap.map.layers.find(function(_1f8){
return _1f8.name=="Proximity markers";
});
if(this.smap.map.layers[0].projection.toString()=="EPSG:4326"){
_1f7.projection=new OpenLayers.Projection("EPSG:4326");
_1f7.maxExtent=new OpenLayers.Bounds(-165,15,-50,75);
_1f7.units="degrees";
_1f7.maxResolution=1.40625;
this.layer=this.smap.map.layers.find(function(_1f9){
return _1f9.name=="SlippyMap W2GI";
});
if(_1f6.any(function(o){
return (o.COUNTRY=="CA");
})){
this.layer=this.smap.map.layers.find(function(_1fb){
return _1fb.name=="SlippyMap Navteq";
});
}else{
if(_1f6.any(function(o){
return (o.COUNTRY!="US"&&o.COUNTRY!="CA"&&o.COUNTRY.length>0);
})){
this.layer=this.smap.map.layers.find(function(_1fd){
return _1fd.name=="Google Normal";
});
if(this.layer){
if(_1f7.projection.toString()!="EPSG:900913"){
_1f7.projection=new OpenLayers.Projection("EPSG:900913");
_1f7.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_1f7.units="m";
_1f7.maxResolution=156543.0339;
}
}
}
}
}else{
this.layer=this.smap.map.layers.find(function(_1fe){
return _1fe.name=="Google Normal";
});
if(this.layer){
if(_1f7.projection.toString()!="EPSG:900913"){
_1f7.projection=new OpenLayers.Projection("EPSG:900913");
_1f7.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_1f7.units="m";
_1f7.maxResolution=156543.0339;
}
}
}
switch(name){
case "poi":
this.centerPoint=this._getCenterPoint(_1ec);
if(this.locator.defaultLocation){
this.locator.defaultLocation=false;
this.locator.uid="";
}
var _1ff=ace.util.getCookie("locationuid");
if(_1ff&&$(_1ff)){
$(_1ff).checked=true;
}
if(this.layer){
this.smap.map.setBaseLayer(this.layer);
}
var _200=0;
if(this.centerPoint){
_200=this.centerPoint.clone();
}
this.smap.zoomToPOIs();
this.smap.proximityLayer.update(_200);
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(_1f5);
}
if(this.locator.whereamiDiv&&this.locator.whereamiDiv!=null&&!this.searchedLonLat){
this._updateLocation(_1f5);
}else{
this.searchedLonLat=false;
}
if(this.geoip&&this.searchForm.addressline){
var _201=city+" "+_1f1+" "+_1f0;
this.searchForm.addressline.value=_201;
}
if(this.locator.location_address_id&&this.locator.location_address_id!=""){
var data=_1f6[0];
var _203=data.ADDRESS1+" "+data.CITY+" "+data.STATE+" "+data.POSTALCODE;
$(this.locator.location_address_id).value=_203;
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")&&_1f5.COUNTRY){
$("search_country").value=_1f5.COUNTRY;
}
if(_1f3){
this._addMapUrlImage(_1f3);
}
return this.cacheResults;
},_updateEtailerIframe:function(_204){
if(_204.COUNTRY){
var _205=$(this.locator.updateEtailersIframe);
_205.src=_205.src.substr(0,_205.src.length-2)+_204.COUNTRY;
}
},_updateLocation:function(_206){
if(!_206.COUNTRY&&!_206.STATE&&!_206.PROVINCE&&!_206.CITY&&!_206.POSTALCODE){
ace.template.updateLocation(this.locator.whereamiDiv,"location_none",_206);
}else{
if(!_206.CITY){
ace.template.updateLocation(this.locator.whereamiDiv,"location_nc",_206);
}else{
ace.template.updateLocation(this.locator.whereamiDiv,"location_us",_206);
}
}
},_getCenterPoint:function(_207){
var _208=ace.xml.getCollection(_207,"poi")||ace.xml.getCollection(_207,"multiple_address");
var _209=_208.getAttribute("centerpoint");
if(_209){
return OpenLayers.LonLat.fromString(_209);
}else{
return 0;
}
},_processSlice:function(_20a){
var _20b=this.smap.getPOIBounds(_20a);
var _20c=this.locator.proximitySearch.centerPoint.clone();
var _20d=this.locator.proximitySearch.centerPoint.clone();
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_20c.transform(new OpenLayers.Projection("EPSG:4326"),this.smap.map.baseLayer.projection);
}
_20b.extend(_20c);
_20b=this.smap.padBounds(_20b);
var view=this.smap.map.calculateBounds();
if(!view.containsBounds(_20b)){
this.smap.map.zoomToExtent(_20b);
}
this.smap.clear();
this.smap.proximityLayer.update(_20d);
},_makeDefaultLocation:function(e,uid){
var name="locationuid";
var _212=uid;
var _213=1000;
var _214=(this.locator.clientCookie&&this.locator.clientCookie.domain)?this.locator.clientCookie.domain:"";
var _215=0;
var _216="";
if(this.locator.clientCookie&&this.locator.clientCookie.value){
var temp=ace.table.records.find(function(e){
return e.UID==uid;
}.bind(this));
if(temp){
_216=temp[this.locator.clientCookie.value.toUpperCase()];
}
}
var _219=(this.locator.clientCookie&&this.locator.clientCookie.name)?this.locator.clientCookie.name:"locationuid";
if(!(this.locator.clientCookie&&this.locator.clientCookie.value&&_216&&_216!="")){
_216=uid;
}
var _21a=(this.locator.clientCookie&&this.locator.clientCookie.expires)?this.locator.clientCookie.expires:1000;
var _21b=(this.locator.clientCookie&&this.locator.clientCookie.domain)?this.locator.clientCookie.domain:"";
if(!e.checked){
ace.util.deleteCookie(name,_214);
if(this.locator.clientCookie&&ace.util.getCookie(_219)){
ace.util.deleteCookie(_219,_214);
}
return;
}
if(this.locator.clientCookie){
ace.util.setCookie(_219,_216,_21a,null,_214,_215);
}
ace.util.setCookie(name,_212,_213,null,_214,_215);
var _21c=ace.util.getCookie(name);
if(!_21c){
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(_21f){
this.locator=_21f;
this.searchForm=$("product_search");
this.altSearchForm=$("driving_directions");
SlippyMap.Search.ProximitySearch.prototype.initialize.apply(this,arguments);
if(_21f.onlinePanel&&_21f.onlinePanel!=""){
this._fillOnlinePanel();
}
},destroy:function(){
SlippyMap.Search.ProximitySearch.prototype.destroy.apply(this,arguments);
this.cacheResults=null;
this.dragStartCenter=null;
this.centerPoint=null;
},search:function(form,_221){
SlippyMap.Search.ProximitySearch.prototype.search.apply(this,arguments);
},_fillOnlinePanel:function(){
var qs=location.search.split("&");
var _223={};
for(var i=0;i<qs.length;i++){
temp=qs[i].split("=");
_223[temp[0].replace(/^\?/,"")]=temp[1];
}
if(!_223.currency){
_223.currency="auto";
}
var _225={formdataID:"onlineetailersearch",alertError:false};
ace.table.update("online_comp_panel",_223,null,_225);
},_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(_227){
this.locator=_227;
this.searchForm=$("driving_directions");
this.altSearchForm=$("locator_search");
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(_228){
return _228.name=="SlippyMap Navteq";
});
},destroy:function(){
SlippyMap.Search.prototype.destroy.apply(this,arguments);
this.bounds=null;
this.includeATW=null;
},search:function(form,_22a){
this.searchFromMarker=false;
var _22b=Form.getInputs(form,"text","addressline");
var _22c=Form.getInputs(form,"hidden","addressline");
if(_22c.size()==1){
_22b.push(_22c[0]);
}
var _22d=Form.serializeElements(_22b,true);
var _22e=_22d.addressline;
var _22f={};
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(_22e,{"latitude":this.locator.lat,"longitude":this.locator.lon,"action":this.locator.action});
_22f={"uid":this.locator.uid,"action":this.locator.action};
}else{
_22f={"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,_22e,_22f,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory},form);
},bubbleSearch:function(_230){
if(!(_230.target.type&&_230.target.type=="checkbox")){
_230.stop();
}
this.searchFromMarker=false;
var form=_230.element().form;
var _232=Form.getInputs(form,"text","addressline")[0];
_232.value=_232.value.strip();
if(_232.value.empty()){
return;
}
var _233=_230.element().readAttribute("recnum");
var poi=ace.table.getRecord(_233);
var _235=(form.getElementsByTagName("a")[0].innerHTML=="To")?false:true;
var _236=Form.serialize(form,true);
var _237=_235?[poi,_236]:[_236,poi];
var _238={uid:poi.UID,action:_235?"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,_237,_238,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory},form);
this._updateSearchForm(_235,_232.value,poi);
},markerSearch:function(_239,_23a,_23b){
this.searchFromMarker=true;
var _23c=new OpenLayers.LonLat(_239.lonlat.lon,_239.lonlat.lat);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_23c.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
var _23d={LONGITUDE:_23c.lon,LATITUDE:_23c.lat,COUNTRY:_239.country};
var _23e=(_23a<=0)?[_23d,_23b]:[_23b,_23d];
ace.directions.search(this.ddpanel,this.formData,this.includeATW,_23e,false,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory});
this._updateAddressline(_239.getAddress(),_23a);
},processResponse:function(_23f){
this.smap.clear();
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(_23f,"maneuvers");
var _241=this.smap.map.layers.find(function(_242){
return _242.name=="Route markers";
});
var _243=this.smap.map.layers.find(function(_244){
return _244.name=="Route vector";
});
if(!_243){
_243=this.smap.map.layers.find(function(_245){
return _245.name=="Route image";
});
}
if(xml){
this.bounds=this.smap.padBounds(this._getRouteBounds(xml));
var _246=this._getIconAddresses(_23f);
this.mapurl=_23f.getElementsByTagName("collection")[0].getAttribute("mapurl");
["A","B"].each(function(_247,_248){
_246[_248].POINUM=_247;
_246[_248].RECNUM=_247;
});
if(this.smap.map.layers[0].projection.toString()=="EPSG:4326"){
this.layer=this.smap.map.layers.find(function(_249){
return _249.name=="SlippyMap Navteq";
});
_243.projection=new OpenLayers.Projection("EPSG:4326");
_243.maxExtent=new OpenLayers.Bounds(-165,15,-50,75);
_243.units="degrees";
_243.maxResolution=1.40625;
_241.projection=new OpenLayers.Projection("EPSG:4326");
_241.maxExtent=new OpenLayers.Bounds(-165,15,-50,75);
_241.units="degrees";
_241.maxResolution=1.40625;
if(_246.any(function(o){
return (o.COUNTRY!="US"&&o.COUNTRY!="CA");
})){
this.layer=this.smap.map.layers.find(function(_24b){
return _24b.name=="Google Normal";
});
_243.projection=new OpenLayers.Projection("EPSG:900913");
_243.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_243.units="m";
_243.maxResolution=156543.0339;
_241.projection=new OpenLayers.Projection("EPSG:900913");
_241.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_241.units="m";
_241.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(_24c){
return _24c.name=="Google Normal";
});
_243.projection=new OpenLayers.Projection("EPSG:900913");
_243.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_243.units="m";
_243.maxResolution=156543.0339;
_241.projection=new OpenLayers.Projection("EPSG:900913");
_241.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_241.units="m";
_241.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(_246);
this.smap.routeMarkerLayer.addEndMarkers(_246);
this.smap.routeLayer.addRoute();
var _24d=ace.xml.getCollection(_23f,"pois");
if(_24d&&_24d.childNodes&&_24d.childNodes.length!=0){
var pois=ace.xml.parse(_24d);
var _24f=this.ddpanel.down();
this._addAlongTheWayInfo(_24f,pois);
}
this._addReverseSearchObservers();
this._updatePanelAddressline(_246);
if(this.mapurl){
this._addMapUrlImage(this.mapurl);
}
}else{
this.responseXML=ace.util.cleanWhitespace(_23f);
this.smap.routeLayer.clear();
this.smap.routeMarkerLayer.clear();
this.smap.zoomToPOIs(true);
var _246=this._getAddressesFromMultiple();
this._updateCountrySelects(_246);
}
return true;
},_addAlongTheWayInfo:function(_250,pois){
this.smap.proximityLayer.addPOIMarkers(pois,true);
var _252=this._getManeuverPOIs(pois);
this._updatePanel(_250,_252);
},_getManeuverPOIs:function(pois){
var _254={};
for(var i=0,len=pois.length;i<len;i++){
var poi=pois[i];
_254[poi.MANEUVER]?_254[poi.MANEUVER].push(poi):_254[poi.MANEUVER]=[poi];
}
return _254;
},_updatePanel:function(_258,_259){
var rows=ace.util.select(_258,"maneuver_pois");
for(maneuver in _259){
var _25b=parseInt(maneuver)-1;
var _25c=ace.template.getTemplate("along_the_way");
_258=ace.template.getTableTemplate(_25c,_259[maneuver]);
rows[_25b].update(_258).show();
}
},_updateCountrySelects:function(_25d){
if($("orig_country")&&_25d[0]&&_25d[0].COUNTRY){
$("orig_country").value=_25d[0].COUNTRY;
}
if($("dest_country")&&_25d[1]&&_25d[1].COUNTRY){
$("dest_country").value=_25d[1].COUNTRY;
}
},_updatePanelAddressline:function(_25e){
var _25f=ace.util.select($(this.ddpanel),"addressline");
if(_25f.length>0){
var _260=ace.util.select($(this.ddpanel),"ddendpoint");
for(var i=0;i<_25f.length;i++){
if(_260&&_260.length==2){
var _262=null;
if(i==0){
_262=ace.template.getTemplate("ddstarticon",{});
}else{
_262=ace.template.getTemplate("ddendicon",{});
}
if(_262!=null){
_260[i].update(_262);
}
}
var _263=$(_25e[i]);
var _264=$(_25f[i]);
var _265=_263.ADDRESS1.blank()?"":_263.ADDRESS1.trim();
var _266=_264.getElementsBySelector(".address_line1");
if(_265&&_266.length>0){
_266[0].update(_265);
}
var city=_263.CITY.empty()?"":_263.CITY+", ";
var _268=ace.util.select(_264,"address_city");
if(city&&_268.length>0){
_268[0].update(city);
}
var _269=(_263.COUNTRY!="US")?_263.PROVINCE+" ":_263.STATE+" ";
var _26a=ace.util.select(_264,"address_state");
if(_269&&_26a.length>0){
_26a[0].update(_269);
}
var _26b=_263.POSTALCODE.empty()?"":_263.POSTALCODE;
var _26c=ace.util.select(_264,"address_zip");
if(_26b&&_26c.length>0){
_26c[0].update(_26b);
}
}
}
},_addPanelObserver:function(_26d){
Event.observe(_26d,"click",function(_26e){
if(!(_26e.target.type&&_26e.target.type=="checkbox")){
_26e.stop();
}
if(!this.searchForm||!this.searchForm.visible()){
return;
}
var _26f=_26e.element().readAttribute("action");
switch(_26f){
case "search_address":
var _270=_26e.element().readAttribute("recnum");
var _271=parseInt(_270)-1;
var _272=this._getMultipleAddresses();
var _273=_272.addresses[_271];
var _274=ace.xml.parseNode(_273);
var _275=this.searchForm.getInputs("text","addressline")[_272.index];
if(_275){
_275.value=this._getSelectedInput(_273);
}
ace.directions.addresses[_272.index]=_274;
ace.directions.search(_26d,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(_277,_278,poi){
var _27a=poi.ADDRESS1+", "+poi.CITY+", "+poi.STATE+" "+poi.POSTALCODE;
var _27b=this.searchForm.getInputs("text","addressline");
var _27c=this.searchForm.getInputs("hidden","addressline");
if(_27b[0]){
_27b[0].value=_277?_27a:_278;
}
if(_27b[1]){
_27b[1].value=_277?_278:_27a;
}else{
if(_27c[0]){
_27c[0].value=_277?_27a:_278;
}
}
var uid=this.searchForm.getInputs("hidden","uid");
var _27e=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(_27e&&_27e.size()>0){
_27e[0].value=_277?"From":"To";
}
if(lon&&lon.size()>0){
lon[0].value=poi.LONGITUDE;
}
if(lat&&lat.size()>0){
lat[0].value=poi.LATITUDE;
}
},_updateAddressline:function(_281,_282){
var _283=this.searchForm.getInputs("text","addressline")[_282];
if(!_283){
_283=this.searchForm.getInputs("hidden","addressline")[0];
}
if(_283){
_283.value=SlippyMap.Util.getAddressline(_281);
}
},_addReverseSearchInputsObservers:function(){
if(this.searchForm){
var _284=this.searchForm.getElementsByTagName("img")[0];
if(_284){
Event.observe(_284,"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"});
},_reverseSearchInputs:function(){
var _285=this.searchForm.getInputs("text","addressline");
var _286=_285.pluck("value").reverse();
_285.each(function(e,_288){
e.value=_286[_288];
});
},_getMultipleAddresses:function(){
var _289=null;
var _28a=this.responseXML.cloneNode(true);
var _28b=$A(_28a.getElementsByTagName("collection")[0].childNodes);
_28b.each(function(e,_28d){
if(e.tagName=="collection"&&e.getAttribute("name")=="multiple_address"){
_289={addresses:e.getElementsByTagName("address"),index:_28d};
e.removeAttribute("name");
throw $break;
}
});
return _289;
},_getAddressesFromMultiple:function(){
var _28e=[];
var _28f=this.responseXML.cloneNode(true);
var _290=$A(_28f.getElementsByTagName("collection")[0].childNodes);
_290.each(function(e,_292){
if(e.tagName=="collection"&&e.getAttribute("name")=="multiple_address"){
_28e.push(ace.xml.parseNode(e.getElementsByTagName("address")[0]));
}else{
_28e.push(ace.xml.parseNode(e));
}
});
return _28e;
},_getSelectedInput:function(_293){
var _294=_293.getElementsByTagName("address1")[0].firstChild;
var _295=_294?_294.nodeValue:"";
var _296=(_293.getElementsByTagName("state")[0].firstChild)?_293.getElementsByTagName("state")[0].firstChild.nodeValue:"";
var _297=(_293.getElementsByTagName("province")[0].firstChild)?_293.getElementsByTagName("province")[0].firstChild.nodeValue:"";
var _298=(_293.getElementsByTagName("postalcode")[0].firstChild)?_293.getElementsByTagName("postalcode")[0].firstChild.nodeValue:"";
var city=(_293.getElementsByTagName("city")[0].firstChild)?_293.getElementsByTagName("city")[0].firstChild.nodeValue:"";
var _29a=((_295=="")?"":_295+", ");
_29a+=city+", ";
_29a+=_296+" "+_297+" "+_298;
return _29a;
},_addReverseSearchObservers:function(){
ace.util.select(this.ddpanel,"reverse_directions").each(function(e){
Event.observe(e,"click",this._reverseSearch.bind(this));
}.bind(this));
},_getIconAddresses:function(_29c){
var xml=ace.xml.getCollection(_29c,"address").getElementsByTagName("address");
return ace.xml.parseNodes(xml);
},_getRouteBounds:function(xml){
var _29f=xml.getAttribute("bounds");
return new OpenLayers.Bounds.fromString(_29f);
}});
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,_2a3){
if(_2a3){
this.highlight=(_2a3.highlight==true)?true:false;
this.highlightEffect=(_2a3.highlightEffect)?_2a3.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(_2a4){
this.addCenterMarker(_2a4);
this.addPOIMarkers();
},addPOIMarkers:function(pois,_2a6){
pois=pois||ace.table.getSlice()||ace.table.records;
for(var i=0,len=pois.length;i<len;i++){
this.addPOIMarker(pois[i],false,_2a6);
}
},addPOIMarker:function(poi,_2aa,_2ab){
var _2ac=null;
if(_2aa){
var _2ad=new OpenLayers.LonLat(poi.LONGITUDE,poi.LATITUDE);
var _2ae=ace.template.getIconTemplate("dragabble_icon",poi);
var icon=new OpenLayers.Icon.IconFromTemplate(_2ae);
_2ac=new OpenLayers.Marker.DragabbleMarker(_2ad,icon);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_2ac.setSphericalMercator(true);
}
if(!_2ab){
_2ac.events.register("click",this,function(evt){
OpenLayers.Event.stop(evt);
});
}
}else{
var _2b1=this._createFeature(poi);
_2ac=_2b1.createMarker();
this.features[poi.RECNUM]=_2b1;
if(!_2ab){
this._bindMarkerClick(_2ac,_2b1,poi.UID);
}
}
_2ac.recnum=poi.RECNUM;
if(this.highlight){
this._bindMarkerOver(_2ac);
}
this.layer.addMarker(_2ac);
return _2ac;
},removePOIMarker:function(_2b2){
var _2b3=this.getPOIMarker(_2b2);
this.layer.removeMarker(_2b3);
if(this.features[_2b2]){
this.features[_2b2].destroy();
delete this.features[_2b2];
}
return _2b3;
},replacePOIMarker:function(_2b4,_2b5){
this.removePOIMarker(_2b4);
var poi=ace.table.getRecord(_2b4);
var ret=this.addPOIMarker(poi,_2b5);
for(i in this.layer.markers){
var m=this.layer.markers[i];
if(m&&m.icon){
if(m.recnum==_2b4){
m.icon.imageDiv.style.zIndex=4500;
}else{
m.icon.imageDiv.style.zIndex=3500;
}
}
}
return ret;
},getPOIMarker:function(_2b9){
return this.layer.markers.find(function(_2ba){
return _2ba.recnum==_2b9;
});
},addCenterMarker:function(_2bb){
var _2bc=ace.template.getTemplate("center_marker");
if(!_2bc){
return null;
}
if(!_2bb){
return null;
}
var icon=new OpenLayers.Icon.IconFromTemplate(_2bc);
var _2be=new OpenLayers.Marker.DragabbleMarker(_2bb,icon);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_2be.setSphericalMercator(true);
}
_2be.events.register("mouseup",this.smap.locator.proximitySearch,function(evt){
OpenLayers.Event.stop(evt);
var _2c0=evt.object.lonlat;
this.smap.map.setCenter(_2c0);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_2c0.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
this.searchLonLat(_2c0,{onError:this.locator.clearLocator.bind(this.locator)});
document.fire("w2gi:track",{action:"centermarkerdrag",value:_2c0.toShortString()});
});
this.layer.addMarker(_2be);
return _2be;
},_addPanelObserver:function(_2c1){
$(_2c1).observe("click",function(_2c2){
if(!(_2c2.target.type&&_2c2.target.type=="checkbox")){
_2c2.stop();
}
var _2c3=_2c2.element().readAttribute("action");
if(_2c3){
var i=_2c3.lastIndexOf("/");
if(i!=-1){
_2c3=_2c3.substring(i+1,_2c3.length);
}
}
var _2c5;
switch(_2c3){
case "open_bubble":
_2c5=_2c2.element().readAttribute("recnum");
if(this._markerClick(this.features[_2c5])){
var _2c6=ace.table.getRecord(_2c5);
document.fire("w2gi:track",{action:"clickondealer-panel",value:_2c6.UID});
}
break;
case "sort_table":
var _2c7=_2c2.element().readAttribute("sort_field");
var _2c8=_2c2.element().readAttribute("field_type");
ace.table.sortRecords(_2c7,_2c8);
ace.table.updateFromRecords(_2c1);
this.smap.clear();
this.update(this.smap.locator.proximitySearch.centerPoint);
break;
case "more_info":
_2c5=_2c2.element().readAttribute("recnum");
ace.table.oldrecords=ace.table.records.clone();
ace.table.selected=_2c5;
var pois=ace.table.records.slice(_2c5-1,_2c5);
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(_2c2.element(),_2c2.element().readAttribute("uid"));
break;
}
}.bind(this));
if(this.highlight){
_2c1.observe("mouseover",function(_2ca){
_2ca.stop();
var _2cb=_2ca.element().readAttribute("recnum");
if(_2cb){
this._markerOver(_2cb);
}
}.bind(this));
_2c1.observe("mouseout",function(_2cc){
_2cc.stop();
this._markerOver();
}.bind(this));
}
},_markerClick:function(_2cd){
this.smap.locator.proximitySearch.dragStartCenter=null;
if(_2cd&&_2cd.popup&&_2cd.popup.visible()){
this.smap.map.events.triggerEvent("popupclose",_2cd.popup);
return false;
}else{
for(i in this.layer.markers){
var m=this.layer.markers[i];
if(m&&m.icon){
if(m.recnum==_2cd.marker.recnum){
m.icon.imageDiv.style.zIndex=4500;
}else{
m.icon.imageDiv.style.zIndex=3500;
}
}
}
this._clearPopups();
this._addBubbleData(_2cd.data);
var _2cf=_2cd.createPopup();
_2cf.recnum=_2cd.data.recnum;
_2cf.bubbleSize=_2cd.data.icon.bubbleSize;
_2cf.bubbleMargin=_2cd.data.icon.bubbleMargin;
_2cf.bubbleOffset=_2cd.data.icon.bubbleOffset;
this.smap.map.addPopup(_2cf,true);
this.smap.map.adjustForBubble(_2cd.marker.lonlat,_2cf.bubbleSize,_2cf.bubbleMargin,_2cf.bubbleOffset);
return true;
}
},_markerOver:function(_2d0){
var _2d1;
var _2d2=this.smap.locator.panel.down();
ace.table.highlightRow(_2d2,_2d0);
var poi;
if(_2d0){
if((markerOld=this.getPOIMarker(_2d0))&&(!markerOld.highlighted)){
poi=ace.table.getRecord(_2d0);
var _2d4=this._createFeature(poi,"alt_icon");
_2d1=_2d4.createMarker();
_2d1.recnum=poi.RECNUM;
_2d1.highlighted=true;
if(this.highlight){
this._bindMarkerOver(_2d1);
}
this._bindMarkerClick(_2d1,_2d4);
this.layer.removeMarker(markerOld);
this.layer.addMarker(_2d1);
if(this.highlightEffect){
this.highlightEffect(_2d1.events.element);
}
}
}else{
if(_2d1=this.layer.markers.find(function(_2d5){
return _2d5.highlighted==true;
})){
poi=ace.table.getRecord(_2d1.recnum);
this.layer.removeMarker(_2d1);
this.addPOIMarker(poi,false,false);
}
}
},_addBubbleData:function(data){
var poi=ace.table.getRecord(data.recnum);
this._setBubbleCountry(data.bubbleID,poi);
var _2d8=ace.template.getTemplate(data.bubbleID,poi);
var _2d9=_2d8.style;
data.popupContentHTML=_2d8.innerHTML;
data.popupSize=new OpenLayers.Size(_2d9.width,_2d9.height);
data.icon.bubbleSize=data.popupSize;
data.icon.bubbleMargin=new OpenLayers.Bounds(_2d9.marginLeft,_2d9.marginBottom,_2d9.marginRight,_2d9.marginTop);
data.icon.bubbleOffset=new OpenLayers.Pixel(_2d8.readAttribute("offsetx"),_2d8.readAttribute("offsety"));
},_setBubbleCountry:function(_2da,poi){
var _2dc=ace.template.templates[_2da].select("#bubble_country")[0];
if(_2dc&&_2dc.options){
for(var i=0;i<_2dc.options.length;i++){
if(_2dc.options[i].value==poi.COUNTRY){
$(_2dc.options[i]).setAttribute("selected","selected");
}else{
$(_2dc.options[i]).removeAttribute("selected");
}
}
}
return;
},_clearPopups:function(){
for(recnum in this.features){
var _2de=this.features[recnum];
if(_2de.popup){
_2de.popup.destroy();
_2de.popup=null;
break;
}
}
},_createFeature:function(poi,_2e0){
var _2e1=new OpenLayers.LonLat(poi.LONGITUDE,poi.LATITUDE);
var data=this._getFeatureData(poi,_2e0);
return new OpenLayers.Feature(this,_2e1,data);
},_getFeatureData:function(poi,_2e4){
var _2e5=ace.template.getIconTemplate(_2e4||poi.ICON,poi);
var data={};
data.recnum=poi.RECNUM;
data.icon=new OpenLayers.Icon.IconFromTemplate(_2e5);
data.bubbleID=_2e5.readAttribute("bubbleid");
return data;
},_bindMarkerOver:function(_2e7){
_2e7.events.register("mouseover",this,function(_2e8){
OpenLayers.Event.stop(_2e8);
this._markerOver(_2e7.recnum);
});
_2e7.events.register("mouseout",this,function(_2e9){
OpenLayers.Event.stop(_2e9);
this._markerOver();
});
},_bindMarkerClick:function(_2ea,_2eb,uID){
_2ea.events.register("click",this,function(evt){
OpenLayers.Event.stop(evt);
if(this._markerClick(_2eb)){
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 _2f0={strokeColor:"blue",strokeOpacity:1,strokeWidth:5,pointRadius:6,pointerEvents:"visiblePainted"};
Object.extend(_2f0,this.layer.map.routeStyle||{});
var _2f1=this._getPointList();
var _2f2=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(_2f1),null,_2f0);
this.layer.addFeatures([_2f2]);
},_getPointList:function(){
var _2f3=ace.table.records.pluck("SEGMENT_GEOMETRY");
var _2f4=[];
for(var i=0,leni=_2f3.length;i<leni;i++){
if(_2f3[i].length<=0){
continue;
}
var _2f7=_2f3[i].substring(11,_2f3[i].length-1).split(",");
for(var j=0,lenj=_2f7.length;j<lenj;j++){
var _2fa=_2f7[j].split(" ");
myPoint=new OpenLayers.Geometry.Point(_2fa[0],_2fa[1]);
if(this.layer.projection.toString()=="EPSG:900913"){
myPoint.transform(new OpenLayers.Projection("EPSG:4326"),this.layer.projection);
}
_2f4.push(myPoint);
}
}
return _2f4;
}});
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 _2fd=this._getImageParams();
ace.request(_2fd,this._processResponse.bind(this),{formdataID:"get_route_image",onHistory:false});
},_getFullRouteMarkers:function(){
return this.layer.markers.findAll(function(_2fe){
return _2fe.isFullImage;
});
},_processResponse:function(_2ff){
this.layer.clearMarkers();
var _300=ace.xml.parse(_2ff);
var _301=this._getRouteImage(_300[0]);
_301.isFullImage=this._viewContainsRoute();
this.layer.addMarker(_301);
return true;
},_getRouteImage:function(_302){
var size=new OpenLayers.Size(_302.WIDTH,_302.HEIGHT);
var _304=new OpenLayers.Icon(_302.URL,size,null,function(){
return new OpenLayers.Pixel(0,0);
});
var x=_302.OFFSET_X;
var y=_302.MAX_Y;
var _307=new OpenLayers.LonLat(x,y);
return new OpenLayers.Marker(_307,_304);
},_getImageParams:function(){
var _308=this.smap.map.getExtent();
var _309=this.smap.map.getSize().w;
var _30a=this.smap.map.getSize().h;
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_308.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
return {routeid:0,bounds:_308.left+","+_308.bottom+","+_308.right+","+_308.top,height:_30a,width:_309};
},_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(_30f){
_30f.each(function(_310,_311){
var _312=null;
if(_311<=0){
_312=ace.template.getTemplate("ddstarticon",_310);
}else{
_312=ace.template.getTemplate("ddendicon",_310);
}
if(_312==null){
_312=ace.template.getIconTemplate("default",_310);
}
var icon=new OpenLayers.Icon.IconFromTemplate(_312);
var _314=new OpenLayers.LonLat(_310.LONGITUDE,_310.LATITUDE);
var _315=new OpenLayers.Marker.DragabbleMarker(_314,icon,this.smap.locator.disableDynamicRoutes);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_315.setSphericalMercator(true);
}
var _316=(_311<=0)?_30f.last():_30f.first();
if(!this.smap.locator.disableDynamicRoutes){
_315.events.register("mouseup",_315,this._mouseUp.bind(this,_315,_311,_316));
}
this.layer.addMarker(_315);
}.bind(this));
},_mouseUp:function(_317,_318,_319){
_317.reverseGeocode(function(_31a){
var _31b=new OpenLayers.LonLat(_31a.lonlat.lon,_31a.lonlat.lat);
this.smap.locator.directionsSearch.markerSearch(_31a,_318,_319);
_31a.moveToLonLat();
document.fire("w2gi:track",{action:"routemarkerdrag",value:_31b.toShortString()});
}.bind(this));
}});

