	function GetToMainFrame(strURL)
	{
		top.frames['MainFrame'].document.location.href=strURL;
	}
	function GetToMainPage(strURL)
	{
		document.location.href=strURL;
	}
	function RedirectURL(strURL)
	{
		document.location.href=strURL;
	}
	function GetToParentPage(strURL)
	{
		opener.document.location.href=strURL;
		CloseWindow();
	}
	function GetToParentWindow(strURL)
	{
		window.parent.location.href=strURL;
	}
	function Back()
	{
		window.history.back(-1);
	}
	function Print()
	{
		window.print();
	}
	function openWindow(myLink,windowName, intWidth, intHeight)
	{
		if(! window.focus)return;
		var myWin=window.open("",windowName,"width="+intWidth+",height="+intHeight+", status=1, resizable=yes, dependent=yes,scrollbars=yes");
		myWin.focus();
		myLink.target=windowName;
	}
	function openWindowNoStatus(myLink,windowName, intWidth, intHeight)
	{
		if(! window.focus)return;
		var myWin=window.open("",windowName,"width="+intWidth+",height="+intHeight+", status=0, resizable=0, dependent=0,scrollbars=0,left=" + (window.event.screenX - 16) + ",top=" + (window.event.screenY - 100));
		myWin.focus();
		myLink.target=windowName;
	}
	function openWindowURL(inURL,windowName, intWidth, intHeight)
	{
		if(! window.focus)return;
		var myWin=window.open(inURL,windowName,"width="+intWidth+",height="+intHeight+", status=1, resizable=yes, dependent=yes,scrollbars=yes");
		myWin.focus();
	}
	function CloseWindow(pRefresh)
	{
		if (pRefresh)
		{
			opener.location.reload();
		}
		window.close();
	}
	function displayInlineError(sField, sErrMsg)
	{
		var itop, ileft, size, sName, oItem;
					
		oItem = sField;
		if(typeof(oItem)!="object")
			return;
					
		itop = 0;
		ileft = 0;
					
		itop = oItem.offsetHeight;
		while (oItem.tagName != "MADY" ){
				itop  += oItem.offsetTop;
				ileft += oItem.offsetLeft;
			oItem = oItem.offsetParent;
		}
					
		divError.style.left = ileft +"px";
		divError.style.top  = itop +"px"; 
		divError.innerText = sErrMsg;
				
		divError.style.display = "inline";
	}
	function ClearError()
	{
		divError.style.display = 'none';
		//if (event.keyCode == 13)
			//goNextPage();
	}	
	function SetBGColor_Yes(objPass)
	{
		objPass.style.backgroundColor="yellow";
	}
	function SetBGColor_No(objPass)
	{
		objPass.style.backgroundColor="";
	}
	function NumericOnly(inObjectField)
	{
		var NumericType = /^[0-9]+$/;
		if (!(NumericType.test(inObjectField.value)))
		{
			SetBGColor_Yes(inObjectField);
			alert('ERROR: \n\nPlease Input Numeric Only!');
			inObjectField.select();
			inObjectField.focus();
			return false;
		}
		else
			return true;
	}
	function HaveValue(inObjectField, inFieldName, bSetFocus)
	{
		if (String(inObjectField.value).length == 0)
		{
			alert("ERROR: \n\nPlease Provide Your "+inFieldName+"!");
			if (bSetFocus==false)
				return false;
			else
			{
				inObjectField.focus();
				return false;
			}
		}
		else
			return true;
	}
	function IsEmail(inObjectField)
	{
	    var reEmail = /^.+@.+\..+$/;
		if (!(reEmail.test(inObjectField.value)))
		{
			alert("Email address should be in the format xxx@yyy.zzz");
			inObjectField.focus()
			return false;
		}
		else
		{
			return true;
		}
	}
	function validateZIP(inObjectField, bSetFocus) 
	{
		var strValue = inObjectField.value;
		var valid = "0123456789-";
		var hyphencount = 0;

		if (strValue.length!=5 && strValue.length!=10) 
		{
			alert("Please enter your 5 digit or 5 digit+4 zip code.");
			return false;
		}
		for (var i=0; i < strValue.length; i++) 
		{
			temp = "" + strValue.substring(i, i+1);
			if (temp == "-") hyphencount++;
			if (valid.indexOf(temp) == "-1") 
			{
				alert("Invalid characters in your zip code.  Please try again.");
				return false;
			}
			if ((hyphencount > 1) || ((strValue.length==10) && ""+strValue.charAt(5)!="-")) 
			{
				alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '#####-####'.   Please try again.");
				return false;
			}
			if (bSetFocus)
				inObjectField.focus();
		}
			
		return true;
	}
	function ConfirmVoid()
	{
		if (confirm('Are you sure you want to void the items?'))
			return true;
		else
			return false;
	}
	function ConfirmDelete()
	{
		if (confirm('Are you sure you want to delete the checked items?'))
			return true;
		else
			return false;
	}
	function ConfirmMessage(strMessage)
	{
		if (confirm(strMessage))
			return true;
		else
			return false;
	}
	function DisplayMessage(strMessage)
	{
		alert(strMessage);
	}
	function formatCurrency(num,bComma)
	{
		num = num.toString().replace(/\$|\,/g,'');
		if(isNaN(num))
		num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		if(cents<10)
		cents = "0" + cents;
		if (bComma==false)
		{
			for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
			num = num.substring(0,num.length-(4*i+3))+num.substring(num.length-(4*i+3));
		}
		else
		{
			for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
			num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));
		}
		return (((sign)?'':'-') + num + '.' + cents);
	}

	//BEGIN -- use to text append
	function pasteIcon(pObject, strValue)
	{
		pObject.focus();
		if (pObject.createTextRange && pObject.selected && pObject.selected.text.length == 0)
		{
			var selected = pObject.selected;
			selected.text = strValue;
		}
		else if ((strValue != null) && (strValue != ""))
		{
			pObject.value += strValue;
		}
		GetTextPosition(pObject);
	}
			
	function GetTextPosition(pObject)
	{
		if (pObject.createTextRange) 
		{
			pObject.selected = document.selection.createRange().duplicate();
		}
	}
	//END -- use to text append

	//BEGIN -- Use for check box highligh
	var objIE = document.all;

	function CheckOne(inMainForm, inObj)
	{
		if (inObj.checked)
		ChangeBGColor(inObj);
		else
		ResetBGColor(inObj);
		var intTotalCheckBox=intTotalUsedCheck=0;
		for (var i=0;i<inMainForm.elements.length;i++)
		{
			var objElement= inMainForm.elements[i];
			if ((objElement.name != 'ckhCheckAll') && (objElement.type=='checkbox'))
			{
				intTotalCheckBox++;
				if (objElement.checked)
					intTotalUsedCheck++;
			}
		}
		if (intTotalUsedCheck==intTotalCheckBox)
			inMainForm.ckhCheckAll.checked=true;
		else
			inMainForm.ckhCheckAll.checked=false;
	}

	function ChangeBGColor(inObj)
	{
		if (objIE)
		{
			while (inObj.tagName!="TR")
			{inObj=inObj.parentElement;}
		}
		else
		{
			while (inObj.tagName!="TR")
			{inObj=inObj.parentNode;}
		}
		if (inObj.className=="TDBG1" || inObj.className=="HIGHLIGHTROW1")
			inObj.className = "HIGHLIGHTROW1";
		else
			inObj.className = "HIGHLIGHTROW2";
	}

	function HighlighBGColor(inObj,inIsOn)
	{
		if (objIE)
		{
			while (inObj.tagName!="TR")
			{inObj=inObj.parentElement;}
		}
		else
		{
			while (inObj.tagName!="TR")
			{inObj=inObj.parentNode;}
		}
		//if (inObj.className=="TDBG1" || inObj.className=="HIGHLIGHTROW1")
		if(inIsOn)
			inObj.className = "HIGHLIGHTROW";
		else
			inObj.className = "";
	}

	function ResetBGColor(inObj)
	{
		if (objIE)
		{
			while (inObj.tagName!="TR")
			{inObj=inObj.parentElement;}
		}
		else
		{
			while (inObj.tagName!="TR")
			{inObj=inObj.parentNode;}
		}
		if (inObj.className=="TDBG1" || inObj.className=="HIGHLIGHTROW1")
			inObj.className = "TDBG1";
		else
			inObj.className = "TDBG2";
	}


	function CheckAll(inMainForm)
	{
		for (var i=0;i<inMainForm.elements.length;i++)
		{
			var objElement = inMainForm.elements[i];
			if ((objElement.name != 'ckhCheckAll') && (objElement.type=='checkbox'))
			{
				objElement.checked = inMainForm.ckhCheckAll.checked;
				//alert(substring(objElement.name,1,1));
				if (inMainForm.ckhCheckAll.checked && objElement.disabled==false)
				{
					ChangeBGColor(objElement);
				}
				else
				{
					objElement.checked=false;
					ResetBGColor(objElement);
				}
			}
		}
	}
	//END -- Use for check box highligh
