function btnManageQueriesClick(bRefresh,sDisplayType)
   { 
    if( bRefresh )
	{
    	if( sDisplayType != '' )
			window.open('../ShowSavedQueries.asp?sqDisplayType=' + sDisplayType + '&refresh=1','_CRSsqwin','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=no,height=400,width=250,left=' + ((screen.width/2)-125) + ',top=' + ((screen.height/2)-200));
    	else
			window.open('../ShowSavedQueries.asp?sqDisplayType=' + sDisplayType + '&refresh=1','_CRSsqwin','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=no,height=400,width=600,left=' + ((screen.width/2)-300) + ',top=' + ((screen.height/2)-200));
    }
    else
    {
    	if( sDisplayType != '' )
			window.open('../ShowSavedQueries.asp?sqDisplayType=' + sDisplayType,'_CRSsqwin','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=no,height=400,width=250,left=' + ((screen.width/2)-125) + ',top=' + ((screen.height/2)-200));
		else
			window.open('../ShowSavedQueries.asp?sqDisplayType=' + sDisplayType,'_CRSsqwin','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=no,height=400,width=600,left=' + ((screen.width/2)-300) + ',top=' + ((screen.height/2)-200));
	}
   }
function btnConfigClick()
   {
   document.Form1.action="../UserConfig.asp"
   document.Form1.submit()
   }
function btnTrustClick()
   {
   document.Form1.action="../trustSearch.asp"
   document.Form1.submit()
   }
function btnSplitClick()
   {
   document.Form1.action="../SplitSearch.asp"
   document.Form1.submit()
   }
function btnCensusClick()
   {
   window.open("../demographics/CensusMenu.asp?St_co=" + document.Form1.tbSt_CO[document.Form1.tbSt_CO.selectedIndex].value)
   }
function btnITClick()
   {
   window.open("../Improvements.asp?St_co=" + document.Form1.tbSt_CO[document.Form1.tbSt_CO.selectedIndex].value)
   }
function btnLUClick()
   {
   window.open("../LandUse.asp?St_co=" + document.Form1.tbSt_CO[document.Form1.tbSt_CO.selectedIndex].value)
   }
function btnSortClick()
   {
   window.open("../SortHelp.asp")
   }
function btnZnClick()
   {
   window.open("../ZoningCodes.asp?St_co=" + document.Form1.tbSt_CO[document.Form1.tbSt_CO.selectedIndex].value)
   }

function isNumber(val)
    {
    //Returns true if val is a number defined as
    //   having an optional leading + or -.
    //   having at most 1 decimal point.
    //   otherwise containing only the characters 0-9.
	var test1 = ".+-0123456789"
	var test2 = ".0123456789"
	var c
	var decimal = false
	//The first character can be + - . or a digit.
	c = test1.indexOf(val.charAt(0))
    //Was it a decimal?
	if (c == 0)
	    decimal = true
	else if (c < 1)
		return false

	//Remaining characters can be only . or a digit, but only one decimal.
	for (var i = 1; i < val.length; i++)
		{
		//alert(val.charAt(i))
		c = test2.indexOf(val.charAt(i))
		//alert(c)
		if (c < 0)
			return false
		else
			if (c == 0)
				{
				if (decimal)		// Second decimal.
					return false
				else
					decimal = true
				}
		}
	return true
    }
function NumOnChange(what)
	{
	var msg 

	if (!isNumber(what.value.replace(',','')))
		{
		msg = "Not a valid number!"
		alert(msg)
		what.focus()
		}
	}

function DateOnChange(what)
	{
	var tdate = new Date()
	var tmills
	var temp
	var msg
	
	if (what.value!="")
		{		
		tmills = Date.parse(what.value)

		if (isNaN(tmills))
			{
		 	msg = "Not a valid date!"
			alert(msg)
			what.value=""
			what.focus()
	 		}
		else
			{  
			nVal = 0;
      		dps = what.value.split('/');
			if( dps.length == 1 ){
	      		sTemp = what.value.replace('-','/');
	      		sTemp = sTemp.replace('-','/');
	      		dps = sTemp.split('/');
				}
			if( dps.length == 3 )
				{
				if( dps[2].length < 4 )
					{
					nVal = parseInt(dps[2]);
					if( nVal >= 30 && nVal < 100 ) nVal = nVal + 1900;
					if( nVal < 30 ) nVal = nVal + 2000;
					}
				else
					{
					tdate.setTime(tmills)
					nVal = tdate.getFullYear()
					}
				}
			tdate.setTime(tmills)
			temp = (tdate.getMonth()+1) + ("/") + (tdate.getDate()) + ("/")
			if( nVal != 0 )
				{
				what.value=(tdate.getMonth()+1) + ("/") + (tdate.getDate()) + ("/") + (nVal)
				}
				else
				{
				what.value=(tdate.getMonth()+1) + ("/") + (tdate.getDate()) + ("/") + (tdate.getFullYear())
				}
			}
		}
	}
function showShelbyMsg()
	{
	var msg
	
		msg = 'NOTICE FOR SHELBY COUNTY, AL USERS!\n\n';
		msg = msg + 'The PROPERTY ADDRESS SEARCH for Shelby Co Alabama has changed.\n\nWhen looking for a parcel using the address searches, use the MAILING ADDRESS option only.\nThe property address option WILL NOT return results.\nAll property can now be found using the mailing address option.\n\nCRS apologizes for the inconvenience, however due to circumstances beyond our control property address information is not available.\n\nIf you have any questions please call us at 800-374-7488: technical support department.\n\nSincerely,\nCRS Technical Support';
		alert(msg);
	}
function showSIMsg()
	{
	var msg
	
		msg = 'The PROPERTY ADDRESS SEARCH for this county is unavailable.\n\nWhen looking for a parcel using the address searches, use the MAILING ADDRESS option only.\nThe property address option WILL NOT return results.\nAll property can now be found using the mailing address option.\n\nCRS apologizes for the inconvenience, however due to circumstances beyond our control property address information is not available.\n\nIf you have any questions please call us at 800-374-7488: technical support department.\n\nSincerely,\nCRS Technical Support';
		alert(msg);
	}
	

function onControlMapChange(what)
{
	sVal = what.value;
	if( sVal.length <= 0 ) return;
	
	sPointer = -1;
	for( i=0;i<sVal.length;i++ )
	{
		if( isNaN(parseInt(sVal.substr(i,1),10)) )
		{
			sPointer = i;
			break;
		}
	}
	nVal = parseInt(sVal,10);
	if( isNaN(nVal) )
	{
		sNewVal = '000' + sVal;
	}
	else
	{
		if( nVal > 999 ) nVal = 1;
//		alert('sval=' + sVal);
//		alert('val=' + nVal.toString());
		if( nVal > 99 )
		{
			sNewVal = nVal.toString();
		}
		else if( nVal > 9 )
		{
			sNewVal = '0' + nVal.toString();
		}
		else
		{
			sNewVal = '00' + nVal.toString();
		}
		if( sPointer >= 0 )
		{
			sNewVal = sNewVal + sVal.substr(sPointer,(sVal.length-sPointer));
		}
//		alert('newval=' + sNewVal);
	}
	if( sNewVal.length > what.maxLength )
		what.value = sNewVal.substr(0,what.maxLength);
	else
		what.value = sNewVal;
}