
var width=800;
var height=600;
var proxyURL="/5.5.01.22787/Mapping/DigitalMaps/DigitalMap.asp";
var _SmartMap;
var _QuickMap;
var _QuickPointLite;
var szDMCUsername="";
var szDMCAccountname="";
var g_sInitError="Error in Digital Map Link Code";
var g_winQM;
var g_winSM;
var g_winQMLite;
var bCloseCurrWin=false;
var szDMCAgentId="",
szDMCAPN="",
szDMCFIPS="",
szDMCAddress="",
szDMCCity="",
szDMCState="",
szDMCZip="",
szDMCType="",
szDMCFname="",
szDMCLname="",
szDMCType="",
szDMCDomain="",
szDMCPic="";
function updateBuildNumber(p_buildNumber)
{
try
{
proxyURL=proxyURL.replace("5.5.01.22787",p_buildNumber);
}
catch(e)
{
errorShowPage(0,g_sInitError,e,"DigitalMap.js","updateBuildNumber");
}
}
function InitCS(p_sAcctName,p_sAgentId,p_sAPN,p_sFIPS,p_sAddress,p_sCity,p_sState,p_sZip,p_sType,p_sFname,p_sLname,p_sMLSNum,p_sDMCDomain,p_sPic)
{
try
{
if(typeof(window.opener.top.DigitalMap)!="undefined")
{
SetCloseWindowFlag(p_sType,window.opener.top);
window.opener.top.DigitalMap(p_sAcctName,p_sAgentId,p_sAPN,p_sFIPS,p_sAddress,p_sCity,p_sState,p_sZip,p_sType,p_sFname,p_sLname,p_sMLSNum,p_sDMCDomain,p_sPic,window);
window.opener.top.setWindowName(p_sType,window);
}
else if(typeof(window.opener.DigitalMap)!="undefined")
{
SetCloseWindowFlag(p_sType,window.opener);
window.opener.DigitalMap(p_sAcctName,p_sAgentId,p_sAPN,p_sFIPS,p_sAddress,p_sCity,p_sState,p_sZip,p_sType,p_sFname,p_sLname,p_sMLSNum,p_sDMCDomain,p_sPic,window);
window.opener.setWindowName(p_sType,window);
}
else
{
SetCloseWindowFlag(p_sType,window);
DigitalMap(p_sAcctName,p_sAgentId,p_sAPN,p_sFIPS,p_sAddress,p_sCity,p_sState,p_sZip,p_sType,p_sFname,p_sLname,p_sMLSNum,p_sDMCDomain,p_sPic,window);
setWindowName(p_sType,window);
}
}
catch(e)
{
errorShowPage(0,g_sInitError,e,"DigitalMap.js","InitCS");
}
}
function DigitalMap(p_sAcctName,p_sAgentId,p_sAPN,p_sFIPS,p_sAddress,p_sCity,p_sState,p_sZip,p_sType,p_sFname,p_sLname,p_sMLSNum,p_sDMCDomain,p_sPic,p_oWindow)
{
try
{
setWindowName(p_sType,p_oWindow);
if(szDMCUsername.length==0)
{
szDMCUsername=p_sAgentId;
initDMC();
}
szDMCAccountname=p_sAcctName;
szDMCAgentId=p_sAgentId;
szDMCAPN=p_sAPN;
szDMCFIPS=p_sFIPS;
szDMCAddress=p_sAddress;
szDMCCity=p_sCity;
szDMCState=p_sState;
szDMCZip=p_sZip;
szDMCType=p_sType;
szDMCFname=p_sFname;
szDMCLname=p_sLname;
szDMCType=p_sMLSNum;
szDMCDomain=p_sDMCDomain;
szDMCPic=p_sPic;
if(bCloseCurrWin)
{
CloseWindow(p_oWindow,p_sType);
}
if(p_sType=="SMARTMAP"||p_sType=="SMARTMAP1")
{
if(p_sAddress.length>0)
{
getSmartMap().queryByLocation(p_sAPN,p_sFIPS,p_sAddress,p_sCity,p_sState,p_sZip,p_sMLSNum);
}
else
{
getSmartMap().openMap();
}
}else if(p_sType=="QMLITE1.1")
{
if(typeof(_QuickPointLite)!="undefined")
{
getQuickPointLite().queryByLocation(p_sAPN,p_sFIPS,p_sAddress,p_sCity,p_sState,p_sZip,p_sMLSNum);
}
}
else
{
if(typeof(_QuickMap)!="undefined")
{
getQuickMap().queryByLocation(p_sAPN,p_sFIPS,p_sAddress,p_sCity,p_sState,p_sZip,p_sMLSNum);
}
else if(typeof(top._QuickMap)!="undefined")
{
top.getQuickMap().queryByLocation(p_sAPN,p_sFIPS,p_sAddress,p_sCity,p_sState,p_sZip,p_sMLSNum);
}
}
}
catch(e)
{
errorShowPage(0,g_sInitError,e,"DigitalMap.js","DigitalMap");
}
}
function SetCloseWindowFlag(p_sType,p_oLoc)
{
try
{
if(p_sType=="SMARTMAP"||p_sType=="SMARTMAP1")
{
if(typeof(p_oLoc.g_winSM)!="undefined"&&!(p_oLoc.g_winSM.closed))
{
p_oLoc.bCloseCurrWin=true;
bCloseCurrWin=true;
}
else
{
p_oLoc.bCloseCurrWin=false;
bCloseCurrWin=false;
}
}
else if(p_sType=="QMLITE1.1")
{
if(typeof(p_oLoc.g_winQMLite)!="undefined"&&!(p_oLoc.g_winQMLite.closed))
{
p_oLoc.bCloseCurrWin=true;
bCloseCurrWin=true;
}
else
{
p_oLoc.bCloseCurrWin=false;
bCloseCurrWin=false;
}
}
else
{
if(typeof(p_oLoc.g_winQM)!="undefined"&&!(p_oLoc.g_winQM.closed))
{
p_oLoc.bCloseCurrWin=true;
bCloseCurrWin=true;
}
else
{
p_oLoc.bCloseCurrWin=false;
bCloseCurrWin=false;
}
}
}
catch(e)
{
errorShowPage(0,g_sInitError,e,"DigitalMap.js","SetCloseWindowFlag");
}
}
function CloseWindow(p_oWindow,p_sType)
{
try
{
var tempName;
if(p_sType=="SMARTMAP"||p_sType=="SMARTMAP1")
{
tempName=g_winSM.name;
}
else if(p_sType=="QMLITE1.1")
{
tempName=g_winQMLite.name;
}
else
{
tempName=g_winQM.name;
}
if(p_oWindow.name!=tempName)
{
p_oWindow.open('','_self','');
p_oWindow.close();
}
}
catch(e)
{
errorShowPage(0,g_sInitError,e,"DigitalMap.js","CloseWindow");
}
}
function setWindowName(p_sType,p_oWindow)
{
try
{
if(p_sType=="SMARTMAP"||p_sType=="SMARTMAP1")
{
if(g_winSM==undefined||g_winSM.closed||g_winSM.name!="_SmartMap")
{
p_oWindow.name="_SmartMap";
g_winSM=p_oWindow;
}
}
else if(p_sType=="QMLITE1.1")
{
if(g_winQMLite==undefined||g_winQMLite.closed||g_winQMLite.name!="_QuickPointLite")
{
p_oWindow.name="_QuickPointLite";
g_winQMLite=p_oWindow;
}
}
else
{
if(g_winQM==undefined||g_winQM.closed||g_winQM.name!="_QuickMap")
{
p_oWindow.name="_QuickMap";
g_winQM=p_oWindow;
}
}
}
catch(e)
{
errorShowPage(0,g_sInitError,e,"DigitalMap.js","setWindowName");
}
}
function initDMC()
{
try
{
if(typeof(szDMCUsername)!="undefined")
{
_SmartMap=new __DMPSmartMapInterface(proxyURL,"_SmartMap",width,height,szDMCUsername);
_QuickMap=new __DMPQuickMapInterface(proxyURL,"_QuickMap",_SmartMap,szDMCUsername);
_QuickPointLite=new __DMPQuickMapInterface(proxyURL,"_QuickPointLite",null,szDMCUsername,"QuickPointLite");
}
}
catch(e)
{
errorShowPage(0,g_sInitError,e,"DigitalMap.js","initDMC");
}
}
function getQuickMap()
{
try
{
var tempWin;
tempWin=window;
while(tempWin!=null&&tempWin.parent!=tempWin&&tempWin._QuickMap==null)
{
tempWin=tempWin.parent;
}
return tempWin._QuickMap;
}
catch(e)
{
errorShowPage(0,g_sInitError,e,"DigitalMap.js","getQuickMap");
}
}
function getQuickPointLite()
{
try
{
var tempWin=window;
while(tempWin!=null&&tempWin.parent!=tempWin&&tempWin._QuickPointLite==null)
{
tempWin=tempWin.parent;
}
return tempWin._QuickPointLite;
}
catch(e)
{
errorShowPage(0,g_sInitError,e,"DigitalMap.js","getQuickPointLite");
}
}
function getSmartMap()
{
try
{
var tempWin=window;
while(tempWin!=null&&tempWin.parent!=tempWin&&tempWin._SmartMap==null)
{
tempWin=tempWin.parent;
}
return tempWin._SmartMap;
}
catch(e)
{
errorShowPage(0,g_sInitError,e,"DigitalMap.js","getSmartMap");
}
}
function __DMPQuickMapInterface(proxyURL,windowName,smartMap,agentId,applicationName)
{
var XMLDocClass="MSXML2.DOMDocument.3.0";
if(applicationName==null||applicationName==""){
applicationName="QuickMap";
}
var width=509;
var height=455;
var windowOptions="status=yes,toolbar=no,menubar=no,location=no,fullscreen=no";
windowOptions+=",height="+height+",width="+width;
var mapReady=false;
var mapWindow=null;
var queryName=null;
var savedAPNs=null;
var savedFIPS=null;
var savedAddress=null;
var savedCity=null;
var savedState=null;
var savedZip=null;
var savedMLS=null;
this.exists=function(){
return true;
}
this.mapWindowExists=function(){
try{
if(mapWindow!=null&&mapWindow!="undefined"&&mapWindow.closed!=true){
var queryHandler=mapWindow.window.environment.packages.getValue("ExternalAppIntegration");
if(queryHandler!=null)return true;
}
}catch(ex){}
return false;
}
this.isMapReady=function(){
if(this.mapWindowExists()==false){
mapReady=false;
this.openMap();
}
return mapReady;
}
this.getMapReferenceOnAncestor=function(curWindow)
{
try{
if(curWindow==null)return null;
if(curWindow._QuickMapWindow!=null
&&curWindow._QuickMapWindow.window.closed!=true){
return curWindow._QuickMapWindow;
}
var tempMapWin=null;
if(curWindow.parent!=curWindow){
tempMapWin=this.getMapReferenceOnAncestor(curWindow.parent);
}
if(tempMapWin!=null)return tempMapWin;
return this.getMapReferenceOnAncestor(curWindow.opener);
}catch(ex){
return null;
}
}
this.setMapReferenceOnAncestor=function(curWindow,mapWin)
{
try{
if(curWindow==null)return;
curWindow._QuickMapWindow=mapWin;
if(curWindow.parent!=curWindow){
this.setMapReferenceOnAncestor(curWindow.parent,mapWin);
}
if(curWindow.opener!=null){
this.setMapReferenceOnAncestor(curWindow.opener,mapWin);
}
}catch(ex){
}
}
this.openMap=function(){
try{
if(this.mapWindowExists()){
mapWindow.focus();
return;
}
mapWindow=this.getMapReferenceOnAncestor(window);
if(mapWindow==null){
mapWindow=window.open(proxyURL
+"?APPLICATION="+applicationName+"&AcctName="+szDMCAccountname+"&AgentID="+szDMCAgentId+"&Fname="+szDMCFname+"&Lname="+szDMCLname+"&DMCDomain="+szDMCDomain+"&DMCPic="+szDMCPic,
windowName,windowOptions);
this.setMapReferenceOnAncestor(window,mapWindow);
}else{
mapReady=true;
}
mapWindow.opener=window;
mapWindow.window.focus();
}catch(ex){
alert(applicationName+".openMap(): "+ex.description);
}
}
this.callBack=function(eventXMLString)
{
try{
mapReady=true;
var eventXMLDoc=new ActiveXObject(XMLDocClass);
eventXMLDoc.loadXML(eventXMLString);
var doc=eventXMLDoc.documentElement;
var eventName=doc.getAttribute("eventName");
if(eventName=="MapLoad"){
mapReady=true;
gObjectManager=mapWindow.window.gObjectManager;
if(queryName=="APN"){
this.queryByAPNs(savedAPNs,savedFIPS);
}else if(queryName=="Location"){
this.queryByLocation(savedAPNs,savedFIPS,savedAddress,savedCity,savedState,savedZip,savedMLS);
}
}
else if(eventName=="OpenSmartMap"){
this.openSmartMap(savedAPNs,savedFIPS,savedAddress,savedCity,savedState,savedZip,savedMLS);
}
}catch(ex){
alert(applicationName+".callBack(): "+ex.description);
}
}
this.queryByAPNs=function(apns,fips)
{
try{
savedAPNs=apns;
savedFIPS=fips;
queryName="APN";
if(this.isMapReady()!=true){
return;
}
if(apns==null||fips==null)return;
mapWindow.window.focus();
var queryHandler=mapWindow.window.environment.packages.getValue("ExternalAppIntegration");
queryHandler.queryByAPNs(apns,fips);
}catch(ex){
alert(applicationName+".queryByAPNs(APN=\""
+apns+"\",fips=\""
+fips+"\"):"+ex.description);
}
}
this.queryByLocation=function(apn,fips,address,city,state,zip,sMLSNum)
{
try{
if(apn!=null)apn=apn.toString();
savedAPNs=apn;
savedFIPS=fips;
savedAddress=address;
savedCity=city;
savedState=state;
savedZip=zip;
savedMLS=sMLSNum;
queryName="Location";
if(this.isMapReady()!=true){
return;
}
mapWindow.window.focus();
var queryHandler=mapWindow.window.environment.packages.getValue("ExternalAppIntegration");
queryHandler.queryByLocation(apn,fips,address,city,state,zip,sMLSNum);
}catch(ex){
alert(applicationName+".queryByLocation(apn=\""+apn+"\", fips=\""+fips+"\", address=\""
+address+"\",city=\""+city+"\",state=\""
+state+"\",zip=\""+zip+"\"):"+ex.description);
}
}
this.openSmartMap=function(apn,fips,address,city,state,zip,sMLSNum)
{
try{
if(smartMap==null){
return;
}
if(apn==null&&(address==null
||(city==null&&zip==null))){
smartMap.openMap();
}else{
smartMap.queryByLocation(apn,fips,address,city,state,zip,sMLSNum);
}
}catch(ex){
alert("QuickMap.openSmartMap('"+apns+"', "+fips+") error: "+ex.description);
}
}
}
function __DMPSmartMapInterface(proxyURL,
windowName,width,height,agentId)
{
var windowOptions="toolbar=no,menubar=no,location=no,resizable=yes";
if(width==null||isNaN(width)||width<100)width=800;
if(height==null||isNaN(height)||height<100)height=600;
windowOptions+=",height="+height+",width="+width;
var applicationName="SmartMap";
var XMLDocClass="MSXML2.DOMDocument.3.0";
var gObjectManager=null;
var mapReady=false;
var mapWindow=null;
var savedResource=null;
var savedFilter=null;
var savedAPNs=null;
var savedFips=null;
var savedAddress=null;
var savedCity=null;
var savedState=null;
var savedZip=null;
var savedMLS=null;
var savedStreet1=null;
var savedStreet2=null;
var lastQueryName=null;
this.mapWindowExists=function(){
try{
if(mapWindow!=null&&mapWindow.closed!=true){
return true;
}
}catch(ex){}
return false;
}
this.isMapReady=function(){
if(this.mapWindowExists()==false){
mapReady=false;
this.openMap();
}
return mapReady;
}
this.getMapReferenceOnAncestor=function(curWindow)
{
try{
if(curWindow==null)return null;
if(curWindow._SmartMapWindow!=null
&&curWindow._SmartMapWindow.window.closed!=true){
return curWindow._SmartMapWindow;
}
var tempMapWin=null;
if(curWindow.parent!=curWindow){
tempMapWin=this.getMapReferenceOnAncestor(curWindow.parent);
}
if(tempMapWin!=null)return tempMapWin;
return this.getMapReferenceOnAncestor(curWindow.opener);
}catch(ex){
return null;
}
}
this.setMapReferenceOnAncestor=function(curWindow,mapWin)
{
try{
if(curWindow==null)return;
curWindow._SmartMapWindow=mapWin;
if(curWindow.parent!=curWindow){
this.setMapReferenceOnAncestor(curWindow.parent,mapWin);
}
if(curWindow.opener!=null){
this.setMapReferenceOnAncestor(curWindow.opener,mapWin);
}
}catch(ex){
}
}
this.openMap=function(){
if(this.mapWindowExists()){
mapWindow.focus();
return;
}
mapWindow=this.getMapReferenceOnAncestor(window);
if(mapWindow==null){
mapWindow=window.open(proxyURL
+"?APPLICATION="+applicationName+"&AcctName="+szDMCAccountname+"&AgentID="+szDMCAgentId+"&Fname="+szDMCFname+"&Lname="+szDMCLname+"&DMCDomain="+szDMCDomain+"&DMCPic="+szDMCPic,
windowName,windowOptions);
this.setMapReferenceOnAncestor(window,mapWindow);
}else{
mapReady=true;
gObjectManager=mapWindow.window.gObjectManager;
}
mapWindow.opener=window;
try{
mapWindow.window.focus();
}catch(ex){
}
}
this.callBack=function(eventXMLString){
try{
var eventXMLDoc=new ActiveXObject(XMLDocClass);
eventXMLDoc.loadXML(eventXMLString);
var doc=eventXMLDoc.documentElement;
var eventName=doc.getAttribute("eventName");
if(eventName=="MapLoad"){
mapReady=true;
gObjectManager=mapWindow.window.gObjectManager;
if(lastQueryName=="query"){
this.query(savedResource,savedFilter);
}
else if(lastQueryName=="apn"){
this.queryByAPNs(savedAPNs,savedFips);
}
else if(lastQueryName=="address"){
this.queryByAddress(savedAddress,savedCity,savedState,savedZip,savedMLS);
}
else if(lastQueryName=="intersection"){
this.queryByIntersection(savedStreet1,savedStreet2,savedFips);
}
else if(lastQueryName=="Location"){
this.queryByLocation(savedAPNs,savedFips,savedAddress,savedCity,savedState,savedZip,savedMLS);
}
}
}catch(ex){
alert(applicationName+".callBack(): "+ex.description);
}
}
this.query=function(resource,condition){
try{
lastQueryName="query";
savedResource=resource;
savedFilter=condition;
if(this.isMapReady()!=true){
return;
}
if(resource==null||condition==null)return;
var queryHandler=gObjectManager.constructObject("SmartMapCatalog:QueryHandler");
queryHandler.setResourceName(resource);
mapWindow.window.focus();
queryHandler.query(condition);
}catch(ex){
alert(applicationName+".query(resource=\""
+resource+"\",condition=\""
+condition+"\"):"+ex.description);
}
}
this.queryByAPNs=function(apns,fips)
{
try{
lastQueryName="apn";
savedAPNs=apns;
savedFips=fips;
if(this.isMapReady()!=true){
return;
}
if(apns==null||fips==null)return;
var queryHandler=gObjectManager.constructObject("SmartMapCatalog:QueryHandler");
mapWindow.window.focus();
queryHandler.queryByAPNs(apns,fips);
}catch(ex){
alert(applicationName+".queryByAPNs(APN=\""
+apns+"\",fips=\""
+fips+"\"):"+ex.description);
}
}
this.queryByAddress=function(address,city,state,zip)
{
try{
lastQueryName="address";
savedAddress=address;
savedCity=city;
savedState=state;
savedZip=zip;
if(this.isMapReady()!=true){
return;
}
if(address==null||(city==null&&zip==null))return;
var queryHandler=gObjectManager.constructObject("SmartMapCatalog:QueryHandler");
mapWindow.window.focus();
queryHandler.queryByAddress(address,city,state,zip);
}catch(ex){
alert(applicationName+".queryByAddress(address=\""
+address+"\",city=\""+city+"\",state=\""
+state+"\",zip=\""+zip+"\"):"+ex.description);
}
}
this.queryByLocation=function(apn,fips,address,city,state,zip,sMLSNum)
{
try{
lastQueryName="Location";
savedAPNs=apn;
savedFips=fips;
savedAddress=address;
savedCity=city;
savedState=state;
savedZip=zip;
savedMLS=sMLSNum;
if(this.isMapReady()!=true){
return;
}
if(address==null||(city==null&&zip==null))return;
var queryHandler=gObjectManager.constructObject("SmartMapCatalog:QueryHandler");
mapWindow.window.focus();
queryHandler.queryByLocation(apn,fips,address,city,state,zip,sMLSNum);
}catch(ex){
alert(applicationName+".queryByLocation(apn=\""+apn+"\", fips=\""+fips+"\", address=\""
+address+"\",city=\""+city+"\",state=\""
+state+"\",zip=\""+zip+"\"):"+ex.description);
}
}
this.queryByIntersection=function(street1,street2,fips)
{
try{
lastQueryName="intersection";
savedStreet1=street1;
savedStreet2=street2;
savedFips=fips;
if(this.isMapReady()!=true){
return;
}
if(street1==null&&street2==null&&fips==null)return;
var queryHandler=gObjectManager.constructObject("SmartMapCatalog:QueryHandler");
mapWindow.window.focus();
queryHandler.queryByIntersection(street1,street2,fips);
}catch(ex){
alert(applicationName+".queryByIntersection(street1=\""
+street1+"\",street2=\""+street2+"\",fips=\""
+fips+"\"):"+ex.description);
}
}
}


