var menuPositionTimer,menuWindowInterval;var lastViewportSize;var lastScrollOffsets;var WindowChangedCounter=0;function updateHCDialog(b,a){$("#HCDialogTitle").html(b);$("#HCDialogContent").html(a)}function isFixedSupported(){if(navigator.userAgent.indexOf("MSIE")>-1){return false}else{return true}}function showConsumerDialog(){$("#HCConsumerInfoDialog").css({top:$("#HCConsumerInfoDialog").height()+"px",overflow:""});$("#HCConsumerInfoDialog").fadeIn();fixHCConsumerInfoDialogPosition();setTimeout("fixHCConsumerInfoDialogPosition();",250)}function hideConsumerDialog(){$("#HCConsumerInfoDialog").fadeOut()}function setupDialogForDisplay(a){if(a=="saved"){updateHCDialog("Your Profile Overview",'<div id="ConsumerDataPanel">Loading...</div>');showConsumerDialog()}else{if(a=="stats"){updateHCDialog("Local Area Stats",'<div id="LocalAnalysisResults">Loading...</div>');showConsumerDialog()}}}function fixHCConsumerInfoDialogPosition(){if(navigator.userAgent.toLowerCase().indexOf("webkit")>-1){$("#HCConsumerInfoDialog").css({position:"absolute",top:((getViewportSize().height+$(document).scrollTop())*0.4)+"px"})}var a=0;var b=0;a=(jQuery("#HCConsumerInfoDialog").offset().top-(jQuery("#HCConsumerInfoDialog").height()*2));b=(jQuery("#HCConsumerInfoDialog").offset().left);if(a<=0){a=25}if(b<=0){b=((getViewportSize().width*0.5)-225)}if(getViewportSize().height<450){a=5}jQuery("#HCConsumerInfoDialog").css({position:"absolute",top:((getViewportSize().height+$(document).scrollTop())*0.33)+"px",left:b+"px"})}function initHCMenuPosition(){positionTimer=setTimeout("fixHCConsumerInfoDialogPosition();",500);menuWindowInterval=window.setInterval("checkForBrowserWindowChanges()",1000)}function checkForBrowserWindowChanges(){if(!lastViewportSize){lastViewportSize=getViewportSize()}if(!lastScrollOffsets){lastScrollOffsets=$(document).scrollTop()}if((lastViewportSize.height!=getViewportSize().height)||(lastScrollOffsets!=$(document).scrollTop())){lastViewportSize=getViewportSize();lastScrollOffsets=$(document).scrollTop();WindowChangedCounter+=1;if(WindowChangedCounter>50){window.clearInterval(menuWindowInterval);menuWindowInterval=window.setInterval("checkForBrowserWindowChanges()",2500)}}}function GetConsumerData(){setupDialogForDisplay("saved");jQuery("#ConsumerDataPanel").html('<div align=\'center\'>Loading...<br /><img src="images/Loading-Glass-Small.gif" border=0 alt="Loading..." /></div>');var b="AjaxHandler.aspx?wID="+CurrentAgent.WebID+"&Action=GetConsumerData&Output=JSON";var a=$.ajax({url:b,success:GetConsumerData_onAjaxResponse,error:GetConsumerData_onAjaxError,dataType:"text"})}function GetConsumerData_onAjaxResponse(response){var strHTML;var strJSON=response;if(strJSON.indexOf("ConsumerData")>-1){eval(strJSON)}strHTML='<div class="ConsDataTitle">Saved Properties</div>\n';for(var i=0;i<ConsumerData.Bookmarks.length;i++){strHTML+='	<div class="ConsDataRow">'+ConsumerData.Bookmarks[i][1]+" - MLS#: "+ConsumerData.Bookmarks[i][2]+" - "+ConsumerData.Bookmarks[i][5]+"</div>\n"}if(ConsumerData.Bookmarks.length<=0){strHTML+='	<div class="ConsDataMsg">You don\'t have any saved properties currently.</div>\n'}else{strHTML+='	<div class="ConsDataRow"><a href="BookShow.aspx?wID='+CurrentAgent.WebID+'">View your Saved Properties &raquo;</a></div>\n'}strHTML+='<div class="ConsDataTitle">Property Alerts</div>\n';for(var i=0;i<ConsumerData.PropertyAlerts.length;i++){strHTML+='	<div class="ConsDataRow">'+ConsumerData.PropertyAlerts[i][2]+" - "+ConsumerData.PropertyAlerts[i][6]+" - $"+ConsumerData.PropertyAlerts[i][4]+"</div>\n"}if(ConsumerData.Bookmarks.length<=0){strHTML+='	<div class="ConsDataMsg">You don\'t have any matching Property Alerts currently.</div>\n'}else{strHTML+='	<div class="ConsDataRow"><a href="Prospects.aspx?wID='+CurrentAgent.WebID+'">View your Property Alerts &raquo;</a></div>\n'}jQuery("#ConsumerDataPanel").html(strHTML)}function GetConsumerData_onAjaxError(a){jQuery("#ConsumerDataPanel").html("Error: "+a)}function GetLocalStats(a,d){if(typeof a!="undefined"){setupDialogForDisplay("stats");if(CurrentProperty.lat==-1||CurrentProperty.lat==-1.1||CurrentProperty.lat==0){jQuery("#LocalAnalysisResults").html('<div id="NotAvailableMsg">No accurate location information could be found for this property. Please check again later.</div>');return}jQuery("#LocalAnalysisResults").html('<div align=\'center\'>Loading...<br /><img src="images/Loading-Glass-Small.gif" border=0 alt="Loading..." /></div>');var c="AjaxHandler.aspx?Action=GetLocalStats&Lat="+a.lat+"&Lon="+a.lon+"&Radius="+d+"&MLS="+a.Board+"&Output=HTML&FieldData=Type|"+a.type+"";var b=$.ajax({url:c,success:GetLocalStats_onAjaxResponse,error:GetLocalStats_onAjaxError,dataType:"text"})}}function GetLocalStats_onAjaxResponse(a){var b=a;jQuery("#LocalAnalysisResults").html(b)}function GetLocalStats_onAjaxError(a){jQuery("#LocalAnalysisResults").html("Error: "+a)};
