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,!1);this.util.addEvent(this.bdy,"click",this.saveInputFavorite,!1);this.util.addEvent(this.bdy,"click",this.saveAnchorFavorite,!1);this.util.addEvent(this.bdy,"click",this.removeFavorite,!1);this.util.addEvent(this.bdy,"click",this.sendToAgent,!1);this.util.addEvent(window,"load",this.gallery.setupGallery,!1);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],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))/MSIE/.test(navigator.userAgent)||(c2c.util.addEvent(window,"blur",
c2c.gallery.stopGallery,!1),c2c.util.addEvent(window,"focus",c2c.gallery.restartGallery,!1)),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)},restartGallery:function(){var a=c2c.gallery;a.advanceGallery();a.galleryTimer=
setInterval(c2c.gallery.advanceGallery,3500)},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},stopGallery:function(){var a=c2c.gallery;clearInterval(a.galleryTimer);clearInterval(a.fadeTimer);a.rightImage.style.opacity=a.leftImage.style.opacity="1";a.leftImage.style.filter=a.rightImage.style.filter="alpha(opacity=100)"}},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)){var a=document.createElement("li"),
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,
!1);c2c.searchHolder1.appendChild(a);c2c.searchHolder2&&c&&(c2c.util.addEvent(c,"click",c2c.showLastSearchResult,!1),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")if(c2c.util.stopDefault(a),/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")){for(var a=a.getElementsByTagName("input"),b=0,c="",d=a.length;b<d;b++)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++)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++)c2c.links[a].className==="favsBtn"&&(e=c2c.links[a].id.replace(/prop(erty)?/,""),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);(!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){if((a=c2c.util.findTarget(a,"input",this))&&a.className==="remBtn"){var a=a.id.replace("prop",""),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){if((a=c2c.util.findTarget(a,"input",this))&&a.className==="favsBtn"){var b=a.id.replace("prop",""),c=c2c.util.findCookie("favs");c?(c+=b+",",c2c.util.createCookie("favs",c,c2c.cookieDuration)):c2c.util.createCookie("favs",b+",",c2c.cookieDuration);c2c.convertFavsButtonToLink(a)}},saveAnchorFavorite:function(a){var b=c2c.util.findTarget(a,"a",this);b&&
b.className==="favsBtn"&&(c2c.util.stopDefault(a),a=b.id.replace(/prop(erty)?/,""),(b=c2c.util.findCookie("favs"))?(b+=a+",",c2c.util.createCookie("favs",b,c2c.cookieDuration)):(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),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!1},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,!1);this.util.addEvent(this.qsSubBtn,"click",this.goToProperty,!1)}},goToProperty:function(a){if(a.type==="click"||a.type==="keyup"&&a.keyCode===13)/^\d{3,}$/.test(c2c.qsTxtBox.value)?location.href=propertyPath+c2c.qsTxtBox.value:alert("Please enter a property number that is at least 3 digits long.")},checkLink:function(a){var b=c2c.util.findTarget(a,"a",this);b&&(/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)):/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!1};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=!0},this.stopDefault=function(a){a.returnValue=!1},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!1}},createCookie:function(a,b,c,d,e,f){a=a+
"="+escape(b);c&&(b=new Date,b.setTime(c),a+="; expires="+b.toGMTString());a+="; path=/";e&&(a+="; domain="+e);f&&(a+="; secure");document.cookie=a},findCookie:function(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+="; 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()};
