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.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,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'));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:'#'}]});$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);});a=c('p',body,{'class':'fnLink',children:[{elType:'img',src:LMI.Urls.getImg('labels/special/map_icon_attraction.gif'),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);}
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);}
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);}
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,c=LMI.Element.create,body=c('div',null);if(poi.getProperty('id')){elem={elType:'a',textValue:poi.getProperty('name'),href:_prepareUrl('/attraction_details.html')+'detailsListingId='+poi.getProperty('id'),'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('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(){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(){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.SavePlaces=(function(){var Y=YAHOO.util;var SavePlaces={getId:function(link){if(link.id.match(/listing_(.+)/)){return RegExp.$1;}
return"";},saveListing:function(e){var p,id=SavePlaces.getId(this);if(id){LMI.AjaxController.addToMyList(function(){},[id],null);p=LMI.Element.create('a',null,{href:'/my_places.html',className:'saved',textValue:LMI.Strings.getString('js.inplacespc')});this.parentNode.replaceChild(p,this);}
Y.Event.stopEvent(e);}};LMI.LinkBehavior.add('saveListing',SavePlaces.saveListing);return SavePlaces;})();LMI.Cookies=(function(){var C={create:function(name,value,days,domain){var cookie,date;cookie=name+"="+value;if(days){date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));cookie+="; expires="+date.toGMTString();}
if(domain){cookie+="; domain="+domain;}
cookie+="; path=/";document.cookie=cookie;},get:function(name){var i,len,c,nameEq=name+"=",ca=document.cookie.split(';');for(i=0,len=ca.length;i<len;++i){c=ca[i];while(c.charAt(0)===' '){c=c.substring(1,c.length);}
if(c.indexOf(nameEq)===0){return c.substring(nameEq.length,c.length);}}
return null;},remove:function(name){C.create(name,"",-1);}};return C;})();LMI.MapPage=(function(){var mapCont,L;L={hiliteElement:function(el){el.style.backgroundColor='#e1e1e1';},unHiliteElement:function(el){el.style.backgroundColor='#fff';},locationHilite:function(evt){var map=LMI.MapInit.getMap();if(!map){return;}
var e=new LMI.BrowserEventObject(evt,window.event,this);var lid=e.getCurrentTarget().id.substring(7);var mapObj=map.objects.getByProperty('id',lid);if(!mapObj){mapObj=map.objects.getByProperty('listingId',lid);}
if(e.getType()==='mouseover'){LMI.MapPage.hiliteElement(e.getCurrentTarget());if(mapObj&&(typeof mapObj.addHilite!=='undefined')){if(mapObj.toId){window.clearTimeout(mapObj.toId);mapObj.toId=null;}else{mapObj.addHilite();}}}else{LMI.MapPage.unHiliteElement(e.getCurrentTarget());if(mapObj&&(typeof mapObj.removeHilite!=='undefined')){mapObj.toId=window.setTimeout(function(){mapObj.removeHilite();},0);}}}};LMI.Init.addFunction(function(){mapCont=document.getElementById('mapImage');LMI.Data.mapOptions.enableResize=false;LMI.Data.mapOptions.enableOverview=false;if((d=document.getElementById('resultsTbl'))){LMI.Lang.forEach(d.getElementsByTagName('tr'),function(o){if(!YAHOO.util.Dom.hasClass(o,'skip')){LMI.BrowserEvent.addListener(o,'mouseover',L.locationHilite);LMI.BrowserEvent.addListener(o,'mouseout',L.locationHilite);}});}},45);return L;})();