var saveditems={data:new Array(),savedsearches:new Array(),savedsearchesSorted:new Array(),recentlyrated:new Array(),recentlyratedSorted:new Array(),presavesearchRegister:false,sortedData:new Array(),allResults:new Array(),currentTab:"",showTab:new Array(),addItem:new Array(),carouselStep:0,carouselCount:0,showPopup:new Array(),saveButtons:new Array(),buttonCallback:new Array(),cdnBaseUrl:"http://edge.coldwellbanker.com",temp:new Array(),initSuccessCallback:new Array(),cssLoaded:false,sliderJsLoaded:false,affordabilityJsLoaded:false,editAffordability:false,init:function(){saveditems.showTab.Property="propertyIds";
saveditems.showTab.Agent="agentIds";
saveditems.showTab.Team="teamIds";
saveditems.showTab.Office="officeIds";
saveditems.showTab.Resource="resourceIds";
saveditems.showTab.RecentlyRated="recentlyratedIds";
$.ajax({type:"GET",cache:$.browser.msie?false:true,url:"/rest/saveditem/items",contentType:"application/json; charset=utf-8",dataType:"json",success:function(data){saveditems.data=data;
saveditems.updatecurrencycookie();
saveditems.updateaffordabilitysettingscookies();
for(var i=0;
i<saveditems.initSuccessCallback.length;
i++){var callbackFunction=saveditems.initSuccessCallback[i];
if(typeof callbackFunction=="function"){callbackFunction(data)
}else{eval(callbackFunction,data)
}}if(typeof(isHomepage)=="undefined"){saveditems.updatecontent()
}}})
},addInitCallback:function(func){saveditems.initSuccessCallback[saveditems.initSuccessCallback.length]=func
},login:function(idprefix){var $button=$("#"+idprefix+"Button");
var pleasewaitButton=function(){if($.browser.msie){$button.html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').css("display","block");
loginAjax()
}else{$button.html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').fadeTo(250,1,function(){loginAjax()
})
}};
var loginAjax=function(){var loginForm={username:$("#"+idprefix+"Email").val(),password:$("#"+idprefix+"Password").val()};
var form=JSON.stringify(loginForm);
$.ajax({type:"POST",url:baseSecureUrl+"/rest/user/login",contentType:"application/json; charset=utf-8",data:form,dataType:"json",error:function(XMLHttpRequest){alert(XMLHttpRequest.statusText);
if($.browser.msie){$button.stop().css("display","none");
$button.html('<a href="javascript:void(0)" onclick="saveditems.login(\''+idprefix+'\');"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/btn-login.png" width="70" height="25" alt="Login"/></a>').css("display","block")
}else{$button.stop().fadeTo(250,0,function(){$(this).html('<a href="javascript:void(0)" onclick="saveditems.login(\''+idprefix+'\');"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/btn-login.png" width="70" height="25" alt="Login"/></a>').fadeTo(250,1)
})
}},success:function(data){if(data&&data.errors){alert(data.errors[0].message);
if($.browser.msie){$button.stop().css("display","none");
$button.html('<a href="javascript:void(0)" onclick="saveditems.login(\''+idprefix+'\');"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/btn-login.png" width="70" height="25" alt="Login"/></a>').css("display","block")
}else{$button.stop().fadeTo(250,0,function(){$(this).html('<a href="javascript:void(0)" onclick="saveditems.login(\''+idprefix+'\');"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/btn-login.png" width="70" height="25" alt="Login"/></a>').fadeTo(250,1)
})
}}else{if(idprefix=="loginpage"){location.href="/home_file"
}else{if(idprefix=="loginpopup"){modal.close("login",true);
saveditems.presavesearchRegister=false;
saveditems.savesearchSubmitForm();
saveditems.init();
saveditems.populateTab("All")
}else{saveditems.currentTab="";
saveditems.init();
saveditems.populateTab("All")
}}}if(!(data&&data.errors)){saveditems.updateprofilecurrency();
saveditems.updateprofileaffordabilitysettings()
}}})
};
if($.browser.msie){$button.stop().css("display","none");
pleasewaitButton()
}else{$button.stop().fadeTo(250,0,function(){pleasewaitButton()
})
}},loginEnterCapture:function(idprefix,event){var keyCode=event.keyCode?event.keyCode:event.which?event.which:event.charCode;
if(keyCode==13){saveditems.login(idprefix);
return false
}else{return true
}},logout:function(){$.ajax({type:"POST",url:"/rest/user/logout",contentType:"application/json; charset=utf-8",dataType:"json",error:function(XMLHttpRequest,textStatus,errorThrown){alert(textStatus)
},success:function(data){$("#globalLoginButton").html('<a href="javascript:void(0)" onclick="saveditems.login(\'globalLogin\');"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/btn-login.png" width="70" height="25" alt="Login"/></a>');
saveditems.currentTab="";
saveditems.init()
}})
},register:function(idprefix){var pleaseWaitButton=function(){if($.browser.msie){$button.html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').css("display","block");
runAjax()
}else{$button.html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').fadeTo(250,1,function(){runAjax()
})
}};
var runAjax=function(){$.ajax({type:"POST",url:baseSecureUrl+"/rest/user/register",data:form,contentType:"application/json; charset=utf-8",dataType:"json",error:function(XMLHttpRequest,textStatus,errorThrown){alert(textStatus)
},success:function(data){if($.browser.msie){$button.stop().css("display","none");
$button.html('<a href="javascript:void(0);" onclick="saveditems.register(\''+idprefix+'\');"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-register.png" width="82" height="25" alt="Register"/></a>').css("display","block")
}else{$button.stop().fadeTo(250,0,function(){$(this).html('<a href="javascript:void(0);" onclick="saveditems.register(\''+idprefix+'\');"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-register.png" width="82" height="25" alt="Register"/></a>').fadeTo(250,1)
})
}if(data&&data.errors){alert(data.errors[0].message)
}else{if($.browser.msie){$("div.homefileFlashFrameContainer").css("display","none")
}modalLoader.modal.open("registerconfirm","/templates/homefile/register-confirm.html",690,function(){if(saveditems.presavesearchRegister){$("#registerCloseButton").html('<a href="javascript:saveditems.registerConfirmSaveSearch();"><img src="'+saveditems.cdnBaseUrl+'/images/global/modal/btn-closewindow.gif" width="85" height="15" alt="Close window" /></a>');
$("#registerContinueButton").html('<a href="javascript:saveditems.registerConfirmSaveSearch();"><img src="'+saveditems.cdnBaseUrl+'/images/global/modal/btn-continue.gif" width="76" height="25" alt="Continue"/></a>')
}else{$("#registerCloseButton").html('<a href="/home_file"><img src="'+saveditems.cdnBaseUrl+'/images/global/modal/btn-closewindow.gif" width="85" height="15" alt="Close window" /></a>');
$("#registerContinueButton").html('<a href="/home_file"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-startusinghomefile.gif" width="153" height="25" alt="Start Using Home File"/></a>')
}if(idprefix=="registerpopup"){modal.close("login",true)
}});
saveditems.init();
webtrends.runTag("Account Register")
}}})
};
var $firstname=$.trim($("#"+idprefix+"FirstName").val());
var $lastname=$.trim($("#"+idprefix+"LastName").val());
var $zip=$.trim($("#"+idprefix+"Zip").val());
var $email=$.trim($("#"+idprefix+"Email").val());
var $emailconfirm=$.trim($("#"+idprefix+"EmailConfirm").val());
var $password=$.trim($("#"+idprefix+"Password").val());
var $passwordconfirm=$.trim($("#"+idprefix+"PasswordConfirm").val());
if($firstname==""){alert("Please enter your first name.");
return
}if($lastname==""){alert("Please enter your last name.");
return
}var $emailcheck=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if(!$emailcheck.test($email)){alert("Please enter a valid email address.");
return
}if($email!=$emailconfirm){alert("Email addresses do not match, please try again.");
return
}if($password==""){alert("Please enter a password");
return
}if($password!=$passwordconfirm){alert("Passwords do not match. Please try again.");
return
}if($password.length<6){alert("Please enter a password that is 6 characters or longer");
return
}var registrationForm={username:$email,password:$password,firstName:$firstname,lastName:$lastname,zip:$zip};
var form=JSON.stringify(registrationForm);
var $button=$("#"+idprefix+"Button");
if($.browser.msie){$button.stop().css("display","none");
pleaseWaitButton()
}else{$button.stop().fadeTo(250,0,function(){pleaseWaitButton()
})
}},registerEnterCapture:function(idprefix,event){var keyCode=event.keyCode?event.keyCode:event.which?event.which:event.charCode;
if(keyCode==13){saveditems.register(idprefix);
return false
}else{return true
}},registerConfirmSaveSearch:function(){modal.close("registerconfirm",true);
saveditems.presavesearchRegister=false;
saveditems.savesearchSubmitForm()
},updatecontent:function(){$("#totalSavedPropertiesWrapper div.totalCount").html((saveditems.data.results)?saveditems.data.results.length:0);
$("#saveditemsAllCount").html((saveditems.data.results)?saveditems.data.results.length:0);
$("#saveditemsPropertyCount").html((saveditems.data.propertyIds)?saveditems.data.propertyIds.length:0);
$("#saveditemsAgentCount").html((saveditems.data.agentIds||saveditems.data.teamIds)?((saveditems.data.agentIds)?saveditems.data.agentIds.length:0)+((saveditems.data.teamIds)?saveditems.data.teamIds.length:0):0);
$("#saveditemsOfficeCount").html((saveditems.data.officeIds)?saveditems.data.officeIds.length:0);
$("#saveditemsResourceCount").html((saveditems.data.resourceIds)?saveditems.data.resourceIds.length:0);
delete saveditems.sortedData;
delete saveditems.allResults;
saveditems.sortedData=new Array();
saveditems.allResults=new Array();
if(saveditems.data.results){$.each(saveditems.data.results,function(){saveditems.sortedData[this.pinId]=this;
saveditems.allResults.push(this.pinId)
})
}if(saveditems.data.loggedIn){$("#saveditemsLogin").css("display","none");
$("#saveditemsLoggedIn").css("display","block");
$("#saveditemsLoginName").html(saveditems.data.name);
$("#saveditemsNotUserLink").html(saveditems.data.name);
$("#saveditemsNewListings").html(saveditems.data.newListingsCount)
}else{$("#saveditemsLogin").css("display","block");
$("#saveditemsLoggedIn").css("display","none")
}$("#saveditemsSavedSearches").html(saveditems.data.savedSearchCount);
saveditems.populateTab()
},updatecurrencycookie:function(){var currency=saveditems.data.selectedCurrency;
var cookieName="userCurrency";
var cookieOpts={path:"/",expires:180};
if(currency){$.cookie(cookieName,currency,cookieOpts)
}},updateprofilecurrency:function(){var currency=null;
var cookieName="userCurrency";
var cookieOpts={path:"/",expires:180};
notsaved=$.cookie("userCurrencyNonLoggedInSaved",undefined,cookieOpts);
if(notsaved=="yes"){$.cookie("userCurrencyNonLoggedInSaved",null,cookieOpts);
location.reload()
}},updateaffordabilitysettingscookies:function(){var monthlyPayment=saveditems.data.monthpayment;
var fundsAvailable=saveditems.data.fundsAvailable;
var loanTerm=saveditems.data.loanTerm;
var interestRate=saveditems.data.interestRate;
var downPayment=saveditems.data.downPayment;
var cookieName="affordabilitySettings";
var cookieNameFA="affSettingsFundsAvailable";
var cookieNameLT="affSettingsLoanTerm";
var cookieNameIR="affSettingsInterestRate";
var cookieNameDD="affSettingsDownPayment";
var cookieOpts={path:"/",expires:180};
if(monthlyPayment&&parseFloat(monthlyPayment)>0){$.cookie(cookieName,monthlyPayment,cookieOpts)
}if(fundsAvailable){$.cookie(cookieNameFA,fundsAvailable,cookieOpts);
$.cookie(cookieNameLT,loanTerm,cookieOpts);
$.cookie(cookieNameIR,interestRate,cookieOpts);
$.cookie(cookieNameDD,downPayment,cookieOpts)
}},updateprofileaffordabilitysettings:function(){var cookieOpts={path:"/",expires:180};
notsaved=$.cookie("userAffordabilityNonLoggedInSaved",undefined,cookieOpts);
if(notsaved=="yes"){$.cookie("userAffordabilityNonLoggedInSaved",null,cookieOpts);
location.reload()
}},populateTab:function(tabname){if(tabname=="Team"){tabname="Agent"
}if(tabname!=saveditems.currentTab){if(saveditems.currentTab==""){saveditems.currentTab="All";
$("#saveditems"+saveditems.currentTab+"Button").css("cursor","default");
saveditems.initCarousel()
}else{if(tabname){function initButtons(){$("#saveditems"+saveditems.currentTab+"Button").css("cursor","pointer");
if($.browser.msie){$("#saveditems"+saveditems.currentTab+"Button div.buttonOn").stop().css("display","none");
$("#saveditemsCarouselContainer").stop().css("display","none");
saveditems.currentTab=tabname;
$("#saveditems"+saveditems.currentTab+"Button").css("cursor","default");
saveditems.initCarousel()
}else{$("#saveditems"+saveditems.currentTab+"Button div.buttonOn").stop().fadeOut(500);
$("#saveditemsCarouselContainer").stop().fadeOut(500,function(){saveditems.currentTab=tabname;
$("#saveditems"+saveditems.currentTab+"Button").css("cursor","default");
saveditems.initCarousel()
})
}}if(tabname=="RecentlyRated"){$.ajax({type:"GET",url:"/rest/rate/items",contentType:"application/json; charset=utf-8",dataType:"json",success:function(data){delete saveditems.recentlyrated;
delete saveditems.recentlyratedSorted;
saveditems.recentlyrated=new Array();
saveditems.recentlyratedSorted=new Array();
saveditems.recentlyrated=(data)?data.results:new Array();
if(saveditems.recentlyrated){$.each(saveditems.recentlyrated,function(){saveditems.recentlyratedSorted[this.pinId]=this
})
}initButtons()
}})
}else{initButtons()
}}else{saveditems.initCarousel()
}}}},initCarousel:function(){saveditems.carouselStep=0;
saveditems.carouselCount=0;
if($.browser.msie){$("#saveditems"+saveditems.currentTab+"Button").find("div.buttonOn").css("display","block")
}else{$("#saveditems"+saveditems.currentTab+"Button").find("div.buttonOn").fadeIn(500)
}var $carouselContainer=$("#saveditemsCarouselContainer");
$carouselContainer.empty();
$carouselContainer.html('<ul id="savedItemsCarouselContent" class="jcarousel-skin-saveditems"></ul>');
$carouselContainer.css({display:"block",visibility:"hidden"});
$carouselContainer.css({display:"none",visibility:"visible"});
if($.browser.msie){$carouselContainer.css("display","block")
}else{$carouselContainer.fadeIn(500)
}},updateCarousel:function(carousel,state){if(state=="init"){saveditems.populateCarousel(10,carousel);
return
}saveditems.populateCarousel(4,carousel)
},populateCarousel:function(numPopulate,carousel){var $carouselData="";
if(saveditems.currentTab=="All"){$carouselData=saveditems.allResults
}else{if(saveditems.currentTab=="RecentlyRated"){$carouselData=saveditems.recentlyrated
}else{if(saveditems.currentTab=="Agent"){if(saveditems.data.agentIds&&saveditems.data.teamIds){$carouselData=$.merge($.merge([],saveditems.data.agentIds),saveditems.data.teamIds)
}else{if(saveditems.data.agentIds){$carouselData=saveditems.data.agentIds
}else{$carouselData=saveditems.data.teamIds
}}}else{$carouselData=saveditems.data[saveditems.showTab[saveditems.currentTab]]
}}}if($carouselData&&$carouselData.length>0){if(saveditems.carouselStep<$carouselData.length){var startrange=saveditems.carouselStep;
if(saveditems.carouselStep!=0){startrange=saveditems.carouselStep+1
}var endrange=startrange+numPopulate;
if($carouselData.length<=endrange){endrange=$carouselData.length
}var carouselText="";
for(var i=startrange;
i<endrange;
i++){if($carouselData[i]){carouselText=(saveditems.currentTab=="RecentlyRated")?saveditems.addItem[saveditems.recentlyrated[i].type](saveditems.recentlyrated[i].pinId):saveditems.addItem[saveditems.sortedData[$carouselData[i]].type]($carouselData[i]);
if(carouselText!=""){saveditems.carouselCount++;
carousel.add(saveditems.carouselCount,carouselText)
}}}saveditems.carouselStep=endrange;
carousel.size(saveditems.carouselCount)
}}else{var $carouselContainer=$("#saveditemsCarouselContainer").find("div.jcarousel-clip");
if($carouselContainer.find("div.nosavedfound").length==0){var $text=saveditems.getEmptyTabText();
$carouselContainer.prepend('<div class="nosavedfound whitetext11bold" style="margin-top: 20px;">'+$text+"</div>")
}}},getEmptyTabText:function(){switch(saveditems.currentTab){case"All":case"Property":return"To find a property, click on the "+saveditems.getGlobalPropertiesTabLink()+" tab.";
case"Agent":return"To find an Agent, click on the "+saveditems.getGlobalAgentTabLink()+" tab.";
case"Office":return"To find an Office, click on the "+saveditems.getGlobalOfficeTabLink()+" tab.";
case"Resource":return"To find a document, calculator or video, click on the "+saveditems.getGlobalLearnLink()+" tab.";
case"RecentlyRated":return"No recently rated items found."
}return"No saved items found."
},getGlobalPropertiesTabLink:function(){return'<a href="javascript:globalsearch.setCurrentTab(\'properties\', true, globalsearch.onTabProperty);" class="whitelink11">Properties</a>'
},getGlobalAgentTabLink:function(){return"<a href=\"javascript:AgentOfficeForm.agentOfficesRadio.select('agent');globalsearch.setCurrentTab('agentsoffices', true, globalsearch.onTabAgents );\" class=\"whitelink11\">Agents/Offices</a>"
},getGlobalOfficeTabLink:function(){return"<a href=\"javascript:AgentOfficeForm.agentOfficesRadio.select('office');globalsearch.setCurrentTab('agentsoffices', true, globalsearch.onTabAgents );\" class=\"whitelink11\">Agents/Offices</a>"
},getGlobalLearnLink:function(){return'<a href="/real_estate/learn" class="whitelink11">Learn</a>'
},displayPopup:function(type,pinId){var $obj=(saveditems.currentTab=="RecentlyRated")?saveditems.recentlyratedSorted[pinId]:saveditems.sortedData[pinId];
var $recentlyrated=(saveditems.currentTab=="RecentlyRated")?"recentlyrated":"";
if($.browser.msie){$("#saveditemsPopup"+type+$obj.id+$recentlyrated).stop().css({display:"block",top:($("#saveditemsCarouselItem"+type+$obj.id+$recentlyrated).offset().top+75)+"px",left:($("#saveditemsCarouselItem"+type+$obj.id+$recentlyrated).offset().left-90)+"px"})
}else{$("#saveditemsPopup"+type+$obj.id+$recentlyrated).stop().css({display:"block",top:($("#saveditemsCarouselItem"+type+$obj.id+$recentlyrated).offset().top+75)+"px",left:($("#saveditemsCarouselItem"+type+$obj.id+$recentlyrated).offset().left-90)+"px"}).fadeTo(1000,1)
}},hidePopup:function(type,pinId){var $obj=(saveditems.currentTab=="RecentlyRated")?saveditems.recentlyratedSorted[pinId]:saveditems.sortedData[pinId];
var $recentlyrated=(saveditems.currentTab=="RecentlyRated")?"recentlyrated":"";
if($.browser.msie){$("#saveditemsPopup"+type+$obj.id+$recentlyrated).stop().css("display","none")
}else{$("#saveditemsPopup"+type+$obj.id+$recentlyrated).stop().fadeTo(1000,0,function(){$(this).css("display","none")
})
}},forgotPassword:function(){modalLoader.modal.open("forgotPassword","/templates/homefile/forgotpassword.html",615)
},forgotPasswordSubmit:function(){var pleaseWaitButton=function(){if($.browser.msie){$button.html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').css("display","block");
runAjax()
}else{$button.html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').fadeTo(250,1,function(){runAjax()
})
}};
var runAjax=function(){var formdata={username:$email};
formdata=JSON.stringify(formdata);
$.ajax({type:"POST",url:"/rest/user/sendforgotpasswordemail",contentType:"application/json; charset=utf-8",dataType:"json",data:formdata,success:function(data){if(data&&data.errors){alert(data.errors[0].message);
$closebutton.css("visibility","visible");
if($.browser.msie){$button.stop().css("display","none");
$button.html('<a href="javascript:saveditems.forgotPasswordSubmit()"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-sendemail.gif" width="104" height="25" alt="Send Email"/></a>').css("display","block")
}else{$button.stop().fadeTo(250,0,function(){$(this).html('<a href="javascript:saveditems.forgotPasswordSubmit()"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-sendemail.gif" width="104" height="25" alt="Send Email"/></a>').fadeTo(250,1)
})
}}else{modal.close("forgotPassword",true);
var rando=new String(Math.random());
rando=rando.substring(2,11);
modal.open("forgotPasswordConfirm","/templates/homefile/forgotpassword-confirm.html",750,function(){$("#forgotPasswordConfirm247").append('<iframe id="300x250" src="http://oascentral.realogy.com/RealMedia/ads/adstream_sx.ads/coldwellbanker/homefile/change/1'+rando+'@Right1"marginheight="0" marginwidth="0" height="250" width="300" frameborder="0"style="float: left; overflow: hidden;"></iframe>')
})
}}})
};
var $email=$.trim($("#forgotpasswordEmail").val());
var $emailcheck=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if(!$emailcheck.test($email)){alert("Please enter a valid email address.");
return
}var $button=$("#forgotpasswordSendButton");
var $closebutton=$("#forgotpasswordCloseButton");
$closebutton.css("visibility","hidden");
if($.browser.msie){$button.stop().css("display","none");
pleaseWaitButton()
}else{$button.stop().fadeTo(250,0,function(){pleaseWaitButton()
})
}},add:function(type,id,buttonsize,brandType){var $brandType=(brandType)?brandType:"";
var $url=(type=="property")?"/rest/saveditem/add/"+type+"/"+$brandType+"/"+id:"/rest/saveditem/add/"+type+"/"+id;
$.each($("#saveLinkWrapper"+id+buttonsize),function(){$(this).html(saveditems.saveButtons[buttonsize].saveOff)
});
$.ajax({type:"POST",url:$url,contentType:"application/json; charset=utf-8",dataType:"json",error:function(XMLHttpRequest,statusText){var $saveLink=saveditems.getSaveButtonGraphics(type,id,buttonsize,$brandType);
$.each($("#saveLinkWrapper"+id+buttonsize),function(){$(this).html($saveLink)
});
alert(statusText)
},success:function(data){if($.cookie("showedLoginAlert")!="true"&&!saveditems.data.loggedIn){modalLoader.modal.open("loginAlert","/templates/homefile/loginalert.html",615);
$.cookie("showedLoginAlert","true")
}function removelink(buttonsize){var $removeLink=saveditems.getRemoveButtonGraphics(type,id,buttonsize,$brandType);
$.each($("#saveLinkWrapper"+id+buttonsize),function(){$(this).animate({opacity:0},500,function(){$(this).html($removeLink);
$(this).animate({opacity:1},500,function(){if(saveditems.buttonCallback[type+id+buttonsize+brandType]){saveditems.buttonCallback[type+id+buttonsize+brandType]()
}})
})
})
}if(saveditems.sortedData[data[type+"Ids"][0]]==undefined){try{saveditems.data.results=$.merge(data.results,saveditems.data.results)
}catch(err){saveditems.data.results=$.extend(data.results,saveditems.data.results)
}try{saveditems.data[type+"Ids"]=$.merge(data[type+"Ids"],saveditems.data[type+"Ids"])
}catch(err){saveditems.data[type+"Ids"]=$.extend(data[type+"Ids"],saveditems.data[type+"Ids"])
}if($("#SavedItemImageAnimation").length==0){$(document.body).append('<div id="SavedItemImageAnimation"></div>')
}var $animationLayer=$("#SavedItemImageAnimation");
var $savedItemImage=$("#"+type+"SaveItemImage"+id);
var $saveButtonWrapper=$("#saveLinkWrapper"+id+buttonsize);
if($savedItemImage.length>0){$animationLayer.css({position:"absolute","z-index":"1000",display:"block",opacity:0.8,top:(type=="resource")?($saveButtonWrapper.offset().top)+"px":($savedItemImage.offset().top-120)+"px",left:(type=="resource")?$saveButtonWrapper.offset().left+"px":$savedItemImage.offset().left+"px"}).empty();
if(type=="resource"){$animationLayer.html($savedItemImage.html())
}else{$savedItemImage.clone().appendTo($animationLayer)
}$animationLayer.animate({opacity:0,top:"200px",left:"650px"},1000,function(){$(this).css("display","none");
saveditems.updateGlobalSearch()
})
}else{saveditems.updateGlobalSearch()
}}else{alert(type.charAt(0).toUpperCase()+type.slice(1)+" already saved to your home file.")
}removelink("small");
removelink("medium");
removelink("large");
removelink("learnsmall");
removelink("learnmedium");
var $iframe=$(window.top.document).find("div.w_content iframe");
$.each($iframe.contents().find("#saveLinkWrapper"+id+"large"),function(){$(this).animate({opacity:0},500,function(){$(this).html(saveditems.getRemoveButtonGraphics(type,id,"large",$brandType));
$(this).animate({opacity:1},500)
})
});
$.each($iframe.contents().find("#saveLinkWrapper"+id+"small"),function(){$(this).animate({opacity:0},500,function(){$(this).html(saveditems.getRemoveButtonGraphics(type,id,"small",$brandType));
$(this).animate({opacity:1},500)
})
});
if(type=="agent"){webtrends.runTag("Save Agent")
}else{if(type=="office"){webtrends.runTag("Save Office")
}else{if(type=="property"){webtrends.runTag("Save Property")
}else{if(type=="resource"){webtrends.runTag("Save Learn Content")
}}}}}})
},updateGlobalSearch:function(){globalsearch.setCurrentTab("saveditems",true,function(){globalsearch.checkAgentMoreOptions()
});
saveditems.updatecontent()
},remove:function(type,id,buttonsize,brandType){var $brandType=(brandType)?brandType:"";
var $url=(type=="property")?"/rest/saveditem/remove/"+type+"/"+$brandType+"/"+id:"/rest/saveditem/remove/"+type+"/"+id;
$.each($("#saveLinkWrapper"+id+buttonsize),function(){$(this).html(saveditems.saveButtons[buttonsize].removeOff)
});
$.ajax({type:"POST",url:$url,contentType:"application/json; charset=utf-8",dataType:"json",error:function(XMLHttpRequest,errorText){var $removeLink=saveditems.getRemoveButtonGraphics(type,id,buttonsize,$brandType);
$.each($("#saveLinkWrapper"+id+buttonsize),function(){$(this).html($removeLink)
});
alert(errorText)
},success:function(data){for(var $i=0;
$i<saveditems.data.results.length;
$i++){if(saveditems.data.results[$i].pinId==data.results[0].pinId){saveditems.data.results.splice($i,1)
}}for(var $j=0;
$j<saveditems.data[type+"Ids"].length;
$j++){if(saveditems.data[type+"Ids"][$j]==data[type+"Ids"][0]){saveditems.data[type+"Ids"].splice($j,1)
}}saveditems.updatecontent();
function savelink(buttonsize){var $saveLink=saveditems.getSaveButtonGraphics(type,id,buttonsize,$brandType);
$.each($("#saveLinkWrapper"+id+buttonsize),function(){$(this).animate({opacity:0},500,function(){$(this).html($saveLink);
$(this).animate({opacity:1},500,function(){if(saveditems.buttonCallback[type+id+buttonsize+brandType]){saveditems.buttonCallback[type+id+buttonsize+brandType]()
}})
})
})
}savelink("small");
savelink("medium");
savelink("large");
savelink("learnsmall");
savelink("learnmedium");
var $iframe=$(window.top.document).find("div.w_content iframe");
$.each($iframe.contents().find("#saveLinkWrapper"+id+"large"),function(){$(this).animate({opacity:0},500,function(){$(this).html(saveditems.getSaveButtonGraphics(type,id,"large",$brandType));
$(this).animate({opacity:1},500)
})
});
$.each($iframe.contents().find("#saveLinkWrapper"+id+"small"),function(){$(this).animate({opacity:0},500,function(){$(this).html(saveditems.getSaveButtonGraphics(type,id,"small",$brandType));
$(this).animate({opacity:1},500)
})
})
}})
},getSaveButtonGraphics:function(type,id,size,brandType,callback){if(callback){saveditems.buttonCallback[type+id+size+brandType]=callback
}return saveditems.saveButtons[size].saveOff+'<div class="fadeOver"><a class="saveLink" href="javascript:window.top.saveditems.add(\''+type+"',"+id+", '"+size+"', '"+brandType+"');\">"+saveditems.saveButtons[size].saveOn+"</a></div>"
},getRemoveButtonGraphics:function(type,id,size,brandType,callback){if(callback){saveditems.buttonCallback[type+id+size+brandType]=callback
}return saveditems.saveButtons[size].removeOff+'<div class="fadeOver"><a class="saveLink" href="javascript:window.top.saveditems.remove(\''+type+"',"+id+",'"+size+"', '"+brandType+"');\">"+saveditems.saveButtons[size].removeOn+"</a></div>"
},savedSearchesView:function(){if(saveditems.data.savedSearchCount==0){alert("You currently do not have any saved searches.")
}else{if($.jScrollPane==undefined){$.ajaxSetup({cache:true});
$.getScript("/js/global/jquery/jScrollPane-1.2.3.min.js",function(){saveditems.savedSearchesViewLoad();
$.ajaxSetup({cache:false})
})
}else{saveditems.savedSearchesViewLoad()
}}},savedSearchesViewLoad:function(){modalLoader.modal.open("savedsearches","/templates/homefile/savedsearches.html",565,function(){saveditems.savedSearchesViewRefreshContent()
})
},savedSearchesViewRefreshContent:function(){$.ajax({type:"GET",url:"/rest/saveditem/searches",contentType:"application/json; charset=utf-8",dataType:"json",success:function(data){saveditems.savedsearches=data;
var $savedsearchitem=$("#savedSearchesItem");
var $savedsearchitemedit=$("#savedSearchesItemEdit");
var $savedsearchitemremove=$("#savedSearchesItemRemove");
var $savedsearchitemVars={searchName:$savedsearchitem.find("span.savedsearchitemSearchName"),message:$savedsearchitem.find("span.savedsearchitemMessage"),type:$savedsearchitem.find("span.savedsearchitemSearchType"),emailNotifications:$savedsearchitem.find("span.savedsearchitemEmailNotifications"),emailOptions:$savedsearchitem.find("div.savedsearchitemEmailOptions"),separateEmail:$savedsearchitem.find("span.savedsearchitemSeparateEmail"),receiveEmailDailyWeekly:$savedsearchitem.find("span.savedsearchitemDailyWeekly"),runSearch:$savedsearchitem.find("div.savedsearchitemRunSearch"),linkRemove:$savedsearchitem.find("a.savedsearchitemRemoveLink"),linkEdit:$savedsearchitem.find("a.savedsearchitemEditLink"),editType:$savedsearchitemedit.find("span.savedsearchitemSearchType"),editFieldSearchName:$savedsearchitemedit.find("input.savesearchName"),editFieldEmailOptionsWrapper:$savedsearchitemedit.find("div.savesearchAdditionalEmail"),editFieldNotificationsOn:$savedsearchitemedit.find("div.savesearchEmailNotificationsOn"),editFieldNotificationsOff:$savedsearchitemedit.find("div.savesearchEmailNotificationsOff"),editFieldSeparateEmailYes:$savedsearchitemedit.find("div.savesearchSeparateEmailYes"),editFieldSeparateEmailNo:$savedsearchitemedit.find("div.savesearchSeparateEmailNo"),editFieldEmailReceiveDaily:$savedsearchitemedit.find("div.savesearchEmailReceiveDaily"),editFieldEmailReceiveWeekly:$savedsearchitemedit.find("div.savesearchEmailReceiveWeekly"),editLinkWrapper:$savedsearchitemedit.find("div.savedsearcheseditLinks"),editLinkSaveChanges:$savedsearchitemedit.find("a.savesearchSaveChangesButton"),editLinkCancel:$savedsearchitemedit.find("a.savesearchCancelButton"),removeType:$savedsearchitemremove.find("div.savedsearchesremoveDescription"),removeLinkWrapper:$savedsearchitemremove.find("div.savedsearchesremoveLinks"),removeLinkRemove:$savedsearchitemremove.find("a.savedsearchitemRemoveLink"),removeLinkCancel:$savedsearchitemremove.find("a.savedsearchitemCancelLink")};
var $savedsearchestext="";
$.each(saveditems.savedsearches.results,function(n){saveditems.savedsearchesSorted[this.id]=this;
$savedsearchitemVars.searchName.html(this.searchName);
var searchcriteria=this.searchText;
if(this.keywords!=""&&this.keywords!=undefined){searchcriteria+="<br/>keywords: "+this.keywords
}if(this.minPrice!="0"&&this.minPrice!=undefined){searchcriteria+="<br/>minimum price: "+this.minPrice
}if(this.maxPrice!="0"&&this.maxPrice!=undefined){searchcriteria+="<br/>maximum price: "+this.maxPrice
}if(this.numberOfBaths!="0"&&this.numberOfBaths!=undefined){searchcriteria+="<br/># baths: "+this.numberOfBaths
}if(this.numberOfBeds!="0"&&this.numberOfBeds!=undefined){searchcriteria+="<br/># beds: "+this.numberOfBeds
}if(this.radius!="0"&&this.radius!=undefined){searchcriteria+="<br/>radius: "+this.radius
}if(this.name!=""&&this.name!=undefined){searchcriteria+="<br/>name: "+this.name
}if(this.language!=""&&this.language!=undefined){searchcriteria+="<br/>language: "+this.language
}$savedsearchitemVars.type.html(searchcriteria);
$savedsearchitemVars.removeType.html(searchcriteria);
$savedsearchitemVars.editType.html(searchcriteria);
$savedsearchitemVars.runSearch.html('<a href="'+this.runSearchUrl+'"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-runsearch.gif" width="104" height="25" alt="Run Search"/></a>');
$savedsearchitemVars.emailNotifications.html((this.sendEmailNotice)?"ON":"OFF");
if(this.sendEmailNotice){$savedsearchitemVars.emailOptions.css("display","block")
}else{$savedsearchitemVars.emailOptions.css("display","none")
}$savedsearchitemVars.separateEmail.html((this.emailIndividual)?"Yes":"No, include with my other searches");
$savedsearchitemVars.receiveEmailDailyWeekly.html((this.emailFrequency=="D")?"DAILY":"WEEKLY");
var $rowcolor=(n%2)?"white":"#f0f0f0";
$savedsearchitemVars.editFieldSearchName.attr("id","editFieldSearchName"+this.id);
$savedsearchitemVars.editFieldNotificationsOn.html('<input type="radio" value="on" name="savesearchEmailNotifications'+this.id+"\" onclick=\"saveditems.emailoptions('show','editFieldEmailOptionsWrapper"+this.id+"');\"/> On");
$savedsearchitemVars.editFieldNotificationsOff.html('<input type="radio" value="off" name="savesearchEmailNotifications'+this.id+"\" onclick=\"saveditems.emailoptions('hide','editFieldEmailOptionsWrapper"+this.id+"');\"/> Off");
$savedsearchitemVars.editFieldSeparateEmailYes.html('<input type="radio" value="yes" name="savesearchSeparateEmail'+this.id+'"/> Yes');
$savedsearchitemVars.editFieldSeparateEmailNo.html('<input type="radio" value="no" name="savesearchSeparateEmail'+this.id+'"/> No, include with my other searches');
$savedsearchitemVars.editFieldEmailReceiveDaily.html('<input type="radio" value="D" name="savesearchEmailReceive'+this.id+'"/> Daily');
$savedsearchitemVars.editFieldEmailReceiveWeekly.html('<input type="radio" value="W" name="savesearchEmailReceive'+this.id+'"/> Weekly');
$savedsearchitemVars.editFieldEmailOptionsWrapper.attr("id","editFieldEmailOptionsWrapper"+this.id);
$savedsearchitemVars.linkRemove.attr("href","javascript:saveditems.savedSearchesRemove("+this.id+")");
$savedsearchitemVars.linkEdit.attr("href","javascript:saveditems.savedSearchesEdit("+this.id+")");
$savedsearchitemVars.editLinkWrapper.attr("id","savedsearcheseditLinks"+this.id);
$savedsearchitemVars.editLinkSaveChanges.attr("href","javascript:saveditems.savedSearchesEditSaveChanges("+this.id+")");
$savedsearchitemVars.editLinkCancel.attr("href","javascript:saveditems.savedSearchesEditCancel("+this.id+")");
$savedsearchitemVars.removeLinkWrapper.attr("id","savedsearchesremoveLinks"+this.id);
$savedsearchitemVars.removeLinkRemove.attr("href","javascript:saveditems.savedSearchesRemoveSubmit("+this.id+")");
$savedsearchitemVars.removeLinkCancel.attr("href","javascript:saveditems.savedSearchesRemoveCancel("+this.id+")");
$savedsearchestext+='<div id="savedsearchitem'+this.id+'" class="savedsearchitem" style="float: left; background-color: '+$rowcolor+'; padding: 10px 10px 15px 15px"><div id="savedsearchitemView'+this.id+'" class="savedsearchitemView">'+$savedsearchitem.html()+'</div><div id="savedsearchitemEdit'+this.id+'" class="savedsearchitemEdit">'+$savedsearchitemedit.html()+'</div><div id="savedsearchitemRemove'+this.id+'" class="savedsearchitemRemove">'+$savedsearchitemremove.html()+"</div></div>"
});
$("#savedsearchesContent").html($savedsearchestext);
setTimeout("saveditems.savedSearchesViewScroll()",500)
}})
},savedSearchesViewScroll:function(){$("#savedsearchesContent").jScrollPane({scrollbarWidth:11});
var $trackdrag=$("#savedsearchesContent").parents("div.jScrollPaneContainer").find("div.jScrollPaneDrag");
var $trackdragarrows='<div class="jScrollPaneDragArrowContainer"><div class="jScrollPaneDragArrowTop"><img src="'+saveditems.cdnBaseUrl+'/images/jquery/jScrollPane/trackdrag-top.gif" width="11" height="9" alt=""/></div><div class="jScrollPaneDragArrowBottom"><img src="'+saveditems.cdnBaseUrl+'/images/jquery/jScrollPane/trackdrag-bottom.gif" width="11" height="10" alt=""/></div></div>';
$trackdrag.append($trackdragarrows)
},savedSearchesRemove:function(id){if($.browser.msie){$("#savedsearchitemView"+id).css("display","none");
$("#savedsearchitemRemove"+id).css("display","block");
saveditems.savedSearchesViewScroll()
}else{$("#savedsearchitemView"+id).fadeOut(500,function(){$("#savedsearchitemRemove"+id).fadeIn(500,function(){saveditems.savedSearchesViewScroll()
})
})
}},savedSearchesEdit:function(id){if($.browser.msie){$("#savedsearchitemView"+id).css("display","none");
saveditems.savedSearchesEditFunction(id)
}else{$("#savedsearchitemView"+id).fadeOut(500,function(){saveditems.savedSearchesEditFunction(id)
})
}},savedSearchesEditFunction:function(id){var $data=saveditems.savedsearchesSorted[id];
var $editlayer=$("#savedsearchitemEdit"+id);
$editlayer.find("input.savesearchName").val($data.searchName);
$editlayer.find("input[name='savesearchEmailNotifications"+id+"']")[($data.sendEmailNotice)?0:1].checked=true;
$editlayer.find("input[name='savesearchSeparateEmail"+id+"']")[($data.emailIndividual)?0:1].checked=true;
$editlayer.find("input[name='savesearchEmailReceive"+id+"']")[($data.emailFrequency=="D")?0:1].checked=true;
if(!$data.sendEmailNotice){saveditems.emailoptions("hide","editFieldEmailOptionsWrapper"+id)
}if($.browser.msie){$("#savedsearchitemEdit"+id).css("display","block");
saveditems.savedSearchesViewScroll()
}else{$("#savedsearchitemEdit"+id).fadeIn(500,function(){saveditems.savedSearchesViewScroll()
})
}},savedSearchesEditCancel:function(id){if($.browser.msie){$("#savedsearchitemEdit"+id).css("display","none");
$("#savedsearchitemView"+id).css("display","block");
saveditems.savedSearchesViewScroll()
}else{$("#savedsearchitemEdit"+id).fadeOut(500,function(){$("#savedsearchitemView"+id).fadeIn(500,function(){saveditems.savedSearchesViewScroll()
})
})
}},savedSearchesEditSaveChanges:function(id){var pleaseWaitButton=function(){if($.browser.msie){$editlinkwrapper.html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').css("display","block");
runAjax()
}else{$editlinkwrapper.html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').fadeTo(250,1,function(){runAjax()
})
}};
var runAjax=function(){var $data=saveditems.savedsearchesSorted[id];
saveditems.savedsearchesSorted[id].searchName=$searchName;
saveditems.savedsearchesSorted[id].sendEmailNotice=$sendEmailNotice;
saveditems.savedsearchesSorted[id].emailFrequency=$emailFrequency;
saveditems.savedsearchesSorted[id].emailIndividual=$emailIndividual;
var formdata={countryId:$data.countryId,emailFrequency:$emailFrequency,emailIndividual:$emailIndividual,id:id,luxuryListing:$data.luxuryListing,maxPrice:$data.maxPrice,minPrice:$data.minPrice,numberOfBaths:$data.numberOfBaths,numberOfBeds:$data.numberOfBeds,radius:$data.radius,searchExpiration:$data.searchExpiration,searchName:$searchName,searchText:$data.searchText,sendEmailNotice:$sendEmailNotice,showOpenHouseFirst:$data.showOpenHouseFirst,showVirtualToursFirst:$data.showVirtualToursFirst};
formdata=JSON.stringify(formdata);
$.ajax({type:"POST",url:"/rest/saveditem/save/search",data:formdata,contentType:"application/json; charset=utf-8",dataType:"json",error:function(XMLHttpRequest,statusText){alert(statusText)
},success:function(data){if($.browser.msie){$("#savedsearchitemEdit"+id).css("display","none");
runAjaxCallback(data)
}else{$("#savedsearchitemEdit"+id).fadeOut(500,function(){runAjaxCallback(data)
})
}}})
};
var runAjaxCallback=function(data){var linktext='<a class="savesearchSaveChangesButton darkbluelink11boldunder" style="float: left; margin-right: 10px;" href="javascript:saveditems.savedSearchesEditSaveChanges('+id+')">Save Changes</a><a class="savesearchCancelButton darkbluelink11boldunder" style="float: left;" href="javascript:saveditems.savedSearchesEditCancel('+id+')">Cancel</a>';
$editlinkwrapper.html(linktext);
var $itemview=$("#savedsearchitemView"+id);
var $messageStatus=$itemview.find("span.savedsearchitemMessage");
$itemview.find("span.savedsearchitemSearchName").html($searchName);
$messageStatus.html("- Updated Successfully!").css("display","inline-block");
$itemview.find("span.savedsearchitemEmailNotifications").html(($sendEmailNotice)?"ON":"OFF");
if($sendEmailNotice){$itemview.find("div.savedsearchitemEmailOptions").css("display","block")
}else{$itemview.find("div.savedsearchitemEmailOptions").css("display","none")
}$itemview.find("span.savedsearchitemSeparateEmail").html(($emailIndividual)?"Yes":"No, include with my other searches");
$itemview.find("span.savedsearchitemDailyWeekly").html(($emailFrequency=="D")?"DAILY":"WEEKLY");
if($.browser.msie){$itemview.css("display","block");
saveditems.savedSearchesViewScroll();
setTimeout("$('#savedsearchitemView"+id+'\').find(\'span.savedsearchitemMessage\').css("display","none");',5000)
}else{$itemview.fadeIn(500,function(){saveditems.savedSearchesViewScroll();
setTimeout("$('#savedsearchitemView"+id+"').find('span.savedsearchitemMessage').fadeOut(500);",5000)
})
}};
var $editlayer=$("#savedsearchitemEdit"+id);
var $searchName=$editlayer.find("input.savesearchName").val();
if($searchName==""){alert("Please enter a search name.");
return
}var $editlinkwrapper=$("#savedsearcheseditLinks"+id);
if($.browser.msie){$editlinkwrapper.stop().css("display","none");
pleaseWaitButton()
}else{$editlinkwrapper.stop().fadeTo(250,0,function(){pleaseWaitButton()
})
}var $sendEmailNotice=($editlayer.find("input[name='savesearchEmailNotifications"+id+"']:checked").val()=="on");
var $emailIndividual=($editlayer.find("input[name='savesearchSeparateEmail"+id+"']:checked").val()=="yes");
var $emailFrequency=$editlayer.find("input[name='savesearchEmailReceive"+id+"']:checked").val()
},savedSearchesRemoveSubmit:function(id){var pleaseWaitButton=function(){if($.browser.msie){$("#savedsearchesremoveLinks"+id).html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').css("display","block");
runAjax()
}else{$("#savedsearchesremoveLinks"+id).html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').fadeTo(250,1,function(){runAjax()
})
}};
var runAjax=function(){$.ajax({type:"POST",url:"/rest/saveditem/remove/search/"+id,contentType:"application/json; charset=utf-8",dataType:"json",error:function(XMLHttpRequest,statusText){alert(statusText)
},success:function(data){if($.browser.msie){$("#savedsearchitemRemove"+id).stop().css("display","none");
$("#savedsearchitemRemove"+id).html('<span class="redtext11bold">Saved search removed successfully.</span>');
$("#savedsearchitemRemove"+id).css("display","block");
saveditems.savedSearchesViewScroll();
setTimeout("$('#savedsearchitem"+id+'\').css("display","none"); saveditems.savedSearchesRefreshRowBG(); saveditems.savedSearchesViewScroll();',5000);
saveditems.data.savedSearchCount--;
$("#saveditemsSavedSearches").html(saveditems.data.savedSearchCount)
}else{$("#savedsearchitemRemove"+id).stop().fadeTo(250,0,function(){$(this).html('<span class="redtext11bold">Saved search removed successfully.</span>');
$(this).fadeTo(250,1,function(){saveditems.savedSearchesViewScroll();
setTimeout("$('#savedsearchitem"+id+"').fadeOut(500, function(){saveditems.savedSearchesRefreshRowBG();saveditems.savedSearchesViewScroll();});",5000);
saveditems.data.savedSearchCount--;
$("#saveditemsSavedSearches").html(saveditems.data.savedSearchCount)
})
})
}}})
};
if($.browser.msie){$("#savedsearchesremoveLinks"+id).stop().css("display","none");
pleaseWaitButton()
}else{$("#savedsearchesremoveLinks"+id).stop().fadeTo(250,0,function(){pleaseWaitButton()
})
}},savedSearchesRefreshRowBG:function(){$.each($("#savedsearchesContent").children("div:visible"),function(n){$(this).css("background-color",(n%2)?"white":"#f0f0f0")
})
},savedSearchesRemoveCancel:function(id){if($.browser.msie){$("#savedsearchitemRemove"+id).css("display","none");
$("#savedsearchitemView"+id).css("display","block");
saveditems.savedSearchesViewScroll()
}else{$("#savedsearchitemRemove"+id).fadeOut(500,function(){$("#savedsearchitemView"+id).fadeIn(500,function(){saveditems.savedSearchesViewScroll()
})
})
}},savesearch:function(){modalLoader.modal.open("savesearch","/templates/homefile/savesearch.html",545,function(){var searchcriteria=veOptions.freeTextAddress;
if(veOptions.keywords!=""&&veOptions.keywords!=undefined){searchcriteria+="<br/>keywords: "+veOptions.keywords
}if(veOptions.minPrice!="0"&&veOptions.minPrice!=undefined){searchcriteria+="<br/>minimum price: "+veOptions.minPrice
}if(veOptions.maxPrice!="0"&&veOptions.maxPrice!=undefined){searchcriteria+="<br/>maximum price: "+veOptions.maxPrice
}if(veOptions.numberOfBaths!="0"&&veOptions.numberOfBaths!=undefined){searchcriteria+="<br/># baths: "+veOptions.numberOfBaths
}if(veOptions.numberOfBeds!="0"&&veOptions.numberOfBeds!=undefined){searchcriteria+="<br/># beds: "+veOptions.numberOfBeds
}if(veOptions.radius!="0"&&veOptions.radius!=undefined){searchcriteria+="<br/>radius: "+veOptions.radius
}$("#savesearchCriteria").html(searchcriteria)
})
},savesearchSubmit:function(){var $savesearchName=$.trim($("#savesearchName").val());
if($savesearchName==""){alert("Please enter a search name.");
return
}if($("input[name='savesearchEmailNotifications']:checked").val()=="on"&&!saveditems.data.loggedIn){saveditems.presavesearchRegister=true;
modalLoader.modal.open("login","/templates/homefile/login.html",960)
}else{saveditems.savesearchSubmitForm()
}},savesearchSubmitForm:function(){var pleaseWaitButton=function(){if($.browser.msie){$("#savesearchSubmitButton").html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').css("display","block");
runAjax()
}else{$("#savesearchSubmitButton").html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').fadeTo(250,1,function(){runAjax()
})
}};
var runAjax=function(){var $savesearchName=$.trim($("#savesearchName").val());
var formdata={searchName:$savesearchName,searchExpiration:180,sendEmailNotice:($("input[name='savesearchEmailNotifications']:checked").val()=="on"),emailIndividual:($("input[name='savesearchSeparateEmail']:checked").val()=="yes"),emailFrequency:$("input[name='savesearchEmailReceive']:checked").val()};
$.extend(formdata,veOptions);
formdata=JSON.stringify(formdata);
$.ajax({type:"POST",url:"/rest/saveditem/save/search",data:formdata,contentType:"application/json; charset=utf-8",dataType:"json",error:function(XMLHttpRequest,statusText){alert(statusText)
},success:function(){modal.open("accountupdated","/templates/homefile/editaccount-confirm.html",750);
modal.close("savesearch",true);
saveditems.data.savedSearchCount++;
$("#saveditemsSavedSearches").html(saveditems.data.savedSearchCount);
webtrends.runTag("Save Search")
}})
};
$("#savesearchCancelButton").css("visibility","hidden");
$("#savesearchCloseButton").css("visibility","hidden");
if($.browser.msie){$("#savesearchSubmitButton").stop().css("display","none");
pleaseWaitButton()
}else{$("#savesearchSubmitButton").stop().fadeTo(250,0,function(){pleaseWaitButton()
})
}},emailoptions:function(flag,layername){if(flag=="show"){$("#"+layername).css("opacity","1");
$("#"+layername+" :input").removeAttr("disabled")
}else{$("#"+layername).css("opacity","0.5");
$("#"+layername+" :input").attr("disabled",true)
}},editAccountSettings:function(){if(!saveditems.cssLoaded){$("head").append("<link>");
css=$("head").children(":last");
css.attr({rel:"stylesheet",type:"text/css",href:"/styles/affordability/affordability.css"});
saveditems.cssLoaded=true
}if(!saveditems.affordabilityJsLoaded){$.getScript("/js/affordability/affordabilityRadar.js");
saveditems.affordabilityJsLoaded=true
}if(!saveditems.sliderJsLoaded){$.getScript("/js/affordability/affordabilitySlider.js");
saveditems.sliderJsLoaded=true
}modalLoader.modal.open("editaccountsettings","/templates/homefile/editaccountsettings.html",590,function(){var displayCurrencies;
$("#accountsettingsTabs").tabs({select:function(event,ui){if(ui.index==2){$("#editaccountUpdateButton").css("display","none");
$("#editaccountCancelButton").css("display","none")
}else{$("#editaccountUpdateButton").css("display","block");
$("#editaccountCancelButton").css("display","block");
if(ui.index==1&&saveditems.data.hasCanadaCookieDomain){$("#editAccountLabelId").css("display","none");
$("#editAccountFieldId").css("display","none");
$("#accordion").css("display","none")
}}modal.adjustHeightVisible("editaccountsettings");
saveditems.editAffordability=(ui.index==1)
}});
$("#editaccountPriceMin").append("<option value='any' selected>No Minimum</option>");
$("#editaccountPriceMin").append("<option value='10000'>"+globalfunc.changeAndFormatCurrency(10000)+"</option>");
$("#editaccountPriceMin").append("<option value='25000'>"+globalfunc.changeAndFormatCurrency(25000)+"</option>");
$("#editaccountPriceMin").append("<option value='50000'>"+globalfunc.changeAndFormatCurrency(50000)+"</option>");
$("#editaccountPriceMin").append("<option value='75000'>"+globalfunc.changeAndFormatCurrency(75000)+"</option>");
$("#editaccountPriceMin").append("<option value='100000'>"+globalfunc.changeAndFormatCurrency(100000)+"</option>");
$("#editaccountPriceMin").append("<option value='125000'>"+globalfunc.changeAndFormatCurrency(125000)+"</option>");
$("#editaccountPriceMin").append("<option value='150000'>"+globalfunc.changeAndFormatCurrency(150000)+"</option>");
$("#editaccountPriceMin").append("<option value='175000'>"+globalfunc.changeAndFormatCurrency(175000)+"</option>");
$("#editaccountPriceMin").append("<option value='200000'>"+globalfunc.changeAndFormatCurrency(200000)+"</option>");
$("#editaccountPriceMin").append("<option value='225000'>"+globalfunc.changeAndFormatCurrency(225000)+"</option>");
$("#editaccountPriceMin").append("<option value='250000'>"+globalfunc.changeAndFormatCurrency(250000)+"</option>");
$("#editaccountPriceMin").append("<option value='275000'>"+globalfunc.changeAndFormatCurrency(275000)+"</option>");
$("#editaccountPriceMin").append("<option value='300000'>"+globalfunc.changeAndFormatCurrency(300000)+"</option>");
$("#editaccountPriceMin").append("<option value='350000'>"+globalfunc.changeAndFormatCurrency(350000)+"</option>");
$("#editaccountPriceMin").append("<option value='400000'>"+globalfunc.changeAndFormatCurrency(400000)+"</option>");
$("#editaccountPriceMin").append("<option value='450000'>"+globalfunc.changeAndFormatCurrency(450000)+"</option>");
$("#editaccountPriceMin").append("<option value='500000'>"+globalfunc.changeAndFormatCurrency(500000)+"</option>");
$("#editaccountPriceMin").append("<option value='600000'>"+globalfunc.changeAndFormatCurrency(600000)+"</option>");
$("#editaccountPriceMin").append("<option value='700000'>"+globalfunc.changeAndFormatCurrency(700000)+"</option>");
$("#editaccountPriceMin").append("<option value='750000'>"+globalfunc.changeAndFormatCurrency(750000)+"</option>");
$("#editaccountPriceMin").append("<option value='800000'>"+globalfunc.changeAndFormatCurrency(800000)+"</option>");
$("#editaccountPriceMin").append("<option value='900000'>"+globalfunc.changeAndFormatCurrency(900000)+"</option>");
$("#editaccountPriceMin").append("<option value='1000000'>"+globalfunc.changeAndFormatCurrency(1000000)+"</option>");
$("#editaccountPriceMin").append("<option value='3000000'>"+globalfunc.changeAndFormatCurrency(3000000)+"</option>");
$("#editaccountPriceMin").append("<option value='5000000'>"+globalfunc.changeAndFormatCurrency(5000000)+"</option>");
$("#editaccountPriceMin").append("<option value='7000000'>"+globalfunc.changeAndFormatCurrency(7000000)+"</option>");
$("#editaccountPriceMin").append("<option value='10000000'>"+globalfunc.changeAndFormatCurrency(10000000)+"</option>");
$("#editaccountPriceMax").append("<option value='any' selected>No Maximum</option>");
$("#editaccountPriceMax").append("<option value='10000'>"+globalfunc.changeAndFormatCurrency(10000)+"</option>");
$("#editaccountPriceMax").append("<option value='25000'>"+globalfunc.changeAndFormatCurrency(25000)+"</option>");
$("#editaccountPriceMax").append("<option value='50000'>"+globalfunc.changeAndFormatCurrency(50000)+"</option>");
$("#editaccountPriceMax").append("<option value='75000'>"+globalfunc.changeAndFormatCurrency(75000)+"</option>");
$("#editaccountPriceMax").append("<option value='100000'>"+globalfunc.changeAndFormatCurrency(100000)+"</option>");
$("#editaccountPriceMax").append("<option value='125000'>"+globalfunc.changeAndFormatCurrency(125000)+"</option>");
$("#editaccountPriceMax").append("<option value='150000'>"+globalfunc.changeAndFormatCurrency(150000)+"</option>");
$("#editaccountPriceMax").append("<option value='175000'>"+globalfunc.changeAndFormatCurrency(175000)+"</option>");
$("#editaccountPriceMax").append("<option value='200000'>"+globalfunc.changeAndFormatCurrency(200000)+"</option>");
$("#editaccountPriceMax").append("<option value='225000'>"+globalfunc.changeAndFormatCurrency(225000)+"</option>");
$("#editaccountPriceMax").append("<option value='250000'>"+globalfunc.changeAndFormatCurrency(250000)+"</option>");
$("#editaccountPriceMax").append("<option value='275000'>"+globalfunc.changeAndFormatCurrency(275000)+"</option>");
$("#editaccountPriceMax").append("<option value='300000'>"+globalfunc.changeAndFormatCurrency(300000)+"</option>");
$("#editaccountPriceMax").append("<option value='350000'>"+globalfunc.changeAndFormatCurrency(350000)+"</option>");
$("#editaccountPriceMax").append("<option value='400000'>"+globalfunc.changeAndFormatCurrency(400000)+"</option>");
$("#editaccountPriceMax").append("<option value='450000'>"+globalfunc.changeAndFormatCurrency(450000)+"</option>");
$("#editaccountPriceMax").append("<option value='500000'>"+globalfunc.changeAndFormatCurrency(500000)+"</option>");
$("#editaccountPriceMax").append("<option value='600000'>"+globalfunc.changeAndFormatCurrency(600000)+"</option>");
$("#editaccountPriceMax").append("<option value='700000'>"+globalfunc.changeAndFormatCurrency(700000)+"</option>");
$("#editaccountPriceMax").append("<option value='750000'>"+globalfunc.changeAndFormatCurrency(750000)+"</option>");
$("#editaccountPriceMax").append("<option value='800000'>"+globalfunc.changeAndFormatCurrency(800000)+"</option>");
$("#editaccountPriceMax").append("<option value='900000'>"+globalfunc.changeAndFormatCurrency(900000)+"</option>");
$("#editaccountPriceMax").append("<option value='1000000'>"+globalfunc.changeAndFormatCurrency(1000000)+"</option>");
$("#editaccountPriceMax").append("<option value='3000000'>"+globalfunc.changeAndFormatCurrency(3000000)+"</option>");
$("#editaccountPriceMax").append("<option value='5000000'>"+globalfunc.changeAndFormatCurrency(5000000)+"</option>");
$("#editaccountPriceMax").append("<option value='7000000'>"+globalfunc.changeAndFormatCurrency(7000000)+"</option>");
$("#editaccountPriceMax").append("<option value='10000000'>"+globalfunc.changeAndFormatCurrency(10000000)+"</option>");
$.ajax({type:"GET",url:"/rest/user/profile",contentType:"application/json; charset=utf-8",dataType:"json",success:function(data){$("input#editaccountEmail").val(data.username);
$("input#editaccountEmailConfirm").val(data.username);
$("input#editaccountFirstName").val(data.firstName);
$("input#editaccountLastName").val(data.lastName);
$("input#editaccountZip").val(data.zip);
$("select#editaccountCountry").val(data.countryId);
$("input#editaccountUserID").val(data.userId);
$("select#currenciesDropDown").val(data.currency);
if(data.phone){$("input#editaccountPhone").val(data.phone)
}if(data.street){$("input#editaccountAddress").val(data.street)
}if(data.city){$("input#editaccountCity").val(data.city)
}if(data.state){$("select#editaccountState").val(data.state)
}if(data.buying){$("select#editaccountBuySell").val("buy")
}else{$("select#editaccountBuySell").val("sell")
}if(data.timeframe){$("select#editaccountWhen").val(data.timeframe)
}if(data.priceMin){$("select#editaccountPriceMin").val(data.priceMin)
}if(data.priceMax){$("select#editaccountPriceMax").val(data.priceMax)
}$.ajax({type:"GET",url:"/rest/user/currencies",contentType:"application/json; charset=utf-8",dataType:"json",success:function(data){displayCurrencies=data;
$.each(displayCurrencies.currencies,function(){if(this.currencyCode==$("select#currenciesDropDown").val()){$("#currencySymbolEditAccount").html(this.currencySymbol)
}})
}})
}});
if(!saveditems.data.hasCanadaCookieDomain){saveditems.initializeAffordabilityContent()
}$("select#currenciesDropDown").change(function(){$.each(displayCurrencies.currencies,function(){if(this.currencyCode==$("select#currenciesDropDown").val()){$("#currencySymbolEditAccount").html(this.currencySymbol)
}})
})
})
},initializeAffordabilityContent:function(){var fifteenYearFixRate=0;
var thirtyYearFixRate=0;
$("#accordion").accordion({collapsible:true,active:false,animated:false,change:function(){closedAccordion=$("#advancedTabLinkEditAccount").hasClass("ui-state-default");
if(closedAccordion){$(".accountSettingsGrayBorder").css("height","495px")
}else{$(".accountSettingsGrayBorder").css("height","770px")
}modal.adjustHeightVisible("editaccountsettings")
}});
var cookieOpts={path:"/",expires:180};
if(!affordabilityRadar.conversionRate){affordabilityRadar.conversionRate=saveditems.data.conversionRate
}cookieVal=$.cookie("affordabilitySettings",undefined,cookieOpts);
if(cookieVal){$("#unformatedMonthlyPayment").val(cookieVal);
$("#monthlyPayment").val(globalfunc.changeAndFormatCurrency(cookieVal,true,"none"));
$("#calcMonthlyPayment").html(globalfunc.changeAndFormatCurrency(parseFloat(cookieVal)))
}else{$("#calcMonthlyPayment").html(globalfunc.changeAndFormatCurrency(0))
}$("#calcLoanAmount").html(globalfunc.changeAndFormatCurrency(0));
$("#calcPurchasePrice").html(globalfunc.changeAndFormatCurrency(0));
var dPayment=$.cookie("affSettingsDownPayment",undefined,cookieOpts)?$.cookie("affSettingsDownPayment",undefined,cookieOpts):0;
$("#calcDownPayment").html(globalfunc.changeAndFormatCurrency(dPayment));
$("#calcClosingCost").html(globalfunc.changeAndFormatCurrency(0));
$(".standaloneCurrencySymbol").html(saveditems.data.currencySymbol);
loanTermCookieVal=$.cookie("affSettingsLoanTerm",undefined,cookieOpts);
if(loanTermCookieVal){if(loanTermCookieVal=="30"||loanTermCookieVal=="0"){var loanTerm30Index=$("#loanTerm30").index();
$("input[name=loanTermOpt]:eq("+loanTerm30Index+")").attr("checked","checked")
}else{loanTerm15Index=$("#loanTerm15").index();
$("input[name=loanTermOpt]:eq("+loanTerm15Index+")").attr("checked","checked")
}}else{$("#loanTerm30").attr("checked","checked")
}$.ajax({type:"GET",cache:$.browser.msie?false:true,url:"/rest/user/interestRate",contentType:"application/json; charset=utf-8",dataType:"json",error:function(data){alert("Failed to get interest rate and currency symbol")
},success:function(data){fifteenYearFixRate=data.fifteenYearInterestRate;
thirtyYearFixRate=data.thirtyYearInterestRate;
sliderHandler=new AffordabilityRadarSlider();
sliderHandler.init(fifteenYearFixRate,thirtyYearFixRate);
$("input[name=loanTermOpt]:radio").change(function(){if($("#loanTerm30").attr("checked")){$("#interestRateSlider").slider({value:thirtyYearFixRate/0.125});
$("#selectedInterestRate").text(thirtyYearFixRate);
$("#interestRate").val(thirtyYearFixRate);
affordabilityRadar.calculate()
}else{$("#interestRateSlider").slider({value:fifteenYearFixRate/0.125});
$("#selectedInterestRate").text(fifteenYearFixRate);
$("#interestRate").val(fifteenYearFixRate);
affordabilityRadar.calculate()
}})
}});
$("#monthlyPayment").blur(function(){var value=$(this).val();
if(affordabilityRadar.selectedCurrency!="USD"){$("#unformatedMonthlyPayment").val(affordabilityRadar.convertToDollar(value))
}else{$("#unformatedMonthlyPayment").val(value)
}$("#monthlyPayment").val(globalfunc.convertToCurrency(parseFloat(value),true,"none"));
$("#calcMonthlyPayment").html(globalfunc.convertToCurrency(parseFloat(value),true,saveditems.data.currencySymbol));
affordabilityRadar.resetSliders();
$("#calcLoanAmount").html(globalfunc.changeAndFormatCurrency(0));
$("#calcPurchasePrice").html(globalfunc.changeAndFormatCurrency(0));
$("#calcDownPayment").html(globalfunc.changeAndFormatCurrency(0));
$("#calcClosingCost").html(globalfunc.changeAndFormatCurrency(0))
});
$("#advancedTabLinkEditAccount").trigger("click")
},updateAccountSettings:function(){var monthlyVal=$("#monthlyPayment").val();
if(monthlyVal!="0.00"&&monthlyVal!=""&&monthlyVal!=globalfunc.changeAndFormatCurrency(parseFloat(saveditems.data.monthpayment),true,"none")){webtrends.runTag("Affordability Radar Homefile Settings")
}var currencySelected=$("#currenciesDropDown option:selected").val();
if(currencySelected!=saveditems.data.selectedCurrency){webtrends.runTag("Currency","WT.z_currency_selected",currencySelected)
}var pleaseWaitButton=function(){if($.browser.msie){$("#editaccountUpdateButton").html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').css("display","block");
runAjax()
}else{$("#editaccountUpdateButton").html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').fadeTo(250,1,function(){runAjax()
})
}};
affordabilityRadar.calledFromSavedItems=true;
affordabilityRadar.setTargetBaseline();
if(affordabilityRadar.updateAccountSettings){var runAjax=function(){var formdata={username:$email,firstName:$firstname,lastName:$lastname,userId:$("input#editaccountUserID").val(),zip:$zip,countryId:$("select#editaccountCountry").val(),buying:($("select#editaccountBuySell").val()=="buy"),phone:$("input#editaccountPhone").val(),street:$("input#editaccountAddress").val(),state:$("select#editaccountState").val(),timeframe:$("select#editaccountWhen").val(),priceMin:$("select#editaccountPriceMin").val(),priceMax:$("select#editaccountPriceMax").val(),currency:$("select#currenciesDropDown").val(),monthlyPayment:$("#unformatedMonthlyPayment").val(),fundsAvailable:$("#fundsAvailable").val(),loanTerm:$("#loanTerm30").attr("checked")?30:15,interestRate:$("#interestRate").val(),downPayment:affordabilityRadar.downPayment};
formdata=JSON.stringify(formdata);
affordabilityRadar.downPayment=formdata.downPayment;
$.ajax({type:"POST",data:formdata,url:"/rest/user/update/profile",contentType:"application/json; charset=utf-8",dataType:"json",success:function(data){modal.close("editaccountsettings",true);
var rando=new String(Math.random());
rando=rando.substring(2,11);
modal.open("accountupdated","/templates/homefile/editaccount-confirm.html",750,function(){$("#accountUpdated247").append('<iframe id="300x250" src="http://oascentral.realogy.com/RealMedia/ads/adstream_sx.ads/coldwellbanker/homefile/update/1'+rando+'@Right1"marginheight="0" marginwidth="0" height="250" width="300" frameborder="0"style="float: left; overflow: hidden;"></iframe>')
})
}})
};
var $firstname=$.trim($("input#editaccountFirstName").val());
var $lastname=$.trim($("input#editaccountLastName").val());
var $zip=$.trim($("input#editaccountZip").val());
var $email=$.trim($("input#editaccountEmail").val());
var $emailconfirm=$.trim($("#editaccountEmailConfirm").val());
if($firstname==""){alert("Please enter your first name.");
return
}if($lastname==""){alert("Please enter your last name.");
return
}var $emailcheck=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if(!$emailcheck.test($email)){alert("Please enter a valid email address.");
return
}if($email!=$emailconfirm){alert("Email addresses do not match, please try again.");
return
}$("#editaccountCloseButton").css("visibility","hidden");
$("#editaccountCancelButton").css("visibility","hidden");
$("#editaccountChangePasswordButton").css("visibility","hidden");
if($.browser.msie){$("#editaccountUpdateButton").stop().css("display","none");
pleaseWaitButton()
}else{$("#editaccountUpdateButton").stop().fadeTo(250,0,function(){pleaseWaitButton()
})
}}},updatePassword:function(){var pleaseWaitButton=function(){if($.browser.msie){$("#editaccountChangePasswordButton").html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').css("display","block");
runAjax()
}else{$("#editaccountChangePasswordButton").html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').fadeTo(250,1,function(){runAjax()
})
}};
var runAjax=function(){var formdata={userId:$("input#editaccountUserID").val(),password:$password};
formdata=JSON.stringify(formdata);
$.ajax({type:"POST",data:formdata,url:baseSecureUrl="/rest/user/update/password",contentType:"application/json; charset=utf-8",dataType:"json",success:function(data){modal.close("editaccountsettings",true);
var rando=new String(Math.random());
rando=rando.substring(2,11);
modal.open("passwordupdated","/templates/homefile/passwordupdated.html",750,function(){$("#forgotPasswordConfirm247").append('<iframe id="300x250" src="http://oascentral.realogy.com/RealMedia/ads/adstream_sx.ads/coldwellbanker/homefile/change/1'+rando+'@Right1"marginheight="0" marginwidth="0" height="250" width="300" frameborder="0"style="float: left; overflow: hidden;"></iframe>')
})
}})
};
var $password=$.trim($("#editaccountPassword").val());
var $passwordconfirm=$.trim($("#editaccountPasswordConfirm").val());
if($password==""){alert("Please enter a password");
return
}if($password!=$passwordconfirm){alert("Passwords do not match. Please try again.");
return
}if($password.length<6){alert("Please enter a password longer than 6 characters.");
return
}$("#editaccountCloseButton").css("visibility","hidden");
$("#editaccountCancelButton").css("visibility","hidden");
$("#editaccountUpdateButton").css("visibility","hidden");
if($.browser.msie){$("#editaccountChangePasswordButton").stop().css("display","none");
pleaseWaitButton()
}else{$("#editaccountChangePasswordButton").stop().fadeTo(250,0,function(){pleaseWaitButton()
})
}}};
saveditems.saveButtons.small={saveOff:'<img src="'+saveditems.cdnBaseUrl+'/images/office/maps/btn-save-off.gif" width="56" height="23" alt="Save"/>',saveOn:'<img src="'+saveditems.cdnBaseUrl+'/images/office/maps/btn-save-on.gif" width="56" height="23" alt="Save"/>',removeOff:'<img src="'+saveditems.cdnBaseUrl+'/images/office/maps/btn-remove-off.gif" width="67" height="23" alt="Remove"/>',removeOn:'<img src="'+saveditems.cdnBaseUrl+'/images/office/maps/btn-remove-on.gif" width="67" height="23" alt="Remove"/>'};
saveditems.saveButtons.medium={saveOff:'<img src="'+saveditems.cdnBaseUrl+'/images/property/list-view/menu-save-off.gif" width="55" height="19" alt="Save"/>',saveOn:'<img src="'+saveditems.cdnBaseUrl+'/images/property/list-view/menu-save-on.gif" width="55" height="19" alt="Save"/>',removeOff:'<img src="'+saveditems.cdnBaseUrl+'/images/property/list-view/menu-remove-off.gif" width="65" height="20" alt="Remove"/>',removeOn:'<img src="'+saveditems.cdnBaseUrl+'/images/property/list-view/menu-remove-on.gif" width="65" height="20" alt="Remove"/>'};
saveditems.saveButtons.large={saveOff:'<img src="'+saveditems.cdnBaseUrl+'/images/global/detailtab/btn-save-off.gif" width="61" height="25" alt="Save"/>',saveOn:'<img src="'+saveditems.cdnBaseUrl+'/images/global/detailtab/btn-save-on.gif" width="61" height="25" alt="Save"/>',removeOff:'<img src="'+saveditems.cdnBaseUrl+'/images/global/detailtab/btn-remove-off.gif" width="72" height="25" alt="Remove"/>',removeOn:'<img src="'+saveditems.cdnBaseUrl+'/images/global/detailtab/btn-remove-on.gif" width="72" height="25" alt="Remove"/>'};
saveditems.saveButtons.learnsmall={saveOff:'<img src="'+saveditems.cdnBaseUrl+'/images/learn/save-btn-off-small.gif" width="20" height="16" alt="Save"/>',saveOn:'<img src="'+saveditems.cdnBaseUrl+'/images/learn/save-btn-on-small.gif" width="20" height="16" alt="Save"/>',removeOff:'<img src="'+saveditems.cdnBaseUrl+'/images/learn/remove-btn-off-small.gif" width="17" height="14" alt="Remove"/>',removeOn:'<img src="'+saveditems.cdnBaseUrl+'/images/learn/remove-btn-on-small.gif" width="17" height="14" alt="Remove"/>'};
saveditems.saveButtons.learnmedium={saveOff:'<img src="'+saveditems.cdnBaseUrl+'/images/learn/save-btn-off.gif" width="33" height="32" alt="Save"/>',saveOn:'<img src="'+saveditems.cdnBaseUrl+'/images/learn/save-btn-on.gif" width="33" height="32" alt="Save"/>',removeOff:'<img src="'+saveditems.cdnBaseUrl+'/images/learn/remove-btn-off.gif" width="33" height="32" alt="Remove"/>',removeOn:'<img src="'+saveditems.cdnBaseUrl+'/images/learn/remove-btn-on.gif" width="33" height="32" alt="Remove"/>'};
saveditems.addItem.modalProperty=function(pinId){var $obj=(saveditems.currentTab=="RecentlyRated")?saveditems.recentlyratedSorted[pinId]:saveditems.sortedData[pinId];
var $recentlyrated=(saveditems.currentTab=="RecentlyRated")?"recentlyrated":"";
var propertyItem='<div id="saveditemsCarouselItemProperty'+$obj.id+$recentlyrated+'" style="overflow: visible; width: 83px; position: relative; cursor: pointer;" onclick="modalLoader[\'modalDetail\'].open('+$obj.id+", 'property', null, null,'"+$obj.brandType+"');\" onmouseover=\"saveditems.showPopup['Property']('"+pinId+"');\" onmouseout=\"saveditems.hidePopup('Property','"+pinId+"')\">";
if($obj.expired){propertyItem+='<div class="expiredBG">&nbsp;</div><div class="expiredText"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/notavailable-text.png" width="65" height="30" style="margin-top: 16px;" alt="No Longer Available"/></div>'
}propertyItem+='<img src="'+$obj.image+"\" alt=\"\" style=\"visibility: hidden\" onload=\"$(this).css('width','83px'); if($(this).height() > '63'){$(this).css({height:'63px',width:''})}; this.style.visibility='visible'\" onerror=\"this.src='"+saveditems.cdnBaseUrl+'/images/property/list-view/nophoto_property_list.gif\'"/><div style="width: 83px; text-align: center;" class="whitetext11"><span style="text-transform: capitalize">'+$obj.location.toLowerCase()+"</span></div></div>";
return propertyItem
};
saveditems.showPopup.Property=function(pinId){var $obj=(saveditems.currentTab=="RecentlyRated")?saveditems.recentlyratedSorted[pinId]:saveditems.sortedData[pinId];
var $recentlyrated=(saveditems.currentTab=="RecentlyRated")?"recentlyrated":"";
var $webtrendsPropertyType=($obj.brandType=="CB")?"CB":"Sister";
var $webtrendsType=($obj.contactForAgent)?"Agent Property Lead":"Office Property Lead";
if($("#saveditemsPopupProperty"+$obj.id+$recentlyrated).length==0){var $popupContent='<div id="saveditemsPopupProperty'+$obj.id+$recentlyrated+'" class="saveditemsPopup"><div style="float: left; width: 248px; height: 10px;"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/popup-top.png" width="248" height="10" alt=""/></div><div class="saveditemsPopupMiddle"><div class="saveditemsPopupAddress"><div style="margin: 10px 10px" class="blacktext11bold"><span style="text-transform: capitalize">'+$obj.mailAddress.street.toLowerCase()+"<br/>"+$obj.mailAddress.city.toLowerCase()+"</span>, "+$obj.mailAddress.subdivision+" "+$obj.mailAddress.postalCode+'</div></div><div style="float: left; width: 130px; margin-left: 12px; line-height: 18px; margin-bottom: 5px;" class="blacktext11"><strong>Price:</strong> <span class="currencyLink" onclick="CurrencyConverterPanel.showRelativeTo(this);">'+globalfunc.changeAndFormatCurrency($obj.price)+"</span><br/><strong>Beds:</strong> "+$obj.numberOfBeds+"<br/><strong>Baths:</strong> "+$obj.numberOfBaths+"<br/><strong>"+$obj.sqFt+' sqft</strong></div><div style="float: left; width: 95px; line-height: 18px" class="blacktext11"><div id="saveditemsPopupRating'+$obj.id+'" class="propertyListViewToolBar addRateToSavedItemsPopupRating"></div><a href="javascript:modalLoader[\'modalDetail\'].open('+$obj.id+", 'property', null, null,'"+$obj.brandType+'\');" class="darkbluelink11bold">View Details <img src="'+saveditems.cdnBaseUrl+'/images/global/right-arrow-small.png" width="10" height="11" alt="View Details"/></a><br/><a href="javascript:modalLoader[\'modalDetail\'].open('+$obj.id+", 'property', 'map', null,'"+$obj.brandType+'\');" class="darkbluelink11bold">View Map <img src="'+saveditems.cdnBaseUrl+'/images/global/right-arrow-small.png" width="10" height="11" alt="View Map"/></a><br/><a href="javascript:modalLoader[\'modalContact\'].open('+$obj.id+", 'property', "+$obj.accountId+", '"+$obj.contact+"', '"+$obj.location+"', '"+$obj.phone+"', '"+$obj.fax+"', '"+$obj.email+"','"+$obj.voiceMail+"','"+$obj.brandType+"','"+$webtrendsType+"','WT.z_prop_type','"+$webtrendsPropertyType+'\');"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/btn-contact.gif" width="79" height="24" alt="Contact"/></a></div></div><div style="float: left; width: 248px; height: 3px; font-size: 1px;"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/popup-bottom.png" width="248" height="3" alt=""/></div></div>';
$(document.body).append($popupContent);
var $savedPopup=$("#saveditemsPopupProperty"+$obj.id+$recentlyrated);
$savedPopup.css({top:($("#saveditemsCarouselItemProperty"+$obj.id+$recentlyrated).offset().top+75)+"px",left:($("#saveditemsCarouselItemProperty"+$obj.id+$recentlyrated).offset().left-90)+"px"});
rate.addRate($(".addRateToSavedItemsPopupRating"),$obj.id,$obj.brandType,$obj.rate,false,true,false);
if($.browser.msie){$savedPopup.mouseover(function(){$(this).stop().css("display","block")
});
$savedPopup.mouseout(function(){$(this).stop().css("display","none")
})
}else{$savedPopup.mouseover(function(){$(this).stop().css("display","block").fadeTo(1000,1)
});
$savedPopup.mouseout(function(){$(this).stop().css("display","block").fadeTo(1000,0,function(){$(this).css("display","none")
})
})
}}saveditems.displayPopup("Property",pinId)
};
saveditems.addItem.modalAgent=function(pinId){return'<div id="saveditemsCarouselItemAgent'+saveditems.sortedData[pinId].id+'" style="overflow: visible; width: 83px; cursor: pointer;" onclick="modalLoader[\'modalDetail\'].open('+saveditems.sortedData[pinId].id+",'agent');\" onmouseover=\"saveditems.showPopup['Agent']('"+pinId+"');\" onmouseout=\"saveditems.hidePopup('Agent','"+pinId+'\')"><img src="'+saveditems.sortedData[pinId].image+"\" alt=\"\" style=\"visibility: hidden\" onload=\"$(this).css('width','83px'); if($(this).height() > '63'){$(this).css({height:'63px',width:''})}; this.style.visibility='visible'\" onerror=\"this.src='"+saveditems.cdnBaseUrl+'/images/property/list-view/nophoto_property_list.gif\'"/><div style="width: 83px; text-align: center;" class="whitetext11"><span style="text-transform: capitalize">'+saveditems.sortedData[pinId].name.toLowerCase()+"</span></div></div>"
};
saveditems.showPopup.Agent=function(pinId){if($("#saveditemsPopupAgent"+saveditems.sortedData[pinId].id).length==0){var $popupContent='<div id="saveditemsPopupAgent'+saveditems.sortedData[pinId].id+'" class="saveditemsPopup"><div style="float: left; width: 248px; height: 10px;"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/popup-top.png" width="248" height="10" alt=""/></div><div class="saveditemsPopupMiddle"><div class="saveditemsPopupAddress"><div style="margin: 10px 10px" class="blacktext11bold">'+saveditems.sortedData[pinId].streetAddress+"<br/>"+saveditems.sortedData[pinId].city+", "+saveditems.sortedData[pinId].state+" "+saveditems.sortedData[pinId].zip+'</div></div><div style="float: left; width: 130px; margin-left: 12px; line-height: 18px; margin-bottom: 5px;" class="blacktext11"><a href="javascript:void(0);" onclick="modalLoader[\'modalDetail\'].open('+saveditems.sortedData[pinId].id+',\'agent\');" class="darkbluelink11bold">View Details <img src="'+saveditems.cdnBaseUrl+'/images/global/right-arrow-small.png" width="10" height="11" alt="View Details"/></a><br/><a href="javascript:void(0);" onclick="modalLoader[\'modalContact\'].open('+saveditems.sortedData[pinId].id+", 'agent', "+saveditems.sortedData[pinId].accountId+", '"+saveditems.sortedData[pinId].name+"', '"+saveditems.sortedData[pinId].streetAddress+", "+saveditems.sortedData[pinId].city+", "+saveditems.sortedData[pinId].state+" "+saveditems.sortedData[pinId].zip+"', '"+saveditems.sortedData[pinId].phone+"', '"+saveditems.sortedData[pinId].mobilePhone+"', '"+saveditems.sortedData[pinId].fax+"', 'email@email.com', '"+saveditems.sortedData[pinId].voiceMail+"', null, 'Agent Profile Lead');\"><img src=\""+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/btn-contact.gif" width="79" height="24" alt="Contact"/></a></div></div><div style="float: left; width: 248px; height: 3px; font-size: 1px;"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/popup-bottom.png" width="248" height="3" alt=""/></div></div>';
$(document.body).append($popupContent);
var $savedPopup=$("#saveditemsPopupAgent"+saveditems.sortedData[pinId].id);
if($.browser.msie){$savedPopup.mouseover(function(){$(this).stop().css("display","block")
});
$savedPopup.mouseout(function(){$(this).stop().css("display","none")
})
}else{$savedPopup.mouseover(function(){$(this).stop().css("display","block").fadeTo(1000,1)
});
$savedPopup.mouseout(function(){$(this).stop().css("display","block").fadeTo(1000,0,function(){$(this).css("display","none")
})
})
}}saveditems.displayPopup("Agent",pinId)
};
saveditems.addItem.modalTeam=function(pinId){return'<div id="saveditemsCarouselItemTeam'+saveditems.sortedData[pinId].id+'" style="overflow: visible; width: 83px; cursor: pointer;" onclick="modalLoader[\'modalDetail\'].open('+saveditems.sortedData[pinId].id+",'team');\" onmouseover=\"saveditems.showPopup['Team']('"+pinId+"');\" onmouseout=\"saveditems.hidePopup('Team','"+pinId+'\')"><img src="'+saveditems.sortedData[pinId].image+"\" alt=\"\" style=\"visibility: hidden\" onload=\"$(this).css('width','83px'); if($(this).height() > '63'){$(this).css({height:'63px',width:''})}; this.style.visibility='visible'\" onerror=\"this.src='"+saveditems.cdnBaseUrl+'/images/property/list-view/nophoto_property_list.gif\'"/><div style="width: 83px; text-align: center;" class="whitetext11"><span style="text-transform: capitalize">'+saveditems.sortedData[pinId].name.toLowerCase()+"</span></div></div>"
};
saveditems.showPopup.Team=function(pinId){if($("#saveditemsPopupTeam"+saveditems.sortedData[pinId].id).length==0){var $popupContent='<div id="saveditemsPopupTeam'+saveditems.sortedData[pinId].id+'" class="saveditemsPopup"><div style="float: left; width: 248px; height: 10px;"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/popup-top.png" width="248" height="10" alt=""/></div><div class="saveditemsPopupMiddle"><div class="saveditemsPopupAddress"><div style="margin: 10px 10px" class="blacktext11bold">'+saveditems.sortedData[pinId].streetAddress+"<br/>"+saveditems.sortedData[pinId].city+", "+saveditems.sortedData[pinId].state+" "+saveditems.sortedData[pinId].zip+'</div></div><div style="float: left; width: 130px; margin-left: 12px; line-height: 18px; margin-bottom: 5px;" class="blacktext11"><a href="javascript:void(0);" onclick="modalLoader[\'modalDetail\'].open('+saveditems.sortedData[pinId].id+',\'agent\');" class="darkbluelink11bold">View Details <img src="'+saveditems.cdnBaseUrl+'/images/global/right-arrow-small.png" width="10" height="11" alt="View Details"/></a><br/><a href="javascript:void(0);" onclick="modalLoader[\'modalContact\'].open('+saveditems.sortedData[pinId].id+", 'agent', "+saveditems.sortedData[pinId].accountId+", '"+saveditems.sortedData[pinId].name+"', '"+saveditems.sortedData[pinId].streetAddress+", "+saveditems.sortedData[pinId].city+", "+saveditems.sortedData[pinId].state+" "+saveditems.sortedData[pinId].zip+"', '"+saveditems.sortedData[pinId].phone+"', '"+saveditems.sortedData[pinId].mobilePhone+"', '"+saveditems.sortedData[pinId].fax+"', 'email@email.com', '"+saveditems.sortedData[pinId].voiceMail+"', null, 'Agent Profile Lead');\"><img src=\""+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/btn-contact.gif" width="79" height="24" alt="Contact"/></a></div></div><div style="float: left; width: 248px; height: 3px; font-size: 1px;"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/popup-bottom.png" width="248" height="3" alt=""/></div></div>';
$(document.body).append($popupContent);
var $savedPopup=$("#saveditemsPopupAgent"+saveditems.sortedData[pinId].id);
if($.browser.msie){$savedPopup.mouseover(function(){$(this).stop().css("display","block")
});
$savedPopup.mouseout(function(){$(this).stop().css("display","none")
})
}else{$savedPopup.mouseover(function(){$(this).stop().css("display","block").fadeTo(1000,1)
});
$savedPopup.mouseout(function(){$(this).stop().css("display","block").fadeTo(1000,0,function(){$(this).css("display","none")
})
})
}}saveditems.displayPopup("Team",pinId)
};
saveditems.addItem.modalOffice=function(pinId){return'<div id="saveditemsCarouselItemOffice'+saveditems.sortedData[pinId].id+'" style="overflow: visible; width: 83px; cursor: pointer;" onclick="modalLoader[\'modalDetail\'].open('+saveditems.sortedData[pinId].id+",'office');\" onmouseover=\"saveditems.showPopup['Office']('"+pinId+"');\" onmouseout=\"saveditems.hidePopup('Office','"+pinId+'\')"><img src="'+saveditems.sortedData[pinId].image+"\" alt=\"\" style=\"visibility: hidden\" onload=\"$(this).css('width','83px'); if($(this).height() > '63'){$(this).css({height:'63px',width:''})}; this.style.visibility='visible'\" onerror=\"this.src='"+saveditems.cdnBaseUrl+'/images/property/list-view/nophoto_property_list.gif\'"/><div style="width: 83px; text-align: center;" class="whitetext11"><span style="text-transform: capitalize">'+saveditems.sortedData[pinId].name.toLowerCase()+"</span></div></div>"
};
saveditems.showPopup.Office=function(pinId){if($("#saveditemsPopupOffice"+saveditems.sortedData[pinId].id).length==0){var $popupContent='<div id="saveditemsPopupOffice'+saveditems.sortedData[pinId].id+'" class="saveditemsPopup"><div style="float: left; width: 248px; height: 10px;"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/popup-top.png" width="248" height="10" alt=""/></div><div class="saveditemsPopupMiddle"><div class="saveditemsPopupAddress"><div style="margin: 10px 10px" class="blacktext11bold">'+saveditems.sortedData[pinId].street+"<br/>"+saveditems.sortedData[pinId].city+", "+saveditems.sortedData[pinId].state+" "+saveditems.sortedData[pinId].zip+'</div></div><div style="float: left; width: 130px; margin-left: 12px; line-height: 18px; margin-bottom: 5px;" class="blacktext11"><a href="javascript:void(0);" onclick="modalLoader[\'modalDetail\'].open('+saveditems.sortedData[pinId].id+',\'office\');" class="darkbluelink11bold">View Details <img src="'+saveditems.cdnBaseUrl+'/images/global/right-arrow-small.png" width="10" height="11" alt="View Details"/></a><br/><a href="javascript:void(0);" onclick="modalLoader[\'modalDetail\'].open('+saveditems.sortedData[pinId].id+",'office', 'map');\" class=\"darkbluelink11bold\">View Map <img src=\""+saveditems.cdnBaseUrl+'/images/global/right-arrow-small.png" width="10" height="11" alt="View Map"/></a><br/><a href="javascript:void(0);" onclick="modalLoader[\'modalContact\'].open('+saveditems.sortedData[pinId].id+", 'office', "+saveditems.sortedData[pinId].accountId+", '"+saveditems.sortedData[pinId].name+"', '"+saveditems.sortedData[pinId].street+", "+saveditems.sortedData[pinId].city+", "+saveditems.sortedData[pinId].state+" "+saveditems.sortedData[pinId].zip+"', '"+saveditems.sortedData[pinId].phone+"', '"+saveditems.sortedData[pinId].mobilePhone+"', '"+saveditems.sortedData[pinId].fax+"', '"+saveditems.sortedData[pinId].email+"', '"+saveditems.sortedData[pinId].voiceMail+"', null, 'Office Profile Lead');\"><img src=\""+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/btn-contact.gif" width="79" height="24" alt="Contact"/></a></div></div><div style="float: left; width: 248px; height: 3px; font-size: 1px;"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/popup-bottom.png" width="248" height="3" alt=""/></div></div>';
$(document.body).append($popupContent);
var $savedPopup=$("#saveditemsPopupOffice"+saveditems.sortedData[pinId].id);
if($.browser.msie){$savedPopup.mouseover(function(){$(this).stop().css("display","block")
});
$savedPopup.mouseout(function(){$(this).stop().css("display","none")
})
}else{$savedPopup.mouseover(function(){$(this).stop().css("display","block").fadeTo(1000,1)
});
$savedPopup.mouseout(function(){$(this).stop().css("display","block").fadeTo(1000,0,function(){$(this).css("display","none")
})
})
}}saveditems.displayPopup("Office",pinId)
};
saveditems.addItem.modalResource=function(pinId){var $obj=(saveditems.currentTab=="RecentlyRated")?saveditems.recentlyratedSorted[pinId]:saveditems.sortedData[pinId];
var $recentlyrated=(saveditems.currentTab=="RecentlyRated")?"recentlyrated":"";
var $contentimage=saveditems.cdnBaseUrl+"/images/learn/landing/article-thumb-medium.png";
if($obj.resource["template"].id==2||$obj.resource["template"].id==31){$contentimage=saveditems.cdnBaseUrl+"/images/learn/landing/weblink-thumb-medium.png"
}else{if($obj.resource["template"].id==200000||$obj.resource["template"].id==300000){$contentimage=saveditems.cdnBaseUrl+"/images/learn/landing/video-thumb-medium.png"
}}var $image=($obj.imageUrl)?$obj.imageUrl:$contentimage;
return'<div id="saveditemsCarouselItemResource'+$obj.id+$recentlyrated+'" style="overflow: visible; width: 83px; cursor: pointer;" onmouseover="saveditems.showPopup[\'Resource\'](\''+pinId+"');\" onmouseout=\"saveditems.hidePopup('Resource','"+pinId+'\')"><a href="/real_estate/learn?learnPage=DETAIL&contentId='+$obj.id+'"><img src="'+$image+"\" alt=\"\" style=\"visibility: hidden\" onload=\"$(this).css('width','83px'); if($(this).height() > '63'){$(this).css({height:'63px',width:'auto'})}; this.style.visibility='visible'\" onerror=\"this.src='"+$contentimage+'\'"/></a><div style="width: 83px; text-align: center;" class="whitetext11"><span style="text-transform: capitalize">'+$obj.resource.title+"</span></div></div>"
};
saveditems.showPopup.Resource=function(pinId){var $obj=(saveditems.currentTab=="RecentlyRated")?saveditems.recentlyratedSorted[pinId]:saveditems.sortedData[pinId];
var $recentlyrated=(saveditems.currentTab=="RecentlyRated")?"recentlyrated":"";
if($("#saveditemsPopupResource"+$obj.id+$recentlyrated).length==0){var $popupContent='<div id="saveditemsPopupResource'+$obj.id+$recentlyrated+'" class="saveditemsPopup"><div style="float: left; width: 248px; height: 10px;"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/popup-top.png" width="248" height="10" alt=""/></div><div class="saveditemsPopupMiddle"><div class="saveditemsPopupAddress"><div style="margin: 10px 10px" class="blacktext11bold">'+$obj.resource.title+'</div></div><div style="float: left; width: 225px; margin-left: 12px; line-height: 18px; margin-bottom: 5px;" class="blacktext11">'+(($obj.resource.description==undefined)?"":$obj.resource.description)+'<br/><a href="/real_estate/learn?learnPage=DETAIL&contentId='+$obj.id+'" class="darkbluelink11bold">View Resource <img src="'+saveditems.cdnBaseUrl+'/images/global/right-arrow-small.png" width="10" height="11" alt="View Resource"/></a><br/></div></div><div style="float: left; width: 248px; height: 3px; font-size: 1px;"><img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/saveditems/popup-bottom.png" width="248" height="3" alt=""/></div></div>';
$(document.body).append($popupContent);
var $savedPopup=$("#saveditemsPopupResource"+$obj.id+$recentlyrated);
$savedPopup.css({top:($("#saveditemsCarouselItemResource"+$obj.id+$recentlyrated).offset().top+75)+"px",left:($("#saveditemsCarouselItemResource"+$obj.id+$recentlyrated).offset().left-90)+"px"});
if($.browser.msie){$savedPopup.mouseover(function(){$(this).stop().css("display","block")
});
$savedPopup.mouseout(function(){$(this).stop().css("display","none")
})
}else{$savedPopup.mouseover(function(){$(this).stop().css("display","block").fadeTo(1000,1)
});
$savedPopup.mouseout(function(){$(this).stop().css("display","block").fadeTo(1000,0,function(){$(this).css("display","none")
})
})
}}saveditems.displayPopup("Resource",pinId)
};
$(document).ready(function(){saveditems.init()
});
var changePassword={init:function(){$(".changePasswordButton img").click(function(){if(changePassword.validate()){var pleaseWaitButton=function(){if($.browser.msie){$(".changePasswordButton").html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').css("display","block");
runAjax()
}else{$(".changePasswordButton").html('<img src="'+saveditems.cdnBaseUrl+'/images/global/homefile/btn-pleasewait.png" width="96" height="25" alt="Please Wait..."/>').fadeTo(250,1,function(){runAjax()
})
}};
var runAjax=function(){var formdata={userId:$("input#hiddenUserId").val(),password:$("#passwordBox1").val()};
formdata=JSON.stringify(formdata);
$.ajax({type:"POST",data:formdata,url:baseSecureUrl="/rest/user/update/password",contentType:"application/json; charset=utf-8",dataType:"json",error:function(XMLHttpRequest,textStatus,errorThrown){alert(textStatus)
},success:function(data){if($.browser.msie){$("#formElementsWrapper").css("display","none");
$("#responseWrapper").css("display","block")
}else{$("#formElementsWrapper").fadeOut(1000,function(){$("#responseWrapper").fadeIn(1000)
})
}}})
};
if($.browser.msie){$(".changePasswordButton").stop().css("display","none");
pleaseWaitButton()
}else{$(".changePasswordButton").stop().fadeTo(250,0,function(){pleaseWaitButton()
})
}}})
},validate:function(){var password1=$("#passwordBox1").val();
var password2=$("#passwordBox2").val();
if(password1==""||password2==""){alert("Please enter your new password in both boxes.");
return false
}else{if(password1!=password2){alert("Passwords do not match. Please try again.");
return false
}else{if(password1.length<6||password2.length<6){alert("Please enter a password longer than 6 characters.");
return false
}}}return true
}};
$(document).ready(function(){changePassword.init()
});
