var arrNavList = new Array("Home","Multi_Subjects_Search","Custom_Search","Foreclosure_Search","Street_Map_Search","Document_Number_Search","Parcel_Map_Search","Customer_Preferences","Admin_Setup","Product_Help");
var arrNavBarList = new Array("Coverage","Product_Information","Sample_Reports","Contact_Us");
var sampleWin = null; 
var reportWIN = null;
var CompsSingleWIN= null; 
var FinishDLWIN = null; 
var DocumentNoWIN=null; 
var changepasswordWIN = null; 
var radiussearchWIN=null; 
var mapViewerWIN = null;
var customerCenterWIN = null;
var contacusWIN = null;
var myprofileWIN = null;
var SEARCHHELP = null;
var liveChatWIN = null;
var RetrieveSavedFormatWIN = null;
var disclaimerWin =null;
var gRQ = "no";
var whatsnewpopupversion = "7.5.0";  // to be updated with each release, along with matching server-side value in Manager.java
function getFile(filename,target,id){
	strContent = getFileContent(filename);
	displayFooter(true);
	if(id==arrNavList[0]){
		showHide('open','SearchOption');
		showHide('close','SwitchContent');
		showHide('close','DIV_Customer_Preferences');
	}else if(id == arrNavList[1]){
		showContent(strContent,target);
		showHide('close','SearchOption');
	}else{
		displayFooter(false);
		showContent(strContent,target);
		showHide('close','SearchOption');
	} 
	offTopNavFocus();
	offTopNavBarFocus();
	for(i=0;i<arrNavBarList.length;i++){if (id==arrNavBarList[i]){document.getElementById(id).className="buttonon";}}
	for(i=0;i<arrNavList.length;i++){
		if (id==arrNavList[i]){
			onTopNavFocus(id);
		}
	}
}
function offTopNavFocus(){
	for(i=0;i<arrNavList.length;i++){
		var menu = document.getElementById(arrNavList[i]);
		var cell = document.getElementById("td"+arrNavList[i]);
		if (menu&&cell){
			menu.className="search_menu";
			//cell.background="../images/tabbar.gif";
			//document.getElementById("img"+arrNavList[i]).src="../images/tab.gif";
		}
	}
}
function offTopNavBarFocus(){
	for(i=0;i<arrNavBarList.length;i++){
		document.getElementById(arrNavBarList[i]).className="button";
	}
}
function onTopNavFocus(id){
	try{
		document.getElementById(id).className="search_menuon";
		//document.getElementById("td"+id).background="../images/tabbaron.gif";
		//document.getElementById("img"+id).src="../images/tabon.gif";	
	}catch(ex){}
}
function onTopNavBarFocus(id){
    try {
        document.getElementById(id).className="buttonon";
    }catch(ex){}
}
function getFileContent(filename){
	try{
		if(navigator.appName == "Microsoft Internet Explorer")
			objHttp = new ActiveXObject("Microsoft.XMLHTTP");
		else
			objHttp = new XMLHttpRequest();
		
		objHttp.open("GET", filename, false);
		objHttp.send(null);
		var strDoc = objHttp.responseText;
		return strDoc;
	}catch(ex){return "";}
}
function sendFileContent(fileContent,stype){
	try{
		if( navigator.appName == "Microsoft Internet Explorer")
			objHttp = new ActiveXObject("Microsoft.XMLHTTP");
		else
			objHttp = new XMLHttpRequest();
			
		objHttp.open("Post", urljspprog+"&action=getvalue&type="+stype,false);
		objHttp.send(fileContent);
		var strDoc = objHttp.responseText;
		return strDoc;
	}catch(ex){return "";}
}
function init(strPage,strType){
	gRQ="yes";
	if(sid!==""){
		initKey();
		displayFooter(true);
	}
	if (strPage.indexOf("Search")!=-1||(strPage.length>0&&"|Property_List|Customer_Preferences|AVMAnalyticsArchive|".indexOf(strPage)!=-1)){
		if ("|AVMAnalyticsArchive|".indexOf(strPage)==-1&&"|vp4archive|vectorarchive|hvearchive|incomeproarchive|loansafearchive|historyproarchive|historyproreviewarchive|hvcsearch|hve|hvc|pass|powerbase|hpa|".indexOf(strType)==-1){
			displayComparable();
			displayReportOptions("checked");
			displayFooter(true);
		}
		updateReportOptions(strPage);
		if (strPage.indexOf("Search")!=-1||"|AVMAnalyticsArchive|".indexOf(strPage)!=-1){
			setProperty();
			if (strPage.indexOf("Search")!=-1){
			    displaySearchForm();
				setCountyState();
			    if ("Street_Map_Search|Multi_Subjects_Search|Custom_Search|Foreclosure_Search|Document_Number_Search|Parcel_Map_Search".indexOf(strPage)!=-1&&strPage.length>0){
					onTopNavFocus(strPage);
					/* for go-back */
					if ("Street_Map_Search"==strPage&&null!=document.forms[0]&&null!=document.forms[0].lat&&null!=document.forms[0].lon){
						if(document.forms[0].lat.value.length>0&&document.forms[0].lon.value.length>0){
							gLat = document.forms[0].lat.value;
							gLon = document.forms[0].lon.value;
							if(document.forms[0].scale.value.length>0)
								gScale  = document.forms[0].scale.value;
							if(document.forms[0].layers.value.length>0)
								gLayers = document.forms[0].layers.value;
							if(document.forms[0].shape.value.length>0)				
								gGPL_Shape  = document.forms[0].shape.value;
							if(document.forms[0].points.value.length>0)
								gGPL_Points = document.forms[0].points.value;
							if(document.forms[0].gplcriteria.value.length>0)
								gGPL_Search_String = document.forms[0].gplcriteria.value;
						}
						initMap(gLat,gLon,gScale,gLayers,gGPL_Shape,gGPL_Points);
						
						if (document.forms[0].gplcriteria.value.length>0)
							gGPL_Search_String = document.forms[0].gplcriteria.value;
						//if (gGPL_Search_String.length>0)
						//	displayPropertyList("");
					}
				}else{
					onTopNavFocus('Home');
					displayUserInputOptions();
					if ("Map_Subject_Search"==strPage){
						GetSubjectMap();
					}
				}
			}else if("|AVMAnalyticsArchive|".indexOf(strPage)!=-1){onAVMAnalyticsReportChanged(document.forms[0].avmana_reporttype);}
		}else if (strPage=="Customer_Preferences"){
			displayReportOptions("all");
			onTopNavFocus(strPage);
		}else if (strPage=="Property_List"){
			if ("custom|foreclosure|multisubjects|streetmapgpl".indexOf(strType)!=-1&&strType.length>0){
				showSelected();
				onTopNavFocus(t2p(strType));
			}else if ("vp4archive"==strType){
				//do nothing
			}else if(gtab=="cs")
				onTopNavFocus('Custom_Search');
			else if(gtab=="fc")
				onTopNavFocus('Foreclosure_Search');
			else if("documentnumber"==strType)
				onTopNavFocus('Document_Number_Search');
			else if(gtab=="sl")
				onTopNavFocus('Multi_Subjects_Search');
			else if(gtab=="st"){
				onTopNavFocus('Street_Map_Search');
			}
			else
				onTopNavFocus('Home');

			if (rs=='y'){
				setContent(document.forms[0]);
			}
		}
	}
	else if (strPage=="main"){onTopNavFocus('Home');}
	else if (strPage=="Input"){setProperty();}
	else if (strPage=="Sample_Reports"){animate();onTopNavBarFocus(strPage);}
	else if (strPage=="Product_Help"){onTopNavFocus(strPage);}
	else if (strPage=="Contact_Us"||strPage=="Product_Information"){onTopNavBarFocus(strPage);} 
	else if (strPage=="error" && strType=="suggestions"){onTopNavFocus('Home');}
    else if (strPage=="Admin"){onTopNavFocus('Admin_Setup');}
	resize();
}
function resize(){
    var footerHeightOffset = 240;
    if ( getQueryVariable("client") == "private" ) {
        footerHeightOffset = 132;
    }

	try {
        // In IE7 and above, changing the height of the element fires another resize event, calling resize again in an infinite loop
        // so need to disable the resize event before changing the height, then re-enable after
        removeEHandler(window, 'resize', arguments.callee);

        if ("Map_Subject_Search"==page){
            map.ResizeMap();
        }
		
		if (null!=document.getElementById('expand') && getHeight() > footerHeightOffset){
			//document.getElementById('expand').style.height = getHeight() - footerHeightOffset;
			document.getElementById('expand').height = getHeight() - footerHeightOffset;
        }

        addEHandler(window, 'resize', arguments.callee);

    }catch(ex){}
}
function Validate_main_Form(form){if (!form.username.value.length){alert("Please enter a username.");form.username.focus();return false;}if (!form.password.value.length){alert("Please enter a password.");form.password.focus();return false;}SetCookie("rqusr", form.remember.checked ? form.username.value : "");showHide('close','SearchOption');showHide('close','top_nav');showHide('open','Processing');}
function trim(str)
{
   if (null==str || typeof(str)=="undefined")
      return "";
   else
      return str.replace(/^\s*/,"").replace(/\s*$/,"");
}
function validatelogin(form){
   if (typeof(form.username)!="undefined")
   {
      form.username.value = trim(form.username.value);
   }
   if (typeof(form.password)!="undefined")
   {
      form.password.value = trim(form.password.value);
   }

   if (!form.username.value.length){
		alert("Please enter a username.");
		form.username.focus();
		return false;
	}
	if (!form.password.value.length){
		alert("Please enter a password.");
		form.password.focus();
		return false;
	}
	var sUsername = form.username.value;
	if (sUsername.indexOf("@")!=-1){
		form.action = "https://"+window.location.host+"/rq/jump.aspx";
		//form.action = "http://beta.visioncore.com/RQ/default.aspx";
	}
	SetCookie("rqusr", form.remember.checked ? form.username.value : "");
	return true;
}
function initLogin(form){
	var sClient = getQueryVariable("client");
	var httpsUrl = "https://"+window.location.host+"/jsp/rq.jsp?action=login"; 
	if (httpsUrl.indexOf(":909")==-1 && sClient!="private"){
		if (null!=form.action){
			try{
				form.action = httpsUrl; 
			}catch(ex){}
		}
	} 
	var username = GetCookie("rqusr"); 
	if (username){
		form.username.value = username;
		form.remember.checked = true;
		form.password.focus();
		SetCookie("rqusr", form.remember.checked ? form.username.value : "");
	}else{
		form.username.focus();
	}
}
function GetCookie(name){
	var start = document.cookie.indexOf(name + "="); 
	var len = start + name.length + 1;
	if ((start == -1) || ((!start) && (name != document.cookie.substring(0,name.length)))){return null;}
	var end = document.cookie.indexOf(";",len);
	if (end == -1){end = document.cookie.length;}
	return unescape(document.cookie.substring(len,end));
}
function SetCookie(name,value){
    //Note: cookie session will be retained upto 1st-Jan-2030
	document.cookie = name + "=" + escape(value) + ";expires=Thu, 01-Jan-2030 00:00:01 GMT; path=/";
}
function Delete_Cookie(name){ 
	if (Get_Cookie(name)){document.cookie =  name + '=; path=/';}
}
function enableDisable(method,section){try{var sectionObj = document.getElementById(section);if (null!=sectionObj){if (method == "enable" ){sectionObj.disabled = false;}else if (method == "disable"){sectionObj.disabled = true;}}}catch(ex){}}
function showHide(method,section){try{var sectionObj = document.getElementById(section);if (null!=sectionObj){if (method == "open" ){sectionObj.style.display = "";}else if (method == "close"){sectionObj.style.display = "none";}}}catch(ex){}}
function showContent(content,target){try{content = "<FONT class='sub'>"+content+"</FONT>";var showContentObj = document.getElementById(target);if (null!=showContentObj){ /*&&null!=showContentObj.innerHTML*/if(showContentObj.innerHTML!=content){showContentObj.innerHTML = content;}else{showContentObj.innerHTML = "";}}}catch(ex){}}
function setContentText(content,target){if (document.all){document.getElementById(target).innerText = content;}else{document.getElementById(target).textContent = content;}}
function getContentText(target){if (document.all){return document.getElementById(target).innerText;}else{return document.getElementById(target).textContent;}}
function showContentNoFontWrapper(content,target) { try { var showContentObj = document.getElementById(target); if (null!=showContentObj) { if(showContentObj.innerHTML!=content) { showContentObj.innerHTML = content; } else { showContentObj.innerHTML = ""; } } } catch(ex){} }
function createTableOpen_bak(){document.write("<TABLE cellspacing=0 cellpadding=0 border=0 align=center><TR><TD bgcolor=#cccccc colspan=2 height=7 rowspan=2><IMG height=7 src=\"../images/corner1.gif\" width=7></TD><TD bgcolor=#cccccc height=1> <IMG height=1 src=\"../images/clearpixel.gif\" border=0></TD><TD bgcolor=#cccccc colspan=2 height=7 rowspan=2> <IMG height=7 src=\"../images/corner2.gif\" width=7></TD>\
	 </TR><TR valign=top><TD><IMG height=6 src=\"../images/clearpixel.gif\" width=1 border=0></TD></TR><TR valign=top><TD width=1 bgcolor=#cccccc><IMG height=1 src=\"../images/clearpixel.gif\" width=1 border=0></TD><TD width=6> <IMG height=1 src=\"../images/clearpixel.gif\" width=6 border=0></TD><TD bgcolor=\"#FFFFFF\" valign=\"top\">");}
