dojo.declare("MQResultsController",null,{constructor:function(){
this._wireUpFormForEnterTrap();
this._directionsRequested=false;
this._initMap();
},SCROLL_LINE_ITEM_HEIGHT_WITH_MARGIN:90,ORIGINAL_ADDRESS:"ORIGINAL_ADDRESS",INVALID_ADDRESS_MSG:"The address you specified seems to be incorrect, please enter valid address.",STATE_ZIP_ERROR_MSG:"The state and zip code do not match. Please make sure they are correct.",INVALID_CITY_STATE_ZIP_MSG:"Please enter a valid City and State or Zip Code to continue.",SELECT_BRAND_MSG:"Please select the store you are interested in to continue.",SELECT_RADIO_MSG:"Please select the distance you're willing to travel.",_lookupToggle:true,_geoAddressForDest:null,_isFirstRun:true,_currentPOIs:null,_currentClickedStoreId:"",_currentStoreSelected:null,locationCollection1:null,_routeDetailsForPrint:null,_directionsRequested:null,_currentOriginAddress:null,handleMapViewTypeChangeEvent:function(_1){
var _2=_1+" map";
this._callCoreMetrics(_2);
},_wireUpFormForEnterTrap:function(){
if(dojo.isIE>0){
dojo.query("#storeLocatorForm input").forEach(function(_3){
dojo.connect(_3,"onkeypress",null,function(_4){
if(_4.keyCode==13){
c.handleStoreLookupFormSubmit(_4);
}
});
});
}
dojo.connect(dojo.byId("storeLocatorForm"),"onsubmit",this,"handleStoreLookupFormSubmit");
},handleStoreLookupFormSubmit:function(_5){
_5.preventDefault();
this._directionsRequested=true;
var _6=this._isFormValid(this.ORIGINAL_ADDRESS);
if(_6){
this._hideErrorMessage();
var _7=function(){
c._initMap();
};
this._setupMapTransition(_7);
return false;
}
},_isFormValid:function(_8){
var _9=this._validateAddress(_8);
if(_9){
return true;
}else{
return false;
}
},_isRadioSelected:function(){
var _a=dojo.query("input[type=\"radio\"]");
var _b=false;
for(var i=0;i<_a.length;i++){
if(_a[i].checked==true){
_b=true;
break;
}
}
return _b;
},_validateAddress:function(_d){
var _e,_f,_10,_11,_12,_13,_14;
var _15=new MQAddress();
var _16=dojo.byId("brand").innerHTML;
poisTable="MQA.MQ_34274_"+_16;
if(_d==this.ORIGINAL_ADDRESS){
_15.setStreet(dojo.byId("a0").value);
_15.setCity(dojo.byId("c0").value);
_11=dojo.byId("s0").value;
_15.setState(_11);
_15.setPostalCode(dojo.byId("z0").value);
_15.setCountry(dojo.byId("u0").value);
_17=dojo.byId("z0").value;
_12=dojo.byId("u0").value;
_10=dojo.byId("c0").value;
this._currentOriginAddress=null;
}else{
_15.setStreet(dojo.byId("a1").value);
_15.setCity(dojo.byId("c1").value);
var _11=dojo.byId("s1");
_15.setState(_11.options[_11.selectedIndex].value);
_15.setPostalCode(dojo.byId("z1").value);
_15.setCountry(dojo.byId("u1").value);
var _17=dojo.byId("z1").value;
var _12=dojo.byId("u1");
_10=dojo.byId("c1").value;
var _18=_12.options[_12.selectedIndex].value;
var _19=_11.options[_11.selectedIndex].value;
}
if(_10==""&&_11==""&&_17==""){
this._showErrorMessage(this.INVALID_CITY_STATE_ZIP_MSG);
return false;
}
if(((_10!=""&&_11=="")||(_10==""&&_11!=""))&&_17==""){
this._showErrorMessage(this.INVALID_CITY_STATE_ZIP_MSG);
return false;
}
if(_17!=""&&_11!=""&&_12!="CA"&&!ValidZip(_17)){
this._showErrorMessage(this.STATE_ZIP_ERROR_MSG);
return false;
}
var _1a=new MQLocationCollection();
var _1b=new MQExec(geocodeServer,serverPath,serverPort,proxyServer,proxyPath,proxyPort);
_1b.geocode(_15,_1a,null);
if(_1a.getSize()==0){
return true;
}else{
if(_1a.getSize()==1){
var _1c=_1a.getAt(0);
if(validateResultCode(_1c.getResultCode())){
this._currentOriginAddress=_1c;
return true;
}else{
this._showErrorMessage(this.INVALID_ADDRESS_MSG);
return false;
}
}else{
this._showErrorMessage(this.INVALID_ADDRESS_MSG);
return false;
}
}
},_fillDrivingDirectionsForm:function(){
dojo.byId("a1").value=dojo.byId("a0").value;
dojo.byId("c1").value=dojo.byId("c0").value;
dojo.byId("s1").value=dojo.byId("s0").value;
dojo.byId("z1").value=dojo.byId("z0").value;
dojo.byId("u1").value=dojo.byId("u0").value;
},_initMap:function(){
this._callCoreMetricsWithPageId("Store Locator Results");
var _1d,_1e,_1f,_20,_21,_22,_23,_24;
_1d=new MQAddress();
_1d.setStreet(dojo.byId("address").innerHTML);
_1d.setCity(dojo.byId("city").innerHTML);
var _21=dojo.byId("state");
_1d.setState(dojo.byId("state").innerHTML);
_1d.setPostalCode(dojo.byId("zipCode").innerHTML);
_1d.setCountry(dojo.byId("country").innerHTML);
_1e=this.getGeoCode(_1d);
if(_1e){
this._showMap(_1e,this._directionsRequested);
}
},getGeoCode:function(_25){
var _26=new MQLocationCollection();
var _27=new MQExec(geocodeServer,serverPath,serverPort,proxyServer,proxyPath,proxyPort);
_27.geocode(_25,_26,null);
if(_26.getSize()==0){
return true;
}else{
if(_26.getSize()==1){
var _28=_26.getAt(0);
if(validateResultCode(_28.getResultCode())){
return _28;
}else{
this._showErrorMessage("Address you specified seems to be incorrect, please enter valid address.");
return false;
}
}else{
this._showErrorMessage("Address you specified seems to match multiple address, enter specific address");
}
}
},_showMap:function(_29,_2a){
if(typeof _2a==="undefined"){
_2a=false;
}
var _2b=dojo.byId("storeName").firstChild.data;
var _2c=dojo.byId("address").firstChild.data;
var _2d=dojo.byId("city").firstChild.data;
var _2e=dojo.byId("state").firstChild.data;
var _2f=dojo.byId("zipCode").firstChild.data;
var _30=dojo.byId("phone").firstChild.data;
var _31=_29.getMQLatLng().getLatitude();
var _32=_29.getMQLatLng().getLongitude();
var _33="025";
dojo.query("input[name=radius]").forEach(function(_34){
if(_34.checked){
_33=_34.value;
}
});
var _35=10;
if(dojo.byId("zoomLevel")){
_35=dojo.byId("zoomLevel").innerHTML;
}
if(_2a){
this._route(this._currentOriginAddress,_29);
if(dojo.byId("content")){
dojo.byId("content").style.height="auto";
if(utils&&typeof utils._setSidebarHeight==="function"){
utils._setSidebarHeight();
}
}
if(typeof cmCreatePageViewTag==="function"){
cmCreatePageViewTag("STORE DIRECTIONS: "+_2b.toUpperCase(),"","","1",0,"","CUSTOMER SERVICE");
}
}else{
var _36=new DataManagerRecord();
_36.setId(_2b);
_36.setStreet(_2c);
_36.setCity(_2d);
_36.setState(_2e);
_36.setPostalCode(_2f);
_36.setPhone(_30);
var _37=_globalStartImagePath;
var poi=new MQA.Poi(new MQA.LatLng(_31,_32));
poi.setKey("origin");
poi.setValue("infoTitleHTML",_2b);
poi.setValue("infoContentHTML",mqAddressToString(_36));
poi.setValue("rolloverEnabled",true);
MQA.EventManager.addListener(poi,"mouseover",this._handlePOIOnMouseOver);
MQA.EventManager.addListener(poi,"click",this._handlePOIOnClick);
MQA.EventManager.addListener(poi,"close",this._handlePOIOnClose);
this._poiCollection=new MQA.ShapeCollection();
this._poiCollection.add(poi);
dojo.byId("map").innerHTML="";
var _39=dojo.byId("map");
var _3a=new MQA.MapInit();
_3a.setBestFitRect(this._poiCollection.getBoundingRect());
wsMap=new MQA.TileMap(_39,_35,_29.getMQLatLng(),"map");
wsMap.addShapes(this._poiCollection);
var _3b=new MQA.LargeZoomControl();
wsMap.addControl(_3b,new MQA.MapCornerPlacement(MQA.MapCorner.TOP_LEFT,new MQA.Size(0,0)));
wsMap.addControl(new MQNoAerialViewControl(wsMap),new MQA.MapCornerPlacement(MQA.MapCorner.TOP_RIGHT,new MQA.Size(-4,0)));
wsMap.setLogoPlacement(MQA.MapLogo.MAPQUEST,new MQA.MapCornerPlacement(MQA.MapCorner.TOP_LEFT,new MQA.Size(44,0)));
wsMap.setLogoPlacement(MQA.MapLogo.SCALES,new MQA.MapCornerPlacement(MQA.MapCorner.BOTTOM_LEFT,new MQA.Size(50,0)));
wsMap.setLogoPlacement(MQA.MapLogo.NAVTEQ_COPYRIGHT,new MQA.MapCornerPlacement(MQA.MapCorner.BOTTOM_LEFT,new MQA.Size(208,0)));
wsMap.setLogoPlacement(MQA.MapLogo.MAPQUEST_COPYRIGHT,new MQA.MapCornerPlacement(MQA.MapCorner.BOTTOM_RIGHT,new MQA.Size(0,0)));
wsMap.setLogoPlacement(MQA.MapLogo.ICUBED_COPYRIGHT,new MQA.MapCornerPlacement(MQA.MapCorner.BOTTOM_RIGHT,new MQA.Size(103,1)));
dojo.byId("map").style.visibility="visible";
var _3c=_33.toString();
if(_3c[0]=="0"){
_3c=_3c.substring(1);
}
var _3d=dojo.byId("msgId");
removeAllChildren(_3d);
MQA.EventManager.addListener(wsMap,"zoomend",this._handleZoomend);
MQA.EventManager.addListener(wsMap,"dragend",this._handleDragend);
this._teardownMapTransition();
}
},_renderSearchResults:function(_3e,_3f,_40){
var _41=wsMap.getShapeCollections();
for(var i=_41.length-1;i>=0;i--){
poi=_41[i];
if(poi.getKey()!="origin"&&poi.getKey()!="start"&&poi.getKey()!="end"){
wsMap.removePoi(poi);
}
}
if(_3e.length>0){
for(var i=currentPage*PAGE_SIZE;i<_3e.length&&i<=MAX_MATCHES&&i<(currentPage*PAGE_SIZE+PAGE_SIZE);i++){
var _43=_globalContentImagesPath.replace(/1.gif/,(i+1)+".gif");
icon=new MQA.Icon(_43,16,16,true,false);
latlng=_3e[i].getMQLatLng();
poi=new MQA.Poi(latlng,icon);
poi.setValue("infoTitleHTML",_3e[i].getInfoTitleHTML());
poi.setValue("infoContentHTML",_3e[i].getInfoContentHTML(i));
poi.setValue("rolloverEnabled",true);
poi.setValue("key",_3e[i].getId());
MQA.EventManager.addListener(poi,"mouseover",this._handlePOIOnMouseOver);
MQA.EventManager.addListener(poi,"click",this._handlePOIOnClick);
MQA.EventManager.addListener(poi,"close",this._handlePOIOnClose);
wsMap.addPoi(poi);
}
}else{
}
var _44,_45,_46,_47;
var _48=1;
dojo.byId("routeResults").innerHTML="";
var _49=document.createElement("div");
_49.setAttribute("id","slidingPane");
dojo.forEach(_3e,function(_4a){
_44=document.createElement("div");
dojo.connect(_44,"onmouseover",this,"_handleStoreOnMouseOver");
dojo.connect(_44,"onclick",this,"_handleStoreOnMouseOver");
dojo.addClass(_44,"vcard");
_44.id="storeDetail_"+_4a.getId();
_44.paneOrder=_48;
_45=document.createElement("div");
dojo.addClass(_45,"fn org");
_46=document.createElement("span");
dojo.addClass(_46,"storeNumber");
_46.innerHTML="<img src='"+_globalContentImagesPath.replace(/1.gif/,(_48)+".gif")+"' />";
_45.appendChild(_46);
_45.appendChild(document.createTextNode(_4a.getName()));
_44.appendChild(_45);
_45=document.createElement("div");
dojo.addClass(_45,"street-address");
_45.innerHTML=_4a.getStreet();
_44.appendChild(_45);
_45=document.createElement("div");
_46=document.createElement("span");
dojo.addClass(_46,"locality");
_46.innerHTML=_4a.getCity()+", ";
_44.appendChild(_46);
_46=document.createElement("span");
dojo.addClass(_46,"region");
_46.innerHTML=_4a.getState()+" ";
_44.appendChild(_46);
_46=document.createElement("span");
dojo.addClass(_46,"postal-code");
_46.innerHTML=_4a.getPostalCode();
_44.appendChild(_46);
_44.appendChild(_45);
_45=document.createElement("div");
dojo.addClass(_45,"tel");
_46=document.createElement("span");
dojo.addClass(_46,"value");
_46.innerHTML=_4a.getPhone();
_45.appendChild(_46);
_44.appendChild(_45);
_45=document.createElement("div");
_45.innerHTML=_4a.getDistance().substring(0,_4a.getDistance().indexOf(".")+2)+" miles";
_44.appendChild(_45);
_45=document.createElement("div");
_47=document.createElement("a");
_47.className="driving-directions-link";
_47.innerHTML="Driving Directions";
_47.href="javascript:c._dd_SL('"+_4a.getStreet()+"','"+_4a.getPostalCode()+"','"+_4a.getCity()+"','"+_4a.getState()+"','"+_4a.getCountry()+"','"+_4a.getMQLatLng().getLatitude()+"','"+_4a.getMQLatLng().getLongitude()+"','1');";
_45.appendChild(_47);
_44.appendChild(_45);
_49.appendChild(_44);
_48++;
},this);
dojo.query(".copyright").forEach(function(_4b){
_4b.style["display"]="block";
});
dojo.byId("routeResults").appendChild(_49);
},_handleZoomend:function(evt){
c._callCoreMetrics("Zoom");
},_handleDragend:function(evt){
c._callCoreMetrics("Map Pan");
},handleDrivingDirectonsFromStore:function(_4e,_4f,_50,_51,_52,_53,_54,_55){
this._callCoreMetrics("Driving Directions");
},_handlePOIOnMouseOver:function(evt){
},highlight:function(_57){
var _58=(_57.node=dojo.byId(_57.node));
_57.duration=_57.duration||400;
var _59=_57.color||"#ffff99";
var _5a=dojo.style(_58,"backgroundColor");
var _5b=(_5a=="transparent"||_5a=="rgba(0, 0, 0, 0)");
var _5c=dojo.animateProperty(dojo.mixin({properties:{backgroundColor:{start:_59,end:_5a}}},_57));
dojo.connect(_5c,"onEnd",_5c,function(){
if(_5b){
_58.style.backgroundColor="transparent";
}
});
return _5c;
},_handlePOIOnClick:function(evt){
c._callCoreMetrics("Store Location");
if((dojo.byId(c._currentClickedStoreId))&&(c._currentClickedStoreId!="")){
dojo.byId(c._currentClickedStoreId).style["backgroundColor"]="#FFFFFF";
}
var _5e="storeDetail_"+this.getKey();
c._currentClickedStoreId=_5e;
if(dojo.byId("slidingPane")){
dojo.byId("slidingPane").scrollTop=(dojo.byId(_5e).paneOrder-1)*c.SCROLL_LINE_ITEM_HEIGHT_WITH_MARGIN;
var _5f=c.highlight({node:dojo.byId(_5e),repeat:2,color:"#EAE8DC"});
dojo.connect(_5f,"onEnd",null,function(){
dojo.byId(_5e).style["backgroundColor"]="#EAE8DC";
dojo.byId(_5e).style["opacity"]="1.0";
});
_5f.play();
}
},_handleStoreOnMouseOver:function(evt){
},_handleStoreOnClick:function(evt){
},_searchMapForStoreData:function(_62,_63,_64){
var _65=new MQRadiusSearchCriteria();
_65.setCenter(new MQA.LatLng(_62,_63));
_65.setRadius(_64);
_65.setMaxMatches(MAX_MATCHES);
var _66=new MQDBLayerQuery();
var _67=dojo.byId("brand");
var _68=dojo.byId("brand").innerHTML;
if(_68=="_"){
this._showErrorMessage("Please select the store you are interested in to continue.");
return false;
}
poisTable="MQA.MQ_34274_"+_68;
_66.setDBLayerName(poisTable);
var _69=new MQDBLayerQueryCollection();
_69.add(_66);
var _6a=new MQFeatureCollection();
var _6b=new MQDTCollection();
var _6c=new MQFeatureCollection();
var _6d=new MQExec(spatialServer,serverPath,serverPort,proxyServer,proxyPath,proxyPort);
_6d.search(_65,_6c,"",_69,_6a,_6b);
var _6e=new Array();
if(_6c.getSize()>0){
var _6f=new MQRecordSet();
var ids=new MQStringCollection();
for(var i=0;i<_6c.getSize();i++){
ids.add(_6c.getAt(i).getKey());
}
var _72=new MQStringCollection();
_6d.getRecordInfo(_72,_66,_6f,ids);
_6e=getResultsAsArray(_6f,_6c,false);
}
return _6e;
},_setupMapTransition:function(_73){
dojo.byId("loading-container").style["opacity"]="0";
dojo.byId("loading-container").style["display"]="block";
var _74=dojo.fadeIn({node:dojo.byId("loading-container"),duration:500});
dojo.connect(_74,"onEnd",null,function(){
dojo.byId("loading-container").style["opacity"]="1";
_73.call();
});
_74.play();
},_teardownMapTransition:function(){
var _75=dojo.fadeOut({node:dojo.byId("loading-container"),duration:500});
dojo.connect(_75,"onEnd",null,function(){
dojo.byId("loading-container").style["opacity"]="1";
dojo.byId("loading-container").style["display"]="none";
});
_75.play();
},_handleCancelDrivingDirectionsClick:function(_76){
this._hideErrorMessage();
var _77=this._validateAddress(0);
var _78=function(){
c._initMap();
};
if(_77){
c._setupMapTransition(_78);
}
},_dd_SL:function(_79,_7a,_7b,_7c,_7d,_7e,_7f,_80){
this._callCoreMetrics("Driving Directions");
c._drivingDirectionsUIEventHelper(_79,_7a,_7b,_7c,_7d,_7e,_7f,_80);
},_dd_POI:function(_81,_82,_83,_84,_85,_86,_87,_88){
this._callCoreMetrics("Driving Directions-Popup");
c._drivingDirectionsUIEventHelper(_81,_82,_83,_84,_85,_86,_87,_88);
},_drivingDirectionsUIEventHelper:function(_89,_8a,_8b,_8c,_8d,_8e,_8f,_90){
var _91=wsMap.getInfoWindow();
_91.hide();
this._hideErrorMessage();
if(dojo.byId("msgId")){
dojo.byId("msgId").innerHTML="";
}
this._geoAddressForDest=new MQGeoAddress();
this._geoAddressForDest.setStreet(_89);
this._geoAddressForDest.setCity(_8b);
this._geoAddressForDest.setState(_8c);
this._geoAddressForDest.setPostalCode(_8a);
this._geoAddressForDest.setMQLatLng(new MQA.LatLng(_8e,_8f));
var _92=function(){
c._doDrivingDirectionsLookup(dojo.byId("address").value,dojo.byId("zipCode").value,dojo.byId("city").value,dojo.byId("state").value,dojo.byId("country").value,"","",null);
};
this._setupMapTransition(_92);
},_doDrivingDirectionsLookup:function(_93,_94,_95,_96,_97,_98,_99,_9a){
if(_9a){
this._currentStoreSelected=null;
}
if((StringFunctions.isBlank(_95)||StringFunctions.isBlank(_96))&&StringFunctions.isBlank(_94)){
this._showErrorMessage("City & State or Zip required!");
return false;
}
var _9b=new MQAddress();
_9b.setStreet(_93);
_9b.setCity(_95);
_9b.setState(_96);
_9b.setPostalCode(_94);
_9b.setCountry(_97);
var _9c=this.getGeoCode(_9b);
if(_9c){
this._route(_9c,this._geoAddressForDest);
}
},_route:function(_9d,_9e){
this._callCoreMetricsWithPageId("Store Locator Driving Direction");
var _9f,_a0;
_a0=_9d;
_9f=_9e;
dojo.byId("map").innerHTML="";
var _a1=dojo.byId("map");
var map=new MQA.TileMap(_a1);
var _a3=new MQA.LargeZoomControl();
map.addControl(_a3,new MQA.MapCornerPlacement(MQA.MapCorner.TOP_LEFT,new MQA.Size(0,0)));
map.addControl(new MQNoAerialViewControl(map),new MQA.MapCornerPlacement(MQA.MapCorner.TOP_RIGHT,new MQA.Size(-4,0)));
map.setLogoPlacement(MQA.MapLogo.MAPQUEST,new MQA.MapCornerPlacement(MQA.MapCorner.TOP_LEFT,new MQA.Size(44,0)));
map.setLogoPlacement(MQA.MapLogo.SCALES,new MQA.MapCornerPlacement(MQA.MapCorner.BOTTOM_LEFT,new MQA.Size(50,0)));
map.setLogoPlacement(MQA.MapLogo.NAVTEQ_COPYRIGHT,new MQA.MapCornerPlacement(MQA.MapCorner.BOTTOM_LEFT,new MQA.Size(208,0)));
map.setLogoPlacement(MQA.MapLogo.MAPQUEST_COPYRIGHT,new MQA.MapCornerPlacement(MQA.MapCorner.BOTTOM_RIGHT,new MQA.Size(0,0)));
map.setLogoPlacement(MQA.MapLogo.ICUBED_COPYRIGHT,new MQA.MapCornerPlacement(MQA.MapCorner.BOTTOM_RIGHT,new MQA.Size(103,1)));
var _a4=new MQExec(routeServer,serverPath,serverPort,proxyServer,proxyPath,proxyPort);
var _a5=new MQSession();
var _a6=new MQRouteResults();
var _a7=new MQLocationCollection();
var _a8=new MQA.RectLL(new MQA.LatLng(),new MQA.LatLng());
_a7.add(_a0);
_a7.add(_9f);
var _a9=new MQRouteOptions();
_a9.setMaxShapePointsPerManeuver(MAX_SHAPE_POINTS);
var _aa=_a4.createSessionEx(_a5);
_a4.doRoute(_a7,_a9,_a6,_aa,_a8);
map.addRouteHighlight(_a8,"http://map.access.mapquest.com",_aa,true);
var _ab=_globalEndImagePath;
var _ac=new MQA.Icon(_ab,37,11,true,false);
var _ad=_globalStartImagePath;
var _ae=new MQA.Icon(_ad,37,11,true,false);
var _af=new MQA.Poi(_a0.getMQLatLng(),_ae);
_af.setValue("infoTitleHTML","Origin");
_af.setValue("infoContentHTML",mqAddressToString(_a0));
map.addPoi(_af);
var _b0=new MQA.Poi(_9f.getMQLatLng(),_ac);
_b0.setValue("infoTitleHTML","Destination");
_b0.setValue("infoContentHTML",mqAddressToString(_9f));
map.addPoi(_b0);
map.bestFit(false,1,11);
MQA.EventManager.addListener(map,"zoomend",this._handleZoomend);
MQA.EventManager.addListener(map,"dragend",this._handleDragend);
this._showRouteResults(_a6,_a0,_9f);
},_showRouteResults:function(_b1,_b2,_b3){
dojo.byId("routeResults").innerHTML="";
this._routeDetailsForPrint={};
var div=document.createElement("div");
div.setAttribute("id","from-estimate");
var _b5="";
if(_b1.getLocations().getAt(0).getStreet()!=""){
_b5=_b1.getLocations().getAt(0).getStreet()+"<br //>";
}
this._routeDetailsForPrint["start"]={};
this._routeDetailsForPrint["start"]["street"]=_b1.getLocations().getAt(0).getStreet();
this._routeDetailsForPrint["start"]["city"]=_b1.getLocations().getAt(0).getCity();
this._routeDetailsForPrint["start"]["state"]=_b1.getLocations().getAt(0).getState();
this._routeDetailsForPrint["start"]["postalCode"]=_b1.getLocations().getAt(0).getPostalCode();
this._routeDetailsForPrint["start"]["country"]=_b1.getLocations().getAt(0).getCountry();
_b5+=_b1.getLocations().getAt(0).getCity()+", "+_b1.getLocations().getAt(0).getState()+" "+_b1.getLocations().getAt(0).getPostalCode();
this._routeDetailsForPrint["startSummary"]=_b5;
var _b6=_b1.getTrekRoutes().get(0).getDistance().toString();
_b6=_b6.substring(0,_b6.indexOf(".")+3)+" miles";
this._routeDetailsForPrint["totalDistance"]=_b6;
var _b7=_b1.getTrekRoutes().get(0).getTime();
if(_b7>3600){
_b7=formatTime(_b7,"%h hrs %m minutes");
}else{
_b7=formatTime(_b7,"%m minutes");
}
this._routeDetailsForPrint["totalTime"]=_b7;
div.innerHTML="<p><strong>From:</strong></p><p>"+_b5+"</p><br/><p><strong>Estimated Travel Time:</strong></p><p>"+_b7+" for "+_b6+" of travel.</p>";
dojo.byId("routeResults").appendChild(div);
div=document.createElement("div");
div.setAttribute("id","to");
var _b8="";
if(_b1.getLocations().getAt(1).getStreet()!=""){
_b8=_b1.getLocations().getAt(1).getStreet()+"<br //>";
}
this._routeDetailsForPrint["destination"]={};
this._routeDetailsForPrint["destination"]["street"]=_b1.getLocations().getAt(1).getStreet();
this._routeDetailsForPrint["destination"]["city"]=_b1.getLocations().getAt(1).getCity();
this._routeDetailsForPrint["destination"]["state"]=_b1.getLocations().getAt(1).getState();
this._routeDetailsForPrint["destination"]["postalCode"]=_b1.getLocations().getAt(1).getPostalCode();
this._routeDetailsForPrint["destination"]["country"]=_b1.getLocations().getAt(1).getCountry();
_b8+=_b1.getLocations().getAt(1).getCity()+", "+_b1.getLocations().getAt(1).getState()+" "+_b1.getLocations().getAt(1).getPostalCode();
this._routeDetailsForPrint["destinationSummary"]=_b8;
div.innerHTML="<p><strong>To:</strong></p><p>"+_b8+"</p>";
dojo.byId("routeResults").appendChild(div);
var _b9=document.createElement("div");
_b9.setAttribute("id","directions");
var _ba=document.createElement("table");
_ba.setAttribute("cellSpacing","0");
_ba.setAttribute("summary","Driving directions to Pottery Barn");
_ba.id="driving-steps";
var _bb=document.createElement("tbody");
var tr=document.createElement("tr");
var th=document.createElement("th");
th.setAttribute("abbr","Driving Directions");
th.setAttribute("scope","col");
th.innerHTML="Driving Directions";
tr.appendChild(th);
th=document.createElement("th");
th.setAttribute("abbr","Distance");
th.setAttribute("scope","col");
th.innerHTML="Distance";
tr.appendChild(th);
th=document.createElement("th");
th.setAttribute("abbr","Time");
th.setAttribute("scope","col");
th.innerHTML="Time";
tr.appendChild(th);
_bb.appendChild(tr);
tr=document.createElement("tr");
var _be="";
this._routeDetailsForPrint["directions"]=[];
var _bf,_c0=-1;
for(var i=0;i<_b1.getTrekRoutes().get(0).getManeuvers().getSize();i++){
_be=_b1.getTrekRoutes().get(0).getManeuvers().get(i).getNarrative();
tr=document.createElement("tr");
if(i%2==1){
tr.className="alt";
}
td=document.createElement("td");
td.innerHTML=(i+1)+". "+_be;
tr.appendChild(td);
_bf=_b1.getTrekRoutes().get(0).getManeuvers().get(i).getDistance();
td=document.createElement("td");
_bf=_bf.substring(0,_bf.indexOf(".")+3)+" miles";
td.innerHTML=_bf;
tr.appendChild(td);
_c0=_b1.getTrekRoutes().get(0).getManeuvers().get(i).getTime();
td=document.createElement("td");
if(_c0>3600){
_c0=formatTime(_c0,"%h hrs %m mins");
}else{
_c0=formatTime(_c0,"%m mins");
}
td.innerHTML=_c0;
tr.appendChild(td);
_bb.appendChild(tr);
this._routeDetailsForPrint["directions"][i]={"narrative":_be,"distance":_bf,"time":_c0};
}
_ba.appendChild(_bb);
_b9.appendChild(_ba);
dojo.byId("routeResults").appendChild(_b9);
var _c2=document.createElement("div");
_c2.className="btn-print-directions";
var _c3=document.createElement("a");
_c3.className="button printButton screen";
_c3.href="#";
_c3.appendChild(document.createTextNode("Print Directions"));
_c2.appendChild(_c3);
dojo.byId("routeResults").appendChild(_c2);
if(dojo.query(".back-link").length>0&&dojo.query(".printButton").length===1){
var _c4=dojo.query(".back-link")[0];
_c3=document.createElement("a");
_c3.href="#";
_c3.className="printButton printButton screen";
_c3.appendChild(document.createTextNode("print directions"));
_c4.appendChild(_c3);
dojo.query(".printButton",dojo.query(".back-link")[0]).forEach(function(_c5){
dojo.connect(_c5,"onclick",function(evt){
evt.preventDefault();
evt.stopPropagation();
window.print();
});
});
}
dojo.query(".printButton","routeResults").forEach(function(_c7){
dojo.connect(_c7,"onclick",function(evt){
evt.preventDefault();
evt.stopPropagation();
window.print();
});
});
this._teardownMapTransition();
},_showErrorMessage:function(_c9){
dojo.byId("errorDisplay").style["display"]="block";
dojo.byId("errorDisplay").style["opacity"]="0";
dojo.byId("errorDisplay").style["visibility"]="visible";
dojo.byId("errorMessage").innerHTML=_c9;
var _ca=dojo.fadeIn({node:dojo.byId("errorDisplay"),duration:500}).play();
dojo.connect(_ca,"onEnd",null,function(){
dojo.byId("errorDisplay").style["opacity"]="1.0";
});
},_hideErrorMessage:function(){
dojo.byId("errorMessage").innerHTML="";
dojo.byId("errorDisplay").style["display"]="none";
},_callCoreMetrics:function(_cb){
},_callCoreMetricsWithPageId:function(_cc){
}});
