LMI.Mapping.MapObject=(function(){function MapObject(point,element){this.init(point,element);}
MapObject.prototype={init:function(point,element){this.element=element;this.properties={};this.setPoint(point);this.setXOffset(0);this.setYOffset(0);this.setZOffset(0);this.setIncludedInBestFit(true);this.initEvents('click','mouseout','mouseover');},setPoint:function(point){this.point=point;},getPoint:function(){return this.point;},getWidth:function(){return this.element.offsetWidth;},getHeight:function(){return this.element.offsetHeight;},setXOffset:function(xOffset){this.xOffset=xOffset;},getXOffset:function(){return this.xOffset;},setYOffset:function(yOffset){this.yOffset=yOffset;},getYOffset:function(){return this.yOffset;},setZOffset:function(zOffset){this.zOffset=zOffset;},getZOffset:function(){return this.zOffset;},setProperty:function(name,val){this.properties[name]=val;},setProperties:function(){var i,o;if(typeof arguments[0]==='object'){o=arguments[0];for(i in o){this.setProperty(i,o[i]);}}else{o=arguments.length;for(i=0;i<o;++i){this.properties[arguments[i]]=arguments[++i];}}
return this;},getProperty:function(name){return(name&&name in this.properties?this.properties[name]:"");},setIncludedInBestFit:function(included){this.includedInBestFit=!!included;},isIncludedInBestFit:function(){return this.includedInBestFit;},update:function(){},remove:function(){}};LMI.Lang.importFunctions(MapObject,LMI.Event);MapObject.prototype._addEventListener=MapObject.prototype.addEventListener;MapObject.prototype.addEventListener=function(type,func){var that;switch(type){case'click':LMI.StyleSheet.setCursor(this.element,'pointer');case'mouseout':case'mouseover':if(this.getListeners(type).length===0){that=this;LMI.BrowserEvent.addListener(this.element,type,function(evt){var e=new LMI.BrowserEventObject(evt,window.event,this);that.triggerEvent(type,e,that);});}
break;}
return this._addEventListener(type,func);};MapObject.prototype.bindEvent=function(type,obj,func,arg){var f=function(e,o){func.call(obj,e,o,arg);};return this.addEventListener(type,f);};return MapObject;})();LMI.Mapping.Icon=(function(){function Icon(point,option){this.init(point,option);}
LMI.Lang.extend(Icon,LMI.Mapping.MapObject);var proto=Icon.prototype,superclass=Icon.superclass;proto.init=function(point,option){this.option=option;var img=LMI.Element.create('img');LMI.BrowserEvent.bind(img,'error',this,imgError);superclass.init.call(this,point,img);this.setIconSrc(this.getRecommendedIconSrc());this.setXOffset(24);this.setYOffset(27);};proto.getIconSrc=function(){return LMI.Element.getImageSrc(this.element);};proto.setIconSrc=function(src){LMI.Element.setImageSrc(this.element,src);};proto.getRecommendedIconSrc=function(){var i=parseInt(this.option,10),lets=LMI.Strings.getString('js.letters'),l=(i>=0&&i<lets.length?lets.charAt(i):'blank');return LMI.Urls.getImg('map_nodes/blue/map_icon_'+l+'.png');};proto.getHeight=function(){return 27;};proto.getWidth=function(){return 24;};proto.getDefaultIcon=function(){var src=this.getIconSrc();return src.replace(/((?:[^\/]+\/)*)[^\/]+/,'$1map_icon_blank.png');};function imgError(evt){var e=new LMI.BrowserEventObject(evt,window.event,this),i=this.element,defaultIcon=this.getDefaultIcon();if(LMI.Element.getImageSrc(i).match(defaultIcon)){i.alt='X';}else{LMI.Element.setImageSrc(i,defaultIcon);}}
return Icon;})();LMI.Mapping.FlyoutFactory=(function(){var create=LMI.Element.create,getImg=LMI.Urls.getImg,hop=YAHOO.lang.hasOwnProperty;function FlyoutFactory(){this.init();}
FlyoutFactory.prototype={init:function(){this.contents={'default':FlyoutFactory.defaultFlyoutContent,ambig:FlyoutFactory.defaultAmbigContent};this.styles={'default':{creator:FlyoutFactory.defaultFlyoutStyle,xOffset:0,yOffset:0,zOffset:5}};},clone:function(){var i,j,f=new LMI.Mapping.FlyoutFactory();for(i in this.contents){if(hop(this.contents,i)){f.contents[i]=this.contents[i];}}
for(i in this.styles){if(hop(this.styles,i)){f.styles[i]={};for(j in this.styles[i]){if(hop(this.styles[i],j)){f.styles[i][j]=this.styles[i][j];}}}}
return f;},addContentCreator:function(type,creator){this.contents[type]=creator;},addStyle:function(style,creator,options){var s={creator:creator};if(!options){s.xOffset=0;s.yOffset=0;s.zOffset=5;}else{LMI.Lang.forEach(['xOffset','yOffset','zOffset'],function(p){if(p in options){s[p]=options[p];}else{s[p]=p==='zOffset'?5:0;}});}
this.styles[style]=s;},getFlyout:function(point,poi,type,style){type=type||'default';style=style||'default';var content=this.contents[type](poi),s=this.styles[style];return new LMI.Mapping.Flyout(point,s.creator(content,poi),s.xOffset,s.yOffset,s.zOffset);}};FlyoutFactory.defaultFlyoutStyle=function(content,poi){var f=create('div',null,{'class':'flyout',id:'LMIMapFlyout'});create('img',f,{src:getImg('icon_close.gif'),alt:'','class':'flyoutClose',browserEvents:{click:function(){poi.hideFlyout();}}});create('div',f,{className:'content'}).appendChild(content);create('img',create('div',f,{'class':'bl'}),{src:getImg('mapping/flyout_box.png'),alt:''});create('img',create('div',f,{'class':'tr'}),{src:getImg('mapping/flyout_box.png'),alt:''});create('img',create('div',f,{'class':'br'}),{src:getImg('mapping/flyout_box.png'),alt:''});create('div',f,{'class':'cap'});create('div',f,{'class':'boot'});create('img',f,{src:getImg('flyout_pointy_corner_tl.png'),alt:'','class':'flyoutTail'});return f;};FlyoutFactory.defaultFlyoutContent=function(){return create('div',null,{textValue:'no content'});};FlyoutFactory.defaultAmbigContent=function(poi){var ul,li,name,a
d=create('div',null,{className:'ambigFlyout'});create('div',d,{textValue:LMI.Strings.getString('js.multimatches')+':',className:'flyoutName'});ul=create('ul',d);LMI.Lang.forEach([poi].concat(poi.collisions),function(o,i){name=o.getProperty('name')||o.getProperty('displayValue');li=create('li',ul,{className:i===0?'first':''});a=create('a',li,{textValue:name,href:'#'});LMI.BrowserEvent.addListener(a,'click',function(evt){var e=new LMI.BrowserEventObject(evt,window.event,this);o.showFlyout();e.preventDefault();});});return d;};return FlyoutFactory;})();LMI.Mapping.Flyout=function(point,el,x,y,z){this.init(point,el,x,y,z);};LMI.Lang.extend(LMI.Mapping.Flyout,DSMapObject);LMI.Mapping.IconWithFlyout=(function(){var collection=new DSMapObject_Collection();function IconWithFlyout(point,index){this.init(point,index);}
LMI.Lang.extend(IconWithFlyout,LMI.Mapping.Icon);var proto=IconWithFlyout.prototype,superclass=IconWithFlyout.superclass;function _overlaps(o1,o2,hTolerance,vTolerance){var e1=o1.element,e2=o2.element,he1=o1.getWidth()/2,he2=o2.getWidth()/2,ve1=o1.getHeight()/2,ve2=o2.getHeight()/2,x1=parseInt(e1.style.left,10)+he1,y1=parseInt(e1.style.top,10)+ve1,x2=parseInt(e2.style.left,10)+he2,y2=parseInt(e2.style.top,10)+ve2,hOverlap=(he1+he2)-Math.abs(x2-x1),vOverlap=(ve1+ve2)-Math.abs(y2-y1);if(!hTolerance){hTolerance=0;}
if(!vTolerance){vTolerance=0;}
return(hOverlap>hTolerance&&vOverlap>vTolerance);}
proto.init=function(point,index){this.flyouts={};superclass.init.call(this,point,index);this.bindEvent('click',this,this.iconClick);};proto.update=function(m){if(!this.map){this.map=m;}
if(!this._addedToMap){this._addedToMap=true;this._id=collection.add(this);}};proto.remove=function(m){this.hideFlyout();this.flyouts={};if(this._addedToMap){collection.remove(this._id);this._addedToMap=false;}};proto.scrollMapToFlyout=function(f){var x=0,y=0,m=this.map.mapLayer,vp=this.map.viewport,xBuffer=30,yBuffer=30,left=parseInt(f.element.style.left,10)+parseInt(m.style.left,10),top=parseInt(f.element.style.top,10)+parseInt(m.style.top,10);if(left-xBuffer<0){x=left-xBuffer;}else if(left+f.element.offsetWidth+xBuffer>vp.offsetWidth){x=f.element.offsetWidth-vp.offsetWidth+left+xBuffer;}
if(top-yBuffer<0){y=top-yBuffer;}else if(top+f.element.offsetHeight+yBuffer>vp.offsetHeight){y=f.element.offsetHeight-vp.offsetHeight+top+yBuffer;}
if(x!==0||y!==0){this.map.slideBy(-x,-y);}};proto.findCollisions=function(){this.collisions=[];for(var it=new DSMapObject_Iterator(collection);it.hasNext();){o=it.next();if(o!==this&&_overlaps(this,o,(o.getWidth()/3),(o.getHeight()/3))){this.collisions.push(o);}}};proto.iconClick=function(){if(this.getActiveFlyout()){this.hideFlyout();}else{this.findCollisions();if(this.collisions.length){this.showFlyout('ambig');}else{this.showFlyout('default');}}};proto.showFlyout=function(type,style){var f;type=type||'default';IconWithFlyout.hideFlyouts();this.element.style.zIndex=this.z+1;f=this.flyouts[type]={type:type,id:null,flyout:this.getFlyoutFactory().getFlyout(this.point,this,type,style)};f.id=this.map.addObject(f.flyout);this.scrollMapToFlyout(f.flyout);};proto.hideFlyout=function(){var f=this.getActiveFlyout();if(f){this.map.removeObject(f.id);f.id=null;}
this.element.style.zIndex=this.z;};proto.getActiveFlyout=function(){var f,i;for(i in this.flyouts){f=this.flyouts[i];if(typeof f==='object'&&f.id){return f;}}
return null;};IconWithFlyout.getActiveFlyouts=function(){var f,a=[],it=new DSMapObject_Iterator(collection);while(it.hasNext()){f=it.next().getActiveFlyout();if(f){a.push(f);}}
return a;};IconWithFlyout.hideFlyouts=function(){var it=new DSMapObject_Iterator(collection);while(it.hasNext()){it.next().hideFlyout();}};IconWithFlyout.flyoutFactory=new LMI.Mapping.FlyoutFactory();proto.getFlyoutFactory=function(){return IconWithFlyout.flyoutFactory;};return IconWithFlyout;})();LMI.Mapping.TravelMarker=(function(){var _E=LMI.Element,$E=YAHOO.util.Event,create=_E.create,getImg=LMI.Urls.getImg,getString=LMI.Strings.getString;var isIE7=(LMI.Browser.browser==='Explorer'&&LMI.Browser.version===7);function TravelMarker(point,index){this.init(point,index);}
LMI.Lang.extend(TravelMarker,LMI.Mapping.IconWithFlyout);var proto=TravelMarker.prototype,superclass=TravelMarker.superclass;TravelMarker.X_OFFSET=21;TravelMarker.Y_OFFSET=26;proto.getRecommendedIconSrc=function(){var i=parseInt(this.option,10),lets=LMI.Strings.getString('js.letters'),l=(i>=0&&i<lets.length?lets.charAt(i):'blank');if(LMI.Data.isGeo){return LMI.Data.siteTheme.baseUrl+'/img/mapNodes/map/map_icon_'+l+'.png';}
return LMI.Urls.getImg('map_nodes/blue/map_icon_'+l+'.png');}
proto.getXOffset=function(){return TravelMarker.X_OFFSET;};proto.getYOffset=function(){return TravelMarker.Y_OFFSET;};proto.showFlyout=function(type,style){superclass.showFlyout.call(this,type,style);var s=_E.getImageSrc(this.element);s=s.replace(/(?:_clipped)?(\.[^.]+$)/,'_clipped$1');_E.setImageSrc(this.element,s);if(isIE7){this.element.width=20;}};proto.hideFlyout=function(){var s=_E.getImageSrc(this.element);s=s.replace(/_clipped/,'');_E.setImageSrc(this.element,s);if(isIE7){this.element.width=24;}
superclass.hideFlyout.call(this);};proto.getOmnitureClass=function(linkName,partner,id){if('Omniture'in LMI){return LMI.Omniture.generateClassName(linkName,partner,id);}else{return"";}};TravelMarker.flyoutStyle=function(content,poi,cls){cls=cls?cls+' flyout':'flyout';var f=create('div',null,{'class':cls,id:'LMIMapFlyout',children:[{elType:'img',src:getImg('icon_close.png'),alt:'',className:'flyoutClose',browserEvents:{click:function(){poi.hideFlyout();}}},{elType:'div',className:'content',children:[{elType:'div',className:'barHolder'}]},{elType:'div',className:'flyoutCorner flyoutBL',children:[{elType:'img',src:getImg('mapping/flyout_box.png'),alt:''}]},{elType:'div',className:'flyoutCorner flyoutTR',children:[{elType:'img',src:getImg('mapping/flyout_box.png'),alt:''}]},{elType:'div',className:'flyoutCorner flyoutBR',children:[{elType:'img',src:getImg('mapping/flyout_box.png'),alt:''}]}]});LMI.Element.getOne('div.content .barHolder',f).appendChild(content);return f;};TravelMarker.getAddressElement=function(poi){var p,csz,dl=create('dl',null,{className:'addrBlock'});if((p=poi.getProperty('streetAddress'))){create('dd',dl,{textValue:p});}
p=poi.getProperty('city');csz=p||'';if((p=poi.getProperty('state'))){csz+=(csz?', ':'')+p;}
p=poi.getProperty('zip')||poi.getProperty('zipCode');if(p){csz+=(csz?' ':'')+p;}
if(csz){create('dd',dl,{textValue:csz});}
return dl;};TravelMarker.getLinksElement=function(poi){var a,ul=create('ul',null,{className:'optionLinks'}),li=create('li',ul),id=(poi.getProperty('id')||poi.getProperty('listingId')),isLandmark=(poi.getProperty("type")==="landmark");if(LMI.Lang.getObject('LMI.RoadTrip.addToTrip')){if(!poi.getProperty('inTrip')&&!isLandmark){a=create('a',li,{href:'#',className:'addToTrip',textValue:getString('js.roadtrip.add.to.trip')});$E.on(a,'click',function(e){LMI.RoadTrip.addToTrip(poi.point,poi.getProperty('id'),'listing');$E.stopEvent(e);});}else if(isLandmark){}else{a=create('a',li,{href:'#',className:'removeFromTrip',textValue:getString('js.roadtrip.remove.from.trip')});$E.on(a,'click',function(e){LMI.RoadTrip.removeFromTrip(poi.option);$E.stopEvent(e);});}}else{if(poi.getProperty('markerType')==='routeSearchMarker'){create('a',li,{href:'#',id:'addR'+id,className:'removeFromTrip',textValue:getString('js.routesearch.add.to.route'),browserEvents:{click:function(){poi.addToRoute();}}});}else{create('a',li,{href:_prepareUrl('/get_directions.html')+'locationType=listing&location='+id,textValue:getString('js.getdirs')});}}
if('SavePlaces'in LMI){li=create('li',ul);if(!poi.getProperty('inList')){a=create('a',li,{id:'listing_'+id,className:'addToPlaces',textValue:getString('js.addtoplaces'),href:'javascript:void(0)'});$E.on(a,'click',function(e){LMI.SavePlaces.saveListing.call(this,e);poi.setProperty('inList',true);});}else{create('a',li,{textValue:getString('js.inplacespc'),href:'/my_places.html',className:'saved'});}}
return ul;};TravelMarker.flyoutFactory=LMI.Mapping.IconWithFlyout.flyoutFactory.clone();TravelMarker.flyoutFactory.addStyle('default',TravelMarker.flyoutStyle,{xOffset:5,yOffset:27,zOffset:0});proto.getFlyoutFactory=function(){return TravelMarker.flyoutFactory;};return TravelMarker;})();LMI.Mapping.RoadTripStopMarker=(function(){var Y=YAHOO.util,$D=Y.Dom,$E=Y.Event,_E=LMI.Element,$=_E.getOne;function StopMarker(point,index){this.init(point,index);}
LMI.Lang.extend(StopMarker,LMI.Mapping.TravelMarker);var proto=StopMarker.prototype;StopMarker.getStopFlyoutContent=function(poi){var a,ul,poiVal,poiType,imgSrc,firstLink=true,c=_E.create,body=c('div',null);_E.create('div',body,{textValue:poi.getProperty('displayValue'),className:'flyoutName'});ul=c('ul',body,{'class':'lmLinkList'});if(poi.getProperty('urlPrefix')){firstLink=false;a=c('li',ul,{className:'first',children:[{elType:'a',textValue:LMI.Strings.getString('js.roadtrip.city.information'),href:poi.getProperty('urlPrefix')}]});}
if('RoadTrip'in LMI){if(LMI.RoadTrip.isZoomedIn()){a=c('li',ul,{'class':'last'+(firstLink?' first':''),children:[{elType:'a','class':'zoomLink',textValue:LMI.Strings.getString('js.roadtrip.zoom.out'),href:'#'}]});$E.on($('a',a),'click',LMI.RoadTrip.zoomOut);}else{a=c('li',ul,{'class':'last'+(firstLink?' first':''),children:[{elType:'a','class':'zoomLink',textValue:LMI.Strings.getString('js.roadtrip.zoom.in'),href:'#'}]});$E.on($('a',a),'click',LMI.RoadTrip.zoomIn,poi);}
poiType=(poi.getProperty('locationType')==='saved'?'saved':'manual');poiVal=(poi.getProperty('locationType')==='saved'?poi.getProperty('uid'):poi.getProperty('displayValue'));imgSrc=LMI.Urls.getImg('labels/special/map_icon_hotel.gif');if(LMI.Data.isGeo){imgSrc=LMI.Data.siteTheme.baseUrl+'/img/mapNodes/labels/map_icon_hotel.gif';}
a=c('p',body,{'class':'fnLink',children:[{elType:'img',src:imgSrc,alt:''},{elType:'a',textValue:LMI.Strings.getString('js.roadtrip.hotels.nearby'),href:'#'}]});$E.on(a.childNodes[1],'click',function(e){LMI.Mapping.IconWithFlyout.hideFlyouts();LMI.RoadTrip.removeHotels();LMI.RoadTrip.setWorkingCursor();LMI.RoadTrip.clearErrorBox();LMI.AjaxController.findNearby(LMI.RoadTrip.hotelsCallback,poiVal,poiType,'hotels');$E.stopEvent(e);});imgSrc=LMI.Urls.getImg('labels/special/map_icon_attraction.gif');if(LMI.Data.isGeo){imgSrc=LMI.Data.siteTheme.baseUrl+'/img/mapNodes/labels/map_icon_attraction.gif';}
a=c('p',body,{'class':'fnLink',children:[{elType:'img',src:imgSrc,alt:''},{elType:'a',textValue:LMI.Strings.getString('js.roadtrip.attractions.nearby'),href:'#'}]});$E.on(a.childNodes[1],'click',function(e){LMI.Mapping.IconWithFlyout.hideFlyouts();LMI.RoadTrip.removeAttractions();LMI.RoadTrip.setWorkingCursor();LMI.RoadTrip.clearErrorBox();LMI.AjaxController.findNearby(LMI.RoadTrip.attractionsCallback,poiVal,poiType,'attractions');$E.stopEvent(e);});if(typeof poi.option==='undefined'){a=c('p',body,{children:[{elType:'a',textValue:LMI.Strings.getString('js.roadtrip.add.to.trip'),href:'#',className:'addToTrip'}]});$E.on(a.firstChild,'click',function(e){LMI.RoadTrip.addToTrip(poi.point,poiVal,poiType);$E.stopEvent(e);});}else{a=c('p',body,{'class':'removeLink',children:[{elType:'a',textValue:LMI.Strings.getString('js.roadtrip.remove.from.trip'),href:'#'}]});$E.on($('a',a),'click',function(e){LMI.RoadTrip.removeFromTrip(poi.option);$E.stopEvent(e);});}}else if(poi.getProperty('urlPrefix')){$D.addClass(a,'last');c('p',body,{className:'fnLink',children:[{elType:'img',src:LMI.Urls.getImg('labels/special/map_icon_hotel.gif'),alt:''},{elType:'a',textValue:LMI.Strings.getString('js.roadtrip.hotels.browse'),href:poi.getProperty('urlPrefix')+'/hotels.html'}]});c('p',body,{className:'fnLink',children:[{elType:'img',src:LMI.Urls.getImg('labels/special/map_icon_attraction.gif'),alt:''},{elType:'a',textValue:LMI.Strings.getString('js.roadtrip.attractions.browse'),href:poi.getProperty('urlPrefix')+'/attractions_results.html'}]});}
return body;};StopMarker.getStopFlyoutStyle=function(content,poi){return LMI.Mapping.TravelMarker.flyoutStyle(content,poi,'stop');};StopMarker.flyoutFactory=LMI.Mapping.TravelMarker.flyoutFactory.clone();StopMarker.flyoutFactory.addContentCreator('default',StopMarker.getStopFlyoutContent);StopMarker.flyoutFactory.addStyle('default',StopMarker.getStopFlyoutStyle,{xOffset:5,yOffset:27,zOffset:0});proto.getFlyoutFactory=function(){return StopMarker.flyoutFactory;};return StopMarker;})();LMI.Mapping.HotelMarker=(function(){function HotelMarker(point,option){this.init(point,option);}
LMI.Lang.extend(HotelMarker,LMI.Mapping.TravelMarker);var proto=HotelMarker.prototype,superclass=HotelMarker.superclass;proto.getRecommendedIconSrc=function(){if(typeof this.option!=='undefined'&&this.option>=0){this.hasLetter=true;return superclass.getRecommendedIconSrc.call(this);}
if(LMI.Data.isGeo){return LMI.Data.siteTheme.baseUrl+'/img/mapNodes/map/map_icon_hotel.png';}
return LMI.Urls.getImg('map_nodes/special/map_icon_hotel.png');};HotelMarker.getHotelFlyoutStyle=function(content,poi){return LMI.Mapping.TravelMarker.flyoutStyle(content,poi,poi.hasLetter?'hotelFlyout letteredHotel':'hotelFlyout');};HotelMarker.createHotelFlyout=function(poi){var _E=LMI.Element,$=_E.getOne,$E=YAHOO.util.Event,getString=LMI.Strings.getString;var a,d=_E.create('div',null),title=_E.create('div',d,{className:'flyoutName'}),id=(poi.getProperty('id')||poi.getProperty('listingId')),partner=_getPartner(poi);url=LMI.Urls.getExternalUrl(poi.getProperty('detailUrl'),partner);var name=poi.getProperty('name');if(name){var linkName=(LMI.Data.pageName==="details"?"hotel_flyout":"hotel_name");a=_E.create('a',title,{textValue:name,href:url,'class':'flyoutName '+superclass.getOmnitureClass(linkName,partner,id)});if('Omniture'in LMI){$E.on(a,'click',LMI.Omniture.linkClick);}
if('AG'in LMI){$E.on(a,'click',LMI.AG.linkClick);}}
d.appendChild(LMI.Mapping.TravelMarker.getAddressElement(poi));if(poi.getProperty('rating')){_E.create('div',d,{'class':'rating',children:[{elType:'p',textValue:getString('js.hotels.flyout.rating')},{elType:'span','class':'star stars'+poi.getProperty('rating')}]});}
if(poi.getProperty('ratesPhone')){_E.create('p',d,{'class':'ratesPhone',textValue:getString('js.hotels.flyout.ratesPhone',poi.getProperty('ratesPhone'))});}
var img=poi.getProperty('imageUrl');if(img){var p=_E.create('p',d,{'class':'imgCont',children:[{elType:'img',src:img}]});}
if(poi.getProperty('priceLevel')){_E.create('div',d,{'class':'priceCont',children:[{elType:'p','class':'starting',textValue:getString('js.hotels.flyout.price')},{elType:'p','class':'price',textValue:'$'+poi.getProperty('priceLevel')}]});}
if(poi.getProperty('urlPrefix')){_E.create('p',d,{className:'fnLink',children:[{elType:'img',src:LMI.Urls.getImg('labels/special/map_icon_attraction.gif'),alt:''},{elType:'a',textValue:LMI.Strings.getString('js.roadtrip.attractions.browse'),href:poi.getProperty('urlPrefix')+'/attractions_results.html'}]});}
d.appendChild(LMI.Mapping.TravelMarker.getLinksElement(poi));a=$('p.imgCont>a',d);if(a&&LMI.Omniture){$E.on(a,'click',LMI.Omniture.linkClick);}
return d;};HotelMarker.flyoutFactory=LMI.Mapping.TravelMarker.flyoutFactory.clone();HotelMarker.flyoutFactory.addContentCreator('default',HotelMarker.createHotelFlyout);HotelMarker.flyoutFactory.addStyle('default',HotelMarker.getHotelFlyoutStyle,{xOffset:5,yOffset:27,zOffset:0});proto.getFlyoutFactory=function(){return HotelMarker.flyoutFactory;};return HotelMarker;})();LMI.Mapping.MovieMarker=(function(){function MovieMarker(point,option){this.init(point,option);}
LMI.Lang.extend(MovieMarker,LMI.Mapping.TravelMarker);var proto=MovieMarker.prototype,superclass=MovieMarker.superclass;proto.getRecommendedIconSrc=function(){if(typeof this.option!=='undefined'&&this.option>=0){this.hasLetter=true;return superclass.getRecommendedIconSrc.call(this);}
if(LMI.Data.isGeo){return LMI.Data.siteTheme.baseUrl+'/img/mapNodes/map/map_icon_movie.png';}
return LMI.Urls.getImg('map_nodes/special/map_icon_movie.png');};MovieMarker.getMovieFlyoutStyle=function(content,poi){return LMI.Mapping.TravelMarker.flyoutStyle(content,poi,poi.hasLetter?'movieFlyout letteredMovie':'movieFlyout');};MovieMarker.createMovieFlyout=function(poi){var _E=LMI.Element,$=_E.getOne,$E=YAHOO.util.Event,getString=LMI.Strings.getString;var a,name,phone,d=_E.create('div',null),title=_E.create('div',d,{className:'flyoutName'}),id=(poi.getProperty('id')||poi.getProperty('listingId')),partner=_getPartner(poi);name=poi.getProperty('name');if(name){_E.create("p",title,{textValue:name});}
d.appendChild(LMI.Mapping.TravelMarker.getAddressElement(poi));phone=poi.getProperty("phoneNumbers")[0];if(phone){_E.create("p",d,{textValue:phone.value});}
return d;};MovieMarker.flyoutFactory=LMI.Mapping.TravelMarker.flyoutFactory.clone();MovieMarker.flyoutFactory.addContentCreator('default',MovieMarker.createMovieFlyout);MovieMarker.flyoutFactory.addStyle('default',MovieMarker.getMovieFlyoutStyle,{xOffset:5,yOffset:27,zOffset:0});proto.getFlyoutFactory=function(){return MovieMarker.flyoutFactory;};return MovieMarker;})();LMI.Mapping.AttractionMarker=(function(){var Y=YAHOO.util,$E=Y.Event;function A(point,option){this.init(point,option);}
LMI.Lang.extend(A,LMI.Mapping.TravelMarker);var proto=A.prototype,superclass=A.superclass;proto.getRecommendedIconSrc=function(){var index=this.option;if(typeof index!=='undefined'&&index>=0){this.hasLetter=true;return superclass.getRecommendedIconSrc.call(this);}
if(LMI.Data.isGeo){return LMI.Data.siteTheme.baseUrl+'/img/mapNodes/map/map_icon_attraction.png';}
return LMI.Urls.getImg('map_nodes/special/map_icon_attraction.png');};A.getAttractionFlyoutStyle=function(content,poi){return LMI.Mapping.TravelMarker.flyoutStyle(content,poi,poi.hasLetter?'attractionFlyout letteredAttraction':'attractionFlyout');};A.getAttractionFlyoutContent=function(poi){var a,title,elem,pType,pVal,rateit,rating,count,c=LMI.Element.create,getString=LMI.Strings.getString,body=c('div',null);if(poi.getProperty('listingId')){elem={elType:'a',textValue:poi.getProperty('name'),href:_prepareUrl('/attraction_details.html')+'detailsListingId='+poi.getProperty('listingId'),'class':'flyoutName'};}else if(poi.getProperty('detailUrl')){elem={elType:'a',textValue:poi.getProperty('name'),href:poi.getProperty('detailUrl'),target:'_blank','class':'flyoutName'};}else{elem={elType:'span',textValue:poi.getProperty('name'),'class':'flyoutName'};}
title=c('div',body,{children:[elem]});if(poi.getProperty('averageRating')){rating=poi.getProperty('averageRating').toString();rating=rating.replace(/\./g,"_");}else{rating='0';}
if(poi.getProperty('ratingCount')){count=poi.getProperty('ratingCount');}else{count=0;}
if(poi.getProperty('listingId')){c('div',body,{'class':'rating attractionRating',children:[{elType:'span','class':'star stars'+rating},{elType:'p',textValue:count+' '+LMI.Strings.getString('js.ratings.count')},{elType:'a',textValue:LMI.Strings.getString('js.ratings.link'),href:_prepareUrl('/attraction_details.html')+'detailsListingId='+poi.getProperty('listingId')+'#showRatingWidget'}]});}
if(poi.getProperty('phoneNumbers')&&poi.getProperty('phoneNumbers').length&&poi.getProperty('phoneNumbers')[0].value){c('p',body,{textValue:poi.getProperty('phoneNumbers')[0].value,style:'font-weight: bold'});}
var addr=LMI.Mapping.TravelMarker.getAddressElement(poi);body.appendChild(addr);if('RoadTrip'in LMI){a=c('p',body,{'class':'fnLink',children:[{elType:'img',src:LMI.Urls.getImg('labels/special/map_icon_hotel.gif'),alt:''},{elType:'a',textValue:LMI.Strings.getString('js.roadtrip.hotels.nearby'),href:'#'}]});if(poi.getProperty("id")){pType="listing";pVal=poi.getProperty("id");}else{pType="manual";pVal=poi.point.lat+","+poi.point.lng;}
Y.Event.on(a.childNodes[1],'click',function(e){LMI.Mapping.IconWithFlyout.hideFlyouts();LMI.RoadTrip.removeHotels();LMI.RoadTrip.setWorkingCursor();LMI.RoadTrip.clearErrorBox();LMI.AjaxController.findNearby(LMI.RoadTrip.hotelsCallback,pVal,pType,'hotels');$E.stopEvent(e);});}else if(poi.getProperty('urlPrefix')){c('p',body,{className:'fnLink',children:[{elType:'img',src:LMI.Urls.getImg('labels/special/map_icon_hotel.gif'),alt:''},{elType:'a',textValue:LMI.Strings.getString('js.roadtrip.hotels.browse'),href:poi.getProperty('urlPrefix')+'/hotels.html'}]});}
var ul=LMI.Mapping.TravelMarker.getLinksElement(poi);body.appendChild(ul);return body;};A.flyoutFactory=LMI.Mapping.TravelMarker.flyoutFactory.clone();A.flyoutFactory.addContentCreator('default',A.getAttractionFlyoutContent);A.flyoutFactory.addStyle('default',A.getAttractionFlyoutStyle,{xOffset:5,yOffset:27,zOffset:0});proto.getFlyoutFactory=function(){return A.flyoutFactory;};return A;})();LMI.Mapping.AirportMarker=(function(){var Y=YAHOO.util,$E=Y.Event;function AirportMarker(point,option){this.init(point,option);}
LMI.Lang.extend(AirportMarker,LMI.Mapping.MovieMarker);var proto=AirportMarker.prototype,superclass=AirportMarker.superclass;proto.getRecommendedIconSrc=function(){if(LMI.Data.isGeo){return LMI.Data.siteTheme.baseUrl+'/img/mapNodes/map/map_icon_airport.png';}
return LMI.Urls.getImg('map_nodes/special/map_icon_airport.png');};AirportMarker.getAirportFlyoutStyle=function(content,poi){return LMI.Mapping.TravelMarker.flyoutStyle(content,poi,poi.hasLetter?'movieFlyout letteredMovie':'movieFlyout');};AirportMarker.createAirportFlyout=function(poi){var _E=LMI.Element,$=_E.getOne,$E=YAHOO.util.Event,getString=LMI.Strings.getString;var a,name,phone,d=_E.create('div',null),title=_E.create('div',d,{className:'flyoutName'}),id=(poi.getProperty('id')||poi.getProperty('listingId')),partner=_getPartner(poi);name=poi.getProperty('name');if(name){_E.create("p",title,{textValue:name});}
d.appendChild(LMI.Mapping.TravelMarker.getAddressElement(poi));phone=poi.getProperty("phoneNumbers")[0];if(phone){_E.create("p",d,{textValue:phone.value});}
var fromUrl="<a href="+_prepareUrl('/get_directions.html')+'locationType=listing&location='+id+'&startFrom=true'+">",toUrl="<a href="+_prepareUrl('/get_directions.html')+'locationType=listing&location='+id+">",p=_E.create("p",d,{'class':'dirsLink'});p.innerHTML=getString("js.carrental.flyout.dirs.get",toUrl,fromUrl);return d;};AirportMarker.flyoutFactory=LMI.Mapping.TravelMarker.flyoutFactory.clone();AirportMarker.flyoutFactory.addContentCreator('default',AirportMarker.createAirportFlyout);AirportMarker.flyoutFactory.addStyle('default',AirportMarker.getAirportFlyoutStyle,{xOffset:5,yOffset:27,zOffset:0});proto.getFlyoutFactory=function(){return AirportMarker.flyoutFactory;};return AirportMarker;})();LMI.Mapping.RealEstateMarker=(function(){var Y=YAHOO.util,$E=Y.Event;function RealEstateMarker(point,option){this.init(point,option);}
LMI.Lang.extend(RealEstateMarker,LMI.Mapping.AttractionMarker);var proto=RealEstateMarker.prototype,superclass=RealEstateMarker.superclass;RealEstateMarker.getRealEstateFlyoutStyle=function(content,poi){return LMI.Mapping.TravelMarker.flyoutStyle(content,poi,poi.hasLetter?'attractionFlyout letteredAttraction':'attractionFlyout');};RealEstateMarker.createRealEstateFlyout=function(poi){var _E=LMI.Element,$=_E.getOne,$E=YAHOO.util.Event,getString=LMI.Strings.getString;var a,d=_E.create('div',null),title=_E.create('div',d,{className:'flyoutName'}),id=(poi.getProperty('id')||poi.getProperty('listingId')),partner=_getPartner(poi);var url=_prepareUrl('/real_estate_details.html')+'detailsListingId='+id;a=_E.create("a",title,{href:url});a.appendChild(LMI.Mapping.TravelMarker.getAddressElement(poi));var price=poi.getProperty("minPrice");if(price){_E.create("p",d,{textValue:"$"+_formatNumber(price),className:"price"});}
var src=poi.getProperty('smallImageUrl');if(!src){src="/mosaic-portlets/img/re_no_photo.jpg";}
_E.create('p',d,{'class':'imgCont',children:[{elType:'img',src:src}]});var beds=poi.getProperty("bedrooms"),baths=poi.getProperty("bathrooms"),area=poi.getProperty("area");if(beds||baths||area){var propCont=_E.create('div',d,{'class':'propInfoCont'});if(beds){_E.create("p",propCont,{textValue:LMI.Strings.getString("js.real.estate.map.beds",beds)});}
if(baths){_E.create("p",propCont,{textValue:LMI.Strings.getString("js.real.estate.map.baths",baths)});}
if(area){_E.create("p",propCont,{textValue:LMI.Strings.getString("js.real.estate.map.area",_formatNumber(area))});}}
_E.create("div",d,{className:"clearer"});_E.create("p",d,{className:"attr",textValue:LMI.Strings.getString("js.real.estate.provider",partner)});return d;};RealEstateMarker.flyoutFactory=LMI.Mapping.TravelMarker.flyoutFactory.clone();RealEstateMarker.flyoutFactory.addContentCreator('default',RealEstateMarker.createRealEstateFlyout);RealEstateMarker.flyoutFactory.addStyle('default',RealEstateMarker.getRealEstateFlyoutStyle,{xOffset:5,yOffset:27,zOffset:0});proto.getFlyoutFactory=function(){return RealEstateMarker.flyoutFactory;};return RealEstateMarker;})();LMI.Mapping.RestaurantMarker=(function(){function RestaurantMarker(point,option){this.init(point,option);}
LMI.Lang.extend(RestaurantMarker,LMI.Mapping.AttractionMarker);var proto=RestaurantMarker.prototype,superclass=RestaurantMarker.superclass;proto.getRecommendedIconSrc=function(){if(LMI.Data.isGeo){return LMI.Data.siteTheme.baseUrl+'/img/mapNodes/map/map_icon_restaurant.png';}
return LMI.Urls.getImg('map_nodes/special/map_icon_restaurant.png');};return RestaurantMarker;})();function _prepareUrl(url){return url+((url.indexOf('?')>=0)?'&':'?');}
function _getPartner(poi){var provider,partner=poi.getProperty("partner");if(partner&&partner.value){return partner.value;}
provider=poi.getProperty("provider");if(provider&&provider.name){return provider.name;}else if(provider){return provider;}}
function _formatNumber(_val){var n,val=_val.toString(),delim=",",a=val.split(".",2),d=a[1],i=parseInt(a[0],10),neg=false;if(isNaN(i)){return"";}
if(i<0){neg=true;}
i=Math.abs(i);n=new String(i);a=[];while(n.length>3){var nn=n.substr(n.length-3);a.unshift(nn);n=n.substr(0,n.length-3);}
if(n.length>0){a.unshift(n);}
n=a.join(delim);if(d&&d.length>=1){val=n+"."+d;}else{val=n;}
return(neg?"-":"")+val;}
LMI.Form=function(){this.action='';this.params={};this.method='post';this.postCallback=null;};LMI.Form.prototype=(function(){return{getAction:function(){return this.action;},setAction:function(a){this.action=this.parseUrl(a);},getMethod:function(){return this.method;},setMethod:function(m){this.method=m;},setPostCallback:function(callback){this.postCallback=callback;},removeVar:function(name){if(this.params[name]){delete this.params[name];}},setVar:function(name,val,append,remove){var added=0;if(!this.params[name]){this.params[name]=[];}
if(val===null)val='';var cur=-1;for(var i=0;i<this.params[name].length;++i){if(this.params[name][i]==val){cur=i;}}
if(cur>-1){if(remove){this.params[name].splice(cur,1);if(this.params[name].length==0){delete this.params[name];}
return;}}
if(!append){this.params[name]=[];this.params[name].push(val);}
added++;if(append||!added){this.params[name].push(val);}},getVar:function(name){return(this.params[name]?this.params[name]:[]);},SUBMIT_NORMAL:0,SUBMIT_NOREFRESH:1,SUBMIT_SESSION:2,submit:function(submitType){var url,body=document.getElementsByTagName('body')[0],f=LMI.Element.create('form',body,{action:this.action,method:this.method,style:'display:none;position:absolute;top-4000px;width:0;height:0'});for(var i in this.params){for(var j=0;j<this.params[i].length;++j){if(submitType==this.SUBMIT_NOREFRESH){url+=i+"="+this.params[i][j]+"&";}else{LMI.Element.create('input',f,{name:i,value:this.params[i][j],style:'display:none;'});}}}
if(submitType==this.SUBMIT_NOREFRESH){(document.createElement('img')).src=this.action+";jsessionid="+LMI.Lang.getObject("LMI.Data.state.sessionId")+"?"+url+"noresponse=1";}else if(submitType==this.SUBMIT_SESSION){f.action=this.action+";jsessionid="+LMI.Lang.getObject("LMI.Data.state.sessionId");f.submit();}else{f.submit();}},go:function(action,submitType,name,val){var frag;for(var i=2;i<arguments.length;i++){if(arguments[i]=='#'){frag=arguments[++i];continue;}
this.setVar(arguments[i],arguments[++i]);}
if(action){this.setAction(frag?action+'#'+frag:action);}
this.submit(submitType);return false;},postUrl:function(url,allowDups){var location=this.parseUrl(url,allowDups);if(this.postCallback){location=this.postCallback(location);}
this.go(location);},parseUrl:function(url,allowDups){var u=new LMI.Url(url);var location=u.getLocation();var ps=u.getParamString();if(ps){location+=';'+ps;}
var keys=u.getQueryNames();for(var i=0;i<keys.length;++i){var v=u.getQueryValues(keys[i]);for(var j=0;j<v.length;++j){this.setVar(keys[i],v[j],allowDups,false);}}
return location;},postLink:function(evt,allowDups){var e;if(evt&&typeof evt.event!='undefined'){e=evt;}else{e=new LMI.BrowserEventObject(evt,window.event,this);}
if(e.getAltKey()||e.getCtrlKey()){return true;}
var t=e.getCurrentTarget()||e.getTarget();while(t.nodeName!='A'&&t.parentNode){t=t.parentNode;}
this.postUrl(t.href,allowDups);if(LMI.Browser.browser=='Safari'){t.href='#';}
e.stopPropagation();e.preventDefault();return false;},copy:function(form){if(form.action){this.setAction(form.action);}
var dsform=this;LMI.Lang.forEach(form.elements,function(o){dsform.setVar(o.name,o.value);});}};})();LMI.Checkboxes=(function(){function Checkboxes(){this.init();}
Checkboxes.prototype={init:function(){var m;this.setMaster(this.findMaster());this.setBoxes(this.findBoxes());YAHOO.util.Event.on(this.getBoxes(),'click',this.boxClick,this,true);m=this.getMaster();if(m){YAHOO.util.Event.on(m,'click',this.masterClick,this,true);}},findMaster:function(){return null;},findBoxes:function(){return[];},getMaster:function(){return this.master;},setMaster:function(m){this.master=m;},getBoxes:function(){return this.boxes;},setBoxes:function(b){this.boxes=b;},getChecked:function(name){var func=name?function(c){return c.checked&&c.name===name;}:function(c){return c.checked;};return LMI.Lang.filter(this.getBoxes(),func);},checkMaster:function(){var m=this.getMaster();if(m){m.checked=this.getChecked().length===this.getBoxes().length;}},boxClick:function(e){this.checkMaster();this.toggleCommands();},checkAll:function(checked){LMI.Lang.forEach(this.getBoxes(),function(o){o.checked=checked;});this.toggleCommands();},masterClick:function(e){var c=this.getMaster().checked;this.checkAll(this.getMaster().checked);},addToggleFunction:function(func,el){var i;func=func||Checkboxes.anyChecked;if(!this.toggleFuncs){this.toggleFuncs=[];this.toggleElems=[];}
i=LMI.Lang.indexOf(this.toggleFuncs,func);if(i===-1){i=this.toggleFuncs.length;this.toggleFuncs.push(func);this.toggleElems[i]=[];}
if(el instanceof Array){this.toggleElems[i]=this.toggleElems[i].concat(el);}else{this.toggleElems[i].push(el);}},toggleCommands:function(){var i,iLen;for(i=0,iLen=this.toggleFuncs.length;i<iLen;++i){if(this.toggleFuncs[i](this)){this.enable(this.toggleElems[i]);}else{this.disable(this.toggleElems[i]);}}},enable:function(el){if(el instanceof Array){LMI.Lang.forEach(el,function(o){o.disabled=false;});}else{el.disabled=false;}},disable:function(el){if(el instanceof Array){LMI.Lang.forEach(el,function(o){o.disabled=true;});}else{el.disabled=true;}}};Checkboxes.anyChecked=function(list){return LMI.Lang.some(list.getBoxes(),function(c){return c.checked;});};return Checkboxes;})();function HideNewLocFlyout(){var remove=false;for(var i in this.flyouts){if(this.flyouts.hasOwnProperty(i)){var f=this.flyouts[i];if(typeof f=='object'&&f.id){DS.map.removeObject(this.flyouts[i].id);this.flyouts[i].id=null;remove=true;}}}
if(remove){DS.map.removeObject(this);}}
function DropNewLocation(e,o){var i=o.element;var xy=LMI.Element.getOffsets(DS.map.container);var x=(e.elementEndPosition.x-xy.x)+LMI.Mapping.TravelMarker.X_OFFSET;var y=(e.elementEndPosition.y-xy.y)+LMI.Mapping.TravelMarker.Y_OFFSET;if(x>0&&x<=DS.map.width&&y>0&&y<=DS.map.height){var p=DS.map.getPointByXY(x,y);var d=new LMI.Mapping.DragNDropMarker(p);d.map=DS.map;d.hideFlyout=HideNewLocFlyout;DS.map.addObject(d);d.showFlyout('edit');}
LMI.Element.destroy(i);}
function CreateNewLocation(evt){var e=new LMI.BrowserEventObject(evt,window.event,this);if(e.getCurrentTarget()==e.getTarget()){var i=e.getCurrentTarget(),icon=i.cloneNode(false);document.getElementsByTagName('body')[0].appendChild(icon);var src=LMI.Element.getImageSrc(icon);src=src.replace(/labels/,'map_nodes');src=src.replace(/\.gif/,'.png');LMI.Element.setImageSrc(icon,src);var xy=LMI.Element.getOffsets(i);icon.style.position='absolute';icon.style.left=xy.x+'px';icon.style.top=xy.y+'px';var d=new DSInteraction.Drag(icon);d.startDrag(e);d.addEventListener('endDrag',DropNewLocation);}}
LMI.Mapping.DragNDropMarker=(function(){var Y=YAHOO.util,$E=Y.Event,_E=LMI.Element,create=_E.create,$=_E.getOne;function DragNDropMarker(point){this.init(point);}
LMI.Lang.extend(DragNDropMarker,LMI.Mapping.TravelMarker);var proto=DragNDropMarker.prototype;proto.getRecommendedIconSrc=function(){return LMI.Urls.getImg('map_nodes/blue/map_icon_plus.png');};function setSaveButtonEnabled(button,input){button.disabled=!input.value.length;}
function createEditFlyout(poi){var timer,id=poi.getProperty('id'),body=create('div',null);create('p',body,{className:'flyoutName',textValue:id?LMI.Strings.getString('js.map.saved.location.edit.title',poi.getProperty('name')):LMI.Strings.getString('js.map.new.place.create.title')});var f=create('form',body,{action:$('form#removeForm').action,method:'post'});create('input',f,{type:'hidden',name:'dsAction',value:'savePlace'});if(typeof EditLocationCallback=='function'){LMI.BrowserEvent.addListener(f,'submit',function(e){EditLocationCallback(e,poi);});}
if(id){create('input',f,{type:'hidden',name:'locationId',value:id});}
create('input',f,{type:'hidden',name:'latitude',value:poi.point.lat});create('input',f,{type:'hidden',name:'longitude',value:poi.point.lng});create('label',f,{textValue:LMI.Strings.getString('js.map.new.place.name'),'for':'locationName'});var i=create('input',f,{type:'text',name:'locationName',id:'locationName',value:poi.getProperty('name'),maxLength:128});if(id){create('a',f,{textValue:LMI.Strings.getString('js.map.saved.location.remove'),'class':'delete',href:_prepareUrl(LMI.Urls.get("removemyplaces.ds"))+'savedLocationIds='+poi.getProperty('id')});}
var saveBtn=create('input',f,{type:'submit',name:'save',value:'save'});setSaveButtonEnabled(saveBtn,i);var cancelBtn=create('input',f,{type:'reset',value:'cancel',browserEvents:{click:LMI.Mapping.IconWithFlyout.hideFlyouts}});window.setTimeout(function(){i.focus();},0);LMI.BrowserEvent.addListener(i,'click',function(evt){var e=new LMI.BrowserEventObject(evt,window.event,this);i.focus();e.stopPropagation();});var killEvent=function(evt){var e=new LMI.BrowserEventObject(evt,window.event,this);e.stopPropagation();};LMI.BrowserEvent.addListener(i,'mousedown',killEvent);timer=window.setInterval(function(){var a=poi.getActiveFlyout();if(a&&a.type==='edit'){setSaveButtonEnabled(saveBtn,i);}else{window.clearInterval(timer);}},100);return body;}
DragNDropMarker.flyoutFactory=LMI.Mapping.TravelMarker.flyoutFactory.clone();DragNDropMarker.flyoutFactory.addContentCreator('edit',createEditFlyout);proto.getFlyoutFactory=function(){return DragNDropMarker.flyoutFactory;};return DragNDropMarker;})();LMI.Init.addFunction(function(){var i=document.getElementById('newLoc');if(i){LMI.BrowserEvent.addListener(i,'mousedown',CreateNewLocation);}});function MyPlacesEditForm_GetId(){if(this.id){return this.id.value;}}
function MyPlacesEditForm_SetId(id){if(this.id){this.id.value=id;}}
function MyPlacesEditForm_GetNote(){if(this.note){return this.note.value;}}
function MyPlacesEditForm_SetNote(note){if(this.note){this.note.value=note;}}
function MyPlacesEditForm_GetName(){if(this.name){return this.name.value;}}
function MyPlacesEditForm_SetName(name){if(this.name){this.name.value=name;}}
function MyPlacesEditForm_GetAddress(){if(this.address){return this.address.value;}}
function MyPlacesEditForm_SetAddress(addr){if(this.address){this.address.value=addr;}}
function MyPlacesEditForm_GetLatitude(){return this.lat?this.lat.value:'';}
function MyPlacesEditForm_SetLatitude(addr){if(this.lat){this.lat.value=addr;}}
function MyPlacesEditForm_GetLongitude(){return this.lng?this.lng.value:'';}
function MyPlacesEditForm_SetLongitude(addr){if(this.lng){this.lng.value=addr;}}
function MyPlacesEditForm_GetAltLocation(){if(this.altLocations.length){var a=LMI.Lang.filter(this.altLocations,function(o){return o.checked;});return a.length?a[0].value:'';}
return'';}
function MyPlacesEditForm_Focus(){if(this.name){this.name.focus();}}
function MyPlacesEditForm_Show(){var _C=LMI.Element.create;if(!this.form){if((this.form=document.getElementById('editRow'))){this.insertBeforePoint=this.form.nextSibling;this.shown=true;var inps=this.form.getElementsByTagName('input');for(var i=0;i<inps.length;++i){switch(inps[i].name){case'locationId':this.id=inps[i];break;case'locationName':this.name=inps[i];break;case'locationValue':this.address=inps[i];break;case'locationNote':this.note=inps[i];break;case'latitude':this.lat=inps[i];break;case'longitude':this.lng=inps[i];break;case'save':this.saveButton=inps[i];break;case'cancel':this.cancelButton=inps[i];break;default:if(inps[i].name=='altLocation'){this.altLocations.push(inps[i]);}}}}else{var t=document.getElementById('mylistTbl');this.insertBeforePoint=t.getElementsByTagName('tbody')[0];var c,p;this.form=document.createElement('tbody');this.form.id='editRow';p=_C('tr',this.form);c=_C('td',p,{className:'cb'});c=_C('td',p,{className:'node'});c=_C('td',p);p=_C('p',c);this.id=_C('input',p,{type:'hidden',id:'locationId',name:'locationId'});this.lat=_C('input',p,{type:'hidden',id:'locationLat',name:'latitude'});this.lng=_C('input',p,{type:'hidden',id:'locationLng',name:'longitude'});_C('label',p,{textValue:LMI.Strings.getString('js.locname')+':','for':'locationName'});this.name=_C('input',p,{type:'text',id:'locationName',name:'locationName',maxLength:128});p=_C('p',c);_C('label',p,{textValue:LMI.Strings.getString('js.addr')+':','for':'locationAddress'});this.address=_C('input',p,{type:'text',id:'locationAddress',name:'locationValue'});p=_C('p',c);this.saveButton=_C('input',p,{type:'image',name:'save',src:LMI.Urls.getImg('btn_save.gif'),alt:LMI.Strings.getString('js.save')});this.cancelButton=_C('input',p,{type:'image',name:'cancel',src:LMI.Urls.getImg('btn_cancel.gif'),alt:LMI.Strings.getString('js.cancel')});}
LMI.BrowserEvent.addListener(this.cancelButton,'click',mywww_edit_cancel);}
if(!this.shown){this.insertBeforePoint.parentNode.insertBefore(this.form,this.insertBeforePoint);this.shown=true;}
this.setDsAction('savePlace');mywww_editFormBoxes_init();}
function MyPlacesEditForm_Hide(){if(this.form){this.form.parentNode.removeChild(this.form);}
this.shown=false;}
function MyPlacesEditForm(){this.shown=false;this.altLocations=[];}
MyPlacesEditForm.prototype.show=MyPlacesEditForm_Show;MyPlacesEditForm.prototype.hide=MyPlacesEditForm_Hide;MyPlacesEditForm.prototype.focus=MyPlacesEditForm_Focus;MyPlacesEditForm.prototype.getId=MyPlacesEditForm_GetId;MyPlacesEditForm.prototype.setId=MyPlacesEditForm_SetId;MyPlacesEditForm.prototype.getNote=MyPlacesEditForm_GetNote;MyPlacesEditForm.prototype.setNote=MyPlacesEditForm_SetNote;MyPlacesEditForm.prototype.getName=MyPlacesEditForm_GetName;MyPlacesEditForm.prototype.setName=MyPlacesEditForm_SetName;MyPlacesEditForm.prototype.getAddress=MyPlacesEditForm_GetAddress;MyPlacesEditForm.prototype.setAddress=MyPlacesEditForm_SetAddress;MyPlacesEditForm.prototype.setLatitude=MyPlacesEditForm_SetLatitude;MyPlacesEditForm.prototype.getLatitude=MyPlacesEditForm_GetLatitude;MyPlacesEditForm.prototype.getLongitude=MyPlacesEditForm_GetLongitude;MyPlacesEditForm.prototype.setLongitude=MyPlacesEditForm_SetLongitude;MyPlacesEditForm.prototype.getAltLocation=MyPlacesEditForm_GetAltLocation;MyPlacesEditForm.prototype.setDsAction=function(action){var i=LMI.Element.getOne('input[name=dsAction]');i.value=action;};function MyWWW(){this.myPlaces=[];this.editForm=new MyPlacesEditForm();}
function mywww_edit_cancel(){DS.mywww.editForm.hide();DS.mywww.editForm.setDsAction('removePlaces');}
function mywww_editFormBoxes_init(){var inputs=['locationName','locationAddress','locationNote'];for(var j=0;j<inputs.length;++j){var inp=document.getElementById(inputs[j]);if(inp){LMI.BrowserEvent.addListener(inp,'focus',mywww_editFormBoxes_handler);LMI.BrowserEvent.addListener(inp,'blur',mywww_editFormBoxes_handler);}}}
function mywww_editFormBoxes_handler(evt){var e=new LMI.BrowserEventObject(evt,window.event,this);if(e.type=='focus'){if(!YAHOO.util.Dom.hasClass(e.getCurrentTarget(),'focused')){YAHOO.util.Dom.addClass(e.getCurrentTarget(),'focused');}}else{YAHOO.util.Dom.removeClass(e.getCurrentTarget(),'focused');}}
DS.MyPlaces={};(function(){var $E=YAHOO.util.Event,_E=LMI.Element,_C=_E.create;var N;N=DS.MyPlaces.Note={};N.setValue=function(p,val){if(p){DOMNode.truncate(p);_C(null,p,{textValue:val});}};N.showForm=function(e){var a=this,tbody=DOMNode.findAncestor(a,'tbody'),p=_E.getOne('p.note',tbody),value='';if(!p){var o=_E.getOne('ul.lmLinkList',tbody);p=_C('p',null,{className:'note'});DOMNode.appendAfter(p,o);}else{var i=p.getElementsByTagName('input')[0];if(i){return;}
var t=DOMNode.findFirstTextChild(p);if(t){value=t.nodeValue;}
DOMNode.truncate(p);}
var form=_C('form',p,{'class':'noteForm'});var note=_C('input',form,{type:'text',name:'note',value:value,maxLength:256});var save=_C('input',form,{type:'submit',value:'save'});var cancel=_C('input',form,{type:'reset',value:'cancel',rel:value});$E.on(form,'submit',N.saveNote);$E.on(cancel,'click',N.cancelEdit);note.focus();var jsp=new LMI.Url.VoidParser(a.href);var v=jsp.getOneValue('id');_C('input',form,{type:'hidden',name:'id',value:v});v=jsp.getOneValue('listing');_C('input',form,{type:'hidden',name:'listing',value:v});if(!v){v=jsp.getOneValue('name');_C('input',form,{type:'hidden',name:'name',value:v});v=jsp.getOneValue('latitude');if(v){_C('input',form,{type:'hidden',name:'latitude',value:v});v=jsp.getOneValue('longitude');_C('input',form,{type:'hidden',name:'longitude',value:v});}else{v=jsp.getOneValue('address');_C('input',form,{type:'hidden',name:'address',value:v});}}};N.getFormElements=function(form){var elems={};var inps=form.getElementsByTagName('input');LMI.Lang.forEach(inps,function(o){if(o.name){elems[o.name]=o.value;}});return elems;};N.saveNote=function(e){var A=LMI.AjaxController,f=this,p=DOMNode.findAncestor(f,'p'),t=DOMNode.findAncestor(p,'tbody'),l=N.getFormElements(f);N.setValue(p,l.note);if(l.listing=='true'){A.editListingNote(function(){},l.id,l.note);}else{if(l.latitude){A.saveSavedLocationLatLng(function(){},l.id,l.name,'',l.latitude,l.longitude,l.note);}else{A.saveSavedLocation(function(){},l.id,l.name,l.address,l.note);}}
var a=DOMNode.getByTagAndClass(t,'a','addEditLink')[0];if(a){a.firstChild.nodeValue=LMI.Strings.getString(l.note?'js.myplaces.note.edit':'js.myplaces.note.add');}
$E.stopEvent(e);};N.cancelEdit=function(e){var b=this,value=b.getAttribute('rel');p=DOMNode.findAncestor(b,'p');N.setValue(p,value);$E.stopEvent(e);};LMI.LinkBehavior.add('editNote',N.showForm);})();LMI.MyPlaces=(function(){var $E=YAHOO.util.Event,_E=LMI.Element,$=_E.getOne;var map,cbs,M=LMI.Mapping,collection=new DSMapObject_Collection();var MyPlaces={setToggleIconLinkText:function(tbody,shown){var m=LMI.Strings.getString(shown?'js.myplaces.remove.from.map':'js.myplaces.show.on.map');LMI.Lang.forEach(_E.getAll('a.iconLink',tbody),function(o){var t=DOMNode.findFirstTextChild(o);if(t){t.nodeValue=m;}});},toggleIconOnMap:function(e){var icon,src,tbody=DOMNode.findAncestor(this,'tbody'),img=$('img.node',tbody),p=new LMI.Url.VoidParser(this.href),id=p.getOneValue('id'),ids=map.objects.getIdsByProperty('id',id),ribbon=$('dd.ribbon img',tbody);if(ids.length){src=_E.getImageSrc(ribbon);_E.setImageSrc(ribbon,src.replace(/([^\/]+?)(?:_disabled)?\.(png|gif)$/,'$1_disabled.$2'));src=_E.getImageSrc(img);_E.setImageSrc(img,src.replace(/labels\/[^\/]+/,'labels/disabled/'));map.removeObject(ids[0]);MyPlaces.setToggleIconLinkText(tbody,false);}else{ids=collection.getIdsByProperty('id',id);if(ids.length){icon=collection.getById(ids[0]);src=_E.getImageSrc(ribbon);_E.setImageSrc(ribbon,src.replace(/_disabled/,''));map.addObject(icon);src=icon.getIconSrc();_E.setImageSrc(img,src.replace(/map_nodes\/+(.+)\.png$/,'labels/$1.gif'));}else{alert(LMI.Strings.getString('js.noaddr'));}
MyPlaces.setToggleIconLinkText(tbody,true);}
map.bestFit();},getDirections:function(e){var i,de=document.getElementById('dirsErr'),f=new LMI.Form(),c=cbs.getChecked();if(c.length>12){var h=document.getElementById('titleAndErrors');if(h&&!de){LMI.Element.create('div',h,{id:'dirsErr',textValue:LMI.Strings.getString('js.directions.too.many.stops')});}
return false;}
if(de){de.parentNode.removeChild(de);}
for(i=0;i<c.length;++i){if(c[i].name==='listingId'){f.setVar('location',c[i].value,true,false);f.setVar('locationType','listing',true,false);}else if(c[i].name==='savedLocationIds'){f.setVar('location',c[i].value,true,false);f.setVar('locationType','saved',true,false);}}
f.go(this.value);$E.stopEvent(e);},newLocation:function(e){if(!DS.mywww){DS.mywww=new MyWWW();}
DS.mywww.editForm.show();DS.mywww.editForm.setId('');DS.mywww.editForm.setName('');DS.mywww.editForm.setNote('');DS.mywww.editForm.setAddress('');DS.mywww.editForm.setLatitude('');DS.mywww.editForm.setLongitude('');DS.mywww.editForm.focus();$E.stopEvent(e);},editLocation:function(e){if(!DS.mywww){DS.mywww=new MyWWW();}
var p=new LMI.Url.VoidParser(this.href);if(p.parsed){var i=p.getOneValue('id'),loc=collection.getByProperty('id',i);if(loc){DS.mywww.editForm.show();DS.mywww.editForm.setId(loc.getProperty('id'));DS.mywww.editForm.setName(loc.getProperty('name'));DS.mywww.editForm.setNote(loc.getProperty('note'));DS.mywww.editForm.setAddress(loc.getProperty('address'));DS.mywww.editForm.setLatitude(loc.point.lat);DS.mywww.editForm.setLongitude(loc.point.lng);DS.mywww.editForm.focus();}}
$E.stopEvent(e);},checkAll:function(e){cbs.checkAll(true);$E.stopEvent(e);},checkNone:function(e){cbs.checkAll(false);$E.stopEvent(e);}};LMI.LinkBehavior.add('toggleIcon',MyPlaces.toggleIconOnMap);LMI.LinkBehavior.add('newLocation',MyPlaces.newLocation);LMI.LinkBehavior.add('editLocation',MyPlaces.editLocation);LMI.LinkBehavior.add('checkAll',MyPlaces.checkAll);LMI.LinkBehavior.add('checkNone',MyPlaces.checkNone);LMI.Init.addFunction(function(){var i=0,added=0,propList=['id','name','listing'];map=new M.InteractiveMap('#mapImage',LMI.Data.mapOptions);map.addControls();DS.map=map;LMI.Lang.forEach(LMI.Data.listBusinesses,function(p){var point;if(!p.listing||p.geoCoded){point=new MyPlaces.MyPlacesMarker(new M.Point(p.latitude,p.longitude),i++);LMI.Lang.forEach(propList,function(o){point.setProperty(o,p[o]);});point.setProperty('inList',true);if(!p.listing){point.setProperties('address',p.locationValue,'note',p.note);}
collection.add(point);if(added++<10){map.addObject(point);}}});map.bestFit();});LMI.Init.addFunction(function(){var remove=$('#removeLocs'),dirs=$('#getDirections');cbs=new LMI.MyPlaces.Checkboxes();dirs.LMIClickFunction=MyPlaces.getDirections;cbs.addToggleFunction(null,[remove,dirs]);cbs.toggleCommands();});LMI.Init.addFunction(function(){if($('#editRow')){DS.mywww=new MyWWW();DS.mywww.editForm.show();}});return MyPlaces;})();LMI.MyPlaces.MyPlacesMarker=function(point,option){this.init(point,option);};LMI.Lang.extend(LMI.MyPlaces.MyPlacesMarker,LMI.Mapping.Icon);LMI.MyPlaces.Checkboxes=(function(){var $E=YAHOO.util.Event;function killEvent(e){$E.stopEvent(e);this.blur();}
function Checkboxes(){this.init();}
LMI.Lang.extend(Checkboxes,LMI.Checkboxes);var proto=Checkboxes.prototype;proto.findBoxes=function(){return LMI.Element.getAll('#mylistTbl input[type=checkbox]');};proto.enable=function(el){var src,that=this;if(el instanceof Array){LMI.Lang.forEach(el,function(o){that.enable(o);});}else{el.src=el.src.replace(/_disabled\./,'.');$E.removeListener(el,'click',killEvent);if(el.LMIClickFunction){$E.on(el,'click',el.LMIClickFunction);}}};proto.disable=function(el){var that=this;if(el instanceof Array){LMI.Lang.forEach(el,function(o){that.disable(o);});}else{el.src=el.src.replace(/(?:_disabled)?\.([^.]+)$/,'_disabled.$1');if(el.LMIClickFunction){$E.removeListener(el,'click',el.LMIClickFunction);}
$E.on(el,'click',killEvent);}};return Checkboxes;})();