//////////////////////////////////////////////////////////
// Browser Types
/*
ns4=(_d.layers)?true:false
ns6=(navigator.userAgent.indexOf("Gecko")!=-1)?true:false
mac=(navigator.appVersion.indexOf("Mac")!=-1)?true:false
mac45=(navigator.appVersion.indexOf("MSIE 4.5")!=-1)?true:false
if(ns6||ns4)mac=false
opera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false
ns61=(parseInt(navigator.productSub)>=20010726)?true:false
ie4=(!_d.getElementById&&_d.all)?true:false;
konq=(navigator.userAgent.indexOf("Konqueror")!=-1)?true:false
*/

//////////////////////////////////////////////////////////
// variables
var strArrow = '<img src="/Stage/images/common/bullet_arrow.gif" border="0" width="7" height="8">';
var strArrowStart = '<img src="/Stage/images/common/bullet_arrow.gif" border="0" width="7" height="8" ';
var strArrowEnd = '>';
var strBullet = '<img src="/Stage/images/common/bullet_square.gif" border="0" width="4" height="4">';
var strPhonePoliceGeneral = "(714) 738-6800";

//////////////////////////////////////////////////////////
// Browsers and OS
//////////////////////////////////////////////////////////
var ns = (!document.all && document.getElementById);
var ie = (document.all && document.getElementById);
var userAgent = navigator.userAgent.toLowerCase();
var userApp = navigator.appName.toLowerCase();
var userVersion = parseFloat(navigator.appVersion);
var userAppVersion = navigator.appVersion.toLowerCase();
var isNetscape6 = false;
if (navigator.userAgent.indexOf('Netscape6') != -1) isNetscape6 = true ;

function isNet4x() {
	if (document.getElementById)
		return false;
	return true;
}

//OS
var OSName="Unknown OS";
var isMac = false;
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
if (navigator.appVersion.indexOf("Mac")!=-1)
{ 
	OSName="MacOS";
	isMac = true;
}

