
(function(window,undefined){var zoozag=window.zoozag=window.zoozag||{},maps,location,listing,marker,mapIcon,infoWindow;maps=zoozag.Maps=function Maps(name,configName,locations,defaultLocation){if(!window.google&&window.google.maps)return false;var t=this,center,bounds=new google.maps.LatLngBounds(),config=t.config=configName&&maps.config[configName]?maps.config[configName](t):null,defaultConfig=maps.config.__default(t);t.name=name;t.configName=configName;t.collection[name]=t;for(var x in config){if(!t[x])t[x]=config[x];}
for(var x in defaultConfig){if(!t[x])t[x]=defaultConfig[x];}
for(var x in t.functions){if(!t[x])t[x]=t.functions[x];}
t.element=document.getElementById(t.elementId);maps.current=t.defaultCurrentDisabled&&!maps.current||!t.defaultCurrentDisabled?this:maps.current;if(t.preMapLoad)t.preMapLoad.call(this);t.map=new google.maps.Map(t.element,t.options);if(t.postMapLoad)t.postMapLoad.call(this);t.setupGenericOverlayView();t.parseLocations(bounds,locations);center=bounds.getCenter();if(defaultLocation){t.defaultLocation=new t.location(new google.maps.LatLng(defaultLocation.latitude,defaultLocation.longitude));bounds.extend(t.defaultLocation.point);}
t.checkMaximumZoom(center);t.map.fitBounds(bounds);google.maps.event.addListenerOnce(t.map,'tilesloaded',function(){t.parseMarkers();});Event.observe(window,'unload',function(){t.element=null;for(var x in t.markers){t.markers[x].unload();}
if(t.unload){t.unload();}
t.map=null;});};maps.collection=maps.prototype.collection={};maps.ContentItemMap=function ContentItemMap(map_id,locations,mapOptions,defaultLocInfo){new zoozag.Maps('contentItemMap','contentItemMap',locations,defaultLocInfo,mapOptions);}
maps.ContentItemMapL=function ContentItemMapL(map_id,locations,mapOptions,defaultLocInfo){new zoozag.Maps('contentItemMapL','contentItemMapL',locations,defaultLocInfo,mapOptions);}
maps.SearchMap=function SearchMap(map_id,locations,mapOptions,defaultLocInfo){new zoozag.Maps('searchMapL','searchMapL',locations,defaultLocInfo,mapOptions);new zoozag.Maps('searchMap','searchMap',locations,defaultLocInfo,mapOptions);}
maps.config={__default:function __default(t){return{options:{zoom:13,mapTypeControl:false,mapTypeId:google.maps.MapTypeId.ROADMAP,scrollwheel:false},locations:{},markersByLocation:{},markers:{}};},searchMap:function searchMap(t){return{elementId:'search_map_canvas',supportsFeaturedListings:true,functions:{switchToLargeMap:function switchToLargeMap(){$('content').addClassName('zg-searchMapL-showing');window.scrollTo(0,$('main').offsetTop);maps.current=maps.collection['searchMapL'];},setupEnlargeLink:function setupEnlargeLink(){var t=this,enlargeLink=document.getElementById('zg-searchMap-enlargeLink-a');if(enlargeLink){enlargeLink.onclick=function(){t.switchToLargeMap();return false;}}},maintainMapPosition:function maintainMapPosition(){var mapItem=$('search_result_map'),mapInnerX=mapItem.offsetLeft,content=$('content'),relX=mapItem.offsetLeft,relY=mapItem.offsetTop,mapViewportOffset,mapTopPadding=14,mapHeight=mapItem.offsetHeight,pageOffsetY,pageOffsetX,contentViewportOffsetY,contentViewportOffsetX,contentCumulativeOffset=content.cumulativeOffset(),contentHeight=content.getHeight(),topMapOffset,contentRemaining,transformProperty=(function getTransformProperty(element){var transformProperties=['transform','WebkitTransform'];for(var x=0;x<transformProperties.length;x++){if(typeof element.style[transformProperties[x]]!='undefined')return transformProperties[x];}})(mapItem),fixedPosition=!transformProperty&&(function getFixedPositionSupported(element,supported){element.style.position='fixed';mapItem.appendChild(element);supported=element.offsetParent!=mapItem;mapItem.removeChild(element);return supported;})(document.createElement('div')),maxOffsetTop=$('search_results').offsetTop,state=0;(this.maintainMapPosition=function maintainMapPosition(force){if(!mapItem)return;if(force){contentCumulativeOffset=content.cumulativeOffset();state=null;}
pageOffsetY=window.scrollY||document.body.scrollTop||document.body.parentNode.scrollTop;contentViewportOffsetY=contentCumulativeOffset.top-pageOffsetY;topMapOffset=mapTopPadding+mapItem.offsetHeight+10;contentRemaining=contentHeight+contentViewportOffsetY;if(contentViewportOffsetY+relY-mapTopPadding<=0&&topMapOffset<=contentRemaining){if(state!=1){if(!transformProperty){if(fixedPosition){pageOffsetX=window.scrollX||document.body.scrollLeft||document.body.parentNode.scrollLeft;contentViewportOffsetX=pageOffsetX+contentCumulativeOffset.left;mapItem.style.left=contentViewportOffsetX+relX+'px';mapItem.style.top=mapTopPadding+'px';mapItem.style.position='fixed';}}else{mapItem.style.top='';}}
if(transformProperty){mapItem.style[transformProperty]='translateY('+(-1*contentViewportOffsetY-relY+mapTopPadding)+'px)';}else if(!fixedPosition){mapItem.style.top=-1*contentViewportOffsetY+mapTopPadding+'px';}
state=1}else{if(state!=0&&state!=2){if(topMapOffset>contentRemaining){state=2;mapItem.style.top=contentHeight-mapHeight-10+'px';}else{state=0;mapItem.style.top='';}
if(transformProperty){mapItem.style[transformProperty]='';}else{mapItem.style.left='';mapItem.style.position='';}}}})();},preMapLoad:function preMapLoad(){this.setupEnlargeLink();this.maintainMapPosition();Event.observe(window,'scroll',this.maintainMapPosition);Event.observe(window,'resize',(function(t){return function(){t.maintainMapPosition(true);};})(this));},postMapLoad:function postMapLoad(){this.setupCustomMarkers();}},markerEvents:{onmouseover:function markerMouseover(){this.listingShow();this.location.highlightListings();},onmouseout:function markerMouseout(e){this.listingHide();this.location.unhighlightListings();},onclick:function markerClick(){this.mapWrapper.switchToLargeMap();maps.current.locations[this.location.pointString].marker.listingShowFull();},ondblclick:function markerDblclick(e){e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();return false;}},mapIconConfig:{__default:function(){return{baseClassName:'zg-map-marker-small-',size:new google.maps.Size(26,34),defaultName:'icon',shadow:'shadow',hover:'hover',circle:'circle',hoverSpan:'hoverSpan',mouseTarget:'mouseTarget',circleMouseTarget:'circleMouseTarget'};},hover:function(){return{};},featured:function(){return{};},shadow:function(){return{};},circle:function(){return{size:new google.maps.Size(23,24)}},hoverSpan:function(){return{};},mouseTarget:function(){return{};},circleMouseTarget:function(){return{size:new google.maps.Size(23,24)}}}};},searchMapL:function searchMapL(t){return{options:{zoom:13,mapTypeControl:true,mapTypeId:google.maps.MapTypeId.ROADMAP,navigationControl:true,navigationControlOptions:{style:google.maps.NavigationControlStyle.ZOOM_PAN},scrollwheel:false},elementId:'zg-searchMapL-canvas',supportsFeaturedListings:true,defaultCurrentDisabled:true,functions:{switchToSmallMap:function switchToSmallMap(){window.scrollTo(0,$('main').offsetTop);if(maps.collection['searchMap'])maps.collection['searchMap'].element.parentNode.style.top='';$('content').removeClassName('zg-searchMapL-showing');if(maps.current.currentInfoWindow)maps.current.currentInfoWindow.marker.listingHideFull();maps.current=maps.collection['searchMap'];},setupReduceLink:function setupReduceLink(){var t=this,reduceLink=document.getElementById('zg-searchMap-reduceLink-a');if(reduceLink){reduceLink.onclick=function(){t.switchToSmallMap();return false;}}},unload:function unload(){var reduceLink=document.getElementById('zg-searchMap-reduceLink-a');if(reduceLink){reduceLink.onclick=null;}},preMapLoad:function preMapLoad(){this.setupReduceLink();},postMapLoad:function postMapLoad(){google.maps.event.addListener(maps.current.map,'drag',function(){var infoWindow=maps.current.currentInfoWindow;if(infoWindow){infoWindow.setPosition();if(infoWindow.shadow)infoWindow.setPosition(infoWindow.shadow);}});google.maps.event.addListener(maps.current.map,'bounds_changed',function(){var infoWindow=maps.current.currentInfoWindow;if(infoWindow){infoWindow.setPosition();if(infoWindow.shadow)infoWindow.setPosition(infoWindow.shadow);}});this.setupCustomMarkers();infoWindow=marker.infoWindow=function InfoWindow(marker){var t=this;t.map=marker.mapWrapper;t.marker=marker;t.add();};infoWindow.prototype=new google.maps.OverlayView();infoWindow.prototype.add=function add(){this.setMap(this.map.map);};infoWindow.prototype.onAdd=function onAdd(){};infoWindow.prototype.remove=function remove(){this.setMap(null);};infoWindow.prototype.onRemove=function onRemove(){};infoWindow.prototype.unload=function unload(){var t=this;t.container=t.innerContainer=t.containerTop=t.containerBody=t.containerBottom=null;t.containerList=t.closeLink=t.shadow=t.shadowTop=t.shadowBody=t.shadowBottom=null;};infoWindow.prototype.draw=function draw(){if(!this.container){this.setup();}else if(this.container.parentNode!=this.getPanes().floatPane){this.container.parentNode.removeChild(this.container);this.getPanes().floatPane.appendChild(this.container);this.setPosition();this.updateShadow();this.recenter();}};infoWindow.prototype.setup=function setup(){var t=this,panes=t.getPanes(),container=t.container=document.createElement('div'),innerContainer=t.innerContainer=document.createElement('div'),containerTop=t.containerTop=document.createElement('div'),containerBody=t.containerBody=document.createElement('div'),containerBottom=t.containerBottom=document.createElement('div'),containerList=t.containerList=document.createElement('ul'),closeLink=t.closeLink=document.createElement('a'),shadow=t.shadow=document.createElement('div'),shadowTop=t.shadowTop=document.createElement('div'),shadowBody=t.shadowBody=document.createElement('div'),shadowBottom=t.shadowBottom=document.createElement('div'),listItems=t.listItems=[],listItem;container.id='zg-searchMapL-infoWindow-'+t.marker.location.pointString;container.className='zg-searchMapL-infoWindow-container';closeLink.className='zg-modal-close zg-searchMapL-infoWindow-close';closeLink.href='#';closeLink.onclick=(function(t){return function(){t.marker.listingHideFull();return false;};})(t);closeLink.title='Close';innerContainer.className='zg-searchMapL-infoWindow-innerContainer';containerList.className='zg-searchMapL-infoWindow-containerList';containerTop.className='png24 zg-searchMapL-infoWindow-containerTop';containerBody.className='png24 zg-searchMapL-infoWindow-containerBody';containerBottom.className='png24 zg-searchMapL-infoWindow-containerBottom';containerBottom.innerHTML='<div class="png24 zg-searchMapL-infoWindow-containerTip"></div>';for(var x=0,content,link,linkContainer,listingAmount=t.marker.location.listings.length;x<listingAmount;x++){listItem=document.createElement('li');listItem.className='zg-searchMapL-infoWindow-li';listItem.innerHTML=content=t.getContentItem(t.marker.location.listings[x]);if(listingAmount>1){link=document.createElement('a');link.href='#';link.className='zg-searchMapL-infoWindow-nextLink-a';link.innerHTML=(x+1)+' of '+t.marker.location.listings.length+' results';link.onclick=(function(t){return function(){t.displayNext.call(t);t.recenter();return false;};})(t);linkContainer=document.createElement('span');linkContainer.className='zg-searchMapL-infoWindow-nextLink';linkContainer.appendChild(link);listItem.appendChild(linkContainer);listItem}
listItems.push(listItem);containerList.appendChild(listItem);}
t.currentListItem=0;$(listItems[0]).addClassName('zg-searchMapL-infoWindow-li-visible');t.setPosition();containerBody.appendChild(containerList);innerContainer.appendChild(containerTop);innerContainer.appendChild(containerBody);innerContainer.appendChild(containerBottom);container.appendChild(innerContainer);container.appendChild(closeLink);panes.floatPane.appendChild(container);shadow.className='zg-searchMapL-infoWindow-shadow';shadowTop.className='png24 zg-searchMapL-infoWindow-shadowTop';shadowBottom.className='png24 zg-searchMapL-infoWindow-shadowBottom';shadowBody.className='png24 zg-searchMapL-infoWindow-shadowBody';shadow.appendChild(shadowTop);shadow.appendChild(shadowBody);shadow.appendChild(shadowBottom);t.updateShadow()
panes.floatShadow.appendChild(shadow);t.show();};infoWindow.prototype.updateShadow=function updateShadow(){if(this.shadow){this.setPosition(this.shadow);this.shadowBody.style.height=this.innerContainer.offsetHeight-21+'px';}};infoWindow.prototype.displayNext=function displayNext(){var t=this;if(t.listItems.length==0)return;t.listItems[t.currentListItem].removeClassName('zg-searchMapL-infoWindow-li-visible');t.currentListItem=(t.currentListItem+1)%(this.listItems.length);$(t.listItems[t.currentListItem]).addClassName('zg-searchMapL-infoWindow-li-visible');t.updateShadow();};infoWindow.prototype.show=function show(){var t=this;t.container.style.display='';t.showing=true;if(t.shadow)t.shadow.style.display='';t.setPosition();if(t.shadow)t.setPosition(t.shadow);t.recenter();if(t.marker.mapWrapper.currentInfoWindow)t.marker.mapWrapper.currentInfoWindow.hide();t.marker.mapWrapper.currentInfoWindow=t;};infoWindow.prototype.hide=function hide(){var t=this;t.container.style.display='none';if(t.shadow)t.shadow.style.display='none';t.showing=false;t.marker.listingHide();t.marker.mapWrapper.currentInfoWindow=null;};infoWindow.prototype.toggle=function toggle(){this.marker.mapWrapper.currentInfoWindow?this.marker.mapWrapper.currentInfoWindow.listingHideFull():this.marker.listingShowFull();};infoWindow.prototype.getContentItem=function getContentItem(listing){var price=!listing.isEvent()&&listing.getPrice()?'<span class="zg-searchMapL-infoWindow-price">'+listing.getPrice()+'</span>':'',condition=listing.getCondition()?'<span class="'+listing.getConditionClassName()+'">'+listing.getCondition()+'</span> ':'',title='<span class="zg-searchMapL-infoWindow-title">'+condition+'<a class="zg-searchMapL-infoWindow-title-a" href="'+
listing.getLink()+'" target="'+listing.getLinkTarget()+'">'+listing.getTitle()+'</a></span>',description='<p class="zg-searchMapL-infoWindow-description">'+listing.getDescription()+'</p>',dateTimes=listing.isEvent()?this.formatSchedules(listing.getSchedules(),listing.getLink()):'';return title+dateTimes+price+description;};infoWindow.prototype.formatSchedules=function formatSchedules(schedules,link){if(schedules&&schedules.length>0){var scheduleString='<span class="zc-searchMapL-infoWindow-dateTime-title">Date & Time:</span><ol class="zc-searchMapL-infoWindow-dateTime-list">';for(var i=0;i<schedules.length;i++){scheduleString+='<li class="zc-searchMapL-infoWindow-dateTime-li">'+schedules[i]+'</li>';}
return scheduleString+'</ol>';}
return'<div class="zc-searchMapL-infoWindow-dateTime-noDates"><a class="zc-searchMapL-infoWindow-dateTime-noDates-a" href="'+
link+'">See Ad for Dates</a></div>';};infoWindow.prototype.getPosition=function getPosition(){var point=this.getProjection().fromLatLngToDivPixel(this.marker.location.point);return{bottom:point.y*-1+this.marker.currentIcon.size.height+20,left:point.x-Math.ceil(this.marker.currentIcon.size.width/2)}};infoWindow.prototype.setPosition=function setPosition(e,position){if(!position)position=this.getPosition();if(!e)e=this.container;e.style.bottom=position['bottom']+'px';e.style.left=position['left']+'px';};infoWindow.prototype.recenter=function(){var bounds=this.map.getBounds();if(!bounds)return;var span=bounds.toSpan(),center=this.map.getCenter(),point=this.marker.location.point,mainContainer=this.map.getDiv(),spacingX=5,spacingY=25,containerWidth=this.container.offsetWidth,containerHeight=this.container.offsetHeight+20,containerXOffset=0,containerYOffset=containerHeight*-1-this.marker.currentIcon.size.height,ratioX=span.lng()/mainContainer.offsetWidth,ratioY=span.lat()/mainContainer.offsetHeight,mapWB=bounds.getSouthWest().lng(),mapEB=bounds.getNorthEast().lng(),mapNB=bounds.getNorthEast().lat(),mapSB=bounds.getSouthWest().lat(),containerWB=point.lng()+(containerXOffset-spacingX)*ratioX,containerEB=point.lng()+(containerXOffset+containerWidth+spacingX)*ratioX,containerNB=point.lat()-(containerYOffset-spacingY)*ratioY,containerSB=point.lat()-(containerYOffset+containerHeight+spacingY)*ratioY,lngDif=(containerWB<mapWB?mapWB-containerWB:0)+
(containerEB>mapEB?mapEB-containerEB:0),latDif=(containerNB>mapNB?mapNB-containerNB:0)+
(containerSB<mapSB?mapSB-containerSB:0);this.map.setCenter(new google.maps.LatLng(center.lat()-latDif,center.lng()-lngDif));};}},markerEvents:{onmouseover:function markerMouseover(){this.listingShow();this.location.highlightListings();},onmouseout:function markerMouseout(e){this.listingHide();this.location.unhighlightListings();},onclick:function markerClick(){this.listingToggleFull();return false;},ondblclick:function markerDblclick(e){e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();return false;}},mapIconConfig:{__default:function(){return{baseClassName:'zg-map-marker-large-',size:new google.maps.Size(26,34),defaultName:'icon',shadow:'shadow',hover:'hover',circle:'circle',hoverSpan:'hoverSpan',mouseTarget:'mouseTarget',circleMouseTarget:'circleMouseTarget'};},hover:function(){return{};},featured:function(){return{};},shadow:function(){return{};},circle:function(){return{size:new google.maps.Size(23,24)}},hoverSpan:function(){return{};},circleMouseTarget:function(){return{size:new google.maps.Size(23,24)}}}};},contentItemMap:function(t){return{elementId:'listing_map_canvas',supportsFeaturedListings:false,functions:{drawMap:function drawMap(locations){for(var x in this.markersByLocation){this.markersByLocation[x].setMap(null);}
this.markers={};this.markersByLocation={};this.locations={};var bounds=new google.maps.LatLngBounds();this.parseLocations(bounds,locations)
var center=bounds.getCenter();if(this.defaultLocation)bounds.extend(this.defaultLocation.point);this.checkMaximumZoom(center);this.map.fitBounds(bounds);this.parseMarkers();},postMapLoad:function postMapLoad(){this.setupCustomMarkers();}},mapIconConfig:{__default:function(){return{baseClassName:'zg-map-marker-small-',size:new google.maps.Size(21,29),defaultName:'contentItem',shadow:'shadow',grabbing:'grabbing',hoverSpan:'hoverSpan'};},shadow:function(){return{};},hoverSpan:function(){return{};}},markerEvents:{onclick:function markerClick(){return false;},onmousedown:function markerMouseDown(e){(e.target||e.srcElement).addClassName(this.mapIcon.getIcon(this.mapWrapper,this.currentIcon.grabbing).className);},onmouseup:function markerMouseUp(e){(e.target||e.srcElement).removeClassName(this.mapIcon.getIcon(this.mapWrapper,this.currentIcon.grabbing).className);},ondblclick:function markerDblclick(e){e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();return false;}}};},contentItemMapL:function contentItemMapL(){var config=maps.config.contentItemMap(),defaultMapIconConfig=config.mapIconConfig['__default']();defaultMapIconConfig.baseClassName='zg-map-marker-large-';defaultMapIconConfig.size=new google.maps.Size(26,34);config.mapIconConfig['__default']=function(){return defaultMapIconConfig;}
return config;}};maps.prototype.checkMaximumZoom=function checkMaximumZoom(center){var map=this.map,zoom=this.options.zoom;google.maps.event.addListenerOnce(map,'zoom_changed',function(){if(map.getZoom()>zoom)map.setZoom(zoom);if(center)map.setCenter(center);});};maps.prototype.parseLocations=function parseLocations(target,locations){for(var location,x,i=0,pointString;i<locations.length;i++){x=locations[i];pointString=x.latitude+'_'+x.longitude;if(location=this.locations[pointString]){location.addListing(x.slug,x.schedules,x.isEvent);}else{location=this.locations[pointString]=new this.location(new google.maps.LatLng(x.latitude,x.longitude),pointString,x.slug,x.schedules,x.isEvent);}
if(target)target.extend(location.point);}};maps.prototype.parseMarkers=function parseMarkers(){for(var location in this.locations){this.locations[location].setupMarker(this);}};maps.listingShow=function listingShow(slug){if(this.current)this.current.listingShow(slug);};maps.listingHide=function listingHide(slug){if(this.current)this.current.listingHide(slug);};maps.prototype.listingShow=function listingShow(slug){if(this.markers[slug])this.markers[slug].listingShow();};maps.prototype.listingHide=function listingHide(slug){if(this.markers[slug])this.markers[slug].listingHide();};maps.prototype.setupGenericOverlayView=function setupGenericOverlayView(){var genericOverlayView=function genericOverlayView(){};genericOverlayView.prototype=new google.maps.OverlayView();genericOverlayView.prototype.draw=function draw(){};this.genericOverlayView=new genericOverlayView();this.genericOverlayView.setMap(this.map);};maps.prototype.getPanes=function getPanes(){return this.genericOverlayView.getPanes();};maps.prototype.getProjectionController=function getProjectionController(){return this.genericOverlayView.getProjection();};location=maps.prototype.location=function Location(point,pointString,slug,schedules,isEvent){this.point=point;this.pointString=pointString;this.listings=[];this.listingsHash={};this.addListing(slug,schedules,isEvent);};location.prototype={setupMarker:function setupMarker(map){this.marker=new marker(map,this);},addListing:function addListing(slug,schedules,isEvent){this.listings.push(this.listingsHash[slug]=new this.listing(slug,schedules,isEvent));},highlightListings:function highlightListings(){for(var x=0;x<this.listings.length;x++){this.listings[x].highlight();}},unhighlightListings:function unhighlightListings(){for(var x=0;x<this.listings.length;x++){this.listings[x].unhighlight();}},hasFeaturedListing:function hasFeaturedListing(){for(var x=0;x<this.listings.length;x++){if(this.listings[x].isFeatured())return true;}
return false;}};maps.prototype.setupCustomMarkers=function setupCustomMarkers(){marker=maps.prototype.marker=function Marker(mapWrapper,location){this.mapWrapper=mapWrapper;this.location=location;this.setRelationships();this.setMap(mapWrapper.map);};marker.prototype=new google.maps.OverlayView();marker.prototype.setRelationships=function setRelationships(){var t=this,listings=t.location.listings,markerHash=t.mapWrapper.markers;t.mapWrapper.markersByLocation[t.location.pointString]=t;for(var x=0,l=listings.length;x<l;x++){markerHash[listings[x].slug]=t;}}
marker.prototype.draw=function draw(){if(!this.container){this.setup();}else if(this.container.parentNode!=this.getPanes().overlayImage){if(this.container.parentNode)this.container.parentNode.removeChild(this.container);this.getPanes().overlayImage.appendChild(this.container);this.setPosition();if(this.shadow)this.setPosition(this.shadow);if(this.mouseTarget)this.setPosition(this.mouseTarget);}else{this.setPosition();if(this.shadow)this.setPosition(this.shadow);if(this.mouseTarget)this.setPosition(this.mouseTarget);}};marker.prototype.onRemove=function onRemove(){this.container.parentNode.removeChild(this.container);if(this.shadow)this.shadow.parentNode.removeChild(this.shadow);if(this.mouseTarget)this.mouseTarget.parentNode.removeChild(this.mouseTarget);}
marker.prototype.setup=function setup(){var t=this,panes=this.getPanes(),container=t.container=document.createElement('a'),circle=t.circle=null,shadow=t.shadow=null,hoverSpan=t.hoverSpan=null,mouseTarget=t.mouseTarget=null;$(container);t.currentIcon=this.mapIcon.getIcon(this.mapWrapper,this.mapIcon.getIcon(this.mapWrapper,'__default').defaultName);container.className=t.currentIcon.className;container.href='#';if(t.mapWrapper.supportsFeaturedListings&&t.location.hasFeaturedListing()){t.currentIcon=t.mapIcon.getIcon(this.mapWrapper,'featured');container.addClassName(t.currentIcon.className);}
if(t.currentIcon.circle&&t.location.listings.length>1){circle=t.circle=document.createElement('span');circle.className='png24 '+t.mapIcon.getIcon(this.mapWrapper,t.currentIcon.circle).className;circle.innerHTML=t.location.listings.length;container.appendChild(circle);}
if(t.currentIcon.shadow){shadow=t.shadow=document.createElement('div');shadow.className='png24 '+this.mapIcon.getIcon(t.mapWrapper,t.currentIcon.shadow).className;t.setPosition(shadow);panes.overlayShadow.appendChild(shadow);}
if(t.currentIcon.mouseTarget){mouseTarget=t.mouseTarget=document.createElement('a');mouseTarget.href='#';mouseTarget.onlick='return false;';mouseTarget.className=this.mapIcon.getIcon(t.mapWrapper,t.currentIcon.mouseTarget).className;t.setPosition(mouseTarget);if(circle&&t.currentIcon.circleMouseTarget){circleMouseTarget=t.circleMouseTarget=document.createElement('span');circleMouseTarget.className=this.mapIcon.getIcon(t.mapWrapper,t.currentIcon.circleMouseTarget).className;mouseTarget.appendChild(circleMouseTarget);}
panes.overlayMouseTarget.appendChild(mouseTarget);}
t.setPosition();t.addEvents();panes.overlayImage.appendChild(container);};marker.prototype.getPosition=function getPosition(){var point=this.getProjection().fromLatLngToDivPixel(this.location.point);return{top:point.y-this.currentIcon.size.height,left:point.x-Math.round(this.currentIcon.size.width/2),zIndex:point.y+2000};};marker.prototype.setPosition=function setPosition(e,position){if(!position)position=this.getPosition();if(!e)e=this.container;e.style.top=position.top+'px';e.style.left=position.left+'px';e.style.zIndex=position.zIndex;};marker.prototype.addEvents=function addEvents(){for(var eventName in this.mapWrapper.markerEvents){(function(eventName,t){(t.mouseTarget||t.container)[eventName]=function(e){if(!e)e=window.event;return t.mapWrapper.markerEvents[eventName].call(t,e);}})(eventName,this);}};marker.prototype.unload=function removeEvents(){var t=this;t.container=null
t.circle=null,t.shadow=null,t.hoverSpan=null,t.mouseTarget=null;if(t.infoWindow){t.infoWindow.unload();}};mapIcon=marker.prototype.mapIcon=function MapIcon(mapWrapper,configName){var t=this,x,config=t.config=mapWrapper.mapIconConfig,defaultConfig=config.__default(),currentConfig=config[configName]?config[configName]():{};t.name=configName;for(x in defaultConfig)t[x]=defaultConfig[x];for(x in currentConfig)t[x]=currentConfig[x];if(!t.className)t.className=t.baseClassName+configName;};mapIcon.getIcon=function getIcon(mapWrapper,type){var icons=this.icons,configName=mapWrapper.configName;if(!icons[configName]){icons[configName]={};}
if(!icons[configName][type]){icons[configName][type]=new this(mapWrapper,type);}
return icons[configName][type];};mapIcon.icons={};marker.prototype.listingLaunch=function listingLaunch(){var link=this.location.listings[0].href;if(Prototype.Browser.IE){window.location=link;}else{window.location.href=link;}};marker.prototype.listingHoverOn=function listingHoverOn(){if(this.currentIcon&&this.currentIcon.hover)this.container.addClassName(this.mapIcon.getIcon(this.mapWrapper,this.currentIcon.hover).className);};marker.prototype.listingHoverOff=function listingHoverOff(){if(this.currentIcon&&this.currentIcon.hover)this.container.removeClassName(this.mapIcon.getIcon(this.mapWrapper,this.currentIcon.hover).className);};marker.prototype.listingShow=function listingShow(){this.listingHoverOn();};marker.prototype.listingHide=function listingHide(){if(!this.infoWindow||this.infoWindow.showing==false)this.listingHoverOff();};marker.prototype.listingShowFull=function listingShowFull(){this.listingHoverOn();this.location.highlightListings();if(!this.infoWindow){this.infoWindow=new infoWindow(this);}else{this.infoWindow.show();}};marker.prototype.listingHideFull=function listingHideFull(){this.listingHoverOff();this.location.unhighlightListings();if(this.infoWindow){this.infoWindow.hide();}};marker.prototype.listingToggleFull=function listingToggleFull(){this.infoWindow&&this.infoWindow.showing?this.listingHideFull():this.listingShowFull();};};listing=location.prototype.listing=function Listing(slug,schedules,eventType){var element,title,titleElement,condition,conditionElement,price,description;this.slug=slug;function getTitleElement(){return titleElement||(titleElement=$('title_'+slug));}
function getConditionElement(){return conditionElement||(conditionElement=$('condition_'+slug));}
this.getElement=function getElement(){return element||(element=$('item_'+slug));};this.isEvent=function isEvent(){return!!eventType;};this.isFeatured=function isFeatured(){return this.getElement().className.indexOf('featured_list')>0;};this.getTitle=function getTitle(){return title||(title=(getTitleElement()||{}).innerHTML||'');};this.getLink=function getLink(){return(getTitleElement()||{}).href||'';};this.getLinkTarget=function getLinkTarget(){return(getTitleElement()||{}).target||'';};this.getCondition=function getCondition(){return condition||(condition=(getConditionElement()||{}).innerHTML||'');};this.getConditionClassName=function getConditionClassName(){return(getConditionElement()||{}).className||'';};this.getPrice=function getPrice(){return price||(price=($('price_'+slug)||{}).innerHTML||'');};this.getDescription=function getDescription(){return description||(description=($('description_'+slug)||{}).innerHTML||'');};this.getSchedules=function getSchedules(){return schedules;};};listing.prototype={highlight:function highlight(){this.getElement().addClassName('map-selected-item');},unhighlight:function unhighlight(){this.getElement().removeClassName('map-selected-item');}};})(window);
