
var PAGETYPE_MY_SEARCHES=0;
var PAGETYPE_MY_FAVOURITES=1;
var PAGETYPE_MY_POSSIBILITIES=2;
var PAGETYPE_AGENT_RECOMMEND=3;
var PAGETYPE_REJECTS=4;
var ACTION_NONE=0;
var ACTION_SAVE_PROPERTY=1;
var ACTION_EDIT_NOTE=2;
var TYPE_NONE=0;
var TYPE_RECOMMEND=1;
var TYPE_FAVORITE=2;
var TYPE_POSSIBILITY=3;
var TYPE_REJECT=4;
var TYPE_NOTESONLY=8
var g_bSaveToResults=false;
var g_VEMap=null;
var g_slProps=null;
function RefreshPage()
{
try
{
var currentForm=(!document.frmClientPropertyList)?document.forms[0]:document.frmClientPropertyList;
if(currentForm!=null)
{
if(currentForm.ShowMySearchResult!=null)
{
currentForm.ShowMySearchResult.value="1";
}
currentForm.action="";
currentForm.target="";
currentForm.onSubmit="";
currentForm.submit();
}
}
catch(e)
{
DisplayErrorDialog("Error refreshing page",e,"PrivateClientView.js","RefreshPage");
}
}
function ShowHomePage()
{
try
{
var currentForm=(!document.frmClientPropertyList)?document.forms[0]:document.frmClientPropertyList;
if(currentForm!=null)
{
var hiddenField=currentForm.ShowMySearchResult;
if(!hiddenField)
{
hiddenField=document.createElement("input");
hiddenField.type="hidden";
hiddenField.name="ShowMySearchResult";
currentForm.appendChild(hiddenField);
}
hiddenField.value="0";
hiddenField=currentForm.PageType;
if(!hiddenField)
{
hiddenField=document.createElement("input");
hiddenField.type="hidden";
hiddenField.name="PageType";
}
hiddenField.value=PAGETYPE_MY_SEARCHES;
currentForm.action="/?Page=-1";
currentForm.target="";
currentForm.onSubmit="";
currentForm.submit();
}
}
catch(e)
{
DisplayErrorDialog("Error showing home page",e,"PrivateClientView.js","ShowHomePage");
}
}
function ShowContactMe(p_sPageId)
{
try
{
var currentForm=(!document.frmClientPropertyList)?document.forms[0]:document.frmClientPropertyList;
if(currentForm!=null&&currentForm.SID!=null&&currentForm.MLNumber!=null&&currentForm.PropAddress!=null)
{
var sMLNumber=currentForm.MLNumber.value;
var sSysPropID=currentForm.SID.value;
var sPropAddress=currentForm.PropAddress.value;
AWPRequestInfo(sMLNumber,sSysPropID,sPropAddress);
}
else
{
document.location.href="http://"+document.domain+"/?Page="+p_sPageId;
}
}
catch(e)
{
DisplayErrorDialog("Error showing contact info page",e,"PrivateClientView.js","ShowContactMe");
}
}
function CaptchaLoaded(p_bSuccess)
{
try
{
$("divImageLoading").style.display="none";
if(p_bSuccess)
{
$("spanImageLoaded").innerHTML=GenerateReloadLink("Change Code");
}
else
{
$("spanImageLoaded").innerHTML="Error loading code. Please "+GenerateReloadLink("try again");
}
}
catch(e)
{
DisplayErrorDialog("Error loading captcha",e,"PrivateClientView.js","CaptchaLoaded");
}
}
function GenerateReloadLink(p_sLinkText)
{
return "<a href='javascript:ReloadCaptcha()'>"+p_sLinkText+"</a>";
}
function ReloadCaptcha()
{
try
{
var iRandomInt=Math.random();
$("imgCaptchaCode").src="/DotNET/AWPContact/JpegImage.aspx?r="+iRandomInt;
}
catch(e)
{
DisplayErrorDialog("Error reloading captcha",e,"PrivateClientView.js","ReloadCaptcha");
}
}
function DisplaySearch(p_iSearchID,p_SearchName,p_SearchDesc)
{
try
{
document.frmClientPropertyList.action="";
document.frmClientPropertyList.target="";
document.frmClientPropertyList.onSubmit="";
document.frmClientPropertyList.SearchID.value=p_iSearchID;
document.frmClientPropertyList.PageType.value=PAGETYPE_MY_SEARCHES;
document.frmClientPropertyList.ShowMySearchResult.value="1";
document.frmClientPropertyList.SwitchTab.value="1";
document.frmClientPropertyList.ResP.value=0;
document.frmClientPropertyList.SearchName.value=p_SearchName;
document.frmClientPropertyList.SearchDesc.value=p_SearchDesc;
document.frmClientPropertyList.submit();
}
catch(e)
{
DisplayErrorDialog("Error displaying my searches page",e,"PrivateClientView.js","DisplaySearch");
}
}
function SortPropertyList()
{
try
{
var frmPropertyList=GetForm("frmClientPropertyList",true);
frmPropertyList.action="";
frmPropertyList.target="";
frmPropertyList.onSubmit="";
frmPropertyList.sortOrder.disabled=true;
frmPropertyList.sortDirection[0].disabled=true;
frmPropertyList.sortDirection[1].disabled=true;
frmPropertyList.SwitchTab.value="0";
frmPropertyList.ResSO.value=frmPropertyList.sortOrder.value;
frmPropertyList.ResSD.value=
(frmPropertyList.sortDirection[0].checked?frmPropertyList.sortDirection[0].value:frmPropertyList.sortDirection[1].value);
frmPropertyList.ShowMySearchResult.value="1";
frmPropertyList.SortOrderChanged.value="1";
frmPropertyList.submit();
}
catch(e)
{
DisplayErrorDialog("Cannot change sort order",e,"PrivateClientView.js","SortPropertyList");
}
}
function MapProperties()
{
try
{
if(document.frmClientPropertyList.Map.value==0)
{
document.frmClientPropertyList.Map.value=1;
$("divResultsMap").style.display="block";
if(g_VEMap==null)
{
InitMap();
}
else
{
$("linkMap").innerText="Hide Map";
}
}
else
{
document.frmClientPropertyList.Map.value=0
$("divResultsMap").style.display="none";
$("linkMap").innerText="Map Properties";
}
}
catch(e)
{
DisplayErrorDialog("Cannot toggle map visibility",e,"PrivateClientView.js","SortPropertyList");
}
}
function InitMap()
{
try
{
if(document.frmClientPropertyList&&document.frmClientPropertyList.Map!=null&&document.frmClientPropertyList.Map.value==1)
{
if($("linkMap")==null)
{
if($("divResultsMap")!=null)
{
$("divResultsMap").style.display="none";
}
}
else
{
$("linkMap").innerText="Hide Map";
g_VEMap=new VEMap("divResultsMap");
g_VEMap.LoadMap();
g_VEMap.AttachEvent("oninitmode",
function()
{
if(g_VEMap.GetMapMode()==VEMapMode.Mode3D)
{
PinProperties();
}
}
);
PinProperties();
}
}
}
catch(e)
{
DisplayErrorDialog("Cannot initialize map",e,"PrivateClientView.js","InitMap");
}
}
function PinProperties()
{
try
{
if(g_slProps==null)
{
g_slProps=new VEShapeLayer();
g_VEMap.AddShapeLayer(g_slProps);
}
else
{
g_slProps.DeleteAllShapes();
}
var aPins=new Array();
var pinAdd=null;
var iPropCount=g_aPropLat.length;
var sContentHTML;
var iRowIndex;
var iCellIndex;
var iCellPos;
var tblData;
var tdData;
for(var iPropIndex=0;iPropIndex<iPropCount;iPropIndex++)
{
if(g_aPropLat[iPropIndex]!=null)
{
pinAdd=new VEShape(VEShapeType.Pushpin,new VELatLong(g_aPropLat[iPropIndex],g_aPropLong[iPropIndex]));
pinAdd.SetCustomIcon("<IMG src='/5.4.03.21271/Images/Mapping/MLXVE_pin_active.gif'></IMG><SPAN style='position: absolute; left: 1px; top: -1px; xborder: solid red 1px; font-family: Arial; font-size:8pt; color:white; font-weight:bold; width:21px; text-align: center; text-decoration:none'>"+(g_iStartIndex+iPropIndex)+"</SPAN>");
pinAdd.SetTitle("");
sContentHTML="<TABLE><TR><TD><IMG id='ListingImage' src='"+$("tblProp"+(iPropIndex+1)).rows.item(0).cells.item(0).firstChild.src+"' style='cursor:auto'></IMG></TD></TR><TR><TD><TABLE>";
iRowIndex=0;
iCellIndex=0;
iCellPos=0;
tblData=$("tblProp"+(iPropIndex+1)).rows.item(0).cells.item(1).firstChild
for(var iContentIndex=0;iContentIndex<6&&iRowIndex<tblData.rows.length;iContentIndex++)
{
tdData=tblData.rows.item(iRowIndex).cells.item(iCellIndex);
sContentHTML+="<TR><TD nowrap='1'>";
sContentHTML+=tdData.innerHTML;
sContentHTML+="</TD></TR>";
iCellPos+=parseInt(tdData.colSpan,10);
iCellIndex++;
if(iCellPos>2)
{
iCellIndex=0;
iCellPos=0;
iRowIndex++;
}
}
sContentHTML+="</TABLE></TD></TR></TABLE>";
pinAdd.SetDescription(sContentHTML);
aPins.push(pinAdd);
}
}
g_slProps.AddShape(aPins);
g_VEMap.SetMapView(g_slProps.GetBoundingRectangle());
}
catch(e)
{
DisplayErrorDialog("Cannot initialize map",e,"PrivateClientView.js","PinProperties");
}
}
function OpenEmailReport(p_sEncryptedVarList,p_sEncryptedSyspropertyID)
{
try
{
document.frmClientPropertyList.action="/Pub/SingleReportView.asp";
document.frmClientPropertyList.target="ReportWindow";
document.frmClientPropertyList.VarList.value=p_sEncryptedVarList;
document.frmClientPropertyList.RecordIDList.value=p_sEncryptedSyspropertyID;
OpenModalWindow('','ReportWindow',800,800,true,true);
document.frmClientPropertyList.submit();
}
catch(e)
{
DisplayErrorDialog("Cannot openning report",e,"PrivateClientView.js","OpenEmailReport");
}
}
function DisplayDetail(p_iDetailIndex,p_sClientName,p_sAgentName,p_sPropAddress)
{
try
{
document.frmClientPropertyList.action="/AWPDetails.asp";
document.frmClientPropertyList.target="";
document.frmClientPropertyList.onSubmit="";
document.frmClientPropertyList.DI.value=p_iDetailIndex;
document.frmClientPropertyList.ClientName.value=p_sClientName;
document.frmClientPropertyList.AgentName.value=p_sAgentName;
document.frmClientPropertyList.PropAddress.value=p_sPropAddress;
document.frmClientPropertyList.submit();
}
catch(e)
{
DisplayErrorDialog("Cannot show property detail",e,"PrivateClientView.js","DisplayDetail");
}
}
function SwitchTab(p_sPageType)
{
try
{
document.frmClientPropertyList.action="";
document.frmClientPropertyList.target="";
document.frmClientPropertyList.onSubmit="";
document.frmClientPropertyList.SwitchTab.value="1";
document.frmClientPropertyList.ResP.value=0;
document.frmClientPropertyList.PageType.value=p_sPageType;
document.frmClientPropertyList.ShowMySearchResult.value="0";
document.frmClientPropertyList.submit();
}
catch(e)
{
DisplayErrorDialog("Cannot switch tab",e,"PrivateClientView.js","SwitchTab");
}
}
function UpdateResultData(p_iPageNumber)
{
if(p_iPageNumber!=null)
{
try
{
document.frmClientPropertyList.action="";
document.frmClientPropertyList.target="";
document.frmClientPropertyList.onSubmit="";
document.frmClientPropertyList.SwitchTab.value="0";
document.frmClientPropertyList.ResP.value=p_iPageNumber;
document.frmClientPropertyList.ShowMySearchResult.value="1";
document.frmClientPropertyList.submit();
}
catch(e)
{
DisplayErrorDialog("Cannot switch change page",e,"PrivateClientView.js","UpdateResultData");
}
}
else
{
return;
}
}
function SavePropertyAs(p_sSysPropertyID,p_iTargetSavedListType,p_iSourceSavedListType,p_objDeleteNote)
{
try
{
var currentForm=document.forms[0];
if(document.frmClientPropertyList)
{
currentForm=document.frmClientPropertyList;
currentForm.ShowMySearchResult.value="1";
currentForm.SwitchTab.value="1";
}
if(p_iTargetSavedListType==TYPE_REJECT&&p_objDeleteNote!=null)
{
currentForm.DeleteNoteText.value=p_objDeleteNote.NewContent;
currentForm.DeleteNoteID.value=p_objDeleteNote.NoteID;
currentForm.DeleteAgentName.value=p_objDeleteNote.AgentName;
}
currentForm.action="";
currentForm.target="";
currentForm.onSubmit="";
currentForm.CurrentAction.value=ACTION_SAVE_PROPERTY;
currentForm.TargetPropertyID.value=p_sSysPropertyID;
currentForm.TargetGroup.value=p_iTargetSavedListType;
currentForm.SourceGroup.value=p_iSourceSavedListType;
if(g_bSaveToResults&&p_iTargetSavedListType==TYPE_REJECT&&currentForm.PageType!=null&&parseInt(currentForm.PageType.value)!=PAGETYPE_REJECTS)
{
BackToResult(null);
}
else
{
currentForm.submit();
}
}
catch(e)
{
DisplayErrorDialog("Cannot save property",e,"PrivateClientView.js","SavePropertyAs");
}
}
function EditNote(p_iNoteID,p_sNoteText,p_iSavedListID,p_iSysPropID,p_sClientName,p_sAgentName,p_sPropAddress,p_iCurrentListType,p_iTargetSavedListType,p_sMLNum,p_iShowPublicAddress,p_iGatewayMode)
{
try
{
var currentForm=(!document.frmClientPropertyList)?document.forms[0]:document.frmClientPropertyList;
currentForm.action="/5.4.03.21271/Tools/Note/ClientNoteDlg.asp";
currentForm.target="NewWindow";
currentForm.CurrentAction.value=ACTION_EDIT_NOTE;
currentForm.NoteID.value=p_iNoteID;
currentForm.NoteText.value=p_sNoteText;
currentForm.SavedListID.value=p_iSavedListID;
currentForm.SysPropID.value=p_iSysPropID;
currentForm.ClientName.value=p_sClientName;
currentForm.AgentName.value=p_sAgentName;
currentForm.PropAddress.value=p_sPropAddress;
currentForm.SourceGroup.value=p_iCurrentListType;
if(currentForm.GatewayMode!=null)
{
currentForm.GatewayMode.value=p_iGatewayMode;
}
if(null !=p_iTargetSavedListType&&p_iTargetSavedListType!=p_iCurrentListType)
{
currentForm.TargetGroup.value=p_iTargetSavedListType;
}
else
{
currentForm.TargetGroup.value="";
}
if(currentForm.MLNum&&p_sMLNum)
{
currentForm.MLNum.value=p_sMLNum;
}
if(p_iShowPublicAddress&&(p_iShowPublicAddress=="1"))
{
currentForm.ShowPublicAddress.value="1";
}
else
{
currentForm.ShowPublicAddress.value="0";
}
OpenModalWindow('','NewWindow',500,400,false,false);
currentForm.submit();
}
catch(e)
{
alert(e.message);
DisplayErrorDialog("Cannot open note dialog",e,"PrivateClientView.js","EditNote");
}
}
function RemovePropertyFromList(p_iSysPropID,p_iSavedListID,p_iCurrentListType,p_iNoteID)
{
try
{
var sListTypeName=null;
if(p_iCurrentListType=='2')
{
sListTypeName="Favorites";
}
else if(p_iCurrentListType=='3')
{
sListTypeName="Possibilities";
}
else
{
sListTypeName="list";
}
if(sListTypeName!=null)
{
if(confirm("Are you sure you want to remove this property from your "+sListTypeName+"? You will lose any notes you have saved.  \n\nNote that if this property currently matches your search criteria it will still be displayed in the search results."))
{
var currentForm=document.forms[0];
currentForm.action="";
currentForm.target="";
currentForm.onSubmit="";
if(currentForm.PageType!=null&&parseInt(currentForm.PageType.value)==PAGETYPE_MY_SEARCHES)
{
currentForm.ShowMySearchResult.value="1";
}
else
{
currentForm.SwitchTab.value="1";
}
currentForm.CurrentAction.value=ACTION_SAVE_PROPERTY;
currentForm.TargetPropertyID.value=p_iSysPropID;
currentForm.TargetGroup.value=TYPE_NONE;
currentForm.SourceGroup.value=p_iSavedListID;
currentForm.submit();
}
}
}
catch(e)
{
DisplayErrorDialog("Cannot remove property from list",e,"PrivateClientView.js","RemovePropertyFromList");
}
}
function DropDown(p_oDropDownBtn,p_sMenuID)
{
try
{
if(p_oDropDownBtn.className=="ActionPanelButtonDown")
{
p_oDropDownBtn.className="ActionPanelButtonOver";
$(p_sMenuID).className="SaveAsDropDown";
}
else
{
ClearAllDropDown();
p_oDropDownBtn.className="ActionPanelButtonDown";
$(p_sMenuID).className="SaveAsDropDownShown";
}
}
catch(e)
{
DisplayErrorDialog("Cannot display drop down menu",e,"PrivateClientView.js","DropDown");
}
}
function ClearAllDropDown(p_iItemCount)
{
try
{
for(var i=1;i<=10;i++)
{
var sCurDropID="DropDownMenu"+i;
var sCurBtnID="DropDownBtn"+i;
if(!$(sCurDropID))
{
break;
}
$(sCurDropID).className="SaveAsDropDown";
$(sCurBtnID).className="ActionPanelButton";
}
}
catch(e)
{
e.description="rivateClientView.js - ClearAllDropDown exception: "+e.description;
throw e;
}
}
function HyperlinkIt(p_nPtag,p_sValue,p_nKey,p_sSubType)
{
var iPTagImageCount=17;
var iPTagShowMap=-990099;
try
{
switch(p_nPtag)
{
case iPTagImageCount:
var element=document.getElementById("btnViewImages");
if(null==element)
{
element=parent.document.getElementById("btnViewImages");
}
if(null !=element)
{
try
{
element.click();
}
catch(e)
{
if("undefined"!=typeof(document.createEvent))
{
var clicker=document.createEvent("MouseEvents");
clicker.initEvent("click",true,true);
element.dispatchEvent(clicker);
}
}
}
break;
case iPTagShowMap:
var objBrowserInfo=new BrowserInfo();
if(objBrowserInfo.VESupported)
{
if(p_sValue!="")
{
var aMapData=p_sValue.split("~");
var fLat=parseFloat(aMapData[9]);
var fLng=parseFloat(aMapData[10]);
if(isNaN(fLat)||isNaN(fLng))
{
alert("Property cannot be located.");
}
else
{
var sURL="/DotNet/Pub/GetMapEx.aspx?lat="+aMapData[9]+
"&lng="+aMapData[10]+
"&addr="+aMapData[0]+
"&lp="+aMapData[7]+
"&st="+aMapData[5]+
"&ml="+aMapData[12];
window.open(sURL,"MapDialog","toolbar=no,scrollbar=no,resizable=yes,width=732,height=667,screenX=0,top=0");
}
}
}
else
{
alert("Virtual Earth Map is not supported in current browser");
}
break;
default:
break;
}
}
catch(e)
{
}
}
function FlipImage(p_sysPropID,p_moveIndex,p_propIndex)
{
var imgIndex=document.getElementById("imgIndex"+p_sysPropID);
var currentIndex=parseInt(imgIndex.value);
var newIndex=currentIndex+parseInt(p_moveIndex)
var aImageArray=eval('aImageArray'+p_sysPropID);
var newImageSrc=aImageArray[newIndex];
if(typeof(newImageSrc)!="undefined")
if($("tblProp"+(p_propIndex))!=null)
{
$("tblProp"+(p_propIndex)).rows.item(0).cells.item(0).firstChild.src=newImageSrc;
}
else
{
$("ResultsBottomTable").rows.item(1).cells.item(0).firstChild.src=newImageSrc;
}
var spanImageFlipper=$("spanImageFlipper"+p_sysPropID);
if(newIndex-1<0)
{
spanImageFlipper.childNodes[2].className="flipperLeftDisabled";
spanImageFlipper.childNodes[2].onclick=null;
}
else
{
spanImageFlipper.childNodes[2].className="flipperLeft";
spanImageFlipper.childNodes[2].onclick=new Function('FlipImage('+p_sysPropID+',-1,'+p_propIndex+')');
}
if(newIndex+1>=aImageArray.length)
{
spanImageFlipper.lastChild.className="flipperRightDisabled";
spanImageFlipper.lastChild.onclick=null;
}
else
{
spanImageFlipper.lastChild.className="flipperRight";
spanImageFlipper.lastChild.onclick=new Function('FlipImage('+p_sysPropID+',1,'+p_propIndex+')');
}
imgIndex.value=newIndex;
}

