xorse.PARSING="xorse.App";xorse.require("xorse.Module");xorse.require("xorse.hash");xorse.require("xorse.maphat.MapHat");xorse.require("google.maps");window.onerror=xorse.write_error;
xorse.App=function(h,b){var c=this,f=c.pri;f.initialize_environment=function(){xorse.maphat.DEBUG=xorse.DEBUG;xorse.maphat.DEFAULT_LATLNG=xorse.maphat.google.LatLng(g_property_lat_lng[0],g_property_lat_lng[1]);xorse.maphat.DEFAULT_ZOOM=12;xorse.maphat.DEFAULT_MAPTYPE=xorse.maphat.google.RoadMap();xorse.maphat.DEFAULT_ICON="base";xorse.maphat.MAP_VERSION=xorse.maphat.MAP_VERSION===undefined?3:xorse.maphat.MAP_VERSION;xorse.maphat.REFINEMENTS={bedrooms:xorse.hash.read("bedrooms",1),bathrooms:xorse.hash.read("bathrooms",
0),rate:xorse.hash.read("rate",0),staylength:xorse.hash.read("staylength","nightly"),pets:xorse.hash.read("pets",0),smoking:xorse.hash.read("smoking",0),sleeps:xorse.hash.read("sleeps",0),internet:xorse.hash.read("internet",0),handicap:xorse.hash.read("handicap",0),property:xorse.hash.read("property",null),search:xorse.hash.read("search",null)};xorse.maphat.LISTVIEW=false;xorse.maphat.RECENTLY_VIEWED=xorse.authenticated;xorse.maphat.FAVORITES=xorse.authenticated;xorse.maphat.CLUSTERING={enable:false};
xorse.maphat.URLS={cluster_data:function(){return"/cluster/data/"},cluster_children_data:function(){return"/cluster/children/info/"},map_data:function(){return"/map/data/"},property_data:function(a){return"/property/"+a+"/info/"},directions_polyline:function(a){return"/property/"+a+"/polyline/"},recently_viewed:function(){return"/account/recentlyviewed/"},listview:function(){return"/map/listview/"},get_latlng:function(a){var e=a.match(/^#?(\d{7,})$/);if(e){a=e[e.length-1];type="property"}else type=
"location";return"/map/latlng/"+type+"/?arg="+a},near_properties:function(){return"/property/"+g_property+"/near/"},favorite:function(a){return a?"/property/"+a+"/favorite/":"/account/favorites/"},map:function(){window.location="/map/#property="+g_property+"&"+location.hash.substr(1)},next_detail:function(a){xorse.hash.remove("property");window.location="/property/"+a+"/detail/?l="+g_near+location.hash}};xorse.maphat.INFOWINDOW={template:{node:document.getElementById("infowindow-template"),class_name:"infowindow"},
content:{node:document.getElementById("infowindow-content"),class_name:"html"},shadow:{node:function(){var a=document.createElement("img");a.src="/static/img/map-icons/infowindow/info-shadow.png";return a}(),class_name:"infowindow-shadow"},close:document.getElementById("infowindow-close"),loading:{content:'<div style="width: 300px; text-align: center;"><img src="/static/img/site-icons/ajax-bar.gif"></div>',shadow:function(){var a=document.createElement("img");a.src="/static/img/map-icons/tooltipwindow/shadow.png";
return a}(),class_name:"infowindow-shadow"}};xorse.maphat.TOOLTIP_INFOWINDOW={template:{node:document.getElementById("tooltipwindow-template"),class_name:"tooltipwindow small"},content:{node:document.getElementById("tooltipwindow-content"),class_name:"html"},shadow:{node:function(){var a=document.createElement("img");a.src="/static/img/map-icons/tooltipwindow/shadow.png";return a}(),class_name:"infowindow-shadow"},close:document.getElementById("tooltipwindow-close"),loading:{content:'<div style="width: 200px; text-align: center;"><img src="/static/img/site-icons/ajax-bar.gif"></div>',
shadow:function(){var a=document.createElement("img");a.src="/static/img/map-icons/tooltipwindow/shadow.png";return a}(),class_name:"infowindow-shadow"}};xorse.maphat.MARKER_OVERRIDES={marker:{click:function(a){window.location="/property/"+a.id+"/detail/"},dblclick:false,mouseup:false,mousedown:false,mouseover:false,mouseout:false,tooltip:function(a,e){var d='<div class="tooltip">';d+='<h1 style="font-size: 11px" class="ui-corner-all ui-widget-header standard">'+e.json.title+"</h1>";d+=a.directions?
'<p class="distance" style="font-size: 9px">'+a.directions.distance+" to the red marker.</p>":'<p class="distance" style="font-size: 9px">Loading directions...</p>';d+="</div>";return d}},cluster_marker:{click:false,dblclick:false,mouseup:false,mousedown:false,mouseover:false,mouseout:false},directions:{color:"#FF0000",weight:5}};xorse.maphat.CENTER_MARKER_CONFIG={settings:{icon:G_DEFAULT_ICON,dragCrossMove:false,title:"Drag Me!",clickable:false,draggable:true,bouncy:true,bounceGravity:1,autoPan:true,
zIndexProcess:function(){return 1},hide:false,click:false},force_center:xorse.maphat.google.LatLng(g_near_lat_lng[0],g_near_lat_lng[1]),event_overrides:{click:false,dblclick:false,mouseup:false,mousedown:false,mouseover:false,mouseout:false,dragstart:false,dragend:false,drag:false}}};f.initialize_map=function(){var a={dom_node:document.getElementById(h),zoom:xorse.maphat.DEFAULT_ZOOM,center:xorse.maphat.DEFAULT_LATLNG,mapTypeId:xorse.maphat.DEFAULT_MAPTYPE,default_icon:xorse.maphat.DEFAULT_ICON,refinements:xorse.maphat.REFINEMENTS,
infowindow:xorse.maphat.INFOWINDOW,tooltip:xorse.maphat.TOOLTIP_INFOWINDOW,url_schema:xorse.maphat.URLS,clustering:xorse.maphat.CLUSTERING,overrides:xorse.maphat.MARKER_OVERRIDES,center_marker_cfg:xorse.maphat.CENTER_MARKER_CONFIG,enable_favorites:xorse.maphat.FAVORITES,enable_recently_viewed:xorse.maphat.RECENTLY_VIEWED,enable_listview:xorse.maphat.LISTVIEW};c.maphat=new xorse.maphat.MapHat(a,b);window.onunload=function(){c.maphat.deconstructor()}};f.constructor=function(){document.createElement("img").src=
"/static/img/site-icons/ajax-bar.gif";f.initialize_environment();f.initialize_map()};f.constructor()};xorse.App.prototype=new xorse.Module("xorse.App");xorse.PARSING="xorse.Layout";xorse.maphat=xorse.maphat===undefined?{}:xorse.maphat;xorse.require("xorse.maphat.MapHat");
xorse.Layout=function(){var h=this,b=h.pri;b.elements={};b.elements.nearby_text=$("#nearby-text");b.elements.nearby_places=$("#nearby-places");b.elements.twitter_feed=$("#twitter-feed");b.preload=["/static/img/site-icons/ajax-loader.gif","/static/img/map-icons/basic/image.png","/static/img/map-icons/basic/shadow.png","/static/img/map-icons/basic/transparent.png","/static/img/map-icons/standard/image.png","/static/img/map-icons/standard/shadow.png","/static/img/map-icons/standard/transparent.png",
"/static/img/map-icons/standard/favorite-image.png","/static/img/map-icons/standard/favorite-shadow.png","/static/img/map-icons/standard/favorite-transparent.png","/static/img/map-icons/standard/viewed-image.png","/static/img/map-icons/standard/viewed-shadow.png","/static/img/map-icons/standard/viewed-transparent.png","/static/img/map-icons/standard/favorite-viewed-image.png","/static/img/map-icons/standard/favorite-viewed-shadow.png","/static/img/map-icons/standard/favorite-viewed-transparent.png",
"/static/img/map-icons/preferred/image.png","/static/img/map-icons/preferred/shadow.png","/static/img/map-icons/preferred/transparent.png","/static/img/map-icons/preferred/favorite-image.png","/static/img/map-icons/preferred/favorite-shadow.png","/static/img/map-icons/preferred/favorite-transparent.png","/static/img/map-icons/preferred/viewed-image.png","/static/img/map-icons/preferred/viewed-shadow.png","/static/img/map-icons/preferred/viewed-transparent.png","/static/img/map-icons/preferred/favorite-viewed-image.png",
"/static/img/map-icons/preferred/favorite-viewed-shadow.png","/static/img/map-icons/preferred/favorite-viewed-transparent.png"];b.maphat=null;h.set_app=function(c){b.app=c};h.set_maphat=function(c){b.maphat=c};b.load_near_properties=function(c){xorse.ajax.get_json(b.maphat.pro.maphat_cfg.url_schema.near_properties(),b.maphat.refinement_manager.get_all(),{"200":function(f){b.property_right=f.right;b.property_left=f.left;c&&c(f)}})};b.load_property=function(c){page_loader=new FhBaux;page_loader.loading("Retrieving "+
c.title+'...<br><img src="/static/img/site-icons/ajax-loader.gif">');return b.maphat.pro.maphat_cfg.url_schema.next_detail(c.id)};b.initialize_signals=function(){xorse.signal("marker_click","layout",function(c){c.id!==g_property&&b.load_property({id:c.id,title:c.config.json.title})});xorse.signal("near_property_right","layout",function(){b.property_right?b.load_property(b.property_right):b.load_near_properties(function(c){b.load_property(c.right)})});xorse.signal("near_property_left","layout",function(){b.property_left?
b.load_property(b.property_left):b.load_near_properties(function(c){b.load_property(c.left)})});xorse.signal("search_map","layout",function(c){page_loader=new FhBaux("<div></div>");page_loader.loading("Searching map for "+c.search+'...<br><img src="/static/img/site-icons/ajax-loader.gif">');return b.maphat.pro.maphat_cfg.url_schema.map(c.search)});$("#search-rentals").click(function(){b.maphat.pro.maphat_cfg.url_schema.map(xorse.hash.read("property")||"Tucson, AZ");return false})};b.initialize_dom=
function(){};b.initialize_nearby_map=function(){if(!xorse.basic)if(b.elements.nearby_places.length){nearby_places=new google.maps.Map2(b.elements.nearby_places[0]);nearby_places.setCenter(new google.maps.LatLng(g_property_lat_lng[0],g_property_lat_lng[1]),12);var c=new google.search.SearchControl,f=new google.search.LocalSearch,a=new google.search.SearcherOptions;f.setCenterPoint(nearby_places);a.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);c.addSearcher(f,a);c.setSearchCompleteCallback(f,
function(){nearby_places.clearOverlays();for(var e=f.results,d=0;d<e.length;d++){var g=e[d],i=new google.maps.LatLng(parseFloat(g.lat),parseFloat(g.lng));i=new google.maps.Marker(i);i.bindInfoWindow(g.html.cloneNode(true));g.marker=i;nearby_places.addOverlay(i)}});c.draw(b.elements.nearby_text[0]);c.execute("restaurants");nearby_places.setUIToDefault();nearby_places.disableScrollWheelZoom()}};b.initialize_binds=function(){var c;$("div.photo-set > img").hover(function(){var a=$(this);if(this.className==
"youtube"||this.className=="youtube-play"){a=$("div.photo-set > img.youtube");$("#youtube").show();$("#photo-tag").hide()}else{$("#photo-tag").show();$("#youtube").hide();var e=parseInt(a.attr("_width")),d=parseInt(a.attr("_height")),g=$("#photo-tag");if(e>435&&d>330)g.attr({width:435,height:330});else if(e>435&&d<330)g.removeAttr("width").attr("height",d);else if(e<435&&d>330)g.removeAttr("height").attr("width",e);else e>d?g.removeAttr("height").attr("width",e):g.removeAttr("width").attr("height",
d);$("#photo-tag").attr({src:a.attr("src"),width:e,height:d});$("#photo-tag").parent().width(e).height(d).css({top:165-d/2})}c&&c.css({"border-color":"#FFF",opacity:"0.5"});a.css({"border-color":"#DEE7FE",opacity:"1.0"});c=a});$("div.photo-set > img").css({"border-color":"#FFF",opacity:"0.50"});c=$("div.photo-set > img:first").css({"border-color":"#DEE7FE",opacity:"1.0"});var f=$("span.title").height();$("div.title-container").height(f);$("#guest-reviews > div.review:last").css("border","0");f=$("div.season > ul > li:not(.small)");
f.length&&$("div.season > ul > li.small").height(f.height());$("div.primary-photo > div, div.photo-container").each(function(){var a=$(this),e=$("img",a),d=parseInt(e.attr("_height")),g=parseInt(e.attr("_width"));if(d&&g){if(g>435&&d>330)e.attr({width:435,height:330});else if(g>435&&d<330)e.removeAttr("width").attr("height",d);else if(g<435&&d>330)e.removeAttr("height").attr("width",g);else g>d?e.removeAttr("height").attr("width",g):e.removeAttr("width").attr("height",d);a.width(g).height(d).css({position:"relative",
top:167.5-d/2})}});$("#new-review input").click(function(){var a=$("#new-review"),e=$("textarea.comment",a).val(),d=$("#review-type").val();if(e.length===0){alert("You did not enter a comment.");return false}$(".waiting",a).show();$.post("/property/"+g_property+"/review/",{comment:e,"review-type":d},function(g,i){if(i==="error")alert(g);else{d==="0"?a.addClass("negative"):a.addClass("positive");$("div.content",a).html(e);$("span.delete",a).html("(Delete)").attr("id",g);$("input, select",a).hide();
$(".review-count").html(parseInt($(".review-count:first").html())+1)}});$(".waiting",a).hide();return false});$("span.delete").live("click",function(){var a=this.id,e=$(this);$.ajax({url:"/property/"+g_property+"/review/?comment_id="+a,type:"DELETE",complete:function(d,g){if(g==="error")alert("Your comment could not be deleted. Please contact support.");else{e.parent().parent().remove();$(".review-count").html(parseInt($(".review-count:first").html())-1)}}})});$("a.contact-owner").click(function(){var a=
xorse.authenticated?window.open($(this).attr("href"),"Contact_Owner","height=600,width=600"):window.open($(this).attr("href"),"Contact_Owner","height=800,width=600");window.focus&&a.focus();return false});$("#amenity-tab").tabs().show()};b.initialize_preloads=function(){for(var c=b.preload.length,f=0;f<c;f++)document.createElement("img").src=b.preload[f]};b.constructor=function(){b.initialize_dom();b.initialize_signals();b.initialize_binds();b.initialize_preloads();b.initialize_nearby_map();$(".corner").corner()};
b.constructor()};xorse.Layout.prototype=new xorse.Module("xorse.Layout");
function Table(h,b,c){var f=this;f=$("<table></table>");var a=true,e=false;for(var d in c){var g=false,i=false,m=d;if(d.indexOf("|")!==-1){var j=d.split("|");m=j[0];if(j[1]==="bool")g=true;else i=j[1]}j=$("<tr></tr>");m=$('<td class="key">'+m+"</td>");var o=$("<td></td>");(a=!a)?j.addClass("even"):j.addClass("odd");var p=$("<table></table"),n=true;for(var q in c[d]){var r=$("<tr></tr>"),k=$("<td></td>"),l=c[d][q];if(q!=="map"){if(l===""||l==0){n=true;break}if(g){k.addClass(l.toLowerCase());l==="True"?
k.html("Yes"):k.html("No")}else k.html(l);i&&k.addClass(i);r.append(k);p.append(r);n=false;e=true}}if(n)a=!a;else{o.append(p);j.append(m);j.append(o);f.append(j)}}e&&$(b).append($("<h2>"+h+"</h2>")).append(f)}
function favorite(){var h=$("img.favorite"),b=h.attr("src");$.post("/property/"+g_property+"/favorite/",{},function(){if(/gray/.test(b)){h.attr("src",b.replace("-gray",""));h.attr("title","This property is a favorite!");xorse.send_signal("marker_"+g_property+"_favorite")}else{h.attr("src",b.replace("star","star-gray"));h.attr("title",'Click to "favorite" this property.');xorse.send_signal("marker_"+g_property+"_unfavorite")}})};xorse.PARSING="xorse.Project";xorse.require("xorse.App");xorse.require("xorse.Layout");xorse.Project=function(){var h=this,b=h.pri;h.initialize_layout=function(){b.layout=new xorse.Layout};h.setup=function(){b.app=new xorse.App("map",function(){b.layout.set_maphat(this)});b.layout.set_app(b.app)};b.constructor=function(){h.initialize_layout()};b.constructor()};xorse.Project.prototype=new xorse.Module("xorse.Project");

