if(document.getElementsByTagName&&document.getElementById&&document.createElement&&document.createTextNode){var c2c={bdy:document.getElementsByTagName("body")[0],links:document.getElementsByTagName("a"),qsArea:document.getElementById("quickSearchArea"),qsTxtBox:document.createElement("input"),qsSubBtn:document.createElement("input"),cookieDuration:(new Date).getTime()+31536E6,searchHolder1:document.getElementById("searchHolder"),searchHolder2:document.getElementById("searchHolder2"),init:function(){this.util.configEvents();
this.bdy.oncontextmenu=this.stopCall;this.util.addEvent(this.bdy,"click",this.checkLink,false);this.util.addEvent(this.bdy,"click",this.saveInputFavorite,false);this.util.addEvent(this.bdy,"click",this.saveAnchorFavorite,false);this.util.addEvent(this.bdy,"click",this.removeFavorite,false);this.util.addEvent(this.bdy,"click",this.sendToAgent,false);this.util.addEvent(window,"load",this.gallery.setupGallery,false);this.configQuickSearch();this.configFavsBox();this.updateFavsText();this.saveSearchCookie();
this.showLastSearchBtn();this.noteNewWindow();this.displaySendAllToAgent()},gallery:{galleryArea:document.getElementById("rotatingImages"),gallerySource:document.getElementById("gallery"),leftImage:null,leftImageArray:[],leftPosition:0,rightImage:null,rightImageArray:[],rightPosition:0,galleryTimer:null,fadeTimer:null,fadeOutNum:100,fadeInNum:0,setupGallery:function(){if(c2c.gallery.galleryArea&&c2c.gallery.gallerySource){c2c.gallery.leftImage=c2c.gallery.galleryArea.getElementsByTagName("img")[0];
c2c.gallery.rightImage=c2c.gallery.galleryArea.getElementsByTagName("img")[1];if(c2c.gallery.leftImage&&c2c.gallery.rightImage){for(var a=c2c.gallery.gallerySource.getElementsByTagName("img"),b=0,c=0,d=0,e=a.length;b<e;b+=2){if(a[b]&&!/\.gif/.test(a[b].src)){c2c.gallery.leftImageArray[c]=a[b].src;c++}if(a[b+1]&&!/\.gif/.test(a[b+1].src)){c2c.gallery.rightImageArray[d]=a[b+1].src;d++}}if(!(c2c.gallery.leftImageArray.length<2||c2c.gallery.rightImageArray.length<2)){c2c.gallery.advanceGallery();c2c.gallery.galleryTimer=
setInterval(c2c.gallery.advanceGallery,3500)}}}},advanceGallery:function(){var a=c2c.gallery;a.leftPosition=a.leftImageArray[a.leftPosition+1]?a.leftPosition+1:0;a.rightPosition=a.rightImageArray[a.rightPosition+1]?a.rightPosition+1:0;a.fadeTimer=setInterval(c2c.gallery.fadeOut,50)},fadeOut:function(){var a=c2c.gallery;a.fadeOutNum-=10;a.leftImage.style.opacity=a.rightImage.style.opacity=a.fadeOutNum/100;a.leftImage.style.filter=a.rightImage.style.filter="alpha(opacity="+a.fadeOutNum+")";if(a.fadeOutNum===
0){clearInterval(a.fadeTimer);a.leftImage.src=a.leftImageArray[a.leftPosition];a.rightImage.src=a.rightImageArray[a.rightPosition];a.fadeTimer=setInterval(c2c.gallery.fadeIn,50);a.fadeOutNum=100}},fadeIn:function(){var a=c2c.gallery;a.fadeInNum+=10;a.rightImage.style.opacity=a.leftImage.style.opacity=a.fadeInNum/100;a.leftImage.style.filter=a.rightImage.style.filter="alpha(opacity="+a.fadeInNum+")";if(a.fadeInNum===100){clearInterval(a.fadeTimer);a.fadeInNum=0}}},displaySendAllToAgent:function(){var a=
document.getElementById("sendAll"),b=document.getElementById("sendAll2"),c=c2c.util.findCookie("favs");if(c&&a)a.style.display="block";if(c&&b)b.style.display="block"},noteNewWindow:function(){for(var a=0,b=this.links.length;a<b;a++)if(/newWin/.test(this.links[a].className))this.links[a].title="This link to an external website opens in a new window or tab"},showLastSearchBtn:function(){var a=this.util.findCookie("search");if(!(!c2c.searchHolder1||!c2c.searchHolder2||!a)){if(/propertyNav/.test(c2c.searchHolder1.className)){a=
document.createElement("li");var b=document.createElement("a");b.href="#";a.appendChild(b).appendChild(document.createTextNode("View Last Search Result"))}else{a=document.createElement("input");a.type="button";a.value="View Last Search Result";a.className="lastSearchBtn"}if(/propertyNav/.test(c2c.searchHolder2.className)){var c=document.createElement("li");b=document.createElement("a");b.href="#";c.appendChild(b).appendChild(document.createTextNode("View Last Search Result"))}c2c.util.addEvent(a,
"click",c2c.showLastSearchResult,false);c2c.searchHolder1.appendChild(a);if(c2c.searchHolder2&&c){c2c.util.addEvent(c,"click",c2c.showLastSearchResult,false);c2c.searchHolder2.appendChild(c)}}},showLastSearchResult:function(a){c2c.util.stopDefault(a);if(a=c2c.util.findCookie("search")){var b=propertyPath.replace("property/","");location.href=b+"search.html"+a}},sendToAgent:function(a){var b=c2c.util.findTarget(a,"input",this)||c2c.util.findTarget(a,"a",this);if(!(!b||b.className!=="sendTo")){c2c.util.stopDefault(a);
if(/agent/.test(b.id)){a=b.id.replace("agent","");location.href=inquiryPath+a}else if(/priv/.test(b.id)){a=b.id.replace("priv","");location.href=propertyPath+a+"#rentalContactSection"}else if(/allfavs/.test(b.id)||/sendAll/.test(b.parentNode.id)||/sendAll2/.test(b.parentNode.id)){if(a=document.getElementById("properties")){a=a.getElementsByTagName("input");b=0;for(var c="",d=a.length;b<d;b++)if(a[b].value==="Send to Agent")c+=a[b].id.replace("agent","")+",";c=c.substring(0,c.lastIndexOf(","));location.href=
inquiryPath+c}if(document.getElementById("searchHolder2")){a=c2c.util.findCookie("favs");a=a.substring(0,a.lastIndexOf(","));location.href=inquiryPath+a}}}},saveSearchCookie:function(){if(/search\.html\?/.test(location.href)){var a=location.href.lastIndexOf("?");a=location.href.substring(a);a.length<4||c2c.util.createCookie("search",a)}},updateFavsText:function(){var a=document.getElementsByTagName("input"),b=c2c.util.findCookie("favs");if(b){for(var c=0,d=[],e=0,f=a.length;c<f;c++)if(a[c].type===
"button"&&a[c].className==="favsBtn"){d[e]=a[c];e++}a=0;for(c=d.length;a<c;a++){e=d[a].id.replace("prop","");b.match(e+",")&&this.convertFavsButtonToLink(d[a])}if(/\/property\//.test(location.href))for(a=0;a<c2c.links.length;a++)if(c2c.links[a].className==="favsBtn"){e=c2c.links[a].id.replace(/prop(erty)?/,"");if(b.match(e+",")){c2c.links[a].parentNode.parentNode.removeChild(c2c.links[a].parentNode);c2c.updatePropertyHeading()}}}},updatePropertyHeading:function(){var a=document.getElementsByTagName("h1")[0];
if(!(a.getElementsByTagName("a").length>0)){var b=document.createElement("a");b.href="rental-favorites.html";b.appendChild(document.createTextNode("Saved as a Favorite"));a.appendChild(document.createTextNode(" ("));a.appendChild(b);a.appendChild(document.createTextNode(")"))}},configFavsBox:function(a){if(!/rental\-favorites\.html/.test(location.href)){var b=c2c.util.findCookie("favs"),c=0;if(b){b=b.substring(0,b.length-1);c=b.split(",");document.getElementById("favs")&&this.bdy.removeChild(document.getElementById("favs"));
b=document.createElement("div");b.id="favs";var d=document.createElement("a");d.href="rental-favorites.html";d.appendChild(document.createTextNode(c.length+" Favorite"+(c.length>1?"s":"")));this.bdy.appendChild(b).appendChild(d);if(!a||a!=="noshowButton")this.insertViewAllFavoritesButton()}}},insertViewAllFavoritesButton:function(a){if(!a){var b=document.getElementById("searchHolder");a=document.getElementById("searchHolder2");if(/\/property\//.test(location.href)&&b){var c=document.createElement("li"),
d=document.createElement("a");d.href="rental-favorites.html";c.appendChild(d).appendChild(document.createTextNode("View All Favorites"));b.insertBefore(c,b.firstChild)}if(/\/property\//.test(location.href)&&a){b=document.createElement("li");c=document.createElement("a");c.href="rental-favorites.html";b.appendChild(c).appendChild(document.createTextNode("View All Favorites"));a.insertBefore(b,a.firstChild)}}},removeFavorite:function(a){a=c2c.util.findTarget(a,"input",this);if(!(!a||a.className!=="remBtn")){a=
a.id.replace("prop","");var b=c2c.util.findCookie("favs");if(b){b=b.replace(a+",","");c2c.util.createCookie("favs",b,c2c.cookieDuration);location.href="rental-favorites.html"}}},saveInputFavorite:function(a){a=c2c.util.findTarget(a,"input",this);if(!(!a||a.className!=="favsBtn")){var b=a.id.replace("prop",""),c=c2c.util.findCookie("favs");if(c){c+=b+",";c2c.util.createCookie("favs",c,c2c.cookieDuration)}else c2c.util.createCookie("favs",b+",",c2c.cookieDuration);c2c.convertFavsButtonToLink(a)}},saveAnchorFavorite:function(a){var b=
c2c.util.findTarget(a,"a",this);if(!(!b||b.className!=="favsBtn")){c2c.util.stopDefault(a);a=b.id.replace(/prop(erty)?/,"");if(b=c2c.util.findCookie("favs")){b+=a+",";c2c.util.createCookie("favs",b,c2c.cookieDuration)}else{c2c.util.createCookie("favs",a+",",c2c.cookieDuration);c2c.insertViewAllFavoritesButton()}b=document.getElementById("prop"+a);a=document.getElementById("property"+a);b&&b.parentNode.parentNode.removeChild(b.parentNode);if(a){a.parentNode.parentNode.removeChild(a.parentNode);c2c.displaySendAllToAgent()}c2c.updatePropertyHeading();
c2c.configFavsBox("noshowButton")}},convertFavsButtonToLink:function(a){var b=document.createElement("a");b.href="rental-favorites.html";var c=/search\.html/.test(location.href)?a.parentNode.parentNode.getElementsByTagName("h2")[0]:a.parentNode.parentNode.cells[4].getElementsByTagName("h2")[0];a.parentNode.removeChild(a);c.insertBefore(document.createTextNode("FAVORITE: "),c.firstChild);c.appendChild(document.createTextNode(" - "));c.appendChild(b).appendChild(document.createTextNode("View Favorites"));
c2c.configFavsBox()},stopCall:function(){return false},configQuickSearch:function(){if(this.qsArea){var a=document.createElement("label");a.appendChild(document.createElement("strong")).appendChild(document.createTextNode("Property Number: "));this.qsTxtBox.type="text";this.qsTxtBox.size="5";this.qsTxtBox.id=a.htmlFor="propNumFld";this.qsSubBtn.type="button";this.qsSubBtn.value="Jump";this.qsArea.appendChild(a);this.qsArea.appendChild(this.qsTxtBox);this.qsArea.appendChild(document.createTextNode(" "));
this.qsArea.appendChild(this.qsSubBtn);this.util.addEvent(this.qsTxtBox,"keyup",this.goToProperty,false);this.util.addEvent(this.qsSubBtn,"click",this.goToProperty,false)}},goToProperty:function(a){if(a.type==="click"||a.type==="keyup"&&a.keyCode===13)if(/^\d{3,}$/.test(c2c.qsTxtBox.value))location.href=propertyPath+c2c.qsTxtBox.value;else alert("Please enter a property number that is at least 3 digits long.")},checkLink:function(a){var b=c2c.util.findTarget(a,"a",this);if(b)if(/newWin/.test(b.className)){window.open(b.href,
"_blank","top=5,left=5,status=1,width=750,height=550,menubar=1,scrollbars=1,resizable=1,location=1,toolbar=1");c2c.util.stopDefault(a)}else if(/videoLink/.test(b.className)){window.open(b.href,"_blank","width=750,height=710");c2c.util.stopDefault(a)}},util:{configEvents:function(){if(document.addEventListener){this.addEvent=function(a,b,c,d){a.addEventListener(b,c,d)};this.stopBubble=function(a){a.stopPropagation()};this.stopDefault=function(a){a.preventDefault()};this.findTarget=function(a,b,c){for(a=
a.target;a&&a!==c;)if(a.nodeName.toLowerCase()===b)return a;else a=a.parentNode;return false}}else if(document.attachEvent){this.addEvent=function(a,b,c){a["e"+b+c]=c;a[b+c]=function(){a["e"+b+c](window.event)};a.attachEvent("on"+b,a[b+c])};this.stopBubble=function(a){a.cancelBubble=true};this.stopDefault=function(a){a.returnValue=false};this.findTarget=function(a,b,c){for(a=a.srcElement;a&&a!==c;)if(a.nodeName.toLowerCase()===b)return a;else a=a.parentNode;return false}}},createCookie:function(a,
b,c,d,e,f){a=a+"="+escape(b);if(c){b=new Date;b.setTime(c);a+="; expires="+b.toGMTString()}a+="; path=/";if(e)a+="; domain="+e;if(f)a+="; secure";document.cookie=a},findCookie:function(a){a=a+"=";for(var b=a.length,c=document.cookie.length,d=0;d<c;){var e=d+b;if(document.cookie.substring(d,e)===a)return this.findCookieValue(e);d=document.cookie.indexOf(" ",d)+1;if(d==0)break}return null},eraseCookie:function(a){if(c2c.util.findCookie(a)){a=a+"=";a+="; expires=Thu, 01-Jan-70 00:00:01 GMT";document.cookie=
a}},findCookieValue:function(a){var b=document.cookie.indexOf(";",a);if(b==-1)b=document.cookie.length;return unescape(document.cookie.substring(a,b))}}};c2c.init()};