
﻿
function PhotoNotAvailLarge(obj){obj.src="/images_alt/prop_no_photo.gif";obj.width=390;obj.height=240;}
function GetEl(sElId){return document.getElementById(sElId);}
var iFCDelay=7000;var iMaxHeight=66;var iMaxWidth=130;var FadeDuration=3;var arFCImg=new Array();var arFCName=new Array();var arFCTxt=new Array();var arFCId=new Array();var arFCHref=new Array();var arFCAddr=new Array();var arFCAddr=new Array();var preFCLoad=new Array();var lastItem=1;var elementsPerRow=1;var vous;var bAuto=true;var iFCCnt=0;var iFCCur=0;var sText="";function load_featured_properties(){var iTotalFCCount=0;var sText=' Properties';for(var i=0;i<propertyListSize;i++){var sFeatVals=gFeatPropData[i].split('|');arFCName[i]=sFeatVals[0];arFCTxt[i]=sFeatVals[1];var sImg=sFeatVals[2];arFCImg[i]=sImg;preFCLoad[i]=new Image();preFCLoad[i].onerror=function(){if(typeof(PhotoNotAvail)=='function')PhotoNotAvail(this)};preFCLoad[i].src=sImg;preFCLoad[i].style.border='0';arFCHref[i]=sFeatVals[3];arFCAddr[i]=sFeatVals[4];arFCId[i]=sFeatVals[5];iTotalFCCount++;}
iFCCnt=arFCImg.length;var oPropNum=GetEl("currPropNum");var oTotalPropNum=GetEl("totalPropNum");RunFCSlideShow(0,iFCDelay);}
function update_check_availability(index){$("#fp_check_avail").attr("prop_name",arFCName[index]);$("#fp_check_avail").attr("listing_id",arFCId[index]);}
function RunFCSlideShow(iFCIdx,iFCDelay)
{if(iFCCnt<1)return;var fcDiv=GetEl("featured_property");var html='';iMaxHeight=161;iMaxWidth=215;if(elementsPerRow>iFCCnt)
elementsPerRow=iFCCnt;for(var iItem=0;iItem<elementsPerRow;iItem++){if(iFCIdx==iFCCnt)
iFCIdx=0;html+=fcCreateElement(iFCIdx);update_check_availability(iFCIdx);iFCIdx++;}
fcDiv.innerHTML=html+'<div class="clearboth"></div>';document.getElementById("propertyCount").innerHTML=iFCIdx+" of "+iFCCnt+sText;iFCCur=iFCIdx;lastItem=iFCIdx+1;if(bAuto){if(iFCIdx>(iFCCnt-1))iFCIdx=0;vous=setTimeout('RunFCSlideShow('+iFCIdx+',iFCDelay)',iFCDelay);}}
function fcCreateElement(iFCIdx){resizeMCImage(preFCLoad[iFCIdx],preFCLoad[iFCIdx]);var imgHtml=preFCLoad[iFCIdx].outerHTML;if(imgHtml==null){var newdiv=document.createElement('div');newdiv.appendChild(preFCLoad[iFCIdx]);imgHtml=newdiv.innerHTML}
var sHtml='';sHtml='<ul>';sHtml+='<li class="col_featuredName">';sHtml+='<a class=\"wt_ag_000O\" href="'+arFCHref[iFCIdx]+'" id=\"featuredPropertyNameLink_'+arFCId[iFCIdx]+'">'+arFCName[iFCIdx].replace('@','<span>@</span>')+'</a></li>';sHtml+='<li><span>'+arFCAddr[iFCIdx]+'</span></li>';sHtml+='<li class="col_featuredImage">';sHtml+='<a class=\"wt_ag_000N\"'+' id=\"featuredPropertyPhotoLink_'+arFCId[iFCIdx]+'" href="'+arFCHref[iFCIdx]+'">'+imgHtml+'</a>';sHtml+='</li>';sHtml+='</ul>';return sHtml;}
function PrevFC(){clearTimeout(vous);var iPrv=(iFCCur==elementsPerRow)?0:iFCCur-(elementsPerRow*2);if(iPrv<1)
iPrv=0;RunFCSlideShow(iPrv,iFCDelay);return false;}
function NextFC(){clearTimeout(vous);var iNxt=(iFCCur<=iFCCnt)?iFCCur:0;RunFCSlideShow(iNxt,iFCDelay);return false;}
function PhotoNotAvailForBanner(obj){obj.src="/images_alt/prop_no_photo.gif";}
function GetElMC(sElId){return document.getElementById(sElId);}
var iMCDelay=7000;var arMCImg=new Array();var arMCAlt=new Array();var arMCName=new Array();var arMCTxt=new Array();var arMCclass=new Array();var arMCid=new Array();var arMCHref=new Array();var arMCTitle=new Array();var preLoadMC=new Array();var vousMC;var bAutoMC=true;var iMCCnt=0;var iMCCur=0;var __elementsPerRow=2;function load_featured_companies(){for(var i=0;i<numOfFeatCompanies;i++){var sFeatVals=gFeatCompData[i].split('|');arMCTitle[i]=sFeatVals[0];arMCAlt[i]=sFeatVals[0];var sImg=sFeatVals[1];arMCImg[i]=sImg;preLoadMC[i]=new Image();preLoadMC[i].onerror=function(){if(typeof(PhotoNotAvail)=='function')PhotoNotAvail(this)};preLoadMC[i].src=sImg;arMCHref[i]=sFeatVals[2];arMCclass[i]=sFeatVals[3];arMCid[i]=sFeatVals[4];}
iMCCnt=arMCImg.length;RunMCSlideShow(0);}
function RunMCSlideShow(iMCIdx){if(iMCCnt<1)return;iMaxHeight=70;iMaxWidth=130;if(__elementsPerRow>iMCCnt)
__elementsPerRow=iMCCnt;var html='';for(var iItem=0;iItem<__elementsPerRow;iItem++){if(iMCIdx==iMCCnt)
iMCIdx=0;html+=mcCreateElement(iMCIdx);iMCIdx++;}
if(html!=''){var mcContainer=document.getElementById("divMc");mcContainer.innerHTML=html;}
if(bAutoMC){if(iMCIdx>(iMCCnt-1))iMCIdx=0;vousMC=setTimeout('RunMCSlideShow('+iMCIdx+')',iMCDelay);}}
function mcCreateElement(iMCIdx){var wt_class=arMCclass[iMCIdx];var mcItemTmplate="<dd class='featCompImg'><a href='{Url}' id=mgnt_{id} class={wt_class} rel='nofollow'>{img}</a></dd>";preLoadMC[iMCIdx].border="0";resizeMCImage(preLoadMC[iMCIdx],preLoadMC[iMCIdx]);var imgHtml=preLoadMC[iMCIdx].outerHTML;if(imgHtml==null){var newdiv=document.createElement('div');newdiv.appendChild(preLoadMC[iMCIdx]);imgHtml=newdiv.innerHTML}
return mcItemTmplate.replace("{Url}",arMCHref[iMCIdx]).replace("{img}",imgHtml).replace("{wt_class}",wt_class).replace("{id}",arMCid[iMCIdx]);}
var iMaxHeight;var iMaxWidth;function resizeMCImage(oPageImg,oImg,bDebug){var iRatio=0;var bWasAdjusted=false;var iBaseHeight=oImg.height;var iBaseWidth=oImg.width;var iNewHeight=iBaseHeight;var iNewWidth=iBaseWidth;if(iBaseWidth==0)
iBaseWidth=iMaxWidth+1;if(iBaseHeight==0)
iBaseHeight=iMaxHeight+1;if(iBaseWidth>iMaxWidth){iRatio=(iMaxWidth/iBaseWidth);iNewWidth=Math.round(iBaseWidth*iRatio);iNewHeight=Math.round(iBaseHeight*iRatio);bWasAdjusted=true;if(bDebug){alert("WIDTH TEST\n"+"iMaxWidth: "+iMaxWidth+"\n"+"iMaxHeight: "+iMaxHeight+"\n"+"iBaseWidth: "+iBaseWidth+"\n"+"iBaseHeight: "+iBaseHeight+"\n"+"iRatio: "+iRatio+"\n"+"iNewWidth: "+iNewWidth+"\n"+"iNewHeight: "+iNewHeight);}}
if(bWasAdjusted){if(iNewHeight>iMaxHeight){iRatio=(iMaxHeight/iNewHeight);iNewWidth=Math.round(iNewWidth*iRatio);iNewHeight=Math.round(iNewHeight*iRatio);if(bDebug){alert(JSResource.HeightTest+"iMaxWidth: "+iMaxWidth+"\n"+"iMaxHeight: "+iMaxHeight+"\n"+"iBaseWidth: "+iBaseWidth+"\n"+"iBaseHeight: "+iBaseHeight+"\n"+"iRatio: "+iRatio+"\n"+"iNewWidth: "+iNewWidth+"\n"+"iNewHeight: "+iNewHeight);}}}
else{if(iBaseHeight>iMaxHeight){iRatio=(iMaxHeight/iBaseHeight);iNewWidth=Math.round(iBaseWidth*iRatio);iNewHeight=Math.round(iBaseHeight*iRatio);if(bDebug){alert(JSResource.NormalHeightTest+"iMaxWidth: "+iMaxWidth+"\n"+"iMaxHeight: "+iMaxHeight+"\n"+"iBaseWidth: "+iBaseWidth+"\n"+"iBaseHeight: "+iBaseHeight+"\n"+"iRatio: "+iRatio+"\n"+"iNewWidth: "+iNewWidth+"\n"+"iNewHeight: "+iNewHeight);}}}
var iPadHeight=((iMaxHeight-iNewHeight)/2)
if(iPadHeight>0){oPageImg.style.marginTop=iPadHeight+"px";}
else{oPageImg.style.marginTop="0px";}
oPageImg.height=iNewHeight;oPageImg.width=iNewWidth;oPageImg.border="0";return;}
var vsm_player_moved=false;var contact_dialog=null;var current_listing_id=null;var f_left=0
var contact_dialog_height=375;var contact_dialog_width=465;var lead_popup='.lead_partial';var top=0;var left=0;var dialog_top_for_scroll=0;$(document).ready(function(){$(".lead_phone").keypress(isNumberKey);$("#mobileNumber").keypress(isNumberKeyNoFormat);$('#lead_partial').submit(submit_lead_via_ajax);$('#lead_partial_coupon').submit(submit_lead_via_ajax);$().mousemove(function(e){f_left=e.pageX;});$("#lead_lightbox").click(function(){$("#lead_lightbox").hide();contact_dialog.dialog("close");});});function submit_lead_via_ajax(){var form_name=$(this).attr("id");if(form_name=="lead_partial_coupon"){$(this).append('<input id="leadtype" type="hidden" value="coupon" name="leadtype" />');}
$.ajax({url:'/leads.js',type:'POST',data:$(this).serialize(),success:function(response){$(lead_popup+" .flash_notice").html(response);$(lead_popup).addClass("thank_you");$(lead_popup+" .lead_form").hide();remove_err();if(form_name=="lead_inline"){window.location.href="http://"+window.location.host+window.location.pathname+"ThankYou/";};return false;},error:function(req,status,err){var errors=eval(req.responseText);var element_name;$("#lead_partial label").each(function(){this.className=""})
$.each(errors,function(){element_selector="#lead_"+this[0]+"_"+form_name;$(element_selector).siblings("label").addClass("error");$(element_selector).siblings("label").attr("title",this[1]);});}});return false;}
function remove_err(){$(".error").removeClass("error");}
function left_position(){var form_width=480;var cur_left=0;var page_width=1000;if((f_left+form_width)>page_width){cur_left=page_width-form_width}
else{cur_left=f_left;}
return cur_left+"px";}
function top_position(){var top=160;if($.browser.msie){top=155;}
return top;}
function set_lead_popup(lead_type,offset_top){if(lead_type!='coupon'||lead_type=='undefined'){set_popup_dimensions(false);if(lead_popup==".lead_partial_coupon"){reset_lead_form();lead_popup=".lead_partial";}
showOverlay();left=left_position();top=(offset_top-top_position())+"px";}
else{set_popup_dimensions(true);if(lead_popup==".lead_partial"){reset_lead_form();lead_popup=".lead_partial_coupon";left=($('#coupon_button').offset().left+5)+'px';top=($('#coupon_button').offset().top+$('#coupon_button').height())+"px";}}
hide_thank_you();dialog_top_for_scroll=(offset_top-350);}
function window_height(){var myHeight=0;if(!$.browser.msie){myHeight=window.innerHeight;}else{myHeight=document.documentElement.clientHeight;}
return myHeight}
function set_popup_dimensions(isCoupon){if(isCoupon){if($.browser.msie){contact_dialog_height=510;}
else{contact_dialog_height=500;}
contact_dialog_width=750;}
else{if($.browser.msie){contact_dialog_height=400;}
else{contact_dialog_height=375;}
contact_dialog_width=465;}}
function hide_thank_you(){$(lead_popup).removeClass("thank_you");$(lead_popup+" .flash_notice").html("");$(lead_popup).css("height",contact_dialog_height);}
function reset_lead_form(){if(contact_dialog){contact_dialog.dialog('destroy');}
contact_dialog=null;}
function setup_lead_form(self){self=self.type=='click'?$(this):self;current_listing_id=$(self).attr("listing_id");lead_phone_required=$(self).attr("lead_phone_required");set_lead_popup($(self).attr("lead_type"),$(self).offset().top);if(lead_phone_required=="1"){$(".lead_phone_label").html("<em>*</em>&nbsp;Phone&nbsp;Number:");}else{$(".lead_phone_label").html("Phone&nbsp;Number:");}
$(".lead_form input[type='hidden'][id='lead_listing_id']").attr("value",current_listing_id);$(".lead_form input[type='hidden'][id='lead_phone_required']").attr("value",lead_phone_required);var occurrence_number=parseInt($(self).attr("id").split('_')[2])+1;if(occurrence_number!=NaN){$(".lead_form input[type='hidden'][id='occurrence_number']").attr("value",occurrence_number);}
$('#prop_name').html($(self).attr('prop_name'));if($(self).hasClass('special_offer')){$('#lead_form_heading').html('Current Rent Specials!');$('.lead_form input#special_offer').attr('value','true');if($('.lead_form textarea.lead_message').html()==''){$('.lead_form textarea.lead_message').html('Please tell me about your current rent specials!');}}else{$('#lead_form_heading').html('Check Availability');$('.lead_form input#special_offer').attr('value','false');}
if($(self).attr('id')=='fp_check_avail'){$('#is_featured_property').attr('value','true');}
if(contact_dialog==null){contact_dialog=$(lead_popup).dialog({modal:false,bgiframe:true,width:contact_dialog_width,height:contact_dialog_height,position:[top,left],resizable:false,draggable:false});$(lead_popup).show();$(lead_popup+" .lead_form").show();}
else{hide_thank_you();$(lead_popup).css("height",contact_dialog_height);$(lead_popup+" .lead_form_container").show();contact_dialog.dialog("open");$(lead_popup+" .lead_form").show();}
$('#lead_first_name_lead_partial').focus();$(".ui-dialog "+lead_popup)[0].parentNode.parentNode.style.left=left;$(".ui-dialog "+lead_popup)[0].parentNode.parentNode.style.top=top;var scroll_top=$(document).scrollTop();var button_top=$(self).offset().top;var available_room=button_top-scroll_top;if(available_room<335){window.scrollTo(0,dialog_top_for_scroll);}else if(available_room+contact_dialog_height>window_height()){window.scrollTo(0,dialog_top_for_scroll);}
return false;}
function showOverlay(){$("#lead_lightbox").show();var height=$("body").height()>$(window).height()?$("body").height():$(window).height();$("#lead_lightbox").css('height',height);$("#lead_lightbox").css('width',$("body").width());}
function isNumberKey(evt){var charCode=(evt.which)?evt.which:evt.keyCode
if(charCode>31&&(charCode<46||charCode>57)){return false;}
formatPhone(evt,this);return true;}
function isNumberKeyNoFormat(evt){var charCode=(evt.which)?evt.which:evt.keyCode;if(charCode>31&&(charCode<46||charCode>57)){return false;}
return true;}
function formatPhone(e,obj){if(e.keyCode==9){return;}
var validchars='0123456789';p=obj.value;for(var i=p.length;i>=0;i--){if(validchars.indexOf(p.charAt(i))==-1){p=p.replace(p.charAt(i),'');}}
if(p.length>1&&p.charAt(0)!="("){p="("+p;}
if(p.length>4&&p.charAt(4)!=")"){p=p.substring(0,4)+") "+p.substring(4);}
if(p.length>5&&p.charAt(5)!=" "){p=p.substring(0,5)+" "+p.substring(5);}
if(p.length>9&&p.charAt(9)!="-"){p=p.substring(0,9)+"-"+p.substring(9);}
for(var xPos=0;xPos<p.length;xPos++){if((p.charAt(xPos)=="-")&&(xPos!=9)){p=p.substring(0,p.length-1);}}
if(p.length>14)
p=p.substring(0,14)
obj.value=p;}
function URLDecode(str){return unescape(str).replace(/\+/g,' ');}
function populateContactFormFromCookie(){form_types=["_inline","_partial"];if($.cookie('lead_details')){lead_arr=$.cookie('lead_details').split("|");lead_first_name=URLDecode(lead_arr[0]);lead_email=URLDecode(lead_arr[2]);lead_phone=URLDecode(lead_arr[3]);lead_message=URLDecode(lead_arr[5]);lead_opt_in=URLDecode(lead_arr[6]);lead_move_date_preference=URLDecode(lead_arr[7]);for(x=0;x<=form_types.length-1;x++){if($(".lead"+form_types[x]).size()>0){$("#lead_first_name_lead"+form_types[x])[0].value=lead_first_name;$("#lead_email_lead"+form_types[x])[0].value=lead_email;$("#lead_phone_lead"+form_types[x])[0].value=lead_phone;$("#lead_move_date_preferencelead"+form_types[x]).selectOptions(lead_move_date_preference,true);$("#lead_message_lead"+form_types[x])[0].value=lead_message;$("#lead_opt_in_lead"+form_types[x])[0].value=lead_opt_in;}}}}
function Property(name,id,url,latitude,longitude,city,state,zipcode,phone_number,bedrooms,price,photo){this.name=name;this.url=url;this.latitude=latitude;this.longitude=longitude;this.city=city;this.state=state;this.zipcode=zipcode;this.phone_number=phone_number;this.bedrooms=bedrooms;this.price=price;this.photo=photo;this.setMarker=function(marker){this.marker=marker;}}function showPhotoHighlights(icon){var photo_urls=$(icon).attr("id").split(",");$(".photo_highlight_thumb").html("").css("width",photo_urls.length*84+"px")
$(photo_urls).each(function(){var name=this.replace(/'/g,"")
var src=this.replace(/'/g,"")+"80-54/"
$(new Image()).addClass("loading").load(function(){$(this).mouseover(function(){selectImage(this);}).removeClass("loading");}).attr("src",src).attr("name",name).appendTo(".photo_highlight_thumb");});$("#photo_highlights a.see_details").attr("href",$(icon).attr("name"));var divPopup=$("#photo_highlights");divPopup.css("left",(icon.offsetParent.offsetLeft+icon.offsetWidth+126)+'px');divPopup.css("top",(icon.offsetParent.offsetTop-80)+'px');divPopup.show().bgiframe();$(".photo_highlight_thumb_container").scrollLeft(0);selectImage($(".photo_highlight_thumb img:first"));return false;}
function selectImage(image){$("#photo_highlights .img_photo_highlight").attr("src",$(image).attr("name")+"350-245/")}
$(document).ready(function(){$(".photo_gallery_icon").live("click",function(){showPhotoHighlights(this);});$("#photo_highlights .popUpClose").live("click",function(){$("#photo_highlights").hide();});$(".navigator a.prev").live("click",function(){$(".photo_highlight_thumb_container").animate({"scrollLeft":"-=200"});});$(".navigator a.next").live("click",function(){$(".photo_highlight_thumb_container").animate({"scrollLeft":"+=200"});});});if($.browser.msie){$(document).ready(function(){$('.round > .round').corner("3px");$('.round').not('.round > .round').corner("5px");});}var map_container;var results_container;var __refine;var ErrorMessageDivHeight=0;$(document).ready(function(){map_container=$("#__mapWin");results_container=$(".results_container")
__refine=$('.breadcrumb')[0]?$('.breadcrumb')[0]:$('#apts');$(".special_refinement").each(function(){refinement_name=$("span.refinement_name",this).html();cookie_value=readCookie(refinement_name);if(cookie_value=="true"||cookie_value==true){$(this).next("ul:first").toggle();$("span.collapse",this).show();$("span.expand",this).hide();}});$("a#lnkPrev").live("click",function(){PrevFC();});$("a#lnkNext").live("click",function(){NextFC();});$("#property_name_form").submit(function(){var property=$("input#property").attr("value");if(property){var url=$("input#refinement_path").attr("value");document.location.href=refinementsUrlWithPropertyName(url,property);}
return false;});bind_search_results_behavior();});function set_refinement_cookie(name,expanded){createCookie(name,expanded);}
function setup_refinement_expand(){$(".refinement_heading").click(function(){$(this).next("ul:first").toggle();$("span.collapse",this).toggle();$("span.expand",this).toggle();var display=$("span.collapse",this).css("display");var expanded=false;if(display=="block"||display=="inline"){expanded=true;}
set_refinement_cookie($("span.refinement_name",this).html(),expanded)});}
function bind_search_results_behavior(){if($(".refine_options").length>0){setup_refinement_expand();}}
function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else
var expires="";document.cookie=name+"="+value+expires+"; path=/";}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var 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;}
function get_container_height(){var height="0px";if(map_open&&!__pinned){height=space_open;}
else if(!map_open&&!__pinned){height=space_close;}
return height;}
$('.wtr_lead').live('click',function(){$('iframe#btnCkAvailability').attr("src","http://switch.atdmt.com/jaction/bvkapt_formpage_2");});var markers=new Array();var map=null;var pin='';var infoTemplate="";var currentMarker=null;function loadMap(){map=new GMap2($("#map")[0]);map.addControl(new GSmallMapControl());map.addControl(new GMapTypeControl());pin=new GIcon(G_DEFAULT_ICON);var firstProperty=true;var maxLat=0;var maxLong=0;var minLat=0;var minLong=0;$(properties).each(function(){var coordinate=new GLatLng(this.latitude,this.longitude);if(this.latitude<minLat||firstProperty)
minLat=parseFloat(this.latitude);if(this.latitude>maxLat||firstProperty)
maxLat=parseFloat(this.latitude);if(this.longitude<minLong||firstProperty)
minLong=parseFloat(this.longitude);if(this.latitude>maxLat||firstProperty)
maxLong=parseFloat(this.longitude);var marker=new GMarker(coordinate,pin);var name=this.name;var url=this.url;var photo=this.photo;var city=this.city;var zipcode=this.zipcode;var bedrooms=this.bedrooms;var price=this.price;var phone_number=this.phone_number;var state=this.state;this.setMarker(marker);GEvent.addListener(marker,"click",function(){if(currentMarker!=null){currentMarker.closeInfoWindow();}
info_html="<div class=\"search_map_bubble\">\n <div class=\"pic\"><a href=\""+url+"\"><img src=\""+photo+"\" alt=\""+name+"\" width=\"70\" height=\"55\"/></a></div>\n  <span class=\"address\">"+name+"</span>\n  <span class=\"listingid\">"+city+","+state+" "+zipcode+"</span>\n";if(bedrooms.length>0){info_html+="<span class=\"bdbth\">"+bedrooms+" beds</span>\n";}
info_html+="<span class=\"price\">"+price+"</span>\n  <span class=\"phone\">"+phone_number+"</span>\n  </div>";marker.openInfoWindowHtml(info_html);currentMarker=marker;});map.addOverlay(marker);firstProperty=false;});var minLatLng=new GLatLng(minLat,minLong);var maxLatLng=new GLatLng(maxLat,maxLong);var bounds=new GLatLngBounds(minLatLng,maxLatLng);var center=bounds.getCenter();map.setCenter(center,map.getBoundsZoomLevel(bounds));map.panTo(map.getCenter());}
function findPropertyById(propertyList,id){for(i=0;i<propertyList.length;i++){if(propertyList[i].id==id){return propertyList[i];}}}
function getDynamicMap(){$.getScript("http://maps.google.com/maps?file=api&v=2&sensor=false&async=2&callback=loadMap&client=gme-csource&channel=AG");}