function createTableClose_bak(){document.write("</TD><TD width=6><IMG height=1 src=\"../images/clearpixel.gif\" width=6 border=0></TD><TD width=1 bgcolor=#cccccc><IMG height=1 src=\"../images/clearpixel.gif\" width=1 border=0></TD></TR><TR valign=bottom><TD colspan=2 height=7 rowspan=2> <IMG height=7 src=\"../images/corner3.gif\" width=7></TD><TD><IMG height=6 src=\"../images/clearpixel.gif\" width=1 border=0></TD>\
     <TD colspan=2 height=7 rowspan=2><IMG height=7 src=\"../images/corner4.gif\" width=7></TD></TR><TR><TD bgcolor=#cccccc><IMG height=1 src=\"../images/clearpixel.gif\" border=0></TD></TR></TABLE>");}
function createTableOpen(){document.write("<TABLE cellspacing='0' cellpadding='0' border='0' align='center'><TR><TD colspan='2' height='7' rowspan='2'><IMG height='7' src='../images/corner1.gif' width='7'></TD><TD style='border-top: 1px solid #BBBBBB;'><IMG height='1' src='../images/clearpixel.gif' width='1' border='0'></TD><TD colspan='2' height='7' rowspan='2'><IMG height='7' src='../images/corner2.gif' width='7'></TD></TR><TR valign='top'><TD><IMG height='5' src='../images/clearpixel.gif' width='1' border='0'></TD></TR><TR valign='top'><TD width='1' style='border-left: 1px solid #BBBBBB;'><IMG height='1' src='../images/clearpixel.gif' width='1' border='0'></TD><TD width='5'><IMG height='1' src='../images/clearpixel.gif' width='5' border='0'></TD><TD bgcolor='#FFFFFF' valign='top'>");}
function createTableClose(){document.write("</TD><TD width='5'><IMG height='1' src='../images/clearpixel.gif' width='5' border='0'></TD><TD width='1' style='border-right: 1px solid #BBBBBB;'><IMG height='1' src='../images/clearpixel.gif' width='1' border='0'></TD></TR><TR valign='bottom'><TD colspan='2' height='7' rowspan='2'><IMG height='7' src='../images/corner3.gif' width='7'></TD><TD style='border-bottom: 1px solid #BBBBBB;'><IMG height='1' src='../images/clearpixel.gif' width='1' border='0'></TD><TD colspan='2' height='7' rowspan='2'><IMG height='7' src='../images/corner4.gif' width='7'></TD></TR></TABLE>");}
function getTableOpen(){return ("<TABLE cellspacing='0' cellpadding='0' border='0' align='center'><TR><TD colspan='2' height='7' rowspan='2'><IMG height='7' src='../images/corner1.gif' width='7'></TD><TD style='border-top: 1px solid #BBBBBB;'><IMG height='1' src='../images/clearpixel.gif' width='1' border='0'></TD><TD colspan='2' height='7' rowspan='2'><IMG height='7' src='../images/corner2.gif' width='7'></TD></TR><TR valign='top'><TD><IMG height='5' src='../images/clearpixel.gif' width='1' border='0'></TD></TR><TR valign='top'><TD width='1' style='border-left: 1px solid #BBBBBB;'><IMG height='1' src='../images/clearpixel.gif' width='1' border='0'></TD><TD width='5'><IMG height='1' src='../images/clearpixel.gif' width='5' border='0'></TD><TD bgcolor='#FFFFFF' valign='top'>");}
function getTableClose(){return ("</TD><TD width='5'><IMG height='1' src='../images/clearpixel.gif' width='5' border='0'></TD><TD width='1' style='border-right: 1px solid #BBBBBB;'><IMG height='1' src='../images/clearpixel.gif' width='1' border='0'></TD></TR><TR valign='bottom'><TD colspan='2' height='7' rowspan='2'><IMG height='7' src='../images/corner3.gif' width='7'></TD><TD style='border-bottom: 1px solid #BBBBBB;'><IMG height='1' src='../images/clearpixel.gif' width='1' border='0'></TD><TD colspan='2' height='7' rowspan='2'><IMG height='7' src='../images/corner4.gif' width='7'></TD></TR></TABLE>");}
function getHeight(){ h=0; if (window.innerWidth){ w = window.innerWidth; h= window.innerHeight; } else if (document.documentElement){ w = ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ); h = ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ); } return h; }
function getWidth(){if (window.innerWidth){w = window.innerWidth; h= window.innerHeight;}else if (document.all){w = document.body.clientWidth; h = document.body.clientHeight;}return w;}
function popUpURL(urlpop){ var w = 720;var h = (screen.height)*0.75;LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=10;settings='width='+w+',height='+h+',screenX='+LeftPosition+',screenY='+TopPosition+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=no,directories=no,status=yes,menubar=yes,toolbar=yes,resizable=yes'; sampleWin = open(urlpop,"Report",settings); }
function displayFooter(option){ if (option){showHide('open','footer_agreement');showHide('open','footer_agreement_private');/*showHide('close','footer_privacy');*/}else {showHide('close','footer_agreement');showHide('close','footer_agreement_private');/*showHide('open','footer_privacy');*/}}
function setPermission(){ DWRController.setPrinDataSession("YES"); }
function MM_findObj(n, d){
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function createTableOpen_withshade(){document.write("<TABLE cellspacing=0 cellpadding=0 align=center border=0><TR><TD><IMG height=6 alt='' src='../images/tbllt1.gif' width=9 border=0></TD><TD background=../images/tblt1.gif><IMG src='../images/tblo.gif'></TD><TD><IMG height=6 alt='' src='../images/tblrt1.gif' width=9 border=0></TD></TR><TR><TD width=9 background=../images/tbllm1.gif><IMG src='../images/tblo.gif'></TD><TD>");}
function createTableClose_withshade(){document.write("</TD><TD background=../images/tblrm1.gif><IMG src='../images/tblo.gif'></TD></TR><TR><TD><IMG height=10 alt='' src='../images/tbllb1.gif' width=9 border=0></TD><TD valign=bottom width=9 background=../images/tblb1.gif><IMG alt='' src='../images/tblo.gif' border=0></TD><TD><IMG height=10 alt='' src='../images/tblrb1.gif' width=9 border=0></TD></TR></TABLE>");}

function MM_swapImgRestore(){var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}
function MM_checkNum(Num,strField){for (i=0; i<(Num.length); i++){if ( Num.charAt(i) < '0' || Num.charAt(i) > '9'){alert("Please enter number for "+strField);return false;}}	return true;}
function checkOpenWin(){
	try{
		if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("MSIE 5.0")!=-1){return true;}
		if(null!=reportWIN&&!reportWIN.closed){reportWIN.focus(); return false;}
		if(null!=FinishDLWIN&&!FinishDLWIN.closed){FinishDLWIN.focus(); return false;}
		if(null!=radiussearchWIN&&!radiussearchWIN.closed){radiussearchWIN.focus(); return false;}
		if(null!=changepasswordWIN&&!changepasswordWIN.closed){changepasswordWIN.focus(); return false;}
		if(null!=sampleWin&&!sampleWin.closed){sampleWin.focus(); return false;}
		if(null!=CompsSingleWIN&&!CompsSingleWIN.closed){CompsSingleWIN.focus(); return false;}
		if(null!=DocumentNoWIN&&!DocumentNoWIN.closed){DocumentNoWIN.focus(); return false;}
		if(null!=mapViewerWIN&&!mapViewerWIN.closed){mapViewerWIN.focus(); return false;}
		if(null!=customerCenterWIN&&!customerCenterWIN.closed){customerCenterWIN.focus(); return false;}
		if(null!=contacusWIN&&!contacusWIN.closed){contacusWIN.focus(); return false;}
		if(null!=myprofileWIN&&!myprofileWIN.closed){myprofileWIN.focus(); return false;}
		
		if(null!=SEARCHHELP){if (!SEARCHHELP.closed) {SEARCHHELP.focus(); return false;}}
		//if(null!=liveChatWIN&&!liveChatWIN.closed){liveChatWIN.focus(); return false;}
		if(null!=RetrieveSavedFormatWIN&&!RetrieveSavedFormatWIN.closed){RetrieveSavedFormatWIN.focus(); return false;}
		return true;
	}catch(ex){}
}
//Following function is used to make the given form elements as readonly type based on the staus sent from the caller as true or false. 
function makeReadOnlyFormElements(formName,readonlyelements,status){
   try{
      var formDoc = "document."+formName+".elements";
      var nLen = formDoc.length;
      for (var i=0;i<nLen;i++){
         var fieldName = document.forms[0].elements[i].name;
         var fieldNameValueLen = document.forms[0].elements[i].value.length;
         if( readonlyelements.indexOf(fieldName) > -1){
             if(fieldNameValueLen > 0){
                 document.forms[0].elements[i].readOnly = status;
             }
         }
      }
   }catch(ex){/*alert(e);*/}
}

function runDisable(){
	//showHide("open","bodycontent");
}
function disableFormElement(status){
	var nLen = document.forms[0].elements.length;
	for (var i=0;i<nLen;i++){
		document.forms[0].elements[i].disabled = status;
	}	
}
function closeReport(){
	var top=self.screenTop;
	if (top>9000){
		closeAllWindows();
	}
}
function closeAllWindows(){
	try{
		if (null!=sampleWin) {sampleWin.close();}
		if (null!=reportWIN) {reportWIN.close();}
		if (null!=CompsSingleWIN) {CompsSingleWIN.close();}
		if (null!=FinishDLWIN) {FinishDLWIN.close();}
		if (null!=DocumentNoWIN) {DocumentNoWIN.close();}
		if (null!=changepasswordWIN) {changepasswordWIN.close();}
		if (null!=radiussearchWIN) {radiussearchWIN.close();}
		if (null!=mapViewerWIN) {mapViewerWIN.close();}
		if (null!=customerCenterWIN) {customerCenterWIN.close();}
		if (null!=contacusWIN) {contacusWIN.close();}
		if (null!=myprofileWIN) {myprofileWIN.close();}
		if (null!=SEARCHHELP) {SEARCHHELP.close();}
		//if (null!=liveChatWIN) {liveChatWIN.close();}
		if (null!=RetrieveSavedFormatWIN) {RetrieveSavedFormatWIN.close();}
        if (null!=window.frames["stf_mapclient"].vFrame.reportWIN) {window.frames["stf_mapclient"].vFrame.reportWIN.close();}
	}catch(ex){}
}
function RorC(){
	try{
		closeAllWindows();
		var top = self.screenTop;
		if (top>9000){
			if (page.indexOf("Search")!=-1||"|VP4Archive|HVEArchive|Property_List|Customer_Preferences|Retrieve|Product_Help|Admin|error|".indexOf(page)!=-1){
				if(null!=self.opener){}			
				else if ("Admin"==page&&"yes"==winPopup){}
				else if (page==""&&type=="getreport"){}
				else{logoutCloseBrowser();}
			}
		}
	}catch(ex){}
} 
function logoutCloseBrowser(){
	var sMsg = getFileContent(urljspprog+'&action=logout&type=close');
}
function logoutCancel(){
	location.replace(urljspprog+'&action=logout');
}
function logout(){
	location.replace(urljspprog+'&action=login');
}
function logoutframes(){
	location.replace(urljspprog+'&page=error&action=switch&type=login');
}
function runRedirect(url){
	location.replace(url);
}
function popLiveChat(urlpop){
	var popcurrentTime = new Date().getTime();
	urlpop += "?&pop="+popcurrentTime;
	var w = 650;var h = 350;LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
	settings='width='+w+',height='+h+',screenX='+LeftPosition+',screenY='+TopPosition+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=yes';
	liveChatWIN = open(urlpop,"liveChatWIN",settings); 
}
function popForgotPassword(url){	
	var w = 640;  var h = 500;
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
	TopPosition=(screen.height)?(screen.height-h)/2:100;
	settings='width='+w+',height='+h+',screenX='+LeftPosition+',screenY='+TopPosition+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
	forgotPasswordWIN = open(url,"ForgotPassword",settings);
}
function popUpDisclaimer(mapId){ 
try{
	var w = 640;
	var h = 440;
	var settings = 'help:0;resizable:0;dialogWidth:'+w+'px;dialogHeight:'+h+'px';
	var db = eval("dashBoard"+mapId);
	
	var lat = db.mapControl.GetCenter().Latitude;
	var lon = db.mapControl.GetCenter().Longitude;

	if (null == lat || null == lon)
	{
		alert("Parcel Boundary Disclaimer is not available");
	}
	else{
		var urlpop = "/jsp/mapdisclaimer.jsp?lat="+lat+"&lon="+lon;
		disclaimerWin = showModalDialog(urlpop,"Disclaimer",settings);
	}
}catch(ex){alert(ex.message);}
}
function getQueryVariable(variable) {
	try{
		var query = new String(window.location.search);
		if (query.charAt(0) == '?'){
			query = query.replace('?','&');
		}
		var vars = query.split("&");
		for (var i=0;i<vars.length;i++) {
			var pair = vars[i].split("=");
			if (pair[0] == variable) {
				var sVal = pair[1];
				sVal = sVal.replace(/\+/gi," ");
				return sVal;
			}
		} 
		return "";
	}catch(ex){return "";}
}
function checkwhere(form){
	if (!form.txtSearchAddr.value.length){
		alert("Please enter search information.");
		form.txtSearchAddr.focus();
		return false;
	}
	return true;
}

var w3c=(document.getElementById)?true:false;
var ie=(document.all)?true:false;
var N=-1;	
function createBar(w,h,bgc,brdW,brdC,blkC,speed,blocks,count,action){
	if(ie||w3c){
		var t='<div id="_xpbar'+(++N)+'" style="visibility:visible; position:relative; overflow:hidden; width:'+w+'px; height:'+h+'px; background-color:'+bgc+'; border-color:'+brdC+'; border-width:'+brdW+'px; border-style:solid; font-size:1px;">';
		t+='<span id="blocks'+N+'" style="left:-'+(h*2+1)+'px; position:absolute; font-size:1px">';
		for(i=0;i<blocks;i++){
			t+='<span style="background-color:'+blkC+'; left:-'+((h*i)+i)+'px; font-size:1px; position:absolute; width:'+h+'px; height:'+h+'px; '
			t+=(ie)?'filter:alpha(opacity='+(100-i*(100/blocks))+')':'-Moz-opacity:'+((100-i*(100/blocks))/100);
			t+='"></span>';
		}
		t+='</span></div>';
		document.write(t);
		var bA=(ie)?document.all['blocks'+N]:document.getElementById('blocks'+N);
		bA.bar=(ie)?document.all['_xpbar'+N]:document.getElementById('_xpbar'+N);
		bA.blocks=blocks; bA.N=N; bA.w=w; bA.h=h; bA.speed=speed; bA.ctr=0; bA.count=count;
		bA.action=action;
		/*bA.togglePause=togglePause;*/
		bA.showBar=function(){this.bar.style.visibility="visible";}
		bA.hideBar=function(){this.bar.style.visibility="hidden";}
		bA.tid=setInterval('startBar('+N+')',speed);
		return bA;
	}
}
function startBar(bn){
	var t=(ie)?document.all['blocks'+bn]:document.getElementById('blocks'+bn);
	if(parseInt(t.style.left)+t.h+1-(t.blocks*t.h+t.blocks)>t.w){
		t.style.left=-(t.h*2+1)+'px'; t.ctr++;
		if(t.ctr>=t.count){eval(t.action);t.ctr=0;}
	}else t.style.left=(parseInt(t.style.left)+t.h+1)+'px';
}
// var xyz = createBar(total_width,total_height,background_color,border_width,border_color,block_color,scroll_speed,block_count,scroll_count,action_to_perform_after_scrolled_n_times)
/* var bar1= createBar(90,20,'white',1,'black','orange',85,7,3,"");*/
