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;
if(ace.util.numberFormat){
OpenLayers.LonLat.prototype.toShortString=function(){
return (this.lon.toString().replace(",",".")+", "+this.lat.toString().replace(",","."));
};
}
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.Icon.IconFromTemplate=OpenLayers.Class.create();
OpenLayers.Icon.IconFromTemplate.prototype=OpenLayers.Class.inherit(OpenLayers.Icon,{bubbleid:null,initialize:function(_4f){
var img=_4f.getElementsByTagName("img")[0];
var url=img._src?img._src:img.src;
var _52=this._getIconSize(_4f);
OpenLayers.Icon.prototype.initialize.apply(this,[url,_52,null,calculateOffset]);
this.bubbleid=_4f.getAttribute("bubbleid");
var _53=_4f.getElementsByTagName("div")[0];
if(_53){
this.imageDiv.appendChild(_53);
}
Element.extend(this.imageDiv);
this.imageDiv.addClassName("icon");
function calculateOffset(){
return new OpenLayers.Pixel(_4f.readAttribute("offsetx"),_4f.readAttribute("offsety"));
};
},_getIconSize:function(_54){
return new OpenLayers.Size(_54.readAttribute("width"),_54.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(_55,_56,_57){
OpenLayers.Control.prototype.initialize.apply(this,arguments);
if(_55){
this.location=_55;
}
if(_56){
this.effectType=_56;
}
if(_57){
this.panel=_57;
}
},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(_5a){
OpenLayers.Event.stop(_5a);
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(_5b){
if(this.blockMoreEffects==true){
return;
}else{
this.blockMoreEffects=true;
}
OpenLayers.Event.stop(_5b);
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(_5d,_5e){
OpenLayers.Marker.prototype.initialize.apply(this,arguments);
this._registerObservers();
},setSphericalMercator:function(_5f){
this.sphericalMercator=_5f;
},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(_60,_61){
var _62=(_61&&_61.country)?_61.country:"";
var _63=new OpenLayers.LonLat(this.lonlat.lon,this.lonlat.lat);
if(this.sphericalMercator){
_63.transform(new OpenLayers.Projection("EPSG:900913"),new OpenLayers.Projection("EPSG:4326"));
}
var _64={longitude:_63.lon,latitude:+_63.lat,country:_62};
ace.geo.reverse(_64,processResponse.bind(this),_61);
function processResponse(_65){
this.reverseGeocoderAddress=_65;
this.geocoderAddress=null;
var _66=new OpenLayers.LonLat(_65.LONGITUDE,_65.LATITUDE);
if(this.sphericalMercator){
_66.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));
}
this.lonlat=_66;
this.country=_65.COUNTRY;
if(!_60){
return true;
}
try{
return _60(this);
}
catch(e){
ace.util.alert(e,{height:100});
}
};
},geocode:function(_67,_68,_69){
if(_67==""){
return;
}
ace.geo.code(_67,processResponse.bind(this),_69);
function processResponse(_6a){
this.geocoderAddresses=_6a;
this.reverseGeocoderAddress=null;
if(!_68){
return true;
}
try{
return _68(this);
}
catch(e){
ace.util.alert(e,{height:100});
}
};
},moveToLonLat:function(_6b){
var px=this.map.getLayerPxFromLonLat(_6b||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 _6f=this.mouseDragStart.x-evt.xy.x;
var _70=this.mouseDragStart.y-evt.xy.y;
var _71=this.icon.imageDiv.style;
var _72=parseInt(_71.left)-_6f;
var _73=parseInt(_71.top)-_70;
_71.left=_72+"px";
_71.top=_73+"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 _75=this.map.getLonLatFromPixel(evt.xy);
var _76=_75.lon-this.mouseDragStartLonLat.lon;
var _77=_75.lat-this.mouseDragStartLonLat.lat;
this.lonlat=this.lonlat.add(_76,_77);
this.mouseDragStart=null;
OpenLayers.Event.stop(evt);
},CLASS_NAME:"OpenLayers.Marker.DragabbleMarker"});
var SlippyMap={locator:null,load:function(_78,_79,_7a){
ace.template.initialize();
ace.util.checkNumberFormat();
SlippyMap.locator=new SlippyMap.Locator(_78,_79,_7a);
},unload:function(){
SlippyMap.locator.destroy();
SlippyMap.locator=null;
ace.template.destroy();
ace.cache.destroy();
},VERSION_NUMBER:"1.6"};
SlippyMap.Popup=Class.create({smap:null,initialize:function(_7b){
this.smap=_7b;
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(_7c){
this._addObservers.bind(this,_7c).defer();
var _7d=this.smap.locator.panel.down();
ace.table.updateActiveRow(_7d,_7c.recnum);
},_popupClose:function(_7e){
this.smap.map.removePopup(_7e);
var _7f=_7e.recnum;
var _80=this.smap.proximityLayer.features[_7f];
if(_80.popup){
_80.popup.destroy();
_80.popup=null;
}
var _81=this.smap.locator.panel.down();
ace.table.updateActiveRow(_81);
},_addObservers:function(_82){
var _83=ace.util.select(_82.div,"bubble_close")[0];
var _84=ace.util.select(_82.div,"tab_label");
if(_83){
_83.observe("click",_82.hide.bind(_82));
}
var _85=Element.extend(_82.div.getElementsByTagName("form")[0]);
_84.each(function(_86){
Event.observe(_86,"click",this._selectTab.bind(this,_86,_82.div,_85));
}.bind(this));
if(_85){
if(_85.visible()){
var _87=setInterval(function(){
Form.focusFirstElement(_85);
clearInterval(_87);
},500);
}
this._addFormObservers(_85);
}
_82.div.observe("click",function(_88){
if(!(_88.target.type&&_88.target.type=="checkbox")){
_88.stop();
}
var _89=$(_88.target).readAttribute("action");
switch(_89){
case "more_info":
var _8a=_88.target.readAttribute("recnum");
ace.table.oldrecords=ace.table.records.clone();
ace.table.selected=_8a;
var _8b=ace.table.records.slice(_8a-1,_8a);
_8b[0].RECNUM=1;
_8b[0].POINUM=1;
this.smap.locator.clear();
ace.table.updateFromRecords(this.smap.locator.panel,_8b,{NAME:"more_info"});
this.smap.proximityLayer.addPOIMarker(_8b[0]);
this.smap.zoomToPOI(_8b,1);
break;
}
}.bind(this));
},_addFormObservers:function(_8c){
var _8d=_8c.getElementsByTagName("input")[0];
var _8e=_8c.getElementsByTagName("input")[1];
Event.observe(_8e,"click",function(_8f){
this.smap.locator.directionsSearch.bubbleSearch(_8f);
}.bind(this));
Event.observe(_8d,"keypress",function(_90){
if(_90.keyCode==Event.KEY_RETURN){
this.smap.locator.directionsSearch.bubbleSearch(_90);
}
}.bind(this));
var _91=_8c.getElementsByTagName("a")[0];
if(_91){
Event.observe(_91,"click",function(_92){
_92.stop();
var dir=ace.util.select(_8c,"dir")[0];
if(_91.innerHTML=="To"){
_91.innerHTML="From";
dir.innerHTML="Get directions to:";
}else{
_91.innerHTML="To";
dir.innerHTML="Get directions from:";
}
_8d.focus();
});
}
},_selectTab:function(_94,div,_96){
var _97=ace.util.select(div,"tab_label").indexOf(_94);
var _98=ace.util.select(div,"tab_content");
var _99=ace.util.select(div,"bubble_tab");
var _9a=ace.util.select(div,"bubble_tab_dual");
_99.each(function(tab,_9c){
if(_97==_9c){
_98[_9c].addClassName("activetabcontent");
_98[_9c].removeClassName("nonactivetabcontent");
tab.addClassName("activetab");
tab.removeClassName("nonactivetab");
if(_96&&_96.visible()){
Form.focusFirstElement(_96);
}
}else{
_98[_9c].removeClassName("activetabcontent");
_98[_9c].addClassName("nonactivetabcontent");
tab.addClassName("nonactivetab");
tab.removeClassName("activetab");
}
}.bind(this));
_9a.each(function(tab,_9e){
var id=tab.id;
if(_97==_9e){
if(_98.length==_9a.length){
_98[_9e].addClassName("activetabcontent");
_98[_9e].removeClassName("nonactivetabcontent");
}
tab.addClassName("active"+id);
tab.removeClassName("nonactivetab");
if(_96&&_96.visible()){
Form.focusFirstElement(_96);
}
}else{
if(_98.length==_9a.length){
_98[_9e].removeClassName("activetabcontent");
_98[_9e].addClassName("nonactivetabcontent");
}
tab.addClassName("nonactivetab");
tab.removeClassName("active"+id);
}
}.bind(this));
}});
SlippyMap.Util={addHistory:function(_a0,_a1){
if(!SlippyMap.locator){
return;
}
var _a2="";
($("locator_search"))?_a2="locator_search":_a2="product_search";
var _a3=$(_a2).visible()?_a2:"driving_directions";
var _a4={formID:_a3,qs:Form.serialize($(_a3)),update:function(){
var _a5=$(this.formID);
if(!_a5.visible()){
var _a6=(this.formID==_a2)?"driving_directions":_a2;
$(_a6).hide();
_a5.show();
Form.focusFirstElement(_a5);
}
Form.deserialize(_a5,this.qs);
}};
var _a7={xml_request:_a0,processResponse:_a1,center:SlippyMap.locator.smap.map.getCenter(),zoom:SlippyMap.locator.smap.map.getZoom(),update:function(){
SlippyMap.locator.clear();
var _a8=ace.cache.get(this.xml_request);
if(_a8){
this.processResponse(_a8);
}
}};
ace.history.add([_a4,_a7]);
},isSearchFormValid:function(_a9){
var _aa=true;
if(!_a9){
return null;
}
$(_a9).getInputs("text","addressline").each(function(e){
e.value=e.value.strip();
if(e.value==""){
e.focus();
_aa=false;
throw $break;
}
});
return _aa;
},lowerCaseObject:function(_ac){
var obj={};
for(var key in _ac){
obj[key.toLowerCase()]=_ac[key];
}
return obj;
},getAddressline:function(_af){
var _b0="";
var _b1="";
var _b2="";
var _b3="";
if(_af.ADDRESS1){
var _b0=_af.ADDRESS1.blank()?"":_af.ADDRESS1.trim()+", ";
}
if(_af.CITY){
var _b1=_af.CITY.empty()?"":_af.CITY+", ";
}
if(_af.COUNTRY){
var _b2=(_af.COUNTRY!="US")?_af.PROVINCE+" ":_af.STATE+" ";
}
if(_af.POSTALCODE){
var _b3=_af.POSTALCODE.empty()?"":_af.POSTALCODE;
}
return _b0+_b1+_b2+_b3;
}};
SlippyMap.IconBar=Class.create({initialize:function(_b4){
this.locator=_b4;
this._addObservers();
},destroy:function(){
this._removeObservers();
},printURL:function(_b5){
var url=location.href.substring(0,location.href.lastIndexOf("/")+1)+_b5;
var _b7=url;
var _b8=this._getForm();
if(SlippyMap.Util.isSearchFormValid(_b8)){
var qs=Form.serialize(_b8);
url+="?form="+_b8.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=_b5+"?uid="+this.locator.uid;
}
}
return url;
},_addObservers:function(){
var _ba=$("icon_bar");
if(!_ba){
return;
}
var _bb=$("page_print");
if(_bb){
_bb.observe("click",this._printPage);
}
var _bc=$("page_email");
if(_bc){
_bc.observe("click",this._emailPage.bind(this));
}
var _bd=$("page_link");
if(_bd){
_bd.observe("click",this._linkToPage.bind(this));
}
},_removeObservers:function(){
var _be=$("icon_bar");
if(!_be){
return;
}
var _bf=$("page_print");
if(_bf){
_bf.stopObserving();
}
var _c0=$("page_email");
if(_c0){
_c0.stopObserving();
}
var _c1=$("page_link");
if(_c1){
_c1.stopObserving();
}
},_printPage:function(){
print();
},_emailPage:function(_c2){
var _c3=this._getForm();
var url=this._getURL(_c3);
var _c5=$("page_email").getAttribute("subject");
location.href="mailto:?subject="+_c5+"&body="+encodeURIComponent(url);
},_linkToPage:function(){
var _c6=this._getForm();
var url=this._getURL(_c6);
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(_c9){
var _ca=location.href.indexOf("?");
var url=(_ca>0)?location.href.substring(0,_ca):location.href;
_ca=location.href.indexOf("#");
url=(_ca>0)?url.substring(0,_ca):url;
if(SlippyMap.Util.isSearchFormValid(_c9)){
var qs=Form.serialize(_c9);
url+="?form="+_c9.readAttribute("id")+"&"+qs;
}
return url;
},_getForm:function(){
var _cd=$("locator_search");
if(!_cd||!_cd.visible()){
_cd=$("driving_directions");
}
return _cd;
}});
SlippyMap.Locator=Class.create({panel:null,whereamiDiv:null,sku:null,uid:null,smap:null,iconBar:null,proximitySearch:null,directionsSearch:null,initialize:function(_ce,_cf,_d0){
Object.extend(this,_d0||{});
this.mapID=_ce;
this.panel=$(_cf);
var _d1={layerProjection:new OpenLayers.Projection("EPSG:4326")};
if(_d0.whereamiDiv&&_d0.whereamiDiv!=null){
this.whereamiDiv=_d0.whereamiDiv;
}
if(_d0.ddpanel&&_d0.ddpanel!=""){
this.ddpanel=_d0.ddpanel;
}
this.iconBar=new SlippyMap.IconBar(this);
this.smap=new SlippyMap.Smap(this,_ce,_d0);
this.directionsSearch=new SlippyMap.Search.DirectionsSearch(this,_d1);
(_d0.formdataid)?this.formdataid=_d0.formdataid:this.formdataid="locatorsearch";
if(_d0.locatorType&&_d0.locatorType=="product"){
this.proximitySearch=new SlippyMap.Search.ProximitySearch.Product(this,_d1);
this.searchFormId="product_search";
}else{
this.proximitySearch=new SlippyMap.Search.ProximitySearch(this,_d1);
this.searchFormId="locator_search";
}
var _d2=this._retrieveGetVals();
var sku=_d2["sku"];
this.sku=sku;
var uid=_d2["uid"];
this.uid=uid;
var _d5=_d2["msrprange"];
this.msrprange=_d5;
var _d6=_d2["enablemap"];
this.enablemap=_d6;
var _d7=_d2["action"];
this.action=_d7;
var lat=_d2["lat"];
this.lat=lat;
var lon=_d2["lon"];
this.lon=lon;
this._load(_d0);
},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 _db={};
for(var i=0;i<qs.length;i++){
temp=qs[i].split("=");
_db[temp[0].replace(/^\?/,"")]=temp[1];
}
return _db;
},clearLocator:function(){
this.clear();
this.smap.proximityLayer.addCenterMarker(this.smap.map.center);
},displayInitialPOIs:function(xml){
ace.table.updateFromResponseXML(this.panel,xml);
var _de=this.smap.zoomToPOIs();
this.smap.proximityLayer.update(_de.getCenterLonLat());
},_load:function(_df){
if(location.href.include(this.panel)||location.href.include("driving_directions")||location.href.include(this.searchFormId)){
this._displayBookmark();
}else{
if(this.geoip){
if(_df.formdataid&&_df.formdataid!=null){
this.proximitySearch.search({"sku":this.sku,"uid":this.uid,"msrprange":this.msrprange,"enablemap":this.enablemap},{formdataID:_df.formdataid,geoip:_df.geoip,alertError:false});
}else{
this.proximitySearch.search({"sku":this.sku,"uid":this.uid,"msrprange":this.msrprange,"enablemap":this.enablemap},{"formdataID":this.formdataid,geoip:true,alertError:false});
}
}else{
var xml=ace.xml.getXML()[0];
if(xml){
if(xml.getElementsByTagName("poi").length>0){
this.displayInitialPOIs(xml);
this._addHistory();
}
}
var _e1=this.panel.down("form");
if($(this.panel)&&_e1){
Form.focusFirstElement(_e1);
}
}
}
},_displayBookmark:function(){
var _e2=location.href.indexOf("?");
if(_e2!=-1){
var _e3=location.href.include("locator_search")?"locator_search":"driving_directions";
if(_e3){
var _e4=$(_e3);
if(!_e4.visible()){
var _e5=(_e3=="locator_search")?"driving_directions":"locator_search";
if($(_e5)){
$(_e5).hide();
}
_e4.show();
}
Form.focusFirstElement(_e4);
var url=location.href.sub("form="+_e3+"&","");
var qs=url.substring(url.indexOf("?")+1);
Form.deserialize(_e4,qs);
if(_e3=="locator_search"){
this.proximitySearch.search(_e4);
}else{
if(this.directionsSearch){
this.directionsSearch.search(_e4);
}
}
}
}
},_addHistory:function(){
formHistory={qs:Form.serializeElements($(this.panel).getInputs("text","addressline")),update:function(){
var _e8=$(this.panel);
if(!_e8.visible()){
$("driving_directions").hide();
_e8.show();
Form.focusFirstElement(_e8);
}
Form.deserialize(_e8,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(_ea,_eb,_ec){
this.locator=_ea;
var _ed={scales:[50000000,20000000,10000000,4000000,1000000,500000,150000,100000,50000,25000,15000,6000],smap:this};
Object.extend(_ed,_ec||{});
var _ee;
if(_ec){
_ee={highlight:(_ec.highlight)?_ec.highlight:false,highlightEffect:(_ec.highlightEffect)?_ec.highlightEffect:false};
}
this.map=this._initOpenLayers(_eb,_ed);
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",_ee);
this._addCopyright(this.map.div);
this.map.events.register("changebaselayer",this,this._updateCopyrightPosition);
this.map.events.register("click",this,this._closePopup);
this.map.events.register("zoomend",this,this._trackZoom);
this.map.events.register("moveend",this,this._trackPan);
this.copyrightBottom=$("w2gi_copyright").getStyle("bottom");
this._addAjaxActivityIndicator(this.map.div);
if(!this.map.disableClickTrack){
document.observe("w2gi:track",function(_ef){
_ef.stop();
ace.click.track(_ef.memo);
});
}
if(Prototype.Browser.IE||Prototype.Browser.Gecko){
document.fire("w2gi:track",{action:"mapstartview",value:new Date().toLocaleString()});
window.onbeforeunload=function(){
document.fire("w2gi:track",{action:"mapendview",value:new Date().toLocaleString()});
};
}
},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);
this.map.events.unregister("zoomend",this,this._trackZoom);
this.map.events.unregister("moveend",this,this._trackPan);
if(!this.map.disableClickTrack){
document.stopObserving("w2gi:track");
}
},clear:function(){
this.proximityLayer.clear();
this.routeLayer.clear();
this.routeMarkerLayer.clear();
this.map.removePopups();
},zoomToPOIs:function(_f0){
var _f1=this.getPOIBounds(ace.table.records);
var _f2;
if(this.locator.proximitySearch){
_f2=this.locator.proximitySearch.centerPoint;
}else{
_f2=this.locator.productSearch.centerPoint;
}
if(_f2){
if(this.map.baseLayer.projection.toString()=="EPSG:900913"){
_f2.transform(new OpenLayers.Projection("EPSG:4326"),this.map.baseLayer.projection);
}
}
if(!_f0){
_f1.extend(_f2);
}
_f1=this.padBounds(_f1);
this.map.zoomToExtent(_f1);
return _f1;
},zoomToPOI:function(_f3,_f4){
var _f5=this.getPOIBounds(_f3);
if(!_f4){
_f5.extend(this.locator.proximitySearch.centerPoint);
}
this.map.zoomToExtent(_f5);
return _f5;
},findControl:function(_f6){
return this.map.controls.find(function(_f7){
return _f7.CLASS_NAME==_f6;
});
},padBounds:function(_f8){
var _f9=0.0125;
return new OpenLayers.Bounds(_f8.left-_f9,_f8.bottom-_f9,_f8.right+_f9,_f8.top+_f9);
},getPOIBounds:function(_fa){
var _fb=180;
var _fc=-180;
var _fd=90;
var _fe=-90;
for(var i=0,len=_fa.length;i<len;i++){
var lon=parseFloat(_fa[i].LONGITUDE);
var lat=parseFloat(_fa[i].LATITUDE);
if(isNaN(lon)||isNaN(lon)){
continue;
}
_fb=Math.min(_fb,lon);
_fc=Math.max(_fc,lon);
_fd=Math.min(_fd,lat);
_fe=Math.max(_fe,lat);
}
bounds=new OpenLayers.Bounds(_fb,_fd,_fc,_fe);
if(this.map.baseLayer.projection.toString()=="EPSG:900913"){
bounds.transform(new OpenLayers.Projection("EPSG:4326"),this.map.baseLayer.projection);
}
return bounds;
},_initOpenLayers:function(_103,_104){
var map=new OpenLayers.Map(_103,_104);
var _106=this._getSources();
var _107=this._getLayers(_106);
map.addLayers(_107);
map.setBaseLayer(_107[0]);
return map;
},_updateCopyrightPosition:function(){
var _108=this.map.baseLayer.CLASS_NAME;
switch(_108){
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 _109=this.map.popups[0];
if(_109){
this.map.events.triggerEvent("popupclose",_109);
}
},_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(_10b){
var _10c=_10b.map(function(_10d){
var url=null;
var _10f={};
var _110=_10d.OPTIONS.evalJSON();
var _111=Object.extend(_10f,_110);
switch(_10d.NAME){
case "SlippyMap W2GI":
case "SlippyMap Navteq":
_10f={g:"__base__",i:"PNG8",appkey:ace.xml.getXMLData("appkey")};
Object.extend(_111,_10f);
url=$w(_10d.IMAGEURL.gsub(","," "));
return new OpenLayers.Layer.KaMap(_10d.NAME,url,_111,{buffer:1});
case "OpenLayers WMS":
url=$w(_10d.IMAGEURL.gsub(","," "));
return new OpenLayers.Layer.WMS(_10d.NAME,url,_111);
case "Google Satellite":
case "Google Normal":
case "Google Hybrid":
return new OpenLayers.Layer.Google(_10d.NAME,_111);
case "Yahoo Regular":
case "Yahoo Satellite":
case "Yahoo Hybrid":
return new OpenLayers.Layer.Yahoo(_10d.NAME,_111);
case "Virtual Earth Aerial":
case "Virtual Earth Road":
case "Virtual Earth Hybrid":
return new OpenLayers.Layer.VirtualEarth(_10d.NAME,_111);
default:
throw new Error(_10d.NAME+" - missing handler in Smap.js: _getLayers()");
}
});
return _10c;
},_addCopyright:function(map){
var w2gi=new Element("div",{id:"w2gi_copyright"}).update("&#169; "+new Date().getFullYear()+" Where 2 Get It, Inc.");
var _114=new Element("div",{id:"navteq_copyright",style:"display: none;"}).update("&#169; "+new Date().getFullYear()+" NAVTEQ Corp.");
map.appendChild(w2gi);
map.appendChild(_114);
if(this.map.baseLayer&&this.map.baseLayer.name=="SlippyMap Navteq"){
_114.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:bonefishGrill.media_path+"slippymap_files/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(_118){
this.locator=_118;
this.smap=_118.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 _11a=this.searchForm.getInputs("text","addressline");
_11a.each(function(_11b){
Event.observe(_11b,"keypress",function(_11c){
if(_11c.keyCode==Event.KEY_RETURN){
_11c.stop();
this._search(_11b.form);
var _11d=$$(".pl_hide");
if(_11d){
_11d.each(function(e){
e.hide();
});
}
}
}.bind(this));
}.bind(this));
var _11f=this.searchForm.getInputs("submit");
if(_11f.size()==0){
_11f=this.searchForm.select("#locator_submit");
}
if(_11f.size()==0){
_11f=this.searchForm.select("#directions_submit");
}
if(_11f.size()!=0){
_11f=_11f[0];
Event.observe(_11f,"click",function(_120){
_120.stop();
this._search(_11f.form);
}.bind(this));
}
var _121=ace.util.select(this.searchForm,"search_toggle");
if(_121.size()>0){
_121=_121[0];
Event.observe(_121,"click",function(_122){
_122.stop();
this.searchForm.hide();
if(this.altSearchForm){
this.altSearchForm.show();
Form.focusFirstElement(this.altSearchForm);
}
}.bind(this));
}
},_validateSearchForm:function(form){
if(!form){
return true;
}
if(!SlippyMap.Util.isSearchFormValid(form)){
ace.util.alert("Please enter address.",{width:250,height:100});
return false;
}
return true;
}});
SlippyMap.Search.ProximitySearch=Class.create(SlippyMap.Search,{cacheResults:false,searchRadius:null,dragStartCenter:null,centerPoint:null,layer:null,layerProjection:null,initialize:function(_124,_125){
this.locator=_124;
var form=null;
if($("locator_search")){
this.xmlId="locatorsearch";
form=$("locator_search");
}else{
this.xmlId="productsearch";
form=$("product_search");
}
this.layerProjection=_125.layerProjection?_125.layerProjection:null;
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(_124.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);
(_124.pl_header&&_124.pl_header!="")?this._observeHeader(_124.pl_header):null;
this.locator.panel.observe("w2gi:sliceUpdated",function(_127){
_127.stop();
this._processSlice(_127.memo);
}.bind(this));
this.layer=this.smap.map.layers.find(function(_128){
return _128.name=="SlippyMap W2GI";
});
if($("search_country")){
var _129="US";
if(this.locator.COUNTRY){
_129=this.locator.COUNTRY;
}
if($("search_country").options&&$("search_country").options.length==0){
ace.collection.updateOptions("search_country","Country",_129);
}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,_12b){
this.dynamicSearch=(_12b&&_12b.dynamicSearch)?true:false;
this.geoip=(_12b&&_12b.geoip&&_12b.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,_12b||{}));
},_observeHeader:function(_12f){
$(_12f).observe("click",function(e){
var _131="";
if(e.target){
_131=$(e.target).readAttribute("action");
}
switch(_131){
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 _133=$("search_bar").getStyle("width");
_133=_133.substr(0,_133.length-2)*1;
var left=(winW-_133)/2;
if(left>0){
$("search_bar").setStyle({"left":left+"px"});
}
$("search_bar").toggle();
break;
}
}.bind(this));
},_addPanelObserver:function(_135){
Event.observe(_135,"click",function(_136){
_136.stop();
if(!this.searchForm.visible()){
return;
}
var _137=_136.element().readAttribute("action");
switch(_137){
case "search_address":
var _138=_136.element().readAttribute("recnum");
var poi=ace.table.getRecord(_138);
var _13a=this.searchForm.getInputs("text","addressline")[0];
_13a.value=(poi.ADDRESS1?poi.ADDRESS1+", ":"")+poi.CITY+", "+poi.STATE+" "+poi.POSTALCODE;
var _13b={addressline:_13a.value,country:poi.COUNTRY};
this.search(_13b,{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 _13d={"sku":this.locator.sku,"uid":this.locator.uid};
var _13e=form.serialize(true);
Object.extend(_13d,_13e);
this.search(_13d,{formdataID:this.locator.formdataid,alertError:true});
},_onMapMouseDown:function(evt){
if(!this.searchRadius){
this.searchRadius=this._getSearchRadius(this.searchForm);
}
if(!this.dragStartCenter){
var _140=this.smap.map.center.clone();
this.dragStartCenter=_140;
}
},_onMapMouseUp:function(evt){
if(this.smap.routeMarkerLayer.layer.markers.length>0){
return;
}
if(!this.dragStartCenter){
return;
}
var _142=this.smap.map.center.clone();
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_142.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
this.dragStartCenter.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
var _143=Math.max(Math.abs(_142.lon-this.dragStartCenter.lon),Math.abs(_142.lat-this.dragStartCenter.lat));
var _144=(_143*69.04)/2;
if(_144>parseFloat(this.searchRadius)/2){
this.searchLonLat(_142,{onError:this.locator.clearLocator.bind(this.locator),alertError:false});
this.dragStartCenter=null;
}
},searchLonLat:function(_145,_146){
var _147={longitude:_145.lon,latitude:_145.lat,searchradius:this.searchRadius,"sku":this.locator.sku,"uid":this.locator.uid};
var opts=Object.extend({formdataID:this.xmlId,dynamicSearch:true},_146||{});
this.search(_147,opts);
this._updateAddressline(_147);
this.searchedLonLat=true;
},_getSearchRadius:function(form){
if(form.searchradius&&this.searchRadius){
return form.searchradius.value;
}
var _14a=ace.xml.getNodeValue(ace.xml.getXML(form)[0].getElementsByTagName("searchradius")[0]);
if(_14a){
return _14a;
}
var _14b=this.smap.map.calculateBounds();
if(!_14b){
return null;
}
var _14c=Math.min(Math.abs(_14b.top-_14b.bottom),Math.abs(_14b.left-_14b.right));
return ""+((_14c*69.04)/2);
},_updateAddressline:function(_14d){
ace.geo.reverse(_14d,function(_14e){
var _14f=SlippyMap.Util.getAddressline(_14e);
this.searchForm.addressline.value=_14f;
if(this.locator.whereamiDiv&&this.locator.whereamiDiv!=null){
var _150={"COUNTRY":_14e.COUNTRY||null,"CITY":_14e.CITY||null,"POSTALCODE":_14e.POSTALCODE||null,"PROVINCE":_14e.PROVINCE||null,"STATE":_14e.STATE||null};
this._updateLocation(_150);
}
}.bind(this));
},_processResponse:function(_151){
var name=ace.xml.getCollectionName(_151);
var _153=_151.getElementsByTagName("collection")[0].getAttribute("country");
var city=_151.getElementsByTagName("collection")[0].getAttribute("city");
var _155=_151.getElementsByTagName("collection")[0].getAttribute("postalcode");
var _156=_151.getElementsByTagName("collection")[0].getAttribute("state");
var _157=_151.getElementsByTagName("collection")[0].getAttribute("province");
var _158={"COUNTRY":_153||null,"CITY":city||null,"POSTALCODE":_155||null,"PROVINCE":_157||null,"STATE":_156||null};
Object.extend(this.locator,_158||{});
switch(name){
case "poi":
this.smap.clear();
this.centerPoint=this._getCenterPoint(_151);
var _159=$A(ace.xml.parse(_151));
var _15a=this.smap.map.layers.find(function(_15b){
return _15b.name=="Proximity markers";
});
_15a.projection=new OpenLayers.Projection("EPSG:4326");
_15a.maxExtent=new OpenLayers.Bounds(-165,15,-50,75);
_15a.units="degrees";
_15a.maxResolution=1.40625;
this.layer=this.smap.map.layers.find(function(_15c){
return _15c.name=="SlippyMap W2GI";
});
if(_159.any(function(o){
return (o.COUNTRY=="CA");
})){
this.layer=this.smap.map.layers.find(function(_15e){
return _15e.name=="SlippyMap Navteq";
});
}else{
if(_159.any(function(o){
return (o.COUNTRY!="US"&&o.COUNTRY!="CA"&&o.COUNTRY.length>0);
})){
this.layer=this.smap.map.layers.find(function(_160){
return _160.name=="Google Normal";
});
if(this.layer){
if(_15a.projection.toString()!="EPSG:900913"){
_15a.projection=new OpenLayers.Projection("EPSG:900913");
_15a.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_15a.units="m";
_15a.maxResolution=156543.0339;
}
}
}
}
if(this.layer){
this.smap.map.setBaseLayer(this.layer);
}
var _161=0;
if(this.centerPoint){
_161=this.centerPoint.clone();
}
this.smap.zoomToPOIs();
this.smap.proximityLayer.update(_161);
break;
case "multiple_address":
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(_158);
}
if(this.locator.whereamiDiv&&this.locator.whereamiDiv!=null&&!this.searchedLonLat){
this._updateLocation(_158);
}else{
this.searchedLonLat=false;
}
if(this.geoip&&this.searchForm.addressline){
var _162=city+" "+_156+" "+_155;
this.searchForm.addressline.value=_162;
}
if(this.locator.location_address_id&&this.locator.location_address_id!=""){
var data=_159[0];
var _164=data.ADDRESS1+" "+data.CITY+" "+data.STATE+" "+data.POSTALCODE;
$(this.locator.location_address_id).value=_164;
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")&&_158.COUNTRY){
$("search_country").value=_158.COUNTRY;
}
return this.cacheResults;
},_updateEtailerIframe:function(_165){
if(_165.COUNTRY){
var _166=$(this.locator.updateEtailersIframe);
_166.src=_166.src.substr(0,_166.src.length-2)+_165.COUNTRY;
}
},_updateLocation:function(_167){
if(!_167.COUNTRY&&!_167.STATE&&!_167.PROVINCE&&!_167.CITY&&!_167.POSTALCODE){
ace.template.updateLocation(this.locator.whereamiDiv,"location_none",_167);
}else{
if(!_167.CITY){
ace.template.updateLocation(this.locator.whereamiDiv,"location_nc",_167);
}else{
ace.template.updateLocation(this.locator.whereamiDiv,"location_us",_167);
}
}
},_getCenterPoint:function(_168){
var _169=ace.xml.getCollection(_168,"poi");
var _16a=_169.getAttribute("centerpoint");
if(_16a){
return OpenLayers.LonLat.fromString(_16a);
}else{
return 0;
}
},_processSlice:function(_16b){
var _16c=this.smap.getPOIBounds(_16b);
_16c.extend(this.locator.proximitySearch.centerPoint);
_16c=this.smap.padBounds(_16c);
var view=this.smap.map.calculateBounds();
if(!view.containsBounds(_16c)){
this.smap.map.zoomToExtent(_16c);
}
this.smap.clear();
this.smap.proximityLayer.update(this.locator.proximitySearch.centerPoint);
}});
SlippyMap.Search.ProximitySearch.Product=Class.create(SlippyMap.Search.ProximitySearch,{cacheResults:false,searchRadius:null,dragStartCenter:null,centerPoint:null,layer:null,initialize:function(_16e){
this.locator=_16e;
this.searchForm=$("product_search");
this.altSearchForm=$("driving_directions");
SlippyMap.Search.ProximitySearch.prototype.initialize.apply(this,arguments);
if(_16e.onlinePanel&&_16e.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,_170){
SlippyMap.Search.ProximitySearch.prototype.search.apply(this,arguments);
},_fillOnlinePanel:function(){
var qs=location.search.split("&");
var _172={};
for(var i=0;i<qs.length;i++){
temp=qs[i].split("=");
_172[temp[0].replace(/^\?/,"")]=temp[1];
}
if(!_172.currency){
_172.currency="auto";
}
var _174={formdataID:"onlineetailersearch",alertError:false};
ace.table.update("online_comp_panel",_172,null,_174);
},_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,layerProjection:null,initialize:function(_176,_177){
this.locator=_176;
this.searchForm=$("driving_directions");
this.altSearchForm=$("locator_search");
this.layerProjection=_177.layerProjection?_177.layerProjection:null;
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(_178){
return _178.name=="SlippyMap Navteq";
});
},destroy:function(){
SlippyMap.Search.prototype.destroy.apply(this,arguments);
this.bounds=null;
this.includeATW=null;
},search:function(form,_17a){
this.searchFromMarker=false;
var _17b=Form.getInputs(form,"text","addressline");
var _17c=Form.getInputs(form,"hidden","addressline");
if(_17c.size()==1){
_17b.push(_17c[0]);
}
var _17d=Form.serializeElements(_17b,true);
var _17e=_17d.addressline;
var _17f={};
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(_17e,{"latitude":this.locator.lat,"longitude":this.locator.lon,"action":this.locator.action});
_17f={"uid":this.locator.uid,"action":this.locator.action};
}else{
_17f=false;
}
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,_17e,_17f,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory},form);
},bubbleSearch:function(_180){
_180.stop();
this.searchFromMarker=false;
var form=_180.element().form;
var _182=Form.getInputs(form,"text","addressline")[0];
_182.value=_182.value.strip();
if(_182.value.empty()){
return;
}
var _183=_180.element().readAttribute("recnum");
var poi=ace.table.getRecord(_183);
var _185=(form.getElementsByTagName("a")[0].innerHTML=="To")?true:false;
var _186=_185?[_182.value,poi]:[poi,_182.value];
var _187={uid:poi.UID,action:_185?"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,_186,_187,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory},form);
this._updateSearchForm(_185,_182.value,poi);
},markerSearch:function(_188,_189,_18a){
this.searchFromMarker=true;
var _18b=new OpenLayers.LonLat(_188.lonlat.lon,_188.lonlat.lat);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_18b.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
var _18c={LONGITUDE:_18b.lon,LATITUDE:_18b.lat,COUNTRY:_188.country};
var _18d=(_189<=0)?[_18c,_18a]:[_18a,_18c];
ace.directions.search(this.ddpanel,this.formData,this.includeATW,_18d,false,this.processResponse.bind(this),{onHistory:SlippyMap.Util.addHistory});
this._updateAddressline(_188.getAddress(),_189);
},processResponse:function(_18e){
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(_18e,"maneuvers");
var _190=this.smap.map.layers.find(function(_191){
return _191.name=="Route markers";
});
var _192=this.smap.map.layers.find(function(_193){
return _193.name=="Route vector";
});
if(!_192){
_192=this.smap.map.layers.find(function(_194){
return _194.name=="Route image";
});
}
if(xml){
this.bounds=this.smap.padBounds(this._getRouteBounds(xml));
var _195=this._getIconAddresses(_18e);
["A","B"].each(function(_196,_197){
_195[_197].POINUM=_196;
_195[_197].RECNUM=_196;
});
this.layer=this.smap.map.layers.find(function(_198){
return _198.name=="SlippyMap Navteq";
});
_192.projection=new OpenLayers.Projection("EPSG:4326");
_192.maxExtent=new OpenLayers.Bounds(-165,15,-50,75);
_192.units="degrees";
_192.maxResolution=1.40625;
_190.projection=new OpenLayers.Projection("EPSG:4326");
_190.maxExtent=new OpenLayers.Bounds(-165,15,-50,75);
_190.units="degrees";
_190.maxResolution=1.40625;
if(_195.any(function(o){
return (o.COUNTRY!="US"&&o.COUNTRY!="CA");
})){
this.layer=this.smap.map.layers.find(function(_19a){
return _19a.name=="Google Normal";
});
_192.projection=new OpenLayers.Projection("EPSG:900913");
_192.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_192.units="m";
_192.maxResolution=156543.0339;
_190.projection=new OpenLayers.Projection("EPSG:900913");
_190.maxExtent=new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
_190.units="m";
_190.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(_195);
this.smap.routeMarkerLayer.addEndMarkers(_195);
this.smap.routeLayer.addRoute();
var _19b=ace.xml.getCollection(_18e,"pois");
if(_19b&&_19b.childNodes&&_19b.childNodes.length!=0){
var pois=ace.xml.parse(_19b);
var _19d=this.ddpanel.down();
this._addAlongTheWayInfo(_19d,pois);
}
this._addReverseSearchObservers();
this._updatePanelAddressline(_195);
}else{
this.responseXML=ace.util.cleanWhitespace(_18e);
this.smap.routeLayer.clear();
this.smap.routeMarkerLayer.clear();
this.smap.zoomToPOIs(true);
}
return true;
},_addAlongTheWayInfo:function(_19e,pois){
this.smap.proximityLayer.addPOIMarkers(pois,true);
var _1a0=this._getManeuverPOIs(pois);
this._updatePanel(_19e,_1a0);
},_getManeuverPOIs:function(pois){
var _1a2={};
for(var i=0,len=pois.length;i<len;i++){
var poi=pois[i];
_1a2[poi.MANEUVER]?_1a2[poi.MANEUVER].push(poi):_1a2[poi.MANEUVER]=[poi];
}
return _1a2;
},_updatePanel:function(_1a6,_1a7){
var rows=ace.util.select(_1a6,"maneuver_pois");
for(maneuver in _1a7){
var _1a9=parseInt(maneuver)-1;
var _1aa=ace.template.getTemplate("along_the_way");
_1a6=ace.template.getTableTemplate(_1aa,_1a7[maneuver]);
rows[_1a9].update(_1a6).show();
}
},_updateCountrySelects:function(_1ab){
if($("orig_country")&&_1ab[0]&&_1ab[0].COUNTRY){
$("orig_country").value=_1ab[0].COUNTRY;
}
if($("dest_country")&&_1ab[1]&&_1ab[1].COUNTRY){
$("dest_country").value=_1ab[1].COUNTRY;
}
},_updatePanelAddressline:function(_1ac){
var _1ad=ace.util.select($(this.ddpanel),"addressline");
if(_1ad.length>0){
var _1ae=ace.util.select($(this.ddpanel),"ddendpoint");
for(var i=0;i<_1ad.length;i++){
if(_1ae&&_1ae.length==2){
var _1b0=null;
if(i==0){
_1b0=ace.template.getTemplate("ddstarticon",{});
}else{
_1b0=ace.template.getTemplate("ddendicon",{});
}
if(_1b0!=null){
_1ae[i].update(_1b0);
}
}
var _1b1=$(_1ac[i]);
var _1b2=$(_1ad[i]);
var _1b3=_1b1.ADDRESS1.blank()?"":_1b1.ADDRESS1.trim();
var _1b4=_1b2.getElementsBySelector(".address_line1");
if(_1b3&&_1b4.length>0){
_1b4[0].update(_1b3);
}
var city=_1b1.CITY.empty()?"":_1b1.CITY+", ";
var _1b6=ace.util.select(_1b2,"address_city");
if(city&&_1b6.length>0){
_1b6[0].update(city);
}
var _1b7=(_1b1.COUNTRY!="US")?_1b1.PROVINCE+" ":_1b1.STATE+" ";
var _1b8=ace.util.select(_1b2,"address_state");
if(_1b7&&_1b8.length>0){
_1b8[0].update(_1b7);
}
var _1b9=_1b1.POSTALCODE.empty()?"":_1b1.POSTALCODE;
var _1ba=ace.util.select(_1b2,"address_zip");
if(_1b9&&_1ba.length>0){
_1ba[0].update(_1b9);
}
}
}
},_addPanelObserver:function(_1bb){
Event.observe(_1bb,"click",function(_1bc){
_1bc.stop();
if(!this.searchForm||!this.searchForm.visible()){
return;
}
var _1bd=_1bc.element().readAttribute("action");
switch(_1bd){
case "search_address":
var _1be=_1bc.element().readAttribute("recnum");
var _1bf=parseInt(_1be)-1;
var _1c0=this._getMultipleAddresses();
var _1c1=_1c0.addresses[_1bf];
var _1c2=ace.xml.parseNode(_1c1);
var _1c3=this.searchForm.getInputs("text","addressline")[_1c0.index];
if(_1c3){
_1c3.value=this._getSelectedInput(_1c1);
}
ace.directions.addresses[_1c0.index]=_1c2;
ace.directions.search(_1bb,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(_1c5,_1c6,poi){
var _1c8=poi.ADDRESS1+", "+poi.CITY+", "+poi.STATE+" "+poi.POSTALCODE;
var _1c9=this.searchForm.getInputs("text","addressline");
_1c9[0].value=_1c5?_1c6:_1c8;
_1c9[1].value=_1c5?_1c8:_1c6;
var uid=this.searchForm.getInputs("hidden","uid");
var _1cb=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(_1cb&&_1cb.size()>0){
_1cb[0].value=_1c5?"From":"To";
}
if(lon&&lon.size()>0){
lon[0].value=poi.LONGITUDE;
}
if(lat&&lat.size()>0){
lat[0].value=poi.LATITUDE;
}
},_updateAddressline:function(_1ce,_1cf){
var _1d0=this.searchForm.getInputs("text","addressline")[_1cf];
if(!_1d0){
_1d0=this.searchForm.getInputs("hidden","addressline")[0];
}
if(_1d0){
_1d0.value=SlippyMap.Util.getAddressline(_1ce);
}
},_addReverseSearchInputsObservers:function(){
if(this.searchForm){
var _1d1=this.searchForm.getElementsByTagName("img")[0];
if(_1d1){
Event.observe(_1d1,"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});
document.fire("w2gi:track",{action:"clickonreversedd",value:"1"});
},_reverseSearchInputs:function(){
var _1d2=this.searchForm.getInputs("text","addressline");
var _1d3=_1d2.pluck("value").reverse();
_1d2.each(function(e,_1d5){
e.value=_1d3[_1d5];
});
},_getMultipleAddresses:function(){
var _1d6=null;
var _1d7=this.responseXML.cloneNode(true);
var _1d8=$A(_1d7.getElementsByTagName("collection")[0].childNodes);
_1d8.each(function(e,_1da){
if(e.tagName=="collection"&&e.getAttribute("name")=="multiple_address"){
_1d6={addresses:e.getElementsByTagName("address"),index:_1da};
e.removeAttribute("name");
throw $break;
}
});
return _1d6;
},_getSelectedInput:function(_1db){
var _1dc=_1db.getElementsByTagName("address1")[0].firstChild;
var _1dd=_1dc?_1dc.nodeValue:"";
var _1de=(_1db.getElementsByTagName("state")[0].firstChild)?_1db.getElementsByTagName("state")[0].firstChild.nodeValue:_1db.getElementsByTagName("province")[0].firstChild.nodeValue;
var _1df=(_1db.getElementsByTagName("postalcode")[0].firstChild)?_1db.getElementsByTagName("postalcode")[0].firstChild.nodeValue:"";
return ((_1dd=="")?"":_1dd+", ")+_1db.getElementsByTagName("city")[0].firstChild.nodeValue+", "+_1de+" "+_1df;
},_addReverseSearchObservers:function(){
ace.util.select(this.ddpanel,"reverse_directions").each(function(e){
Event.observe(e,"click",this._reverseSearch.bind(this));
}.bind(this));
},_getIconAddresses:function(_1e1){
var xml=ace.xml.getCollection(_1e1,"address").getElementsByTagName("address");
return ace.xml.parseNodes(xml);
},_getRouteBounds:function(xml){
var _1e4=xml.getAttribute("bounds");
return new OpenLayers.Bounds.fromString(_1e4);
}});
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,_1e8){
if(_1e8){
this.highlight=(_1e8.highlight==true)?true:false;
this.highlightEffect=(_1e8.highlightEffect)?_1e8.highlightEffect:false;
}
this.features={};
this.layer=new OpenLayers.Layer.Markers(name,{projection:new OpenLayers.Projection("EPSG:4326")});
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(_1e9){
this.addPOIMarkers();
this.addCenterMarker(_1e9);
},addPOIMarkers:function(pois,_1eb){
pois=pois||ace.table.getSlice()||ace.table.records;
for(var i=0,len=pois.length;i<len;i++){
this.addPOIMarker(pois[i],false,_1eb);
}
},addPOIMarker:function(poi,_1ef,_1f0){
var _1f1=null;
if(_1ef){
var _1f2=new OpenLayers.LonLat(poi.LONGITUDE,poi.LATITUDE);
var _1f3=ace.template.getIconTemplate("dragabble_icon",poi);
var icon=new OpenLayers.Icon.IconFromTemplate(_1f3);
_1f1=new OpenLayers.Marker.DragabbleMarker(_1f2,icon);
if(!_1f0){
_1f1.events.register("click",this,function(evt){
OpenLayers.Event.stop(evt);
});
}
}else{
var _1f6=this._createFeature(poi);
_1f1=_1f6.createMarker();
this.features[poi.RECNUM]=_1f6;
if(!_1f0){
this._bindMarkerClick(_1f1,_1f6,poi.UID);
}
}
_1f1.recnum=poi.RECNUM;
if(this.highlight){
this._bindMarkerOver(_1f1);
}
this.layer.addMarker(_1f1);
return _1f1;
},removePOIMarker:function(_1f7){
var _1f8=this.getPOIMarker(_1f7);
this.layer.removeMarker(_1f8);
if(this.features[_1f7]){
this.features[_1f7].destroy();
delete this.features[_1f7];
}
return _1f8;
},replacePOIMarker:function(_1f9,_1fa){
this.removePOIMarker(_1f9);
var poi=ace.table.getRecord(_1f9);
return this.addPOIMarker(poi,_1fa);
},getPOIMarker:function(_1fc){
return this.layer.markers.find(function(_1fd){
return _1fd.recnum==_1fc;
});
},addCenterMarker:function(_1fe){
var _1ff=ace.template.getTemplate("center_marker");
if(!_1ff){
return null;
}
if(!_1fe){
return null;
}
var icon=new OpenLayers.Icon.IconFromTemplate(_1ff);
var _201=new OpenLayers.Marker.DragabbleMarker(_1fe,icon);
_201.events.register("mouseup",this.smap.locator.proximitySearch,function(evt){
OpenLayers.Event.stop(evt);
var _203=evt.object.lonlat;
this.smap.map.setCenter(_203);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_203.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
this.searchLonLat(_203,{onError:this.locator.clearLocator.bind(this.locator)});
document.fire("w2gi:track",{action:"centermarkerdrag",value:_203.toShortString()});
});
this.layer.addMarker(_201);
return _201;
},_addPanelObserver:function(_204){
$(_204).observe("click",function(_205){
_205.stop();
var _206=_205.element().readAttribute("action");
if(_206){
var i=_206.lastIndexOf("/");
if(i!=-1){
_206=_206.substring(i+1,_206.length);
}
}
var _208;
switch(_206){
case "open_bubble":
_208=_205.element().readAttribute("recnum");
if(this._markerClick(this.features[_208])){
var _209=ace.table.getRecord(_208);
document.fire("w2gi:track",{action:"clickondealer-panel",value:_209.UID});
}
break;
case "sort_table":
var _20a=_205.element().readAttribute("sort_field");
var _20b=_205.element().readAttribute("field_type");
ace.table.sortRecords(_20a,_20b);
ace.table.updateFromRecords(_204);
this.smap.clear();
this.update(this.smap.locator.proximitySearch.centerPoint);
break;
case "more_info":
_208=_205.element().readAttribute("recnum");
ace.table.oldrecords=ace.table.records.clone();
ace.table.selected=_208;
var pois=ace.table.records.slice(_208-1,_208);
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;
}
}.bind(this));
if(this.highlight){
_204.observe("mouseover",function(_20d){
_20d.stop();
var _20e=_20d.element().readAttribute("recnum");
if(_20e){
this._markerOver(_20e);
}
}.bind(this));
_204.observe("mouseout",function(_20f){
_20f.stop();
this._markerOver();
}.bind(this));
}
},_markerClick:function(_210){
this.smap.locator.proximitySearch.dragStartCenter=null;
if(_210.popup&&_210.popup.visible()){
this.smap.map.events.triggerEvent("popupclose",_210.popup);
return false;
}else{
for(i in this.layer.markers){
var m=this.layer.markers[i];
if(m&&m.icon){
if(m.recnum==_210.marker.recnum){
m.icon.imageDiv.style.zIndex=4500;
}else{
m.icon.imageDiv.style.zIndex=3500;
}
}
}
this._clearPopups();
this._addBubbleData(_210.data);
var _212=_210.createPopup();
_212.recnum=_210.data.recnum;
_212.bubbleSize=_210.data.icon.bubbleSize;
_212.bubbleMargin=_210.data.icon.bubbleMargin;
_212.bubbleOffset=_210.data.icon.bubbleOffset;
this.smap.map.addPopup(_212,true);
this.smap.map.adjustForBubble(_210.marker.lonlat,_212.bubbleSize,_212.bubbleMargin,_212.bubbleOffset);
return true;
}
},_markerOver:function(_213){
var _214;
var _215=this.smap.locator.panel.down();
ace.table.highlightRow(_215,_213);
var poi;
if(_213){
if((markerOld=this.getPOIMarker(_213))&&(!markerOld.highlighted)){
poi=ace.table.getRecord(_213);
var _217=this._createFeature(poi,"alt_icon");
_214=_217.createMarker();
_214.recnum=poi.RECNUM;
_214.highlighted=true;
if(this.highlight){
this._bindMarkerOver(_214);
}
this._bindMarkerClick(_214,_217);
this.layer.removeMarker(markerOld);
this.layer.addMarker(_214);
if(this.highlightEffect){
this.highlightEffect(_214.events.element);
}
}
}else{
if(_214=this.layer.markers.find(function(_218){
return _218.highlighted==true;
})){
poi=ace.table.getRecord(_214.recnum);
this.layer.removeMarker(_214);
this.addPOIMarker(poi,false,false);
}
}
},_addBubbleData:function(data){
var poi=ace.table.getRecord(data.recnum);
this._setBubbleCountry(data.bubbleID,poi);
var _21b=ace.template.getTemplate(data.bubbleID,poi);
var _21c=_21b.style;
data.popupContentHTML=_21b.innerHTML;
data.popupSize=new OpenLayers.Size(_21c.width,_21c.height);
data.icon.bubbleSize=data.popupSize;
data.icon.bubbleMargin=new OpenLayers.Bounds(_21c.marginLeft,_21c.marginBottom,_21c.marginRight,_21c.marginTop);
data.icon.bubbleOffset=new OpenLayers.Pixel(_21b.readAttribute("offsetx"),_21b.readAttribute("offsety"));
},_setBubbleCountry:function(_21d,poi){
var _21f=ace.template.templates[_21d].select("#bubble_country")[0];
if(_21f&&_21f.options){
for(var i=0;i<_21f.options.length;i++){
if(_21f.options[i].value==poi.COUNTRY){
$(_21f.options[i]).setAttribute("selected","selected");
}else{
$(_21f.options[i]).removeAttribute("selected");
}
}
}
return;
},_clearPopups:function(){
for(recnum in this.features){
var _221=this.features[recnum];
if(_221.popup){
_221.popup.destroy();
_221.popup=null;
break;
}
}
},_createFeature:function(poi,_223){
var _224=new OpenLayers.LonLat(poi.LONGITUDE,poi.LATITUDE);
var data=this._getFeatureData(poi,_223);
return new OpenLayers.Feature(this,_224,data);
},_getFeatureData:function(poi,_227){
var _228=ace.template.getIconTemplate(_227||poi.ICON,poi);
var data={};
data.recnum=poi.RECNUM;
data.icon=new OpenLayers.Icon.IconFromTemplate(_228);
data.bubbleID=_228.readAttribute("bubbleid");
return data;
},_bindMarkerOver:function(_22a){
_22a.events.register("mouseover",this,function(_22b){
OpenLayers.Event.stop(_22b);
this._markerOver(_22a.recnum);
});
_22a.events.register("mouseout",this,function(_22c){
OpenLayers.Event.stop(_22c);
this._markerOver();
});
},_bindMarkerClick:function(_22d,_22e,uID){
_22d.events.register("click",this,function(evt){
OpenLayers.Event.stop(evt);
if(this._markerClick(_22e)){
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:new OpenLayers.Projection("EPSG:4326")});
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 _233={strokeColor:"blue",strokeOpacity:1,strokeWidth:5,pointRadius:6,pointerEvents:"visiblePainted"};
Object.extend(_233,this.layer.map.routeStyle||{});
var _234=this._getPointList();
var _235=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(_234),null,_233);
this.layer.addFeatures([_235]);
},_getPointList:function(){
var _236=ace.table.records.pluck("SEGMENT_GEOMETRY");
var _237=[];
for(var i=0,leni=_236.length;i<leni;i++){
if(_236[i].length<=0){
continue;
}
var _23a=_236[i].substring(11,_236[i].length-1).split(",");
for(var j=0,lenj=_23a.length;j<lenj;j++){
var _23d=_23a[j].split(" ");
myPoint=new OpenLayers.Geometry.Point(_23d[0],_23d[1]);
if(this.layer.projection.toString()=="EPSG:900913"){
myPoint.transform(new OpenLayers.Projection("EPSG:4326"),this.layer.projection);
}
_237.push(myPoint);
}
}
return _237;
}});
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 _240=this._getImageParams();
ace.request(_240,this._processResponse.bind(this),{formdataID:"get_route_image",onHistory:false});
},_getFullRouteMarkers:function(){
return this.layer.markers.findAll(function(_241){
return _241.isFullImage;
});
},_processResponse:function(_242){
this.layer.clearMarkers();
var _243=ace.xml.parse(_242);
var _244=this._getRouteImage(_243[0]);
_244.isFullImage=this._viewContainsRoute();
this.layer.addMarker(_244);
return true;
},_getRouteImage:function(_245){
var size=new OpenLayers.Size(_245.WIDTH,_245.HEIGHT);
var _247=new OpenLayers.Icon(_245.URL,size,null,function(){
return new OpenLayers.Pixel(0,0);
});
var x=_245.OFFSET_X;
var y=_245.MAX_Y;
var _24a=new OpenLayers.LonLat(x,y);
return new OpenLayers.Marker(_24a,_247);
},_getImageParams:function(){
var _24b=this.smap.map.getExtent();
var _24c=this.smap.map.getSize().w;
var _24d=this.smap.map.getSize().h;
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_24b.transform(this.smap.map.baseLayer.projection,new OpenLayers.Projection("EPSG:4326"));
}
return {routeid:0,bounds:_24b.left+","+_24b.bottom+","+_24b.right+","+_24b.top,height:_24d,width:_24c};
},_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:new OpenLayers.Projection("EPSG:4326")});
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(_252){
_252.each(function(_253,_254){
var _255=null;
if(_254<=0){
_255=ace.template.getTemplate("ddstarticon",_253);
}else{
_255=ace.template.getTemplate("ddendicon",_253);
}
if(_255==null){
_255=ace.template.getIconTemplate("default",_253);
}
var icon=new OpenLayers.Icon.IconFromTemplate(_255);
var _257=new OpenLayers.LonLat(_253.LONGITUDE,_253.LATITUDE);
var _258=new OpenLayers.Marker.DragabbleMarker(_257,icon);
if(this.smap.map.baseLayer.projection.toString()=="EPSG:900913"){
_258.setSphericalMercator(true);
}
var _259=(_254<=0)?_252.last():_252.first();
_258.events.register("mouseup",_258,this._mouseUp.bind(this,_258,_254,_259));
this.layer.addMarker(_258);
}.bind(this));
},_mouseUp:function(_25a,_25b,_25c){
_25a.reverseGeocode(function(_25d){
var _25e=new OpenLayers.LonLat(_25d.lonlat.lon,_25d.lonlat.lat);
this.smap.locator.directionsSearch.markerSearch(_25d,_25b,_25c);
_25d.moveToLonLat();
document.fire("w2gi:track",{action:"routemarkerdrag",value:_25e.toShortString()});
}.bind(this));
}});

