var SORT_ASCENDING=1;var SORT_DESCENDING=0;function el(a){return document.getElementById(a)}function shorten(b,a){if(b.length>a){return b.substr(0,a)+"..."}else{return b}}function monetize(a){return"$"+RComma(a)}function RComma(a){a=String(a);var b=/^(.*\s)?([-+\u00A3\u20AC]?\d+)(\d{3}\b)/;return a==(a=a.replace(b,"$1$2,$3"))?a:RComma(a)}function quote(a){return'"'+a+'"'}function quote2(a){return"'"+a+"'"}function set_cookie(b,c,d){var a=new Date();a.setTime(a.getTime()+Math.floor(d*1000*60));document.cookie=b+"="+c+";expires="+a.toGMTString()+";path=/"}function setCookie(a,b,c){set_cookie(a,b,c)}function get_cookie(c){var b=document.cookie.split(";");for(var d=0;d<b.length;d++){var a=b[d].split("=");if(trim(a[0])==trim(c)){return a[1]}}return null}function getCookie(a){return get_cookie(a)}function delete_cookie(a){setCookie(a,"",-1)}function delCookie(a){delete_cookie(a)}function trim(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Listings(){this.listings=new Hash;this.listingOrder=new Array;this.pages=1;this.buildings=new Hash;this.load=function(a){this.listings=new Hash;this.listingOrder=new Array;this.buildings=new Hash;for(var b=0;b<a.length;b++){var c=a[b];this.listings.set(c.id,c);this.listingOrder[b]=c.id}};this.setPages=function(a){this.pages=a};this.getPages=function(){return this.pages};this.get=function(a){return this.listings.get(a)};this.getBuilding=function(a){return this.listings.get(a).building_id};this.size=function(){return this.listingOrder.length};this.index=function(a){if(a>=this.listingOrder.length){return null}return this.listings.get(this.listingOrder[a])};this.listingsFromBuilding=function(c){var b=new Array;for(var a=0;a<this.listingOrder.length;a++){var d=this.listings.get(this.listingOrder[a]);if(d.building_id==c){b.push(d.id)}}return b};this.dispose=function(){this.listings.dispose();this.listingOrder.dispose();this.buildings.dispose();delete (this.listings);delete (this.listingOrder);delete (this.buildings)}}function Buildings(){this.buildings=new Hash;this.buildingToLatLng=new Hash;this.buildingOrder=new Array;this.dispose=function(){this.buildings.dispose();this.buildingToLatLng.dispose();delete (this.buildings);delete (this.buildingToLatLng);delete (this.buildingOrder)};this.buildingOrder=new Array;this.load=function(e){this.buildings=new Hash;this.buildingToLatLng=new Hash;this.buildingOrder=new Array;var c=0;if(e.length==0){return}for(var b in e){var d=e[b];var a=new GLatLng(d.latitude,d.longitude);this.buildingToLatLng.set(d.building_id,a);this.buildings.set(d.building_id,d);this.buildingOrder[c]=d.building_id;c++}};this.get=function(a){return this.buildings.get(a)};this.size=function(){return this.buildingOrder.length};this.getPoint=function(a){return this.buildingToLatLng.get(a)};this.index=function(a){if(a>=this.buildingOrder.length){return null}return this.buildings.get(this.buildingOrder[a])};this.createMarker=function(d,f,c,b){var e=this.get(d);var a=f.createMarker(d,this.getPoint(d),{id:d,name:e.name,address:e.address,phone:e.phone,website:e.url,company:e.manage_co,useFilter:c},b);return a};this.getMarker=function(a){return this.markers.get(a)};this.getBuildingHash=function(){return this.buildings}}Array.prototype.clone=function(){var b=new Array;for(var a=0;a<this.length;a++){b[a]=this[a]}return b};Array.prototype.dispose=function(){for(var a=0;a<this.length;a++){this[a]=null}};function Hash(){this.hashObj=new Object;this.clone=function(){var b=new Hash();var a=this.keys();for(i=0;i<a.length;i++){b.set(a[i],this.hashObj[a[i]])}a=null;return b};this.get=function(a){if(a in this.hashObj){return this.hashObj[a]}else{return null}};this.set=function(a,b){this.hashObj[a]=b};this.keys=function(){var c=new Array;var a=0;if(this.hashObj.length==0){return c}for(var b in this.hashObj){c[a++]=b}return c};this.unset=function(a){delete (this.hashObj[a])};this.dispose=function(){var a=this.keys();for(i=0;i<a.length;i++){delete (this.hashObj[a[i]])}a=null}}function serialize_checkboxes(b){var c=document.getElementsByName(b);var a="";for(i=0;i<c.length;i++){if(c[i].checked==true){a+=c[i].value+"|"}}return(a)}function jquery_toggle_checkbox(a){if(!$("input[cb_id="+a+"]").attr("checked")){$("input[cb_id="+a+"]").attr("checked","true")}else{$("input[cb_id="+a+"]").attr("checked","")}}function serializeCheckbox(a){return serialize_checkboxes(a)}function toggle_checkbox(a,b){var c=document.getElementsByName(a);for(i=0;i<c.length;i++){c[i].checked=b}}function toggleCheckbox(a,b){toggle_checkbox(a,b)}function unserialize_checkbox(b,a){checkbox_vars=a.split("|");for(i=0;i<checkbox_vars.length;i++){checkbox_vars[checkbox_vars[i]]=1}if(checkbox_vars[$(b).val()]==1){$(b).attr("checked",true)}else{$(b).attr("checked",false)}}function unserialize_checkboxes(b,a){checkbox_vars=a.split("|");for(i=0;i<checkbox_vars.length;i++){checkbox_vars[checkbox_vars[i]]=1}checkboxes=document.getElementsByName(b);for(i=0;i<checkboxes.length;i++){if(checkbox_vars[checkboxes[i].value]==1){checkboxes[i].checked=true}else{checkboxes[i].checked=false}}}function loadCheckbox(b,a){unserialize_checkboxes(b,a)}function load_get(c,a){getString="";for(var b=0;b<c.length;b++){getString+=c[b]+"="+escape(a[b]);if(b!=c.length-1){getString+="&"}}return getString}function loadGet(b,a){return load_get(b,a)}function show_pic(f,g,e,b,a){var d=$("#"+f);d.attr("src","/images/loader.gif");if(a==null){d.css("margin-top","136px")}else{d.css("margin-top",a+"px")}for(var c=0;c<20;c++){if(el(f+"_"+c)==null){break}if(c==b){$("#"+f+"_"+c).css("border","2px solid black")}else{$("#"+f+"_"+c).css("border","0px")}}newImg=new Image();newImg.onload=function(){d.hide().css("margin-top","0px").attr("src",this.src).show()};newImg.src=g;$("#"+f).parent().attr("href",e)}function generic_load_pic(c,b,a){el(c).src="/images/"+a;newImg=new Image();newImg.onload=function(){el(c).src=this.src};newImg.src=b}function showPic(d,e,c,b,a){show_pic(d,e,c,b,a)}function get_current_date(){var c=new Date();var d=c.getMonth()+1;var a=c.getDate();var b=c.getFullYear();return zero_pad(d,2)+"/"+zero_pad(a,2)+"/"+b}function zero_pad(b,a){b=b.toString();while(b.length<a){b="0"+b}return b}function in_array(b,a){for(i=0;i<a.length;i++){if(a[i]==b){return true}}return false}function is_favorite(b){var a=get_cookie("favorites");if(a==null){return false}favorites_arr=a.split("|");if(in_array(b,favorites_arr)){return true}else{return false}}function schedule(a){add_favorite(a);window.location="/user/favorites"}function toggle_fav2(d,b){delete_favorite(b);var a=$("tr[listing_id="+b+"]");var c=$("tr[listing_id="+b+"]").next();a.remove();c.remove()}function Scheduler(b,a){this.table=null;this.get_date_start=function(c){return new Date(c.getFullYear(),c.getMonth(),c.getDate())};this.highlights=new Array();this.months=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");this.days=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");this.start_time=a.start_time?a.start_time:8;this.end_time=a.end_time?a.end_time:22;this.num_per_hour=a.num_per_hour?a.num_per_hour:2;this.ref_date=a.ref_date?a.ref_date:this.get_date_start(new Date());this.curr_start_date=this.get_date_start(new Date());this.curr_start_date.setDate(this.curr_start_date.getDate()-this.ref_date.getDay());this.build_calendar=function(){var g=document.createElement("table");var h=document.createElement("thead");var d=document.createElement("tbody");for(var e=0;e<7;e++){col=document.createElement("th");if(e>0){col=document.createElement("th");col.innerHTML=this.get_weekly_format(this.offset_days(this.curr_start_date,e-1))}h.appendChild(col)}for(e=this.start_time*this.num_per_hour;e<this.start_time+this.num_per_hour*(this.end_time-this.start_time);e++){row=document.createElement("tr");for(var c=0;c<7;c++){col=document.createElement("td");if(e%this.num_per_hour==0&&c==0){col.innerHTML=this.get_format_hour(Math.floor(e/this.num_per_hour));col.rowSpan=this.num_per_hour;row.appendChild(col)}else{if(c>0){var f=this.is_highlight(this.offset_days(this.curr_start_date,c-1),Math.floor(e/this.num_per_hour));if(f){$(col).css("background-color","yellow")}col.innerHTML=e+"_"+c;col.hr=Math.floor(e/this.num_per_hour);col.day=c-1;row.appendChild(col)}}}d.appendChild(row)}g.appendChild(h);g.appendChild(d);document.getElementById(b).appendChild(g);this.table=g};this.refresh=function(){var c=0;var d=this;$(this.table).children("thead").children().each(function(){if(c>0){$(this).html(d.get_weekly_format(d.offset_days(d.curr_start_date,c-1)))}c++});c=0;$(this.table).find("tbody tr td").each(function(){var e=$(this).attr("hr");var f=$(this).attr("day");if(c>0){var g=d.offset_days(d.curr_start_date,f);if(d.is_highlight(g,e)){$(this).css("background-color","yellow")}else{$(this).css("background-color","white")}}c++})};this.get_format_hour=function(c){if(c>12){return(c-12)+"PM"}else{if(c==12){return"12PM"}else{if(c==0){return"12AM"}else{return c+"AM"}}}};this.get_format_date=function(c){return this.months[c.getMonth()]+" "+c.getDate()+", "+c.getFullYear()};this.next_week=function(){this.curr_start_date=this.offset_days(this.curr_start_date,7)};this.prev_week=function(){this.curr_start_date=this.offset_days(this.curr_start_date,-7)};this.offset_days=function(c,d){return new Date(c.getTime()+d*24*60*60*1000)};this.is_highlight=function(g,h){for(var e=0;e<this.highlights.length;e++){var c=this.highlights[e].h_date;var f=this.highlights[e].start_time;var d=this.highlights[e].end_time;if(c.valueOf()==g.valueOf()){if(h>=f&&h<d){return true}}}return false};this.set_highlight=function(e,c,d){this.highlights[this.highlights.length]={h_date:e,start_time:c,end_time:d}};this.clear_highlights=function(){this.highlights=new Array()};this.set_highlight_dt=function(e,g,c,d,f){set_highlights(new Date(e,g-1,c),d,f)}}function parse_google_placemark(a){if(a.Status.code!=200){return false}if(typeof(a.Placemark)=="undefined"||typeof(a.Placemark[0])=="undefined"){return false}var b=a.Placemark[0];var d=new Object;try{d.lat=b.Point.coordinates[1];d.lng=b.Point.coordinates[0];d.address=null;d.city=null;d.state=null;d.zipcode=null;d.accuracy=null;d.address_base=null;traverse(b,function(e,f){if(e=="address"&&d.address_base==null){d.address_base=f}if(e=="ThoroughfareName"&&d.address==null){d.address=f}if(e=="AddressLine"&&d.address==null){d.address=f}if(e=="LocalityName"&&d.city==null){d.city=f}if(e=="AdministrativeAreaName"&&d.state==null){d.state=f}if(e=="PostalCodeNumber"&&d.zipcode==null){d.zipcode=f}if(e=="Accuracy"&&d.accuracy==null){d.accuracy=f}});if((d.address==null||d.city==null||d.state==null||d.zipcode==null)&&!(d.address_base==null)){parsed_address_array=d.address_base.split(",");d.address=parsed_address_array[0];d.city=parsed_address_array[1];city_zipcode=parsed_address_array[2];city_zipcode_array=city_zipcode.split(" ");d.zipcode=city_zipcode_array[city_zipcode_array.length-1];d.state=city_zipcode_array.slice(0,city_zipcode_array.length-1).join(" ")}}catch(c){return false}return d}function LM2Tabs(a){if(typeof(a.selected)!="undefined"){this.selected=a.selected}else{this.selected=0}if(typeof(a.sections)=="undefined"){return null}else{this.sections=a.sections}if(typeof(a.tabs)=="undefined"){return null}else{this.tabs=a.tabs}if(typeof(a.on)=="undefined"||typeof(a.off)=="undefined"){return null}else{this.on=a.on;this.off=a.off}this.tab_events=new Array();this.add_event=function(c,b){this.tab_events[c]=b};this.show=function(b){this.selected=b;for(i=0;i<this.sections.length;i++){if(i!=this.selected){$("#"+this.sections[i]).hide();$("#"+this.tabs[i]).removeClass();$("#"+this.tabs[i]).addClass(this.off)}}$("#"+this.sections[this.selected]).show();if(typeof(this.tab_events[this.selected])!="undefined"){this.tab_events[this.selected]()}$("#"+this.tabs[this.selected]).removeClass();$("#"+this.tabs[this.selected]).addClass(this.on)};this.show(this.selected);return this}function toggle_div(b,a){if(typeof(a)=="undefined"){if($("#"+b).is(":hidden")){$("#"+b).show()}else{$("#"+b).hide()}}else{if($("#"+b).is(":hidden")){$("#"+b).slideDown("medium",function(){$(this).show()})}else{$("#"+b).slideUp("medium",function(){$(this).hide()})}}return false}function serialize_feature_set(b){var a="";$("#"+b).children("div[feature]").each(function(){a+=$(this).attr("feature")+"|"});return a}function map_hover_box(g,e,d,a,f){var b=$("#"+g).offset().top;var c=$("#"+g).offset().left;generic_load_pic("map_hover_img",get_google_static_streetview(d.latitude,d.longitude),"clear2.gif");$("#map-hover-building").html(d.name);$("#map-hover-post").html("<b>Posted by:</b><br>"+d.manage_co);$("#"+e).css({top:b+a.y,left:c+a.x-f}).show()}function get_google_static_streetview(b,a){return"http://cbk0.google.com/cbk?output=thumbnail&w=90&h=68&ll="+b+","+a}function map_click_overlay(g,e,d,a,f){var b=$("#"+g).offset().top;var c=$("#"+g).offset().left;$("#map-click-building").html(d.name);$("#map-click-post").html("<b>Posted by:</b><br>"+d.manage_co);$("#map-click-nh").html("<i>"+d.neighborhoods+"</i>");generic_load_pic("map-click-img",get_google_static_streetview(d.latitude,d.longitude),"clear2.gif");$("#"+e).css({top:b+a.y-100,left:c+a.x-f});$("#map-click-table").html('<div style="height:250px; text-align:center; margin-top: 80px;"><img src="/images/loader.gif"></img></div>');$("#"+e).slideDown("medium",function(){$(this).show()})}function center_on_screen(c){var b=$(window).height();var a=$(window).width();$("#"+c).appendTo("body");$("#"+c).css("top",(f_scrollTop()+5));$("#"+c).css("left",(a-$("#"+c).width())/2)}function center_on_screen2(c){var b=$(window).height();var a=$(window).width();$("#"+c).appendTo("body");$("#"+c).css("top",(f_scrollTop()+b/2-$("#"+c).height()/2));$("#"+c).css("left",(a-$("#"+c).width())/2)}function center_in_block(b,a){$("#"+b).appendTo("#"+a);id_width=$("#"+b).width();id_height=$("#"+b).height();block_width=$("#"+a).width();block_height=$("#"+a).height();block_top=$("#"+a).position().top;block_left=$("#"+a).position().left;$("#"+b).prependTo("#"+a);$("#"+b).css({top:Math.round(block_top+(block_height-id_height)/2),left:Math.round(block_left+(block_width-id_width)/2)});$("#"+b).show()}function wait_block(){$.blockUI({message:'<img src="/images/loader2.gif" alt=""/></img>',css:{border:"none",background:"none"},fadeIn:0,fadeOut:0})}function wait_block2(){$.blockUI({message:'<img src="/images/loader.gif" alt=""/></img>',css:{border:"none",background:"none",opacity:1},overlayCSS:{backgroundColor:"#fff",opacity:0},fadeIn:0,fadeOut:0})}function f_scrollTop(){return f_filterResults(window.pageYOffset?window.pageYOffset:0,document.documentElement?document.documentElement.scrollTop:0,document.body?document.body.scrollTop:0)}function f_filterResults(d,b,a){var c=d?d:0;if(b&&(!c||(c>b))){c=b}return a&&(!c||(c>a))?a:c}function remove_me(){$(this).remove()}function generic_error_reload(){$.unblockUI()}function serialize_object(b){var c="";for(var a in b){if(a!==null&&a!=""){c+=a+"|"}}return c}function serialize_object_2(b){var c="";for(var a in b){if(a!==null&&a!=""){c+=a+":"+b[a]+"|"}}return c}function deserialize_object_2(d){new_object=new Object;var b=d.split("|");for(var a=0;a<b.length;a++){var c=b[a].split(":");if(c[0]!=""){new_object[c[0]]=c[1]}}return new_object}function count_object(c){var b=0;for(var a in c){if(a!==null&&a!=""){b++}}return b}function fill_form(b,d){if(d===null){return}var c="#"+b+" ";$(c+":input").each(function(){if(d[$(this).attr("id")]===null){$(this).val("")}else{$(this).val(d[$(this).attr("id")])}});var a=new Object;$(c+'input[type="checkbox"]').each(function(){var e=$(this).attr("name");if(a[e]!=1){unserialize_checkboxes(e,d[e]);a[e]=1}})}function serialize_form(b,c){var e="#"+b+" ";var d=null;if(c===undefined){d=new Object}else{d=c}$(e+':input[type!="checkbox"]').each(function(){d[$(this).attr("id")]=$(this).val()});var a=new Object;$(e+'input[type="checkbox"]').each(function(){var f=$(this).attr("name");if(a[f]!=1){d[f]=serialize_checkboxes(f);a[f]=1}});return d}function serialize_form_2(b,c){var e="#"+b+" ";var d=null;if(c===undefined){d=new Object}else{d=c}$(e+':input[type!="checkbox"]').each(function(){d[$(this).attr("name")]=$(this).val()});var a=new Object;$(e+'input[type="checkbox"]').each(function(){var f=$(this).attr("name");if(a[f]!=1){d[f]=serialize_checkboxes(f);a[f]=1}});return d}function clear_form(b){var c="#"+b+" ";$(c+'input[type="hidden"]').each(function(){$(this).val("")});$(c+'input[type="text"]').each(function(){$(this).val("")});$(c+"textarea").each(function(){this.value=""});var a=new Object;$(c+'input[type="checkbox"]').each(function(){this.checked=false})}function reset_features(a){for(var b=0;b<a.length;b++){$('div[feature="'+features_array[b]+'"]').appendTo("#unselected-features");$('div[feature="'+features_array[b]+'"]').children("img").attr("src","/images/icons/plus.png")}}function php_query(a){for(i=0;i<a.length;i++){if(typeof(a[i]["selector"])=="undefined"){continue}if(a[i]["selector"]=="*"){window[a[i]["method"]]();continue}selector=$(a[i]["selector"]);method=a[i]["method"];argument=a[i]["argument"];switch(true){case (method=="blur"||method=="change"||method=="click"||method=="dblclick"||method=="error"||method=="focus"||method=="keydown"||method=="keypress"||method=="keyup"||method=="load"||method=="unload"||method=="mousedown"||method=="mousemove"||method=="mouseout"||method=="mouseover"||method=="mouseup"||method=="resize"||method=="scroll"||method=="select"||method=="submit")&&argument.length==1:selector[method](window[argument[0]]);break;case (method=="show"||method=="hide"||method=="slideDown"||method=="slideUp"||method=="slideToggle"||method=="fadeIn"||method=="fadeOut")&&argument.length==2:selector[method](argument[0],window[argument[1]]);break;case (method=="toggle"||method=="hover")&&argument.length==2:selector[method](window[argument[0]],window[argument[1]]);break;case (method=="fadeTo"&&argument.length==3):selector[method](argument[0],argument[1],window[argument[2]]);break;case (method=="animate"&&argument.length==4):selector[method](argument[0],argument[1],argument[2],window[argument[3]]);break;case argument.length==0:selector[method]();break;case argument.length==1:selector[method](argument[0]);break;case argument.length==2:selector[method](argument[0],argument[1]);break;case argument.length==3:selector[method](argument[0],argument[1],argument[2]);break;case argument.length==4:selector[method](argument[0],argument[1],argument[2],argument[3]);break;default:break}}}function close_no_save(a){$(a).hide()}function traverse(b,a){$.each(b,function(d,c){if(typeof(c)=="object"){traverse(c,a)}else{a(d,c)}})}function schedule_send(a){var b=serialize_form("schedule_form");$("#schedule_form").hide();$("#schedule_wait").show();$.post("/r/listings/contact/"+a,b,function(c,d){schedule_response(c,d)},"json")}function schedule_response(a,c){var b=a.response;if(b=="renter_email"){$("#schedule_result_text").css("color","red");$("#schedule_result_text").text("Please enter a valid e-mail so that the poster can contact you")}else{if(b=="renter_contact"){$("#schedule_result_text").css("color","red");$("#schedule_result_text").text("Please enter either a valid e-mail or phone number")}else{$("#schedule_result_text").css("color","green");$("#schedule_result_text").text("Thank you for using RentHop! The poster should be getting back to you shortly, and please let us know if you don't hear back!")}}$("#schedule_wait").hide();$("#schedule_result").show();setTimeout("schedule_result()",5000)}function schedule_result(){$("#schedule-overlay").hide();$("#schedule_result").hide();$("#schedule_form").show()}function load_remote_js(a,b,d){var c=document.createElement("script");c.type="text/javascript";if(!d){}else{c.onreadystatechange=function(){if(this.readyState=="complete"){d()}};c.onload=d}c.src=b;el(a).appendChild(c);return false}function TinyMCE(a){$("#"+a).tinymce({theme:"advanced",mode:"textareas",theme_advanced_toolbar_location:"top",theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,fontsizeselect,forecolor,separator,bullist,numlist,outdent,indent,blockquote,separator,undo,redo,separator,link,unlink,separator,justifyleft,justifycenter,justifyright,separator",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_toolbar_align:"left",plugins:"inlinepopups",convert_urls:0,dialog_type:"modal",extended_valid_elements:"object[align|width|height|flashvars|type|data|id|classid,classid:clsid:D27CDB6E-AE6D-11cf-96B8-444553540000],param[name|value],embed[src|type|wmode|width|height|autoplay|flashvars|classid,allowfullscreen],iframe[width|height|scrolling|marginheight|marginwidth|frameborder|border|src]",apply_source_formatting:false})}function get_tomorrow(){var c=new Date();c.setDate(c.getDate()+1);var d=c.getMonth()+1;var a=c.getDate();var b=c.getFullYear();return zero_pad(d,2)+"/"+zero_pad(a,2)+"/"+b}function ClScheduled(){}ClScheduled.remove_scheduled_post=function(b){var a=confirm("Are you sure you want to remove this scheduled post?");if(a){$.ajax({url:"/r/cl/remove_scheduled_post/"+b,success:function(){$("div[listing_row_id="+b+"]").slideUp()},error:function(){$("div[listing_row_id="+b+"]").slideUp()}})}return false};function ListingsSearch(){}ListingsSearch.load=function(){$('a[class="neighborhood_group_select"]').click(function(){return ListingsSearch.click_select_neighborhood_group(this)});$("#page_input_box").keypress(function(a){if(a.which==13){$("#search").val(0);$("#page").val($("#page_input_box").val());$("#search_form").submit()}});$("div[feature]").click(function(){var c=$(this).parent().attr("id");if(c=="unselected-features"){$(this).appendTo("#selected-features");$(this).children("img").attr("src","/images/icons/minus.png")}else{$(this).appendTo("#unselected-features");$(this).children("img").attr("src","/images/icons/plus.png")}var b=[];$("#selected-features").children("div[feature]").each(function(){b.push($(this).attr("feature"))});var a="";for(i=0;i<b.length;i++){a=b.join("|")}$("#features").val(a)})};ListingsSearch.click_select_neighborhood_group=function(a){var b=true;$(a).next().children("input[type=checkbox]").each(function(){if($(this).attr("checked")!="checked"){b=false}});if(b==false){$(a).next().children("input[type=checkbox]").attr("checked",true)}else{$(a).next().children("input[type=checkbox]").attr("checked",false)}return false};function AccountListings(){}AccountListings.remove_listing=function(b,c){var a;if(c==0){a=confirm("Are you sure you want to de-activate this listing?");if(a){$.ajax({url:"/r/listings/remove/"+b+"?ajax=1",type:"GET",success:function(){$("div[listing_row_id="+b+"]").slideUp()},error:function(){$("div[listing_row_id="+b+"]").slideUp()}})}}else{if(c==1){a=confirm("Are you sure you want to permanently delete this listing?");if(a){$.ajax({url:"/r/listings/remove/"+b+"?archive=1",type:"GET",success:function(){$("div[listing_row_id="+b+"]").slideUp()},error:function(){$("div[listing_row_id="+b+"]").slideUp()}})}}}return false};AccountListings.feature_listing=function(a){$("#featured_listing_id").attr("value",a);center_on_screen2("feature_listing_overlay");$("#feature_listing_overlay").show();return false};AccountListings.complete_profile=function(){center_on_screen2("profile_completeness_overlay");$("#profile_completeness_overlay").show();return false};AccountListings.change_listings=function(){if($("#change_listings_select").val()=="active"){window.location="/r/account/listings"}else{window.location="/r/account/listings?status=inactive"}};function Messages(){}Messages.contact_send=function(a){var b=serialize_form("contact_form");$("#contact_form").hide();$("#contact_wait").show();$.post("/r/listings/contact/"+a,b,function(c,d){Messages.contact_response(c)},"json")};Messages.contact_response=function(a,b){if(a.status==0){$("#contact_result_text").css("color","red")}else{$("#contact_result_text").css("color","green")}$("#contact_result_text").text(a.status_text);$("#contact_wait").hide();$("#contact_result").show()};function AccountMessageInbox(){}AccountMessageInbox.change_inbox=function(){if($("#change_inbox_select").val()=="active"){window.location="/r/account/message_inbox"}else{window.location="/r/account/message_inbox?status=deleted"}};function Favorites(){}Favorites.is_favorite=0;Favorites.current_listing_id=-1;Favorites.add=function(a){Favorites.is_favorite=1;Favorites.details_favorites_on();$('div[value="favorite_'+a+'"]').show();$.ajax({url:"/r/renter/add_favorite/"+a,type:"get",dataType:"json",success:function(b,c){if($('div[value="favorite_'+a+'"]').length==0){RenterPanel.add_favorite(b.html)}},error:function(){}});return false};Favorites.remove=function(a){Favorites.is_favorite=0;Favorites.details_favorites_off();$('div[value="favorite_'+a+'"]').hide();$.ajax({url:"/r/renter/remove_favorite/"+a,type:"get",dataType:"json",success:function(){},error:function(){}});return false};Favorites.toggle=function(a){if(Favorites.is_favorite){Favorites.remove(a)}else{Favorites.add(a)}return false};Favorites.details_favorites_off=function(){var a='<img width="16" height="16" src="/images/icons/add.png" style="vertical-align: text-bottom;"/> Add Favorite';$(".fav_on").removeClass("fav_on").addClass("fav_off");$(".fav_off").html(a);$("#favorites_button").removeClass("white").addClass("orange").html("Add To Favorites")};Favorites.details_favorites_on=function(){var a='<img width="16" height="16" src="/images/icons/delete.png" style="vertical-align: text-bottom;"/> Remove Favorite';$(".fav_off").removeClass("fav_off").addClass("fav_on");$(".fav_on").html(a);$("#favorites_button").removeClass("orange").addClass("white").html("Remove Favorite")};function RenterPanel(){}RenterPanel.renter_panel_action=function(a){$.ajax({url:"/r/renter/renter_panel_action/"+a,type:"get",dataType:"json"})};RenterPanel.add_favorite=function(a){$(a).prependTo("#favorites_list")};function RenterLoginOverlay(){}RenterLoginOverlay.login=function(){$.ajax({url:"/r/account/ajax_login_request",data:$("#renter_overlay_login").serializeArray(),type:"post",dataType:"json",success:function(a){if(a.status==1){location.reload()}else{$("#renter_login_password").val("");$("#renter_login_overlay_status").html('<div class="error_box">Username or password is incorrect.</div>')}},error:function(){}});return false};RenterLoginOverlay.register=function(){$.ajax({url:"/r/account/ajax_register_request",data:$("#renter_overlay_register").serializeArray(),type:"post",dataType:"json",success:function(a){if(a.status==1){location.reload()}else{$("#renter_login_overlay_status").html('<div class="error_box">'+a.status_text+"</div>")}},error:function(){}});return false};
