// Copyright 2010 BestHomeProm

(function($){$.toJSON=function(o){if(typeof(JSON)=='object'&&JSON.stringify)return JSON.stringify(o);var type=typeof(o);if(o===null)return"null";if(type=="undefined")return undefined;if(type=="number"||type=="boolean")return o+"";if(type=="string")return $.quoteString(o);if(type=='object'){if(typeof o.toJSON=="function")return $.toJSON(o.toJSON());if(o.constructor===Date){var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
if(o.constructor===Array){var ret=[];for(var i=0;i<o.length;i++)
ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]";}
var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;if(typeof o[k]=="function")
continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val);}
return"{"+pairs.join(", ")+"}";}};$.evalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);return eval("("+src+")");};$.secureEvalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");};$.quoteString=function(string)
{if(string.match(_escapeable))
{return'"'+string.replace(_escapeable,function(a)
{var c=_meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
return'"'+string+'"';};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};})(jQuery);jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}};jQuery.iPikaChoose={build:function(user_options)
{var defaults={show_captions:true,slide_enabled:true,auto_play:false,show_prev_next:true,slide_speed:5000,thumb_width:90,thumb_height:60,buttons_text:{play:"",stop:"",previous:"Previous",next:"Next"},delay_caption:true,user_thumbs:false};return jQuery(this).each(function(){function LoadImages(){jQuery(this).bind("load",function(){jQuery(this).parent('div').prev().remove();images=jQuery(this).parents('ul').find('img');var w=jQuery(this).width();var h=jQuery(this).height();if(w===0){w=jQuery(this).attr("width");}
if(h===0){h=jQuery(this).attr("height");}
var rw=options.thumb_width/w;var rh=options.thumb_height/h;var ratio;if(rw<rh){ratio=rh;var left=((w*ratio-options.thumb_width)/2)*-1;left=Math.round(left);jQuery(this).css({left:left});}else{ratio=rw;var top=0;jQuery(this).css({top:top});}
var width=Math.round(w*ratio);var height=Math.round(h*ratio);jQuery(this).css("position","relative");jQuery(this).width(width).height(height);var imgcss={width:width,height:height};jQuery(this).css(imgcss);if(jQuery(this).hasClass('pika_first')){jQuery(this).trigger("click",["auto"]);}});var newImage=jQuery(this).clone(true).insertAfter(this);jQuery(this).hide();images=ulist.children('li').children('img');}
var options=jQuery.extend(defaults,user_options);var images=jQuery(this).children('li').children('img');images.fadeOut(1);var ulist=jQuery(this);images.each(LoadImages);jQuery(this).before("<div class='pika_main'></div>");var main_div=jQuery(this).prev(".pika_main");if(options.slide_enabled){main_div.append("<div class='pika_play'></div>");var play_div=jQuery(this).prev(".pika_main").children(".pika_play");play_div.html("<a class='pika_play_button'>"+options.buttons_text.play+"</a><a class='pika_stop_button'>"+options.buttons_text.stop+"</a>");play_div.fadeOut(1);var play_anchor=play_div.children('a:first');var stop_anchor=play_div.children('a:last');}
main_div.append("<div class='pika_subdiv'></div>");var sub_div=main_div.children(".pika_subdiv");sub_div.append("<img class='pika_back_img'/><img class='pika_main_img' />");var main_img=sub_div.children("img:last");var back_img=sub_div.children("img:first");sub_div.append("<div class='pika_prev_hover'></div><div class='pika_next_hover'></div>");var prevHover=sub_div.find('.pika_prev_hover');var nextHover=sub_div.find('.pika_next_hover');prevHover.hide();nextHover.hide();if(options.show_captions){main_div.append("<div class='pika_caption'></div>");var caption_div=main_div.children(".pika_caption");}
jQuery(this).after("<div class='pika_navigation'></div>");var navigation_div=jQuery(this).next(".pika_navigation");navigation_div.prepend("<a>"+options.buttons_text.previous+"</a> :: <a>"+options.buttons_text.next+"</a>");var previous_image_anchor=navigation_div.children('a:first');var next_image_anchor=navigation_div.children('a:last');if(!options.show_prev_next){navigation_div.css("display","none");}
var playing=options.auto_play;main_img.wrap("<a></a>");var main_link=main_img.parent("a");function activate(){images.bind("click",image_click);if(options.slide_enabled){if(options.auto_play){playing=true;play_anchor.hide();stop_anchor.show();}else{play_anchor.show();stop_anchor.hide();}}
ulist.children("li:last").children("img").addClass("pika_last");ulist.children("li:first").children("img").addClass("pika_first");ulist.children("li").each(function(){jQuery(this).children("span").hide();});var divcss={width:options.thumb_width+"px",height:options.thumb_height+"px","list-style":"none",overflow:"hidden"};var licss={"list-style":"none",overflow:"hidden"};images.each(function(){jQuery(this).parent('li').css(licss);jQuery(this).wrap(document.createElement("div"));jQuery(this).parent('div').css(divcss);if(jQuery(this).attr('complete')===true&&jQuery(this).css('display')=="none")
{jQuery(this).css({display:'inline'});}});previous_image_anchor.bind("click",previous_image);prevHover.bind("click",previous_image);next_image_anchor.bind("click",next_image);nextHover.bind("click",next_image);sub_div.mousemove(function(e){var w=sub_div.width();var x=e.pageX-sub_div.offset().left;if(x<w*0.3)
{prevHover.fadeIn('fast');}else{prevHover.fadeOut('fast');}
if(x>w*0.7)
{nextHover.fadeIn('fast');}else{nextHover.fadeOut('fast');}});sub_div.mouseleave(function(){prevHover.fadeOut('fast');nextHover.fadeOut('fast');});}
function image_click(event,how){if(how!="auto"){if(options.slide_enabled){stop_anchor.hide();play_anchor.show();playing=false;}
main_img.stop();main_img.dequeue();if(options.show_captions)
{caption_div.stop();caption_div.dequeue();}}
if(options.user_thumbs)
{var image_source=jQuery(this).attr("ref");}else
{var image_source=this.src;}
var image_link=jQuery(this).attr("rel");var image_caption=jQuery(this).parent().next("span").html();images.filter(".pika_selected").removeClass("pika_selected");jQuery(this).addClass("pika_selected");if(options.show_captions)
{if(options.delay_caption)
{caption_div.fadeTo(800,0);}
caption_div.fadeTo(500,0,function(){caption_div.html(image_caption);caption_div.fadeTo(800,1);});}
var delay=100;if(main_img.attr('opacity')<0.8)
{delay=500;}
back_img.attr("src",main_img.attr("src"));main_img.fadeTo(delay,0.00,function(){main_img.unbind('load');main_img.bind('load',function()
{main_img.fadeTo(800,1,function(){if(playing){jQuery(this).animate({opacity:1},options.slide_speed,function(){if(playing){next_image_anchor.trigger("click",["auto"]);}});}
back_img.attr("src",main_img.attr("src"));});});main_img.attr("src",image_source);main_link.attr("href",image_link);});}
function next_image(event,how){if(images.filter(".pika_selected").hasClass("pika_last")){images.filter(":first").trigger("click",how);}else{images.filter(".pika_selected").parents('li').next('li').find('img').trigger("click",how);}}
function previous_image(event,how){if(images.filter(".pika_selected").hasClass("pika_first")){images.filter(":last").trigger("click",how);}else{images.filter(".pika_selected").parents('li').prev('li').find('img').trigger("click",how);}}
function play_button(){main_div.hover(function(){play_div.fadeIn(400);},function(){play_div.fadeOut(400);});play_anchor.bind("click",function(){main_img.stop();main_img.dequeue();if(options.show_captions)
{caption_div.stop();caption_div.dequeue();}
playing=true;next_image_anchor.trigger("click",["auto"]);jQuery(this).hide();stop_anchor.show();});stop_anchor.bind("click",function(){playing=false;jQuery(this).hide();play_anchor.show();});}
if(options.slide_enabled){play_button();}
activate();});}};jQuery.fn.PikaChoose=jQuery.iPikaChoose.build;$.getScript=function(url,callback,cache){$.ajax({type:"GET",url:url,success:callback,dataType:"script",cache:cache});};function appendJS(filename){var fileref=document.createElement('script');fileref.setAttribute("type","text/javascript");fileref.setAttribute("src",filename);document.getElementsByTagName("head")[0].appendChild(fileref);}
$(document).ready(function(){if($('#location-map').length!=0){if(!($.browser.msie)&&!($.browser.mozilla)&&!($.browser.safari)){$("#location-map").html("Virtual Earth is not supported by your browser.")}else{if(!maploaded){maploaded=true;$("#location-map").addClass("maploading");if(!(window.attachEvent)){appendJS("http:/"+"/ecn.dev.virtualearth.net/mapcontrol/v6.3/js/atlascompat.js");}
appendJS("http:/"+"/ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3&onScriptLoad=onvescriptload");}}}});function showLongDesc(){document.getElementById('location-page-content-summary').style.display='none';document.getElementById('location-page-content').style.display='block';return false;}
function doOptInPendingForms(){$(function(){$('#save-favorite').click(function(){$('#msg-dialog').dialog('option','title','Save Favorite');$('#msg-dialog').html('<p>A response to the Opt-In email we sent you at '+useremail+' is still pending. Please check your email and click the link that was sent.</p>');$('#msg-dialog').dialog('option','buttons',{"Resend Opt-In Email":function(){resendregemail(useremail);},"Ok":function(){$(this).dialog("close");}});$('#msg-dialog').dialog('open');_gaq.push(['_trackEvent','BHP2Location','SaveFavorite','DOIPending',1]);});$('#ask-question').click(function(){$('#msg-dialog').dialog('option','title','Ask a Question');$('#msg-dialog').html('<p>A response to the Opt-In email we sent you at '+useremail+' is still pending. Please check your email and click the link that was sent.</p>');$('#msg-dialog').dialog('option','buttons',{"Resend Opt-In Email":function(){resendregemail(useremail);},"Ok":function(){$(this).dialog("close");}});$('#msg-dialog').dialog('open');_gaq.push(['_trackEvent','BHP2Location','AskQuestion','DOIPending',1]);});$('#schedule-visit').click(function(){$('#msg-dialog').dialog('option','title','Schedule a Visit');$('#msg-dialog').html('<p>A response to the Opt-In email we sent you at '+useremail+' is still pending. Please check your email and click the link that was sent.</p>');$('#msg-dialog').dialog('option','buttons',{"Resend Opt-In Email":function(){resendregemail(useremail);},"Ok":function(){$(this).dialog("close");}});$('#msg-dialog').dialog('open');_gaq.push(['_trackEvent','BHP2Location','ScheduleVisit','DOIPending',1]);});$('#mktplc-ad').click(function(){$('#msg-dialog').dialog('option','title','Get Agent Offers');$('#msg-dialog').html('<p>A response to the Opt-In email we sent you at '+useremail+' is still pending. Please check your email and click the link that was sent.</p>');$('#msg-dialog').dialog('option','buttons',{"Resend Opt-In Email":function(){resendregemail(useremail);},"Ok":function(){$(this).dialog("close");}});$('#msg-dialog').dialog('open');_gaq.push(['_trackEvent','BHP2Location','EnterMarketplace','DOIPending',1]);});});};if(isloggedin){$(function(){$('#save-favorite').click(function(){$('#msg-prompt').dialog('option','title','Save to Favorites');$('#prompt-label').html('Notes:');$('#prompt-msg').html(propertyaddress);$("#msg-prompt").dialog("option","buttons",{"Save":function(){promptval=$('#prompt-text').val();$('#prompt-msg').html('<p><img src="/images/icons/ajax-loader2.gif" align="left">&nbsp;Please wait...</p>');$.post("/besthomepro/bhp2.cfc",{method:'doSaveFavorite',returnformat:'json',UserID:userid,ListingID:listingid,NoteText:promptval},function(data){if(data){$('#msg-prompt').dialog('close');$('#msg-dialog').dialog('option','title','Success');$('#msg-dialog').html('<p>Successfully saved to your favorites.</p><p>Visit your <a href="/c" target="_blank">BestHomePro Dashboard</a> to see all your saved favorites.</p>');$('#msg-dialog').dialog('open');}else{$('#prompt-msg').html('<p><img src="/images/icons/error.gif" width="32" height="32" align="left" style="margin:4px 2px;">Error saving favorite. Please try again.</p><p>If errors persist, please contact <a href="mailto:support@besthomepro.com">support@besthomepro.com</a></p>');}},"json");},"Cancel":function(){$(this).dialog("close")}});$('#msg-prompt').dialog('open');_gaq.push(['_trackEvent','BHP2Location','SaveFavorite','LoggedIn',1]);});if(agentid==8792){$('#ask-question').click(function(){$('#msg-dialog').dialog('option','title','Ask a Question');$('#msg-dialog').html('<p>You will be able to directly submit questions to your Agent once you select one from the Marketplace. Enter the Marketplace from your <a href="/c" style="color:#0000CC;">BestHomePro Dashboard</a>.</p>');$('#msg-dialog').dialog('option','buttons',{"Ok":function(){$(this).dialog("close");}});$('#msg-dialog').dialog('open');$.post("/besthomepro/bhp2.cfc",{method:'doUrgentClient',returnformat:'json',UserID:userid,clientaction:2,BHP_Location:propertyaddress,BHP_Ref_URL:window.location.href,SubmitDateTime:sDate},function(data){},"json");_gaq.push(['_trackEvent','BHP2Location','AskQuestion','LoggedIn',1]);});$('#schedule-visit').click(function(){$('#msg-dialog').dialog('option','title','Schedule a Visit');$('#msg-dialog').html('<p>You will be able to Schedule a visit with your Agent once you select one from the Marketplace. Enter the Marketplace from your <a href="/c" style="color:#0000CC;">BestHomePro Dashboard</a>.</p>');$('#msg-dialog').dialog('option','buttons',{"Ok":function(){$(this).dialog("close");}});$('#msg-dialog').dialog('open');$.post("/besthomepro/bhp2.cfc",{method:'doUrgentClient',returnformat:'json',UserID:userid,clientaction:3,BHP_Location:propertyaddress,BHP_Ref_URL:window.location.href,SubmitDateTime:sDate},function(data){},"json");_gaq.push(['_trackEvent','BHP2Location','ScheduleVisit','LoggedIn',1]);});}else{$('#ask-question').click(function(){$('#msg-prompt').dialog('option','title','Ask a Question');$('#prompt-msg').html(propertyaddress);$('#prompt-label').html('My Question:');$('#prompt-text').val('');var dt=new Date();var sDate=dt.toLocaleString();$("#msg-prompt").dialog("option","buttons",{"Save":function(){promptval=$('#prompt-text').val();$('#prompt-msg').html('<p><img src="/images/icons/ajax-loader2.gif" align="left">&nbsp;Please wait...</p>');$.post("/besthomepro/bhp2.cfc",{method:'doClientMessageToAgent',returnformat:'json',UserID:userid,ListingID:listingid,NoteText:promptval,msgType:1,SubmitDateTime:sDate},function(data){if(data.success){$('#msg-prompt').dialog('close');$('#msg-dialog').dialog('option','title','Success');$('#msg-dialog').html('<p>Successfully sent your question to your agent.</p>');$('#msg-dialog').dialog('open');}else{$('#prompt-msg').html('<p><img src="/images/icons/error.gif" width="32" height="32" align="left" style="margin:4px 2px;">'+data.msg+'</p>');}},"json");},"Cancel":function(){$(this).dialog("close")}});$('#msg-prompt').dialog('open');_gaq.push(['_trackEvent','BHP2Location','AskQuestion','AgentID',agentid]);});$('#schedule-visit').click(function(){$('#msg-prompt').dialog('option','title','Schedule a Visit');$('#prompt-msg').html(propertyaddress);$('#prompt-label').html('Message to Agent:');$('#prompt-text').val('I would like to schedule a viewing of the property at '+propertyaddress+'(MLS ID: '+mlsnumber+')');var dt=new Date();var sDate=dt.toLocaleString();$("#msg-prompt").dialog("option","buttons",{"Save":function(){promptval=$('#prompt-text').val();$('#prompt-msg').html('<p><img src="/images/icons/ajax-loader2.gif" align="left">&nbsp;Please wait...</p>');$.post("/besthomepro/bhp2.cfc",{method:'doClientMessageToAgent',returnformat:'json',UserID:userid,ListingID:listingid,NoteText:promptval,msgType:2,SubmitDateTime:sDate},function(data){if(data.success){$('#msg-prompt').dialog('close');$('#msg-dialog').dialog('option','title','Success');$('#msg-dialog').html('<p>Successfully submitted your request to your agent.</p>');$('#msg-dialog').dialog('open');}else{$('#prompt-msg').html('<p><img src="/images/icons/error.gif" width="32" height="32" align="left" style="margin:4px 2px;">'+data.msg+'</p>');}},"json");},"Cancel":function(){$(this).dialog("close")}});$('#msg-prompt').dialog('open');_gaq.push(['_trackEvent','BHP2Location','ScheduleVisit','AgentID',agentid]);});}
$('#mktplc-ad').click(function(){$('#msg-dialog').dialog('option','title','Get Agent Offers');$('#msg-dialog').html('<p>You can anonymously receive agent offers by entering the Marketplace via your <a href="/c" style="color:#0000CC;">BestHomePro Dashboard</a>.</p>');$('#msg-dialog').dialog('option','buttons',{"Ok":function(){$(this).dialog("close");}});$('#msg-dialog').dialog('open');var dt=new Date();var sDate=dt.toLocaleString();$.post("/besthomepro/bhp2.cfc",{method:'doUrgentClient',returnformat:'json',UserID:userid,clientaction:4,BHP_Location:propertyaddress,BHP_Ref_URL:window.location.href,SubmitDateTime:sDate},function(data){},"json");_gaq.push(['_trackEvent','BHP2Location','EnterMarketplace','AgentID',agentid]);});});}else{if(doipending){doOptInPendingForms();}else{termsOfService=function(){termsOfServiceWin=window.open('/TermsOfUse/BHP-Clients-terms.cfm','BHP_TOU_PP','resizable=yes,scrollbars=yes,width=640,height=480,screenX=>300,screenY=200');}
privacyPolicy=function(){privacyPolicyWin=window.open('/TermsOfUse/BHP-Clients-privacy.cfm','BHP_TOU_PP','resizable=yes,scrollbars=yes,width=640,height=480,screenX=>300,screenY=200');}
$(function(){var firstname=$("#firstname"),lastname=$("#lastname"),email=$("#email"),password=$("#password"),allFields=$([]).add(firstname).add(lastname).add(email).add(password),tips=$("#validateTips");function updateTips(t){tips.html(t).effect("highlight",{},1500);}
function checkLength(o,n,min,max){if(o.val().length>max||o.val().length<min){o.addClass('ui-state-error');updateTips("<p><img src=/images/icons/error.gif width=32 height=32 align=left style=margin:4px 2px;>Length of "+n+" must be between "+min+" and "+max+" characters long.</p>");return false;}else return true;}
function checkRegexp(o,regexp,n){if(!(regexp.test(o.val()))){o.addClass('ui-state-error');updateTips(n);return false;}else return true;}
$("#dialog").dialog({bgiframe:false,autoOpen:false,width:635,height:522,modal:true,zIndex:1000,buttons:{'Create an account':function(){var bValid=true;allFields.removeClass('ui-state-error');bValid=bValid&&checkLength(firstname,"First Name",3,50);bValid=bValid&&checkLength(lastname,"Last Name",3,50);bValid=bValid&&checkLength(password,"Password",6,50);bValid=bValid&&checkRegexp(email,/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,"<p><img src=/images/icons/error.gif width=32 height=32 align=left style=margin:4px 2px;>Invalid email address format.</p>");if(bValid){var dt=new Date();var sDate=dt.toLocaleString();var isbuyer=$('#isbuyer').attr('checked');var isseller=$('#isseller').attr('checked');var sFirstName=firstname.val();var sLastName=lastname.val();var sEmail=email.val();var sPassword=password.val();var sNotes=$('#notes').val();tips.html('<p><img src="/images/icons/ajax-loader2.gif" align="left">&nbsp;Please wait...</p>');$.post("/besthomepro/admin.cfc",{method:'RegisterBHPClient',EMAIL:sEmail,FIRSTNAME:sFirstName,ISBUYER:isbuyer,ISSELLER:isseller,LASTNAME:sLastName,PASSWORD:sPassword,NOTES:sNotes,SUBMITDATETIME:sDate,RefAffiliateID:refaffiliateid,RegAction:regaction,ListingID:listingid,BHP_Location:propertyaddress,BHP_Ref_URL:window.location.href,AdvSearchURL:advsearchurl},function(data){if(data.success){doipending=true;$.cookie('__BHP_DOIPending',sEmail,{expires:30,path:'/'});doOptInPendingForms();useremail=sEmail;$.cookie('__BHP_regSuccess',2,{expires:30,path:'/'});var cookiedough='';switch(regaction){case 1:{cookiedough=$.toJSON(['saveFavorite',listingid]);break;}
case 2:{cookiedough=$.toJSON(['askQuestion',listingid,sNotes]);break;}
case 3:{cookiedough=$.toJSON(['scheduleVisit',listingid,sNotes]);break;}
case 4:{cookiedough=$.toJSON(['findAnAgent']);break;}}
$.cookie('__BHP_regAction',cookiedough,{expires:30,path:'/'});_gaq.push(['_trackEvent','BHP2Location','Registered','RegAction',regaction]);window.location='http:/'+'/'+location.hostname+'/bhp2_optin.cfm';$('#dialog').dialog('close');}else{var sMsg=data.msg;var signinurl='http';if(location.hostname=='www.besthomepro.com'){signinurl+='s:/'+'/'+location.hostname+'/login.cfm?ref='+escape(location.href);}else{if(location.hostname=='besthomepro.com')
signinurl+='s:/'+'/www.besthomepro.com/login.cfm?ref='+escape(location.href);else
signinurl+=':/'+'/'+location.hostname+'/login.cfm?ref='+escape(location.href);}
sMsg=sMsg.replace('sign in','<a href="'+signinurl+'" style="color:#00A">sign in</a>');tips.html('<img src="/images/icons/error.gif" width="32" height="32" align="left" style="margin:4px 2px;">'+sMsg).effect("highlight",{},1500);;}},"json");}},Cancel:function(){$(this).dialog('close');}},close:function(){allFields.val('').removeClass('ui-state-error');}});$('#save-favorite').click(function(){regaction=1;$('#dialog').dialog('option','title','Save as Favorite');if(ispropertypage)$('#validateTips').html('Saving '+propertyaddress);$('#notes-label').show();$('#notes').show();$('#notes-label').html('Property Notes:');$('#notes').val('');$('#dialog').dialog('open');_gaq.push(['_trackEvent','BHP2Location','ShowRegForm','SaveFavorite']);});$('#ask-question').click(function(){regaction=2;$('#dialog').dialog('option','title','Ask a Question');if(ispropertypage)$('#validateTips').html('Ask a question about '+propertyaddress);$('#notes-label').show();$('#notes').show();$('#notes-label').html('My Question:');if(ispropertypage)$('#notes').val('I have a question about '+propertyaddress+'. (MLS ID: '+mlsnumber+') ');else $('#notes').val('');$('#dialog').dialog('open');_gaq.push(['_trackEvent','BHP2Location','ShowRegForm','AskQuestion']);});$('#schedule-visit').click(function(){regaction=3;$('#dialog').dialog('option','title','Schedule a Visit');if(ispropertypage)$('#validateTips').html('Schedule a visit of '+propertyaddress);$('#notes-label').show();$('#notes').show();$('#notes-label').html('Schedule a Visit:');if(ispropertypage)$('#notes').val('I would like to schedule a viewing of the property at '+propertyaddress+'. (MLS ID: '+mlsnumber+')');else $('#notes').val('');$('#dialog').dialog('open');_gaq.push(['_trackEvent','BHP2Location','ShowRegForm','ScheduleVisit']);});$('#mktplc-ad').click(function(){regaction=4;$('#dialog').dialog('option','title','Get Agent Offers');$('#validateTips').html('Buying or Selling a home? Why pay full commissions when you can have agents compete for your business!<br><br>Remain completely anonymous while agents send you their money-saving offers. When ready, choose the agent with the best offer.');$('#notes-label').html('<span style="font-size:17px; font-weight:bold; color:#CC0000;">Get Started Now! No Cost. No Obligation.</span><br><br>');$('#notes').hide();$('#dialog').dialog('open');_gaq.push(['_trackEvent','BHP2Location','ShowRegForm','EnterMarketplace']);});});}}
var addthis_config={username:"besthomepro",ui_click:true,services_exclude:'print'}
$.ajaxSetup({cache:false});$(function(){$("#msg-prompt").dialog({bgiframe:false,autoOpen:false,width:400,height:320,zIndex:1200,modal:true,buttons:{Ok:function(){$(this).dialog('close');}}});$("#msg-dialog").dialog({bgiframe:false,autoOpen:false,width:400,height:240,zIndex:1100,modal:true,buttons:{Ok:function(){$(this).dialog('close');}}});});rainbows={init:function(o){$(function(){if(typeof o=="string")
o={'selector':o};var opt={'selector':'.rainbows'};$.extend(opt,o);if(opt.from||opt.to)rainbows.gradient(opt);if(opt.shadow||opt.highlight)rainbows.makeSnafucated(opt);});},gradient:function(o){var opt={'selector':'.rainbows','from':'#ffffff','to':'#000000'};$.extend(opt,o);$(opt.selector).each(function(){$(this).css({'position':'relative','overflow':'hidden'});var h=$(this).height();var origH=$(this).css('height');var spans=[];var html;var f=[parseInt(opt.from.substring(1,3),16),parseInt(opt.from.substring(3,5),16),parseInt(opt.from.substring(5,7),16)],t=[parseInt(opt.to.substring(1,3),16),parseInt(opt.to.substring(3,5),16),parseInt(opt.to.substring(5,7),16)];if(this.initHTML)
html=this.initHTML;else
html=this.innerHTML;this.initHTML=html;for(var i=0;i<h*1.0;i++){var ratio=1-(h-Math.min(i,h))/h;var c=[Math.round(f[0]*(1-ratio)+t[0]*ratio),Math.round(f[1]*(1-ratio)+t[1]*ratio),Math.round(f[2]*(1-ratio)+t[2]*ratio)];spans.push('<span class="rainbow rainbow-'+i+'" style="color: rgb('+c[0]+','+c[1]+','+c[2]+');"><span style="top: '+(-i)+'px;">'+html+'</span></span>');}
this.innerHTML=spans.join('');$(this).css('height',origH);});},makeSnafucated:function(o){$(o.selector).each(function(){$(this).css('position','relative');if(this.initHTML)
html=this.initHTML;else
html=this.innerHTML;var hi='',sh='';if(o.shadow)sh='<span class="rainbows-shadow">'+html+'</span>';if(o.highlight)hi='<span class="rainbows-highlight">'+html+'</span>';this.innerHTML=this.innerHTML+sh+hi;});}};rainbows.init({selector:'.mktplc-ad-title',highlight:false,shadow:true,from:'#5B91B5',to:'#154666'});function resendregemail(sEmail){_gaq.push(['_trackEvent','BHP2Location','ResendOptInEmail']);$.post("/besthomepro/admin.cfc",{method:'ResendBHPRegEmail',EMAIL:sEmail},function(data){if(data.success){window.location='http:/'+'/'+location.hostname+'/bhp2_optin.cfm';$('#dialog').dialog('close');}else{$('#dialog').dialog('close');$('#msg-dialog').dialog('option','title','Error');$('#msg-dialog').html('<img src="/images/icons/error.gif" width="32" height="32" align="left" style="margin:4px 2px;">'+data.msg);$('#msg-dialog').dialog('open');}},"json");};;(function($){$.fn.textfill=function(options){var defaults={maxFontPixels:40,innerTag:'span'};var Opts=jQuery.extend(defaults,options);return this.each(function(){var fontSize=Opts.maxFontPixels;var ourText=$(Opts.innerTag+':visible:first',this);var maxHeight=$(this).height();var maxWidth=$(this).width();var textHeight;var textWidth;do{ourText.css('font-size',fontSize);textHeight=ourText.height();textWidth=ourText.width();fontSize=fontSize-1;}while((textHeight>maxHeight||textWidth>maxWidth)&&fontSize>3);});};})(jQuery);$(document).ready(function(){$('.jtextfill').textfill({maxFontPixels:28,innerTag:'h1'});$('.jtextfill').textfill({maxFontPixels:28,innerTag:'h2'});if(imagecount>0)$("#pikame_user").PikaChoose({user_thumbs:true,show_prev_next:true,thumb_width:60,thumb_height:45,auto_play:true,show_captions:false,show_prev_next:false});});$(window).unload(function(){if(map)map.Dispose();});