MV.widget.Accordion=function(a,b){this.init(a,b)};

MV.widget.Accordion.prototype={init:function(b,d)
  { var a=this;
	  this.el=$get(b);
		this.cfg=new $U.Config(this);
		this.cfg.addProperty("autoSize",{value:"None",handler:function(f,e,g){},validator:function(e){if(typeof e=="string"){return("None, Fill, Limit".indexOf(e)!=-1)}else{return false}}});
		this.cfg.addProperty("selectedIndex",{value:0,handler:function(f,e,g){},validator:a.cfg.checkNumber});
		this.cfg.addProperty("accordion",{value:true,handler:function(f,e,g){},validator:a.cfg.checkBoolean});
		this.cfg.addProperty("requireOpenedPane",{value:true,handler:function(f,e,g){},validator:a.cfg.checkBoolean});
		this.cfg.addProperty("headerCssClass",{value:"",handler:function(f,e,g){}});
		this.cfg.addProperty("headerSelectedCssClass",{value:"",handler:function(f,e,g){}});
		this.cfg.addProperty("contentCssClass",{value:"",handler:function(f,e,g){}});
		this.cfg.addProperty("animationSpeed",{value:0.25,handler:function(f,e,g){a.animationSpeed=e[0]},validator:a.cfg.checkNumber});
		this.cfg.addProperty("animationMethod",{value:$U.Easing.easeOut,handler:function(f,e,g){}});
		this.cfg.addProperty("animationCompleteHandler",{value:null,handler:function(f,e,g){if(a._animationCompleteEvt){a._animationCompleteEvt.unsubscribe(a._currAnimationCompleteHandler,a)}a._currAnimationCompleteHandler=e[0];
		if(a._currAnimationCompleteHandler){if(!a._animationCompleteEvt){a._animationCompleteEvt=new $U.CustomEvent("onAnimationComplete",a)}a._animationCompleteEvt.subscribe(a._currAnimationCompleteHandler,a)}}});
		if(d){this.cfg.applyConfig(d,true)}this._currAnimationCompleteHandler=this.cfg.getProperty("animationCompleteHandler");
		
		var c=this.cfg.getProperty("animationCompleteHandler");
		if(c){this._animationCompleteEvt=new $U.CustomEvent("onAnimationComplete",this);
		this._animationCompleteEvt.subscribe(c,this)}this._selectedIndex=this.cfg.getProperty("selectedIndex");
		this._panes=[];
		this._autoSize=this.cfg.getProperty("autoSize");
		this._requireOpenedPane=this.cfg.getProperty("requireOpenedPane");
		this._headersSize=0;
		this._headerCssClass=this.cfg.getProperty("headerCssClass");
		this._headerSelectedCssClass=this.cfg.getProperty("headerSelectedCssClass");
		this._contentCssClass=this.cfg.getProperty("contentCssClass");
		this._paddingHeight=this.cfg.getProperty("paddingHeight");
		this._animationSpeed=this.cfg.getProperty("animationSpeed");
		this._animationMethod=this.cfg.getProperty("animationMethod");
		this._accordion=this.cfg.getProperty("accordion");
		this.initialize()},initialize:function(){var c=this.el.childNodes;var d={};
		for(d.value=0;d.value<c.length;d.value++){var a=this._getNextDiv(c,d);
		if(!a){break}var b=this._getNextDiv(c,d);
		if(b){this.addPane(a,b);d.value--}}this._initializeLayout()},addPane:function(e,b){var a={};
		a.animation=null;
		a.header=e;
		e._index=this._panes.length;
		$E.addListener(e,"click",this._onHeaderClick,this,true);
		var c=this.el;
		var d=document.createElement("div");
		c.insertBefore(d,b);
		d.appendChild(b);
		d._original=b;
		a.content=d;
		d.style.border="";
		d.style.margin="";
		d.style.padding="";
		this._panes.push(a);
		this._initializePane(e._index);
		b.style.display="block";
		return a},get_Pane:function(a){if(a===undefined||a===null){a=this._selectedIndex}return(this._panes&&a>=0&&a<this._panes.length)?this._panes[a]:null},setProperty:function(b,a,c){this.cfg.setProperty(b,a,c)},getProperty:function(a){return this.cfg.getProperty(a)},_getNextDiv:function(b,c){var a=null;while(c.value<b.length&&(a=b[c.value++])){if(a.tagName&&(a.tagName.toLowerCase()==="div")){break}}return a},_onHeaderClick:function(a){var c=$E.getTarget(a);var b=this.el;while(c&&(c.parentNode!==b)){c=c.parentNode}$E.stopPropagation(a);var d=c._index;if((d===this._selectedIndex)&&!this._requireOpenedPane){d=-1}this._changeSelectedIndex(d,true)},_changeSelectedIndex:function(d){var a=this._selectedIndex;var c=this.get_Pane(d);var b=this.get_Pane(a);if(b){b.header.className=this._headerCssClass}if(c){c.header.className=(this._headerSelectedCssClass=="")?this._headerCssClass:this._headerSelectedCssClass}this._selectedIndex=d;this._changePanes(a)},_changePanes:function(c){var d=null;var a=null;for(var b=0;b<this._panes.length;b++){var e=this._panes[b];var f=this._getAnimation(e);if(f.isAnimated()){f.stop()}if(b==this._selectedIndex){f._opening=true;d=f}else{if(b==c){f._opening=false;a=f}else{continue}}this._startPaneChange(e,f._opening);if(this._autoSize==="Fill"){f.setEl(e.content._original);f.attributes.height.from=($T.getContentSize(e.content._original).height);f.attributes.height.to=(f._opening?this._getRemainingHeight(true):0)}else{f.setEl(e.content);f.attributes.height.from=(e.content.offsetHeight);f.attributes.height.to=(f._opening?this._getRemainingHeight(false):0)}}if(a){if(this.cfg.getProperty("animationCompleteHandler")){this._animationCompleteEvt.fire(this._panes[c],false)}a.animate()}if(d){if(this.cfg.getProperty("animationCompleteHandler")){this._animationCompleteEvt.fire(this._panes[this._selectedIndex],true)}d.animate()}},_getAnimation:function(a){var b=a.animation;if(!b){b=new $A(a.content,{height:{from:0,to:0}},this._animationSpeed,this._animationMethod);a.animation=b;b.onComplete.subscribe(function(){this._endPaneChange(a,b._opening)},this,true)}return b},_startPaneChange:function(a,d){var c=a.content;var b=c._original;if(d){c.style.display="block"}else{c.style.overflow="hidden";b.style.overflow="hidden";if(this._autoSize==="Limit"){c.style.height=this._getTotalSize(b).height+"px";b.style.maxHeight=""}}},_endPaneChange:function(a,d){var c=a.content;var b=c._original;if(d){if(this._autoSize==="Limit"){var e=this._getRemainingHeight(true);b.style.maxHeight=e+"px"}b.style.overflow="auto";c.style.height="auto";c.style.overflow="auto"}else{c.style.display="none"}},_initializePane:function(e){var a=this.get_Pane(e);if(!a){return}var d=a.content;var c=d._original;var b=(e===this._selectedIndex);d.style.height=(b||(this._autoSize==="Fill"))?"auto":"0px";d.style.overflow=b?"auto":"hidden";d.style.display=b?"block":"none";c.style.height="auto";c.style.maxHeight="";c.style.overflow=b?"auto":"hidden"},_initializeLayout:function(){for(var c=0;c<this._panes.length;c++){var d=this._panes[c].animation}var b=this.el;this._initialHeight=b.offsetHeight;var a=b.style;if(this._autoSize==="None"){var e=(MV.env.ua.ie&&MV.env.ua.ie>=7);if(!e||(e&&a.height&&a.height.length>0)){a.height="auto"}if(!e||(e&&a.overflow&&a.overflow.length>0)){a.overflow="auto"}}else{a.height=b.offsetHeight+"px";a.overflow="hidden"}for(var c=0;c<this._panes.length;c++){this._initializePane(c)}this._resizeSelectedPane()},_resizeSelectedPane:function(){var a=this.get_Pane();if(!a){return}this._headersSize=this._getHeadersSize().height;var b=a.content._original;switch(this._autoSize){case"None":b.style.height="auto";b.style.maxHeight="";break;case"Limit":var c=this._getRemainingHeight(false);b.style.height="auto";b.style.maxHeight=c+"px";break;case"Fill":var c=this._getRemainingHeight(true);b.style.height=c+"px";b.style.maxHeight="";break}},_getHeadersSize:function(){var a={width:0,height:0};for(var c=0;c<this._panes.length;c++){var b=this._getTotalSize(this._panes[c].header);a.width=Math.max(a.width,b.width);a.height+=b.height}return a},_getTotalSize:function(c){var a=$T.getSize(c);var b=$T.getMarginBox(c);a.width+=b.horizontal;a.height+=b.vertical;return a},_getRemainingHeight:function(e){var b=0;var a=this.get_Pane();if(this._autoSize==="None"){if(a){b=this._getTotalSize(a.content._original).height}}else{b=this._headersSize;if(e&&a){b+=this._getGutterSize(a.content._original).height}var c=this.el;b=Math.max(c.offsetHeight-b,0);if(a&&(this._autoSize==="Limit")){var d=this._getTotalSize(a.content._original).height;if(d>0){b=Math.min(b,d)}}}return b},_getGutterSize:function(a){var d={width:0,height:0};try{var b=$T.getPaddingBox(a);d.width+=b.horizontal;d.height+=b.vertical}catch(c){}try{var b=$T.getBorderBox(a);d.width+=b.horizontal;d.height+=b.vertical}catch(c){}var b=$T.getMarginBox(a);d.width+=b.horizontal;d.height+=b.vertical;return d}};MV.register("Accordion",MV.widget.Accordion,{version:"1.0.0.1",build:"001"});var listingIds="";var midListingId="";var midNavigation="";var midProduct="";var midType="";var midSeq="";var SEOModule=null;var moreSEOLink=$get("seoShow");if(window.LinkClick){MUE.addListener("carousel1Content1ViewDetails","click",LinkClick,"Carousel Listing Extreme");MUE.addListener("carouselContent1ViewDetails","click",LinkClick,"Carousel Listing Local")}function doFARSearch(){__doPostBack("ctl00$cphC$FindRealtorSearch$lbFARGo","")}function doWYHWSearch(){__doPostBack("ctl00$cphC$WhatsYourHomeWorth$lbWYHWGo","")}function initValidation(){if($get("ctl00_cphC_WhatsYourHomeWorth_lbWYHWGo")!=null){var c=new MV.widget.FormValidator("ctl00_cphC_WhatsYourHomeWorth_lbWYHWGo",{trapEnterKey:"wyhwForm",fields:[new MV.widget.FieldValidator("tbWYHWZip",{errorContainer:"ZipcodeError",Required:{Message:"Please enter a zip code."},RegEx:{expr:/(^\d{5}$)|(^\d{5}-\d{4}$)/,Message:"Please enter a valid zip code."}})]});c.on("onValid",this.doWYHWSearch.createDelegate(this))}if($get("ctl00_cphC_FindRealtorSearch_lbFARGo")!=null){var b=new MV.widget.FormValidator("ctl00_cphC_FindRealtorSearch_lbFARGo",{trapEnterKey:"divHomeRealtorForm",fields:[new MV.widget.FieldValidator("tbCity",{errorContainer:"FAR_Error_City",Required:{Message:"Please enter a city."}}),new MV.widget.FieldValidator("ctl00_cphC_FindRealtorSearch_ccStateddl",{errorContainer:"FAR_Error_State",Required:{Message:"Please enter a state."}})]});b.on("onValid",this.doFARSearch.createDelegate(this))}var d=new MV.widget.FormValidator("ctl00_cphC_MainSearch_btnSearch",{trapEnterKey:"MVHPSearchForm",fields:[new MV.widget.FieldValidator("srchHomeLocation",{errorContainer:"mvLocErr",messageContainer:"mvLocMsg",Required:{Message:"Please enter a location."}}),new MV.widget.FieldValidator("txtMinPrice",{filterType:"Custom",filterMode:"ValidChars",validChars:"0123456789$.,"}),new MV.widget.FieldValidator("txtMaxPrice",{filterType:"Custom",filterMode:"ValidChars",validChars:"0123456789$.,"})]});d.on("onValid",doFAHSearch.createDelegate(this));var a=new MV.widget.FormValidator("ctl00_cphC_MainSearch_btnMLSIDsearch",{trapEnterKey:"dMLSSearch",fields:[new MV.widget.FieldValidator("txtMLSID",{errorContainer:"dMLSError",Required:{Message:"Please enter an MLS ID."}})]});a.on("onValid",doMLSIDSearch.createDelegate(this))}function loadHomePage(){initSEOModule();initValidation();initCarousel()}MUE.onDOMReady(loadHomePage);function seeMoreSEO(){SEOModule.show();moreSEOLink.style.display="none"}function seeLessSEO(){SEOModule.hide();moreSEOLink.style.display="inline"}function initSEOModule(){SEOModule=new MV.widget.Module("moreSEO",{visible:false});SEOModule.render();MUE.addListener("seoShow","click",seeMoreSEO,SEOModule,true);MUE.addListener("seoHide","click",seeLessSEO,SEOModule,true)};var currentCarouselType;var carouselTypes={EXT:0,LOC:1};function initCarousel(){SetCarouslType();var a="/WCF/SearchService.svc/listing/PhotoCarousel.json/25";if(currentCarouselType==carouselTypes.EXT){a="WCF/SearchService.svc/listing/ExtremeHomes.json/25"}pcLocalHomes=new MV.widget.Carousel("dLocalHomesCarousel",{autoPlay:6425,animationType:1,fadeText:"fadeSec",size:25,nextElement:"btnCarouselRt",prevElement:"btnCarouselLt",animationSpeed:0.6,loadingHeader:"Loading Photo Carousel, please wait...",loadingBody:"<div align='center'><img src='http://"+baseHost+"static.move.com/common/img/loading.gif' /></div>",serviceURL:a,animationStartHandler:onLocalHomesAnimStart,animationCompleteHandler:onLocalHomesAnimComp,onSuccessHandler:onLocalHomesSuccessHandler,onFailureHandler:onLocalHomesFailureHandler,animationAttributes:{attr1:{width:{to:70},height:{to:53},top:{to:57},left:{to:10}},attr2:{width:{to:100},height:{to:75},top:{to:35},left:{to:113}},attr3:{width:{to:140},height:{to:105},top:{to:5},left:{to:242}},attr4:{width:{to:100},height:{to:75},top:{to:35},left:{to:411}},attr5:{width:{to:70},height:{to:53},top:{to:57},left:{to:543}}}});pcLocalHomes.onMiddleImageClicked.subscribe(MiddleClick);pcLocalHomes.onMiddleImageClicked.subscribe(onLocalMiddleImageClicked);MUE.addListener("carouselInfo1","click",LinkClick);MUE.addListener("carouselContent1Save","mouseover",onSaveMouseOverLocalHomes,this)}function SetCarouslType(){var a=MU.Cookie.get("RecentSearch");if(ML.isNull(a)){currentCarouselType=carouselTypes.EXT}else{if(a.length>10){currentCarouselType=carouselTypes.LOC}else{carouselType=carouselTypes.EXT}}}var pcLocalHomes=null,pcExtremeHomes=null,hsWelcome=null,tvCarousel=null;var onLocalHomesAnimStart=function(b,a){};var onLocalHomesAnimComp=function(c,i){var j="";if(window.location.search.substring(1).length>1){j="&"+window.location.search.substring(1)}var d=this._dataList.Listings[this._midImg];var a=$get("carouselInfo1");a.href=d.URL+j;$E.addListener(a,"click",onLocalMiddleImageClicked,this);var k=new MUA("fadeSec",{opacity:{from:0,to:1}},0.3,$U.Easing.easeBoth);k.animate();if(d.Address){$update("carouselInfo1",d.Address+", ")}else{$update("carouselInfo1","")}$update("carouselInfo2"," "+d.CSP);$update("lPrice",d.pr);$update("carouselInfo3"," | "+d.Features);var h=$get("brokerLogo");var l=$get("brokerImg");var g=$get("brokerLink");if(d.BOL){if(g){g.href=d.BOL;MUD.setStyle(g,"visibility","visible");MUD.setStyle("saveSep","visibility","visible");$E.addListener(g,"click",ReportOtherLinkClick,d.BOL)}else{MUD.setStyle("saveSep","visibility","hidden")}}else{MUD.setStyle(g,"visibility","hidden");MUD.setStyle("saveSep","visibility","hidden")}if(h&&d.BL){var e=null;if(l){e=l}else{e=document.createElement("img")}e.src=d.BL;e.id="brokerImg";h.appendChild(e);$show(h)}else{if(l){h.removeChild(l);$hide(h)}}var f=$$("carouselSave")[0];var b={lid:d.ListingID,ph:d.Photo,sn:d.SaveName,ct:d.City,adr:d.Address,mls:"",bds:d.bds,bts:d.bts,pr:d.pr,product:d.Product,type:d.Type,seq:d.Sequence,st:d.st};$update("listingData",$L.JSON.stringify(b));f.lid=b.lid;f.href="javascript:void(0)";$update(f,"Save Listing");mvReg.changeStatus("SavedListing");midListingId=d.ListingID;midNavigation=d.URL;midProduct=d.Product;midType=d.Type;midSeq=d.Sequence;ReportListingImpression(d)};var onLocalMiddleImageClicked=function(b,a){if(this&&this._dataList&&this._dataList.Listings){var c=this._dataList.Listings[this._midImg]}MV.util.Cookie.remove("criteria",{path:"/"});MV.util.Cookie.remove("criteria",{path:"/",domain:"realtor.com"})};var onLocalHomesSuccessHandler=function(b,a){var c=this._dataList.Listings[this._midImg];var c={lid:c.ListingID,ph:c.Photo,sn:c.SaveName,ct:c.City,adr:c.Address,mls:"",bds:c.bds,bts:c.bts,pr:c.pr,bl:c.bl,bol:c.bol,st:c.state,url:c.url};$update("listingData",$L.JSON.stringify(c));var d=$$("carouselSave")[0];$D.addClass(d,"mvSavLstLnk");d.lid=c.lid;mvReg.addASaveListing(d,"SavLnk");mvReg.changeStatus("SavedListing");$show("divCarouselInfo");d.name=(currentCarouselType==carouselTypes.EXT)?"carousel-extreme-savelisting":"carousel-local-savelisting";$E.addListener(d,"click",reportCarouselSaveListingClick,d,d)};var onLocalHomesFailureHandler=function(b,a){$update($$("hd","div","dCarouselWait")[0],"Sorry, we couldn't load the information for this section.");$update($$("bd","div","dCarouselWait")[0],"<div class='padIt'>Refresh the page to try again.</div>")};function onSaveMouseOverLocalHomes(){pcLocalHomes.stopAutoPlay()}function reportCarouselSaveListingClick(b,c){if(ClientEvents&&ClientEvents.ReportListingClickJson){var a={label:c.name,listID:midListingId,listType:"Property",pageID:"HomePage"};ClientEvents.ReportListingClickJson(a)}}var MiddleClick=function(b,a){if(currentCarouselType==carouselTypes.EXT){DolphinListingClick("Carousel Listing Extreme",EventLog.ObjectType.Image,midNavigation,midListingId,"CarouselPhoto",midProduct,midSeq,midType);if(ClientEvents&&ClientEvents.ReportListingClickJson){var c={label:"Extremehomes-imageclick",listID:midListingId,listType:"Property",pageID:"HomePage"};ClientEvents.ReportListingClickJson(c)}}else{DolphinListingClick("Carousel Listing Local",EventLog.ObjectType.Image,midNavigation,midListingId,"CarouselPhoto",midProduct,midSeq,midType);if(ClientEvents&&ClientEvents.ReportListingClickJson){var c={label:"Localhomes-imageclick",listID:midListingId,listType:"Property",pageID:"HomePage"};ClientEvents.ReportListingClickJson(c)}}};function LinkClick(f,a){var d=(currentCarouselType==carouselTypes.EXT)?"Carousel Listing Extreme":"Carousel Listing Local";var b=(currentCarouselType==carouselTypes.EXT)?"Extremehomes-addressclick":"Localhomes-addressclick";DolphinListingClick(d,EventLog.ObjectType.Link,midNavigation,midListingId,"CarouselViewDetails",midProduct,midSeq,midType);if(ClientEvents&&ClientEvents.ReportListingClickJson){var c={label:b,listID:midListingId,listType:"Property",pageID:"HomePage"};ClientEvents.ReportListingClickJson(c)}}function ProfileClick(b,a){DolphinProfile(a,EventLog.ObjectType.Link,"savelisting",midListingId,"RDC")}function ReportListingImpression(b){if(listingIds.indexOf(b.ListingID)<0){listingEvent.length=0;listingEvent[listingEvent.length]=new Event_Listing(b.ListingID,b.Product,b.Type);listingIds+=b.ListingID+",";var c=(currentCarouselType==carouselTypes.EXT)?"Carousel Listing Extreme":"Carousel Listing Local";var a=(currentCarouselType==carouselTypes.EXT)?"ExtremeHomes":"LocalHomes";DolphinListingImpression(c,listingEvent);if(window.ClientEvents&&ClientEvents.ReportListingViewJson){ClientEvents.ReportListingViewJson({label:a,listID:b.ListingID,listType:"Property"})}}}function ReportOtherLinkClick(b,a){if(window.ClientEvents&&ClientEvents.ReportLinkClick){ClientEvents.ReportLinkClickJson({label:"BrokerOtherLink",pageID:"HomePage",refUrl:document.location,targetUrl:document.location+a,type:"internal"})}};MUE.onDOMReady(loadMainSearch);MUE.onContentReady("srchHomeLocation",setFocus);function setFocus(){$get("srchHomeLocation").focus()}function loadMainSearch(){MUE.addListener("aMLSsearch","click",showMLSIDSearch)}function doFAHSearch(f){var j=$get("txtMinPrice"),a=$get("txtMaxPrice");var b="",h="";var i=NaN,g=NaN;var c=ML.trim($get("srchHomeLocation").value).toLowerCase();b=$delComma(j.value.replace(/^\$/,""));h=$delComma(a.value.replace(/^\$/,""));i=parseInt(b);g=parseInt(h);if(i>-1&&g>-1&&i>g){var d=i;i=g;g=d}if(!isNaN(i)){j.value=i.toString()}if(!isNaN(g)){a.value=g.toString()}__doPostBack("ctl00$cphC$MainSearch$btnSearch","")}function showMLSIDSearch(b){$get("dMLSSearch").style.display="block";var a=new MV.widget.Panel("dMLSSearch",{width:"263px",close:true,modal:false,fixedcenter:false,visible:false,constraintoviewport:false,underlay:"none",zIndex:9999,context:["aMLSsearch","tl","bl"]});a.render(document.body);a.show();$get("txtMLSID").focus()}function doMLSIDSearch(c){var b=ML.trim($get("txtMLSID").value).toLowerCase();var a=$get("ctl00_cphC_MainSearch_hdnMLSID");a.value=b;document.location=$get("ctl00_cphC_MainSearch_btnMLSIDsearch").href};var onSliderAniComplete=function(c,b){var a=b[0];var d=b[1];var e=a.header.getElementsByTagName("img")[0];var f=e.className;if(d===true){if(f.indexOf("Selected")<0){e.className+="Selected"}}else{e.className=f.substring(0,f.indexOf("Sel"))}};var dSliderHome=new MV.widget.Accordion("dSliderHome",{autoSize:"Fill",requireOpenedPane:true,selectedIndex:0,headerCssClass:"hsAccordHeader",contentCssClass:"hsAccordContent",animationCompleteHandler:onSliderAniComplete});