function isIE()
{
	if(navigator.userAgent.toLowerCase().indexOf("msie") > -1)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function isOpera()
{
	if(navigator.userAgent.toLowerCase().indexOf("opera") > -1)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function isFirefox()
{
	if(navigator.userAgent.toLowerCase().indexOf("firefox") > -1)
	{
		return true;
	}
	else
	{
		return false;
	}
}



//////////////////////////////////////////////////////////
// Window Management
//////////////////////////////////////////////////////////
function fncPopWindow(strUrl,strWindowName,strFeatures){
	if(strWindowName == ""){
		strWindowName = "wndSecondary";
	}
	if(strFeatures == ""){
		strFeatures = "width=500,height=350,resizable=yes,scrollbars=yes,top=200px,dependent=yes"
	}
	var wndPop = window.open(strUrl,strWindowName,strFeatures);
	wndPop.document.close();
	wndPop.focus();
}

function fncCloseThisWindow(){
	window.close();
}

function fncWindowWidth()
{
    return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
}
function fncWindowHeight()
{
    return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
}
/////////////////////////////////////////////////////
// Layer Management
//////////////////////////////////////////////////////////
function fncShowHideById(strElementID)
{
	if(document.getElementById(strElementID).style.display == "none")
    {
        document.getElementById(strElementID).style.display = "";
    }
    else
    {
        document.getElementById(strElementID).style.display = "none";
    }
}

function fncShowHideById2(strElementID,blnShow)
{
    if(!blnShow)
    {
        document.getElementById(strElementID).style.display = "none";
    }
    else
    {
        document.getElementById(strElementID).style.display = "";
    }
}

function fncAddPaddingBottom(strElementID, intPadding)
{
    var intExistingPadding = 0;
    var intDivTop = 0;
	//if(document.getElementById(strElementID))
	//{
    intExistingPadding = document.getElementById(strElementID).style.paddingBottom;
	
    if(intExistingPadding == "" || intExistingPadding == null)
    {
        intExistingPadding = 0;
    }
    intExistingPadding = intExistingPadding.toString();
    if(intExistingPadding.indexOf("px") != -1)
    {
        var intLength = 0;
        intLength = intExistingPadding.length - 2;
        intExistingPadding = intExistingPadding.substr(0,intLength);
    }
	intExistingPadding = parseInt(intExistingPadding) + parseInt(intPadding);
    document.getElementById(strElementID).style.paddingBottom = intExistingPadding;
	//}
}

//////////////////////////////////////////////////////////
// Mouse Events
//////////////////////////////////////////////////////////
function fncOnMouseOverCursor(strID)
{
    document.getElementById(strID).style.cursor = "pointer";
}

function fncOnMouseOutCursor(strID)
{
    document.getElementById(strID).style.cursor = "default";
}

function fncMouseOver(strID)
{
    document.getElementById(strID).style.cursor = "pointer";
}

function fncMouseOut(strID)
{
    document.getElementById(strID).style.cursor = "default";
}

//////////////////////////////////////////////////////////
//row select
//////////////////////////////////////////////////////////
var imgArrowDown = "/webdata/images/icons/arrow_down.png";
var imgArrowRight = "/webdata/images/icons/arrow_right.png";


function fncShowHide(ID) {
    if (document.getElementById(ID).style.display != "block") 
    {
        document.getElementById(ID).style.display = "block";
    }
    else 
    {
        document.getElementById(ID).style.display = "none";
    }
}

function fncMouseOverRow(ID) 
{
	if(document.getElementById(ID) != null)
	{
	    document.getElementById(ID).className = "tableRowHover";
	    fncOnMouseOverCursor(ID);
	}
}

function fncMouseOutRow(ID, IsAlternate) 
{
	if(document.getElementById(ID) != null)
	{
	    if (IsAlternate) 
	    {
	        document.getElementById(ID).className = "tableRowAlternate";
	    }
	    else 
	    {
	        document.getElementById(ID).className = "tableRow";
	    }
	    fncOnMouseOutCursor(ID);
	}
}

function fncMouseDownRow(ID, ChildID, IsAlternate) {
    if (document.getElementById(ChildID).style.display != "none") 
    {
        document.getElementById(ChildID).style.display = "none";
    }
    else 
    {
        document.getElementById(ID).className = "tableRowSelected";
        if (isIE()) 
	    {
	        document.getElementById(ChildID).style.display = "block";
	    }
	    else 
	    {
	        document.getElementById(ChildID).style.display = "table-row";
	    }
    }
}

function fncMouseOverGroup(ID) 
{
    document.getElementById(ID).className = "tableGroupSelected";
    fncOnMouseOverCursor(ID);
}

function fncMouseOutGroup(ID, IsAlternate) 
{
    if (IsAlternate) 
    {
        document.getElementById(ID).className = "tableGroupBackground";
    }
    else 
    {
        document.getElementById(ID).className = "tableGroupBackground";
    }
    fncOnMouseOutCursor(ID);
}

function fncMouseDownGroup(ID, ChildID, imgID)
{
    if (document.getElementById(ChildID).style.display != "none") 
    {
        document.getElementById(ChildID).style.display = "none";
		if(imgID != '')
		{
	        document.getElementById(imgID).src = imgArrowRight;
		}
    }
    else 
    {
        if (isIE()) 
	    {
	        document.getElementById(ChildID).style.display = "block";
	    }
	    else 
	    {
	        document.getElementById(ChildID).style.display = "table-row";
	    }
        if(imgID != '')
		{
	        document.getElementById(imgID).src = imgArrowDown;
		}
    }
}

function fncExpandRow(ID, ChildID) 
{
    if (document.getElementById(ChildID).style.display != "none") 
    {
        document.getElementById(ChildID).style.display = "none";
    }
    else 
    {
        if (isIE()) 
	    {
	        document.getElementById(ChildID).style.display = "block";
	    }
	    else 
	    {
	        document.getElementById(ChildID).style.display = "table-row";
	    }
    }
}

function fncExpandRow(ChildID) 
{
    if (document.getElementById(ChildID).style.display != "none") 
    {
        document.getElementById(ChildID).style.display = "none";
    }
    else 
    {
        if (isIE()) 
	    {
	        document.getElementById(ChildID).style.display = "block";
	    }
	    else 
	    {
	        document.getElementById(ChildID).style.display = "table-row";
	    }
    }
}

function fncForceExpandRow(ChildID) 
{
       if (isIE()) 
    {
        document.getElementById(ChildID).style.display = "block";
    }
    else 
    {
        document.getElementById(ChildID).style.display = "table-row";
    }
}

function fncForceCollapseRow(ChildID) 
{
    if (document.getElementById(ChildID).style.display != "none") 
    {
        document.getElementById(ChildID).style.display = "none";
    }
}

function fncCollapseGroup(ID, ChildID, imgID) 
{
    document.getElementById(ChildID).style.display = "none";
    document.getElementById(imgID).src = imgArrowRight;
}

function fncExpandGroup(ID, ChildID, imgID) 
{
    if (isIE()) 
    {
        document.getElementById(ChildID).style.display = "block";
    }
    else 
    {
        document.getElementById(ChildID).style.display = "table-row";
    }
    document.getElementById(imgID).src = imgArrowDown;
}

function fncDispalyRow(ID, ChildID, IsAlternate) {
    if (document.getElementById(ChildID).style.display != "none") 
	{
		document.getElementById(ChildID).style.display = "none";
	}
    else 
	{
        if (isIE()) 
	    {
	        document.getElementById(ChildID).style.display = "";
	    }
	    else 
	    {
	        document.getElementById(ChildID).style.display = "";
	    }
    }
}


function fncDisplayRow(ID)
 {
     if (document.getElementById(ID).style.display != "none")
     {
         document.getElementById(ID).style.display = "none";
     }
     else
     {
         if (ie)
         {
             document.getElementById(ID).style.display = "block";
         }
         else
         {
             document.getElementById(ID).style.display = "table-row";
         }
     }
 }

 function fncDisplayDiv(ID)
 {
 	if (document.getElementById(ID).style.display != "none")
     {
         document.getElementById(ID).style.display = "none";
     }
     else
     {
	 	document.getElementById(ID).style.display = "block";
	 }
 }
 
 function fncDisplayDivOnly(ID)
 {
 	document.getElementById(ID).style.display = "block";
 }
 
 function fncHideDivOnly(ID)
 {
 	document.getElementById(ID).style.display = "none";
 }
 
 function fncDisplayRowOnly(ID)
 {
 	if (ie)
	 {
	     document.getElementById(ID).style.display = "block";
	 }
	 else
	 {
	     document.getElementById(ID).style.display = "table-row";
	 }
 }
 
 function fncHideRowOnly(ID)
 {
 	document.getElementById(ID).style.display = "none";
 }


 
//////////////////////////////////////////////////////////
// String Validation
//////////////////////////////////////////////////////////

function fncReplaceChar(str, chr, newchr)
{
	for(var i=0;i<str.length;i++)
	{
		str = str.replace(chr,newchr);		
	}
	if(str.length == 1)
	{
		if(str == chr)
		{
			str = newchr;
		}
	}
	return str;
}

function fncReplaceFirstChar(str, chr, newchr)
{
	if(str.length > chr.length)
	{
		if(str.indexOf(chr) == 0)
		{
			str.substring(chr.length);
			str = newchr + str;
		}
	}
	return str;
}

function fncReplaceLastChar(str, chr, newchr)
{
	if(str.length > chr.length)
	{
		if(str.indexOf(chr) == (str.length - chr.length))
		{
			str.substring(0, str.length - chr.length);
			str = str + newchr;
		}
	}
	return str;
}

function replaceChar(str, chr){
	for(var i = 0; i < str.length; i++)
	{
		str = str.replace(chr,"");
	}
	if(str.length == 1)
	{
		if(str == chr)
		{
			str = "";
		}
	}
	return str;
}

function rep_leading_blanks(inString)
{
	var i, j = inString.length, retString = inString;
	for (var i = 0; i < j ; i++) 
	{
		if (inString.charAt(i) == ' ')
			retString = inString.substr(i+1,j-i-1);
		else
			return(retString);
	}
	return(retString);
}

function rep_trailing_blanks(inString){
	var i, j = inString.length, retString = inString;
	
	for (var i=j;i>0;i--) {
		if (inString.charAt(i-1)==' ')
			retString=inString.substr(0,i-1);
		else
		return(retString);
	}	
	return(retString);
}

function fncRemoveExtraBlanks(obj){
	obj = rep_leading_blanks(obj);
	obj = rep_trailing_blanks(obj);
	return obj;
}

function fncRemoveExtraBlanksString(str){
	str = rep_leading_blanks(str);
	str = rep_trailing_blanks(str);
	return str;
}


function mask (InString, Mask)  {
	var LenStr = InString.length, LenMsk = Mask.length;
	
	if ((LenStr==0) || (LenMsk==0))	return(0);
	if (LenStr!=LenMsk)	return(0);

	for(var Count=0; Count<=InString.length; Count++) {
		StrChar = InString.substring(Count, Count+1);
		MskChar = Mask.substring(Count, Count+1);
		if (MskChar=='#') {
			if(!isNumberChar(StrChar)) return(0);
		} else if (MskChar=='?') {
			if(!isAlphabeticChar(StrChar)) return(0);
		} else if (MskChar=='!') {
			if(!isNumOrChar(StrChar)) return(0);
		} else if (MskChar=='*') {
		} else {
			if (MskChar!=StrChar) return(0);
		}
	}
	return (1);
}

/*
function Mask(e, m) 
{
     if (event.keyCode > 0) 
     {
         e.focus();
         var sel = document.selection;
         var rng = sel.createRange();
         rng.colapse;
         if ((sel.type == "Text" || sel.type == "None") && rng != null) 
         {
             rng.text = String.fromCharCode(event.keyCode);
         }
     }
     var ev = e.value;
     if (event.keyCode > 0) {
         e.value = '';
         e.select();
     }
     var cIndx = -1;
     var Out = '';
     var cChar = '';
     var mChar = ''
     var nChar = '';
     var Hold = '';
     var rx;

     for (var i = 0; i < m.length; i++) {
         mChar = m.substr(i, 1)
         if (mChar == '#' || mChar == '(' || mChar == ')' || mChar=='-' || mChar=='@') 
		 {
             if (mChar == '#') { rx = /\d/; }
			 else if (mChar == '(') { rx = /\(/; }
             else if (mChar == ')') { rx = /\)/; }
             else if (mChar == '-') { rx = /-/; } 
             else if(mChar=='@'){rx = /[a-zA-Z]/;}
			 
             cChar = ev.substr(++cIndx, 1);
             if (m.substr(i + 1, 1) != '*')
                 cChar.toString();
             while (cIndx < ev.length && !rx.test(cChar))
                 cChar = ev.substr(++cIndx, 1);
             if (cIndx < ev.length && rx.test(cChar)) {
                 Out += Hold + ev.substr(cIndx, 1);
                 Hold = '';
                 if (m.substr(i + 1, 1) == '*' || m.substr(i + 1, 1) == '+') {
                     nChar = ev.substr(cIndx + 1, 1);
                     while (cIndx < ev.length && rx.test(nChar)) {
                         Out += nChar;
                         nChar = ev.substr(++cIndx + 1, 1);
                     }
                 }
             } else if (cIndx < ev.length && m.substr(i + 1, 1) == '*') {
                 --cIndx;
             }
         } else if (mChar != '*' && mChar != '+') {
             if (ev.substr(cIndx + 1, 1).toLowerCase() == mChar.toLowerCase()) {
                 Out += mChar;
                 cIndx++;
             } else {
                 Hold += mChar;
             }
         }
         if (cIndx >= ev.length) {
             e.value = Out;
             return false;
         }
     }
     e.value = Out;
     return false;
 }
*/


function isNumberChar (InString)  {
	var RefString="1234567890";

	if(InString.length!=1) return false;
	if(RefString.indexOf (InString, 0)==-1) return false;
	
	return true;
}

function isAlphabeticChar (InString)  {
	var	RefString="abcdefghijklmnopqrstuvwxyz";
	
	if(InString.length != 1) return false;	
	InString=InString.toLowerCase ()
	if (RefString.indexOf (InString, 0)==-1) return false;
	
	return true;
}

function isNumOrChar (InString)  {
	var RefString="1234567890abcdefghijklmnopqrstuvwxyz";

	if(InString.length!=1) return false;
	InString=InString.toLowerCase();
	if (RefString.indexOf (InString, 0)==-1) return false;

	return true;
}

var aryCommonJsNumbers = new Array("0","1","2","3","4","5","6","7","8","9");
var aryCommonJsLetters = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
var aryCommonJsOtherChar = new Array(",",".","<",">","/","\\","|","{","}","[","]","`","~","!","@","#","$","%","^","&","*","(",")","-","_","+","=",";",":","?","'","\"");

var aryNameCharacters = new Array(",",".","-","'");
var aryPhoneCharacters = new Array(".","(",")","-");
var aryAddressCharacters = new Array(",",".","#","-","'");
var aryGeneralCharacters = new Array(",",".","-","'","!","&","$");
var aryEmailCharacters = new Array(".","@","-","_","+");
var aryZipCharacters = new Array("-");

//Replaces unwanted characters with ""	
function fncCleanInput(str,type)
{
	type = type.toLowerCase();
	if(type == "phone" || type == "number" || type == "zip")
	{
		//remove letters
		for(var i = 0; i < aryCommonJsLetters.length; i++)
		{
			if(str.indexOf(aryCommonJsLetters[i]) > -1)
			{
				str = replaceChar(str, aryCommonJsLetters[i]);
			}
		}
		if(type == "phone")
		{
			//remove all characters except phone related ()-.
			for(var i = 0; i < aryCommonJsOtherChar.length; i++)
			{
				var isamatch = false;
				if(str.indexOf(aryCommonJsOtherChar[i]) > -1)
				{	//found character in general list
					for(var j = 0; j < aryPhoneCharacters.length; j++)
					{
						if(aryCommonJsOtherChar[i] == aryPhoneCharacters[j])
						{	//character is permitted 
							isamatch = true;
							break;
						}
					}
					if(!isamatch)
					{
						str = replaceChar(str, aryCommonJsOtherChar[i]);
					}
				}
			}
		}
		else if(type == "zip")
		{
			//remove all characters except zip related -
			for(var i = 0; i < aryCommonJsOtherChar.length; i++)
			{
				var isamatch = false;
				if(str.indexOf(aryCommonJsOtherChar[i]) > -1)
				{	//found character in general list
					for(var j = 0; j < aryZipCharacters.length; j++)
					{
						if(aryCommonJsOtherChar[i] == aryZipCharacters[j])
						{	//character is permitted 
							isamatch = true;
							break;
						}
					}
					if(!isamatch)
					{
						str = replaceChar(str, aryCommonJsOtherChar[i]);
					}
				}
			}
		}
	}
	else if(type == "name")
	{
		//remove all characters except name related ,-.'
		for(var i = 0; i < aryCommonJsOtherChar.length; i++)
		{
			if(str.indexOf(aryCommonJsOtherChar[i]) > -1)
			{	//found character in general list
				var isamatch = false;
				for(var j = 0; j < aryNameCharacters.length; j++)
				{
					if(aryCommonJsOtherChar[i] == aryNameCharacters[j])
					{	//character is permitted 
						isamatch = true;
						break;
					}
				}
				if(!isamatch)
				{
					str = replaceChar(str, aryCommonJsOtherChar[i]);
				}
			}
		}
	}
	else if(type == "address")
	{
		//remove all characters except name related ,-.'
		for(var i = 0; i < aryCommonJsOtherChar.length; i++)
		{
			if(str.indexOf(aryCommonJsOtherChar[i]) > -1)
			{	//found character in general list
				var isamatch = false;
				for(var j = 0; j < aryAddressCharacters.length; j++)
				{
					if(aryCommonJsOtherChar[i] == aryAddressCharacters[j])
					{	//character is permitted 
						isamatch = true;
						break;
					}
				}
				if(!isamatch)
				{
					str = replaceChar(str, aryCommonJsOtherChar[i]);
				}
			}
		}
	}
	else if(type == "email")
	{
		//remove all characters except name related ,-.'
		for(var i = 0; i < aryCommonJsOtherChar.length; i++)
		{
			if(str.indexOf(aryCommonJsOtherChar[i]) > -1)
			{	//found character in general list
				var isamatch = false;
				for(var j = 0; j < aryEmailCharacters.length; j++)
				{
					if(aryCommonJsOtherChar[i] == aryEmailCharacters[j])
					{	//character is permitted
						isamatch = true;
						break;
					}
				}
				if(!isamatch)
				{
					str = replaceChar(str, aryCommonJsOtherChar[i]);
				}
			}
		}
	}
	else if(type == "text")
	{
		//remove all characters except name related ,-.'
		for(var i = 0; i < aryCommonJsOtherChar.length; i++)
		{
			if(str.indexOf(aryCommonJsOtherChar[i]) > -1)
			{	//found character in general list
				var isamatch = false;
				for(var j = 0; j < aryGeneralCharacters.length; j++)
				{
					if(aryCommonJsOtherChar[i] == aryGeneralCharacters[j])
					{	//character is permitted 
						isamatch = true;
						break;
					}
				}
				if(!isamatch)
				{
					str = replaceChar(str, aryCommonJsOtherChar[i]);
				}
			}
		}
	}
	else	//general
	{
		//remove all characters except name related ,-.'
		for(var i = 0; i < aryCommonJsOtherChar.length; i++)
		{
			if(str.indexOf(aryCommonJsOtherChar[i]) > -1)
			{	//found character in general list
				var isamatch = false;
				for(var j = 0; j < aryGeneralCharacters.length; j++)
				{
					if(aryCommonJsOtherChar[i] == aryGeneralCharacters[j])
					{	//character is permitted 
						isamatch = true;
						break;
					}
				}
				if(!isamatch)
				{
					str = replaceChar(str, aryCommonJsOtherChar[i]);
				}
			}
		}
	}
	return str;
}


//Verifies character based strings
function fncCharStringVerification(strValue,type)  {
	var allowNumbers = "no";
	if(type == "Name" || type == "Street Address" || type == "State License" || type == "Email Body"){
		allowNumbers = "yes";
	}
	
	var foundNumber = "no";
	if(allowNumbers == "no"){
		for(var x = 0; x < aryCommonJsNumbers.length; x++){
			if(strValue.indexOf(aryCommonJsLetters[x]) > -1){
				foundNumber = "yes";
				//alert("Please do not enter numbers in the " + type + " filed.");
				return false;
				break;
			}
		}
	}
	
	if(foundNumber == "no"){
		for(var y = 0; y < aryCommonJsOtherChar.length; y++){
			if(strValue.indexOf(aryCommonJsOtherChar[y]) > -1){
				if(type == "Name"){	//allow periods, dashes, and commas in name fields
					if((aryCommonJsOtherChar[y] != ".") && (aryCommonJsOtherChar[y] != "-") && (aryCommonJsOtherChar[y] != ",")){
						return false;
						break;
					}
				}else if(type == "Street Address"){	//allow periods, dashes, and commas in street address fields
					if((aryCommonJsOtherChar[y] != ".") && (aryCommonJsOtherChar[y] != "-") && (aryCommonJsOtherChar[y] != "#")){
						return false;
						break;
					}
				}else if(type == "State License"){	//allow dashes in state license
					if((aryCommonJsOtherChar[y] != "-")){
						return false;
						break;
					}
				}else if(type == "Email Body"){
					if((aryCommonJsOtherChar[y] != ".") && (aryCommonJsOtherChar[y] != "-") && (aryCommonJsOtherChar[y] != "#") && (aryCommonJsOtherChar[y] != "'") && (aryCommonJsOtherChar[y] != ",")){
						return false;
						break;
					}
				}else{
					return false;
					break;
				}
			}
		}
	}
}
//////////////////////////////////////////////////////////
//Checks to verify string is a number
//////////////////////////////////////////////////////////
function fncReturnNumbers(strValue,type)
{
	var _newString = strValue;
	var foundLetter = "no";
	strValue = strValue.toString();
	for(var x = 0; x < aryCommonJsLetters.length; x++){
		if(strValue.indexOf(aryCommonJsLetters[x]) > -1){
			_newString = fncReplaceChar(_newString, aryCommonJsLetters[x], "")
			//foundLetter = "yes";
			//alert("Please enter only numbers and commas in the " + type + " fields.");
			//return false;
			//break;
		}
	}
	
	if(foundLetter == "no"){
		for(var y = 0; y < aryCommonJsOtherChar.length; y++){
			if(strValue.indexOf(aryCommonJsOtherChar[y]) > -1){
				if(type.toLowerCase() == "phone"){
					if(aryCommonJsOtherChar[y] != "-" && aryCommonJsOtherChar[y] != "(" && aryCommonJsOtherChar[y] != ")"){
						_newString = fncReplaceChar(_newString, aryCommonJsOtherChar[x], "")
					}
				}else if(type.toLowerCase() == "date"){
					if(aryCommonJsOtherChar[y] != "/"){
						_newString = fncReplaceChar(_newString, aryCommonJsOtherChar[x], "")
					}
				}else if(type.toLowerCase() == "ziplong"){
					if(aryCommonJsOtherChar[y] != "-"){
						_newString = fncReplaceChar(_newString, aryCommonJsOtherChar[x], "")
					}
				}else if(type.toLowerCase() == "decimal"){
					if(aryCommonJsOtherChar[y] != "."){
						_newString = fncReplaceChar(_newString, aryCommonJsOtherChar[x], "")
					}
				}else if(type.toLowerCase() == "zip" || type.toLowerCase() == "pure" || type.toLowerCase() == "meter"){
					_newString = fncReplaceChar(_newString, aryCommonJsOtherChar[x], "")
				}else if(type.toLowerCase() == "dollar"){
					if(aryCommonJsOtherChar[y] != "," && aryCommonJsOtherChar[y] != ".")
					{
						_newString = fncReplaceChar(_newString, aryCommonJsOtherChar[x], "")
					}
				}else if(type.toLowerCase() == "pure"){
					_newString = fncReplaceChar(_newString, aryCommonJsOtherChar[x], "")
				}else{
					if(aryCommonJsOtherChar[y] != ","){	//allow commas, except for rates
						//alert("Please enter only numbers and commas in the " + type + " fields.");
						_newString = fncReplaceChar(_newString, aryCommonJsOtherChar[x], "")
					}
				}
			}
		}
	}
}

function fncCleanNumbers(strValue,type){
	var foundLetter = "no";
	strValue = strValue.toString();
	for(var x = 0; x < aryCommonJsLetters.length; x++){
		if(strValue.indexOf(aryCommonJsLetters[x]) > -1){
			foundLetter = "yes";
			//alert("Please enter only numbers and commas in the " + type + " fields.");
			return false;
			break;
		}
	}
	
	if(foundLetter == "no"){
		for(var y = 0; y < aryCommonJsOtherChar.length; y++){
			if(strValue.indexOf(aryCommonJsOtherChar[y]) > -1){
				if(type.toLowerCase() == "phone"){
					if(aryCommonJsOtherChar[y] != "-" && aryCommonJsOtherChar[y] != "(" && aryCommonJsOtherChar[y] != ")"){
						return false;
						break;
					}
				}else if(type.toLowerCase() == "date"){
					if(aryCommonJsOtherChar[y] != "/"){
						return false;
						break;
					}
				}else if(type.toLowerCase() == "ziplong"){
					if(aryCommonJsOtherChar[y] != "-"){
						return false;
						break;
					}
				}else if(type.toLowerCase() == "decimal"){
					if(aryCommonJsOtherChar[y] != "."){
						return false;
						break;
					}
				}else if(type.toLowerCase() == "zip" || type.toLowerCase() == "pure" || type.toLowerCase() == "meter"){
					return false;
					break;
				}else if(type.toLowerCase() == "dollar"){
					if(aryCommonJsOtherChar[y] != "," && aryCommonJsOtherChar[y] != ".")
					{
						return false;
						break
					}
				}else if(type.toLowerCase() == "pure"){
					return false;
					break
				}else{
					if(aryCommonJsOtherChar[y] != ","){	//allow commas, except for rates
						//alert("Please enter only numbers and commas in the " + type + " fields.");
						return false;
						break;
					}
				}
			}
		}
	}
}
//////////////////////////////////////////////////////////
//Email Check
//////////////////////////////////////////////////////////
function fncCommonCheckEmail(frmEmail){
	if (frmEmail.value == ""){
		alert("Enter a value for the \"Email Address\" field.");
		frmEmail.focus();
		return false;
	}
	
	var checkOK = "|&;()<>\'\"*?\\[]$!#`{}";
	var checkStr = frmEmail.value;
	var allValid = true;
	
	for (var i = 0;  i < checkOK.length;  i++){
		var ch = checkOK.charAt(i);
		if (checkStr.indexOf(ch,0) != -1){
			allValid = false;
			break;
		}
	}
	
	if (!allValid){
		alert("Enter only valid characters in \"Email Address\" field.");
		frmEmail.focus();
		return false;
	}
	
	if (frmEmail.value.length < 6){
		//alert("Enter at least 6 characters in the \"Email Address\" field.");
		alert("Enter a valid email address.");
		frmEmail.focus();
		return false;
	}
	
	//Contains @
	if (frmEmail.value.indexOf('@',0)==-1){
		//alert("Enter a @ character in the \"Email Address\" field.");
		alert("Enter a valid email address.");
		frmEmail.focus();
		return false;
	}
	
	//@ is not the first character
	if (frmEmail.value.indexOf('@',0)==0){
		alert("Enter a valid email Address.");
		frmEmail.focus();
		return false;
	}
	
	// Get length of email address
	var strLength = frmEmail.value.length;
	var strEmail = frmEmail.value;
	var result = strEmail.lastIndexOf(".");
	var atSign = strEmail.lastIndexOf("@");
	
	//there cannot be fewer than 5 characters after the @ sign
	if (strLength - atSign < 5){
		alert("Enter a valid email Address.");
		frmEmail.focus(); 	
		return false;
	}
	
	//the period cannot be in the first position
	if (frmEmail.value.indexOf('.',0)==-1){
		alert("Enter a valid email Address.");
		frmEmail.focus();
		return false;
	}
	
	// Must have 2 characters after the period
	if (strLength - result < 3){
		alert("Enter a valid email Address.");
		frmEmail.focus(); 	
		return false;
	}
	
	//No blanks in the email
	if (frmEmail.value.indexOf(' ',0)!=-1){
		//alert("Don't enter a blank character in the \"EmailAddress\" field.");
		alert("Enter a valid email Address.");
		frmEmail.focus();
		return false;
	}
}

//////////////////////////////////////////////////////////
//States
//////////////////////////////////////////////////////////
var aryStateAbbr = new Array("AL","AK","AZ","AR","CA","CO","CT","DC","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY");
var aryStateNames = new Array("Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","DC","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming");

function fncStateDropDown(objSelectBox,strType,strFirstValue,strSelected){
	var cnt = 0;
	if(strFirstValue > ""){
		objSelectBox.options[cnt] = new Option(strFirstValue,"");
		cnt = 1;
	}
	
	if(strType == "Full"){
		for(i = 0; i < aryStateAbbr.length; i++){
			objSelectBox.options[i+cnt] = new Option(aryStateNames[i],aryStateAbbr[i]);
		}
	}else{
		for(i = 0; i < aryStateAbbr.length; i++){
			objSelectBox.options[i+cnt] = new Option(aryStateAbbr[i],aryStateAbbr[i]);
		}
	}
	
	if(strSelected > ""){
		for(var j = 0; j < objSelectBox.length; j++){
			if(objSelectBox.options[j].value == strSelected){
				objSelectBox.options[j].selected = true;
			}
		}
	}
}

//State Drop Downs Loaded from Data Base
function fncSetState( strState, objDropDown ){
	for(var i = 0; i < objDropDown.length; i++){
		if(objDropDown[i].text == strState){
			objDropDown[i].selected = true;
		}
	}
}

function fncSetHdnState(objDropDown,objHidden){
	objHidden.value = objDropDown.options[objDropDown.selectedIndex].text;
}

function fncGetState(objHidden,objDropDown){
	if(objHidden.value < " "){
		fncSetState( "CA", objDropDown );
	}else{
		fncSetState( objHidden.value, objDropDown );
	}
}

//////////////////////////////////////////////////////////
// form management
// disable submit button
//////////////////////////////////////////////////////////
function fncDisableButton() {
	document.frm.submit();
	window.setTimeout("fncDisableButton('" + window.event.srcElement.id + "')", 0);
}

function fncDisableButtonForm(frm) {
	frm.submit();
	window.setTimeout("fncDisableButton('" + window.event.srcElement.id + "')", 0);
}

function fncDisableButtonFormBtn(frm,btn) {
	frm.submit();
	window.setTimeout("fncDisableButton('" + btn + "')", 0);
}

function fncDisableButton(buttonID) {
	document.getElementById(buttonID).disabled=true;
}

//////////////////////////////////////////////////////////
//Click Paths
var strClickHome = "http://www.ci.fullerton.ca.us/";
var strClickDepartments = "/departments/departments.html";
//Police
var strClickPolice = "/departments/police";

//////////////////////////////////////////////////////////
//User Details
//User Name
//////////////////////////////////////////////////////////
function fncParseName(PropertyNames, PropertyValues)
{
	//Catherine Carter
	//FirstName:S:0:9:LastName:S:9:6:
	
	var aryNameProperties = new Array();
	aryNameProperties = PropertyNames.split(":");
	
	var strFirstName = PropertyValues.slice(aryNameProperties[2],(aryNameProperties[2] + aryNameProperties[3]));
	var strLastName = PropertyValues.slice(aryNameProperties[6], (aryNameProperties[6] + aryNameProperties[7]));
	
	document.write(strFirstName + " " + strLastName);
}

//////////////////////////////////////////////////////////
//scan alert
//////////////////////////////////////////////////////////
function fncDisplayScanAlertImage()
{
	var strScanAlert = '<div style="padding-top: 10px;"><!-- START SCANALERT CODE -->';
	strScanAlert += '<a target="_blank" href="https://www.scanalert.com/RatingVerify?ref=www.cityoffullerton.com"><img width="115" height="30" border="0" src="//images.scanalert.com/meter/www.cityoffullerton.com/32.gif" alt="HACKER SAFE certified sites prevent over 99.9% of hacker crime." oncontextmenu="alert(';
	strScanAlert += "'Copying Prohibited by Law - HACKER SAFE is a Trademark of ScanAlert'";
	strScanAlert += '); return false;"></a>';
	strScanAlert += '<!-- END SCANALERT CODE --></div>';
	
	
	/*var strScanAlert = '<!-- START SCANALERT CODE -->';
	strScanAlert += '<a target="_blank" href="https://www.scanalert.com/RatingVerify?ref=www.cityoffullerton.com"><img width="115" height="30" border="0" src="//images.scanalert.com/meter/www.cityoffullerton.com/32.gif" alt="HACKER SAFE certified sites prevent over 99.9% of hacker crime." oncontextmenu="alert(';
	strScanAlert += "'Copying Prohibited by Law - HACKER SAFE is a Trademark of ScanAlert'";
	strScanAlert += '); return false;"></a>';
	strScanAlert += '<!-- END SCANALERT CODE -->';*/
	
	document.write(strScanAlert);
}

function fncDisplayScanAlert()
{
	var strScanAlert = '<!-- START SCANALERT CODE -->';
	strScanAlert += '<a target="_blank" href="https://www.scanalert.com/RatingVerify?ref=www.cityoffullerton.com"><img width="115" height="30" border="0" src="//images.scanalert.com/meter/www.cityoffullerton.com/32.gif" alt="HACKER SAFE certified sites prevent over 99.9% of hacker crime." oncontextmenu="alert(';
	strScanAlert += "'Copying Prohibited by Law - HACKER SAFE is a Trademark of ScanAlert'";
	strScanAlert += '); return false;"></a>';
	strScanAlert += '<!-- END SCANALERT CODE -->';
	
	document.write(strScanAlert);
}

//////////////////////////////////////////////////////////
//verisign
//////////////////////////////////////////////////////////

function fncDisplayVerisign()
{
	var strVerisign = '<div title="Click to Verify - This site chose VeriSign SSL for secure e-commerce and confidential communications.">';
	strVerisign += '<script src=https://seal.verisign.com/getseal?host_name=www.cityoffullerton.com&size=S&use_flash=NO&use_transparent=NO&lang=en></script>';
	strVerisign += '</div>';
	
	document.write(strVerisign);
}

//////////////////////////////////////////////////////////
//rounded corners
//////////////////////////////////////////////////////////
function fncRoundedCorners()
{
	var aryRoundedClasses = new Array("rounded", "roundedTop", "roundedBottom", "roundedRight", "roundedLeft", "roundedTopRight", "roundedTopLeft", "roundedBottomRight", "roundedBottomLeft");
	var aryRoundedClassesTopRight = new Array("rounded", "roundedTop", "roundedRight", "roundedTopRight");
	var aryRoundedClassesTopLeft = new Array("rounded", "roundedTop", "roundedLeft", "roundedTopLeft");
	var aryRoundedClassesBottomRight = new Array("rounded", "roundedBottom", "roundedRight", "roundedBottomRight");
	var aryRoundedClassesBottomLeft = new Array("rounded", "roundedBottom", "roundedLeft", "roundedBottomLeft");
	//class= "rounded roundedTop roundedBottom roundedRight roundedLeft roundedTopRight roundedTopLeft roundedBottomRight roundedBottomLeft"
	//rounded = roundedTopRight roundedTopLeft roundedBottomRight roundedBottomLeft
	//roundedTop = roundedTopRight roundedTopLeft
	//roundedBottom = roundedBottomRight roundedBottomLeft
	//roundedRight = roundedTopRight roundedBottomRight
	//roundedLeft = roundedTopLeft roundedBottomLeft
	
	var aryGetDivs = document.getElementsByTagName("div");
	var aryRoundedDivs = [];
	var styleName = "rounded";
	for(var i = 0; i < aryGetDivs.length; i++)
	{
		//if(styleName.exec(aryGetDivs[i].className))
		if(aryGetDivs[i].className.indexOf(styleName) != -1)
		{
			aryRoundedDivs[aryRoundedDivs.length] = aryGetDivs[i];
		}
	}
	
	for(var i = 0; i < aryRoundedDivs.length; i++)
	{
		var currentDiv = aryRoundedDivs[i];
		var currentDivStyleType = currentDiv.className;
		var blnHasTopRight = false;
		var blnHasTopLeft = false;
		var blnHasBottomRight = false;
		var blnHasBottomLeft = false;
		
		for(var j = 0; j < aryRoundedClasses.length; j++)
		{
			currentDiv.className = currentDiv.className.replace(aryRoundedClasses[j],"");
		}
		
		//roundedTopRight
		for(var k = 0; k < aryRoundedClassesTopRight.length; k++)
		{
			if(currentDivStyleType == aryRoundedClassesTopRight[k])
			{
				blnHasTopRight = true;
			}
		}
		//roundedTopLeft
		for(var m = 0; m < aryRoundedClassesTopLeft.length; m++)
		{
			if(currentDivStyleType == aryRoundedClassesTopLeft[m])
			{
				blnHasTopLeft = true;
			}
		}
		//roundedBottomRight
		for(var n = 0; n < aryRoundedClassesBottomRight.length; n++)
		{
			if(currentDivStyleType == aryRoundedClassesBottomRight[n])
			{
				blnHasBottomRight = true;
			}
		}
		//roundedBottomLeft
		for(var n = 0; n < aryRoundedClassesBottomLeft.length; n++)
		{
			if(currentDivStyleType == aryRoundedClassesBottomLeft[n])
			{
				blnHasBottomLeft = true;
			}
		}
		
		//alert("blnHasTopRight = " + blnHasTopRight + "; blnHasTopLeft = " + blnHasTopLeft + "; blnHasBottomRight = " + blnHasBottomRight + "; blnHasBottomLeft = " + blnHasBottomLeft);
		var lastCorner = "";
		
		if(blnHasTopRight)
		{
			var tr = document.createElement("div");
			tr.className = "roundedTopRightCorner";
			currentDiv.parentNode.replaceChild(tr, currentDiv);
			lastCorner = tr;
		}
		if(blnHasTopLeft)
		{
			var tl = document.createElement("div");
			tl.className = "roundedTopLeftCorner"
			if(lastCorner != "")
			{
				lastCorner.appendChild(tl);
			}
			else
			{
				currentDiv.parentNode.replaceChild(tl, currentDiv);
			}
			lastCorner = tl;
		}
		if(blnHasBottomRight)
		{
			var br = document.createElement("div");
			br.className = "roundedBottomRightCorner"
			if(lastCorner != "")
			{
				lastCorner.appendChild(br);
			}
			else
			{
				currentDiv.parentNode.replaceChild(br, currentDiv);
			}
			lastCorner = br;
			
		}
		if(blnHasBottomLeft)
		{
			var bl = document.createElement("div");
			bl.className = "roundedBottomLeftCorner";
			if(lastCorner != "")
			{
				lastCorner.appendChild(bl);
			}
			else
			{
				currentDiv.parentNode.replaceChild(bl, currentDiv);
			}
			lastCorner = bl;
		}
		
		lastCorner.appendChild(currentDiv);
	}
}

////////////////////////////////////////
//select sorting
// sort function - ascending (case-insensitive)
////////////////////////////////////////
 function sortFuncAsc(record1, record2) 
 {
     var value1 = record1.optText.toLowerCase();
     var value2 = record2.optText.toLowerCase();
     if (value1 > value2) return(1);
     if (value1 < value2) return(-1);
     return(0);
 }

     // sort function - descending (case-insensitive)
 function sortFuncDesc(record1, record2) 
 {
     var value1 = record1.optText.toLowerCase();
     var value2 = record2.optText.toLowerCase();
     if (value1 > value2) return(-1);
     if (value1 < value2) return(1);
     return(0);
 }

 function sortSelect(selectToSort, ascendingOrder) 
 {
     if (arguments.length == 1) ascendingOrder = true;    // default to ascending sort

     // copy options into an array
     var myOptions = [];
     for (var loop=0; loop<selectToSort.options.length; loop++) {
         myOptions[loop] = { optText:selectToSort.options[loop].text, optValue:selectToSort.options[loop].value };
     }

     // sort array
     if (ascendingOrder) {
         myOptions.sort(sortFuncAsc);
     } else {
         myOptions.sort(sortFuncDesc);
     }

     // copy sorted options from array back to select box
     selectToSort.options.length = 0;
     for (var loop=0; loop<myOptions.length; loop++) {
         var optObj = document.createElement('option');
         optObj.text = myOptions[loop].optText;
         optObj.value = myOptions[loop].optValue;
         selectToSort.options.add(optObj);
     }
 }

///////////////////////////////////////////////////////////
// Check Textbox keypress for numbers //
//  onkeypress="return fncOnlyNumbers(event);"
///////////////////////////////////////////////////////////
var KEY_NULL = null;
var KEY_NONE = 0;
var KEY_BCKSPC = 8;
var KEY_TAB = 9;
var KEY_ENTER = 13;
var KEY_ESC = 27;

function fncOnlyNumbers(e)
{
	var key;
	var keychar;
	
	if (window.event) {
		key = window.event.keyCode;
	}
	else if (e) {
		key = e.which;
	}
	else {
		return true;
	}
	keychar = String.fromCharCode(key);
 
	// Control keys (no @#$% "magic numbers")
	if (
	(key == KEY_NULL) || 
	(key == KEY_NONE) || 
	(key == KEY_BCKSPC) || 
	(key == KEY_TAB) || 
	(key == KEY_ENTER) || 
	(key == KEY_ESC) || 
	(("0123456789").indexOf(keychar) > -1)
	 ) {
		return true;
	}
	else if (this.className == 'dec') { // Decimal point allowed
		if (keychar == '.') {
			if (this.value.indexOf('.') == -1) { // Can only have a single decimal point
				return true;
			}
		}
	} 
	return false;
}

function fncOnlyNumbersWithDecimal(e)
{
	var key;
	var keychar;
	
	if (window.event) {
		key = window.event.keyCode;
	}
	else if (e) {
		key = e.which;
	}
	else {
		return true;
	}
	keychar = String.fromCharCode(key);
 
	// Control keys (no @#$% "magic numbers")
	if (
	(key == KEY_NULL) || 
	(key == KEY_NONE) || 
	(key == KEY_BCKSPC) || 
	(key == KEY_TAB) || 
	(key == KEY_ENTER) || 
	(key == KEY_ESC) || 
	(("0123456789").indexOf(keychar) > -1) || keychar == '.'
	 ) {
		return true;
	}
	else if (this.className == 'dec') { // Decimal point allowed
		if (keychar == '.') {
			if (this.value.indexOf('.') == -1) { // Can only have a single decimal point
				return true;
			}
		}
	} 
	return false;
}


function fncOnlyNumbersWithDecimalAndComma(e)
{
	var key;
	var keychar;
	
	if (window.event) {
		key = window.event.keyCode;
	}
	else if (e) {
		key = e.which;
	}
	else {
		return true;
	}
	keychar = String.fromCharCode(key);
 
	// Control keys (no @#$% "magic numbers")
	if (
	(key == KEY_NULL) || 
	(key == KEY_NONE) || 
	(key == KEY_BCKSPC) || 
	(key == KEY_TAB) || 
	(key == KEY_ENTER) || 
	(key == KEY_ESC) || 
	(("0123456789").indexOf(keychar) > -1) || keychar == '.' || keychar == ','
	 ) {
		return true;
	}
	else if (this.className == 'dec') { // Decimal point allowed
		if (keychar == '.') {
			if (this.value.indexOf('.') == -1) { // Can only have a single decimal point
				return true;
			}
		}
	} 
	return false;
}

function fncOnlyNumbersWithDash(e)
{
	var key;
	var keychar;
	
	if (window.event) {
		key = window.event.keyCode;
	}
	else if (e) {
		key = e.which;
	}
	else {
		return true;
	}
	keychar = String.fromCharCode(key);
 
	// Control keys (no @#$% "magic numbers")
	if (
	(key == KEY_NULL) || 
	(key == KEY_NONE) || 
	(key == KEY_BCKSPC) || 
	(key == KEY_TAB) || 
	(key == KEY_ENTER) || 
	(key == KEY_ESC) || 
	(("0123456789").indexOf(keychar) > -1) || keychar == '-'
	 ) {
		return true;
	}
	else if (this.className == 'dec') { // Decimal point allowed
		if (keychar == '.') {
			if (this.value.indexOf('.') == -1) { // Can only have a single decimal point
				return true;
			}
		}
	} 
	return false;
}

function fncOnlyPhoneNumbers(e)
{
	var key;
	var keychar;
	
	if (window.event) {
		key = window.event.keyCode;
	}
	else if (e) {
		key = e.which;
	}
	else {
		return true;
	}
	keychar = String.fromCharCode(key);
 
	// Control keys (no @#$% "magic numbers")
	if (
	(key == KEY_NULL) || 
	(key == KEY_NONE) || 
	(key == KEY_BCKSPC) || 
	(key == KEY_TAB) || 
	(key == KEY_ENTER) || 
	(key == KEY_ESC) || 
	(("0123456789").indexOf(keychar) > -1) || keychar == '.' || keychar == '-' || keychar == '(' || keychar == ')' 
	 ) {
		return true;
	}
	return false;
}

function fncOnlyTheseCharacters(e,characters)
{
	var key;
	var keychar;
	
	if (window.event) {
		key = window.event.keyCode;
	}
	else if (e) {
		key = e.which;
	}
	else {
		return true;
	}
	keychar = String.fromCharCode(key);
 
	// Control keys (no @#$% "magic numbers")
	if (
	(key == KEY_NULL) || 
	(key == KEY_NONE) || 
	(key == KEY_BCKSPC) || 
	(key == KEY_TAB) || 
	(key == KEY_ENTER) || 
	(key == KEY_ESC) || 
	((characters).indexOf(keychar) > -1)) 
	{
		return true;
	}
	return false;
}

/*******************************
icon rollover images
*******************************/
function fncIconOver(imgid, imgname)
{
    document.getElementById(imgid).src = "/webdata/images/icons/" + imgname + "_over.png";
}

function fncIconOut(imgid, imgname)
{
    document.getElementById(imgid).src = "/webdata/images/icons/" + imgname + ".png";
}

function fncIconDown(imgid, imgname)
{
    document.getElementById(imgid).src = "/webdata/images/icons/" + imgname + "_over.png";
}

function fncIconOverObject(imgobj, imgname)
{
    imgobj.src = "/webdata/images/icons/" + imgname + "_over.png";
}

function fncIconOutObject(imgobj, imgname)
{
    imgobj.src = "/webdata/images/icons/" + imgname + ".png";
}

function fncIconDownObject(imgobj, imgname)
{
    imgobj.src = "/webdata/images/icons/" + imgname + "_over.png";
}

/*******************************
Popup windows
*******************************/
var wh;
var ww;

function displayFloatingDiv(divOutterID, divInnerID, left, top)
{
    document.getElementById(divInnerID).style.position = 'absolute';
    document.getElementById(divInnerID).style.left = left + 'px';
    document.getElementById(divInnerID).style.top = top + 'px';

    document.getElementById(divOutterID).style.background = 'url(/webdata/images/common/bg_dark_solid.png)';
    document.getElementById(divOutterID).style.display = "block";
}

function fncUpdateWindow(divOutterID, divInnerID)
{
    //var strTitle = "Update" + UpdateType;
    var intLeft = 800 / 4; //screen.width / 4;
    var intTop = 600 / 6; //screen.height / 6;

    if (ie)
    {
        intLeft = document.body.offsetWidth / 3;
        intTop = document.body.offsetHeight / 8;
    }
    else
    {
        intLeft = window.innerWidth / 3;
        intTop = window.innerHeight / 6;
    }

    displayFloatingDiv(divOutterID, divInnerID, intLeft, intTop);
}

function fncCloseUpdateWindow(divOutterID, spnTitleHolder)
{
    document.getElementById(divOutterID).style.display = "none";
    if(spnTitleHolder.length > 0)
    {
    	document.getElementById(spnTitleHolder).innerHTML = "";
    }
}

/************************************************************/
/*******************************
Scrolling
*******************************/
	
function fncGetScrollTop()
{
	var ScrollTop = document.body.scrollTop;
	if (ScrollTop == 0)
	{
		if (window.pageYOffset)
		{
			ScrollTop = window.pageYOffset;
		}
		else
		{
			ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
		}
	}
	return ScrollTop;
}

function fncScrollPosition(textboxID) 
{
    var ScrollTop = document.body.scrollTop;
    if (ScrollTop == 0) 
	{
        if (window.pageYOffset) 
		{
            ScrollTop = window.pageYOffset;
        }
        else 
		{
            ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
        }
    }
    document.getElementById(textboxID).value = ScrollTop;
}
