	function SelCall(call)
	{
		document.frmSelection.call.value = call;
		document.frmSelection.submit();
	}
  ///////////////////////////////////////////////////////////////////////////////////////////////////////
	function NewCall(dealer)
	{
		document.frmNewCall.ndc.value = dealer;
		document.frmNewCall.submit();
	}
  ///////////////////////////////////////////////////////////////////////////////////////////////////////
	function DelSO(OrdNbr)
	{
		document.frmDelOrd.dordnum.value = OrdNbr;
		document.frmDelOrd.submit();
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function ConvertSO(OrdNbr)
	{
		document.frmConvertOrd.cordnum.value = OrdNbr;
		document.frmConvertOrd.submit();
	}
  ///////////////////////////////////////////////////////////////////////////////////////////////////////
  function ApplyDealers(funcType)
	{
		GetHJCDealers();
		GetOXFDealers();
		GetCSTLDealers();
		GetNoneDealers();
		document.frmDealers.funcType.value = funcType;
		document.frmDealers.submit();
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function ClearSearch()
	{
		document.frmSearch.partSType.selectedIndex = 0;
		document.frmSearch.partSNum.value = '';
		document.frmSearch.submit();
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function ClearISSearch()
	{
		document.frmSearch.partSType.selectedIndex = 0;
		document.frmSearch.partSNum.value = '';
		document.frmSearch.fDate.value = '';
		document.frmSearch.tDate.value = '';
		document.frmSearch.submit();
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function ClearFOSearch()
	{
		document.frmSearch.custNbr.selectedIndex = 0;
		document.frmSearch.repList.selectedIndex = 0;
		document.frmSearch.submit();
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function GetHJCDealers()
  {
	var field = document.frmDealers.hjclist
	var CheckList = ''
	var UnCheckList = ''
	var fLength = 1
	  
	if (field.length >= 0) 
	{
	  fLength = field.length
	}
	
	if (document.frmDealers.numFields.value != "" && document.frmDealers.numFields.value != "0")
	{
	    for (i = 0; i < fLength; i++)
	    {
		  if (fLength > 1)
		  {
		    if (field[i].checked == true) 
	        {
			  CheckList = CheckList + field[i].value + ';'
		    }   
				else
				{
			  UnCheckList = UnCheckList + field[i].value + ';'
				} 
		  }
		  else
		  {
		    if (field.checked == true) 
	        {
			  CheckList = CheckList + field.value + ';'
					}
				else
				  {
				UnCheckList = UnCheckList + field.value + ';'
		      } 
		  }
		}
    }
	document.frmDealers.HJCChkList.value = CheckList
	document.frmDealers.HJCUnChkList.value = UnCheckList
  }
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function GetOXFDealers(funcType)
  {
	var field = document.frmDealers.oxflist
	var CheckList = ''
	var UnCheckList = ''
	var fLength = 1
	  
	if (field.length >= 0) 
	{
	  fLength = field.length
	}
	
	if (document.frmDealers.numFields.value != "" && document.frmDealers.numFields.value != "0")
	{
	    for (i = 0; i < fLength; i++)
	    {
		  if (fLength > 1)
		  {
		    if (field[i].checked == true) 
	        {
			  CheckList = CheckList + field[i].value + ';'
		    }   
				else
				  {
				UnCheckList = UnCheckList + field[i].value + ';'
		      } 
		  }
		  else
		  {
		    if (field.checked == true) 
	        {
			  CheckList = CheckList + field.value + ';'
		    } 
				else
				  {
				UnCheckList = UnCheckList + field.value + ';'
		      } 
		  }
		}
    }
	document.frmDealers.OXFChkList.value = CheckList
	document.frmDealers.OXFUnChkList.value = UnCheckList
  }
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function GetCSTLDealers(funcType)
  {
	var field = document.frmDealers.cstllist
	var CheckList = ''
	var UnCheckList = ''
	var fLength = 1
	  
	if (field.length >= 0) 
	{
	  fLength = field.length
	}
	
	if (document.frmDealers.numFields.value != "" && document.frmDealers.numFields.value != "0")
	{
	    for (i = 0; i < fLength; i++)
	    {
		  if (fLength > 1)
		  {
		    if (field[i].checked == true) 
	        {
			  CheckList = CheckList + field[i].value + ';'
		    }   
				else
				  {
				UnCheckList = UnCheckList + field[i].value + ';'
		      } 
		  }
		  else
		  {
		    if (field.checked == true) 
	        {
			  CheckList = CheckList + field.value + ';'
		    } 
				else
				  {
				UnCheckList = UnCheckList + field.value + ';'
		      } 
		  }
		}
    }
	document.frmDealers.CSTLChkList.value = CheckList
	document.frmDealers.CSTLUnChkList.value = UnCheckList
  }
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function GetNoneDealers()
  {
	var field = document.frmDealers.dlnone
	var CheckList = ''
	var UnCheckList = ''
	var fLength = 1
	  
	if (field.length >= 0) 
	{
	  fLength = field.length
	}
	
	if (document.frmDealers.numFields.value != "" && document.frmDealers.numFields.value != "0")
	{
	    for (i = 0; i < fLength; i++)
	    {
		  if (fLength > 1)
		  {
		    if (field[i].checked == true) 
	        {
			  CheckList = CheckList + field[i].value + ';'
		    }   
				else
				{
			  UnCheckList = UnCheckList + field[i].value + ';'
				} 
		  }
		  else
		  {
		    if (field.checked == true) 
	        {
			  CheckList = CheckList + field.value + ';'
					}
				else
				  {
				UnCheckList = UnCheckList + field.value + ';'
		      } 
		  }
		}
    }
	document.frmDealers.NoneChkList.value = CheckList
	document.frmDealers.NoneUnChkList.value = UnCheckList
  }
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function SetTypeChk(funcType)
		{
			if (funcType == 0)
			{
				if (document.frmRepType.repType[0].checked == true)
				{
				document.frmRepType.lstDealer.disabled = false
				document.frmRepType.lstSignUp.disabled = true
				}
				else
				{
				document.frmRepType.lstDealer.disabled = true
				}
			}
			else if (funcType == 1)
			{
				if (document.frmRepType.repType[1].checked == true)
				{
				document.frmRepType.lstSignUp.disabled = false
				document.frmRepType.lstDealer.disabled = true
				}
				else
				{
				document.frmRepType.lstSignUp.disabled = true
				}
			}
			else if (funcType == 2)
			{
				document.frmRepType.repType[2].checked = true
				document.frmRepType.lstDealer.disabled = true
				document.frmRepType.lstSignUp.disabled = true
			}
			else if (funcType == 3)
			{
				document.frmRepType.repType[3].checked = true
				document.frmRepType.lstDealer.disabled = true
				document.frmRepType.lstSignUp.disabled = true
			}
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function SetWindow(winLocation)
	{
	  window.location = winLocation
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function ReadCookie(name)
	{
	  var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++)
		{
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function SetCookie(name,value,days)
	{
		if (days)
		{
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+";path=/;";
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function deleteCookie(name) {
		//SetCookie(name,"",-1)
		var kill_time = new Date("January 1, 1970");
		var kill_string = "name="+name+";expires=" + kill_time.toGMTString() + ";path=/;"
    document.cookie=kill_string; // delete cookie
  }
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function CheckCookies()
	{
		testValue=Math.floor(1000*Math.random());
		SetCookie('AreCookiesEnabled',testValue);
		if (testValue==ReadCookie('AreCookiesEnabled')) 
		{
				 //Cookies Enabled
		return true
		}
		else
		{
		alert('To Access CastleSales.NET, You Must Have Cookies Enabled In Your Browser.\n\n1. In Internet Explorer, click Internet Options on the Tools menu (or View menu in Internet Explorer version 4.x).\n\n2. In Internet Explorer 5, click the Security tab, and then click Custom Level. Click Enable or Prompt under Allow cookies that\n are stored on your computer. In Internet Explorer 4.x, click the Advanced tab, and then click Prompt Before Accepting Cookies\n or Always Accept Cookies.\n\n3. Click OK until you return to Internet Explorer.\n\n4. Connect to the Web address from which you received the "Not accepting cookies" error message to verify\n that you are able to gain access to the Web page.')
		return false
		}
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function RepTypeSubmit()
		{
		  if (document.frmRepType.repType[0].checked == true)
		  {
			SetCookie('jCustChosen','True');
			document.frmRepType.action = '../dealer/default.asp';
		  }
			else if (document.frmRepType.repType[1].checked == true)
		  {
			document.frmRepType.action = 'confirmsu.asp';
		  }
		  else if (document.frmRepType.repType[2].checked == true)
		  {
			document.frmRepType.action = 'confirm.asp';
		  }
			else if (document.frmRepType.repType[3].checked == true)
		  {
			SetCookie('jCustChosen','True');
			document.frmRepType.action = '../demo/default.asp';
		  }
		  document.frmRepType.submit();
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function CustSearchSubmit(custnum)
		{
			document.frmSearchList.lstdealer.value = custnum
		  document.frmSearchList.submit()
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function RepSubmit(UserID)
		{
			document.frmRepDetail.selUserID.value = UserID
		  document.frmRepDetail.submit()
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function RequestSubmit(RID)
		{
			document.frmRequestDetail.selRID.value = RID
		  document.frmRequestDetail.submit()
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function EditCust(funcType)
		{
			document.frmCustAcct.funcType.value = funcType
			if(funcType == '1')
			{
				VF_frmCustAcct();
			}
			else
			{
		    document.frmCustAcct.submit()
			}
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function DisplayCust(custnum)
		{
			document.frmToCustDisplay.lstdealer.value = custnum
		  document.frmToCustDisplay.submit()
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function AcctSubmit(funcType)
		{
		  if (funcType == 0)
		  {
			document.getElementById("frmTopMenu").action = '../rep/invoices.asp'
		  }
		  else if (funcType == 1)
		  {
			document.getElementById("frmTopMenu").action = '../rep/backorders.asp'
		  }
		  else if (funcType == 2)
		  {
			document.getElementById("frmTopMenu").action = '../rep/item_sales_history.asp'
		  }
			else if (funcType == 3)
		  {
			document.getElementById("frmTopMenu").action = '../rep/notes.asp'
		  }
			else if (funcType == 4)
		  {
			document.getElementById("frmTopMenu").action = '../rep/top_sales_chart.asp'
		  }
			else if (funcType == 5)
		  {
			document.getElementById("frmTopMenu").action = '../rep/racks.asp'
		  }
		  document.getElementById("frmTopMenu").submit()
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function DAcctSubmit(funcType)
		{
		  if (funcType == 0)
		  {
			document.getElementById("frmTopMenu").action = '../dealer/invoices.asp'
		  }
		  else if (funcType == 1)
		  {
			document.getElementById("frmTopMenu").action = '../dealer/backorders.asp'
		  }
		  else if (funcType == 2)
		  {
			document.getElementById("frmTopMenu").action = '../dealer/item_sales_history.asp'
		  }
			else if (funcType == 3)
		  {
			document.getElementById("frmTopMenu").action = '../dealer/notes.asp'
		  }
			else if (funcType == 4)
		  {
			document.getElementById("frmTopMenu").action = '../dealer/racks.asp'
		  }
		  document.getElementById("frmTopMenu").submit()
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function MAcctSubmit(funcType)
		{
		  if (funcType == 0)
		  {
			document.getElementById("frmTopMenu").action = '../demo/invoices.asp'
		  }
		  else if (funcType == 1)
		  {
			document.getElementById("frmTopMenu").action = '../demo/backorders.asp'
		  }
		  else if (funcType == 2)
		  {
			document.getElementById("frmTopMenu").action = '../demo/itemsales.asp'
		  }
		  document.getElementById("frmTopMenu").submit()
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function AAcctSubmit(funcType)
		{
		  if (funcType == 0)
		  {
			document.getElementById("frmTopMenu").action = '../accounting/invoices.asp'
		  }
		  else if (funcType == 1)
		  {
			document.getElementById("frmTopMenu").action = '../accounting/backorders.asp'
		  }
		  else if (funcType == 2)
		  {
			document.getElementById("frmTopMenu").action = '../accounting/itemsales.asp'
		  }
		  document.getElementById("frmTopMenu").submit()
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function IAcctSubmit(funcType)
		{
		  if (funcType == 0)
		  {
			document.getElementById("frmTopMenu").action = '../inhouse/invoices.asp'
		  }
		  else if (funcType == 1)
		  {
			document.getElementById("frmTopMenu").action = '../inhouse/backorders.asp'
		  }
		  else if (funcType == 2)
		  {
			document.getElementById("frmTopMenu").action = '../inhouse/item_sales_history.asp'
		  }
			else if (funcType == 3)
		  {
			document.getElementById("frmTopMenu").action = '../inhouse/notes.asp'
		  }
			else if (funcType == 4)
		  {
			document.getElementById("frmTopMenu").action = '../inhouse/vendorexclusions.asp'
		  }
		  document.getElementById("frmTopMenu").submit()
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function isNumber(evt)
		{
			IE = document.all;
			if (IE)
			{  
				var keycode = window.event.keyCode;
				//if (keycode < 48 || keycode > 57) return false;
				if ((keycode >= 48 && keycode <= 57) || keycode == 13)
				{
				return true;
				}
				else
				{
				window.event.keyCode = 0;
				return false;
				}
			} 
			else
			{
				keycode = evt.which;
				var bs = String.fromCharCode(evt.which);
				//if (keycode < 48 || keycode > 57) return false;
				if ((keycode >= 48 && keycode <= 57) || keycode == 13)
				{
				return true;
				}
				else
				{
				evt.which = 0;
				return false;
				}
			}
		//return false;
		}
  ///////////////////////////////////////////////////////////////////////////////////////////////////////
	function ISPartType()
		{
		  if (document.frmSearch.partSType.value != 'none')
			{
				document.frmSearch.partSNum.value = ''
			}
	  }
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function PartNumFormat(frmname, boxname, evt)
		{
			IE = document.all;

			if (IE) 
			{
				var keycode = window.event.keyCode;
				var shift   = window.event.shiftKey;
				var ctrl    = window.event.ctrlKey;
				var alt     = window.event.altKey;
				var tmpStr = document.getElementById(boxname).value;
				var pos     = tmpStr.length + 1;
				var lparen  = (shift  && !ctrl && !alt && keycode == 40);
				var rparen  = (shift  && !ctrl && !alt && keycode == 41);
				var space   = (!shift && !ctrl && !alt && keycode == 32);
				var dash    = (!shift && !ctrl && !alt && keycode == 45);
				var slash   = (!shift && !ctrl && !alt && keycode == 47);
				var digit   = (!shift && !ctrl && !alt && keycode >= 48 && keycode <= 57);
	
				if (keycode == 13) document.getElementById(frmname).submit();
				
				if (!dash && !digit && !slash && !space) return false;
				if (dash) return false;
				if (pos == 1  && digit) return true;
				if (pos == 2  && digit) return true;
				if (pos == 3  && dash)   { document.getElementById(boxname).value += '-'; return false; }
				if (pos == 3  && slash)  { document.getElementById(boxname).value += '-'; return false; }
				if (pos == 3  && space)  { document.getElementById(boxname).value += '-'; return false; }
				if (pos == 3  && digit)  { document.getElementById(boxname).value += '-'; return true; }
				if (pos == 4  && digit) return true;
				if (pos == 5  && digit) return true;
				if (pos == 6  && digit) return true;
				if (pos == 7  && digit) return true;
				if (pos == 8  && digit) return true;
				if (pos == 9  && digit) return true;
				if (pos == 10  && digit) return true;
		  } 
			else
			{
				keycode = evt.which;
				var bs = String.fromCharCode(evt.which);
				if (keycode >= 48 && keycode <= 57) return true;
				if (keycode == 0) return true;
				if ((keycode == 32) || (keycode >= 40 && keycode <= 41) || (keycode >= 45 && keycode <= 46)) return true;
				if (bs == "\b") return true;
				//if (keycode == 13) checkForm();
				return false;
    	}
		return false;
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function ISPartNum(evt)
		{
			IE = document.all;

			if (IE) 
			{
				var keycode = window.event.keyCode;
				var shift   = window.event.shiftKey;
				var ctrl    = window.event.ctrlKey;
				var alt     = window.event.altKey;
				var tmpStr = document.frmSearch.partSNum.value;
				var pos     = tmpStr.length + 1;
				var lparen  = (shift  && !ctrl && !alt && keycode == 40);
				var rparen  = (shift  && !ctrl && !alt && keycode == 41);
				var space   = (!shift && !ctrl && !alt && keycode == 32);
				var dash    = (!shift && !ctrl && !alt && keycode == 45);
				var slash   = (!shift && !ctrl && !alt && keycode == 47);
				var digit   = (!shift && !ctrl && !alt && keycode >= 48 && keycode <= 57);
	
				if (keycode == 13) document.frmSearch.submit();
				
				document.frmSearch.partSType.selectedIndex = 0;
				
				if (!dash && !digit && !slash && !space) return false;
				if (dash) return false;
				if (pos == 1  && digit) return true;
				if (pos == 2  && digit) return true;
				if (pos == 3  && dash)   { document.frmSearch.partSNum.value += '-'; return false; }
				if (pos == 3  && slash)  { document.frmSearch.partSNum.value += '-'; return false; }
				if (pos == 3  && space)  { document.frmSearch.partSNum.value += '-'; return false; }
				if (pos == 3  && digit)  { document.frmSearch.partSNum.value += '-'; return true; }
				if (pos == 4  && digit) return true;
				if (pos == 5  && digit) return true;
				if (pos == 6  && digit) return true;
				if (pos == 7  && digit) return true;
				if (pos == 8  && digit) return true;
				if (pos == 9  && digit) return true;
				if (pos == 10  && digit) return true;
		  } 
			else
			{
				keycode = evt.which;
				var bs = String.fromCharCode(evt.which);
				if (keycode >= 48 && keycode <= 57) return true;
				if (keycode == 0) return true;
				if ((keycode == 32) || (keycode >= 40 && keycode <= 41) || (keycode >= 45 && keycode <= 46)) return true;
				if (bs == "\b") return true;
				//if (keycode == 13) checkForm();
				return false;
    	}
		return false;
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function ISInvPartNum(evt)
		{
			IE = document.all;

			if (IE) 
			{
				var keycode = window.event.keyCode;
				var shift   = window.event.shiftKey;
				var ctrl    = window.event.ctrlKey;
				var alt     = window.event.altKey;
				var tmpStr = document.frmSearch.partSNum.value;
				var pos     = tmpStr.length + 1;
				var lparen  = (shift  && !ctrl && !alt && keycode == 40);
				var rparen  = (shift  && !ctrl && !alt && keycode == 41);
				var space   = (!shift && !ctrl && !alt && keycode == 32);
				var dash    = (!shift && !ctrl && !alt && keycode == 45);
				var slash   = (!shift && !ctrl && !alt && keycode == 47);
				var digit   = (!shift && !ctrl && !alt && keycode >= 48 && keycode <= 57);
	
				//document.frmSearch.lstSeasons.value = 'none';
				//document.frmSearch.lstGroups.value = 'none';
				//document.frmSearch.lstStyles.value = 'none';
				//document.frmSearch.lstPartTypes.value = 'none';
	
				//if (keycode == 13) checkForm();
				if (!dash && !digit && !slash && !space) return false;
				if (dash) return false;
				if (pos == 1  && digit) return true;
				if (pos == 2  && digit) return true;
				if (pos == 3  && dash)   { document.frmSearch.partSNum.value += '-'; return false; }
				if (pos == 3  && slash)  { document.frmSearch.partSNum.value += '-'; return false; }
				if (pos == 3  && space)  { document.frmSearch.partSNum.value += '-'; return false; }
				if (pos == 3  && digit)  { document.frmSearch.partSNum.value += '-'; return true; }
				if (pos == 4  && digit) return true;
				if (pos == 5  && digit) return true;
				if (pos == 6  && digit) return true;
				if (pos == 7  && digit) return true;
				if (pos == 8  && digit) return true;
				if (pos == 9  && digit) return true;
				if (pos == 10  && digit) return true;
		  } 
			else
			{
				keycode = evt.which;
				var bs = String.fromCharCode(evt.which);
				if (keycode >= 48 && keycode <= 57) return true;
				if (keycode == 0) return true;
				if ((keycode == 32) || (keycode >= 40 && keycode <= 41) || (keycode >= 45 && keycode <= 46)) return true;
				if (bs == "\b") return true;
				//if (keycode == 13) checkForm();
				return false;
    	}
		return false;
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function ItemEnterPartNum(obj, evt)
		{
			IE = document.all;

			if (IE) 
			{
				var keycode = window.event.keyCode;
				var shift   = window.event.shiftKey;
				var ctrl    = window.event.ctrlKey;
				var alt     = window.event.altKey;
				var tmpStr = obj.value;
				var pos     = tmpStr.length + 1;
				var lparen  = (shift  && !ctrl && !alt && keycode == 40);
				var rparen  = (shift  && !ctrl && !alt && keycode == 41);
				var space   = (!shift && !ctrl && !alt && keycode == 32);
				var dash    = (!shift && !ctrl && !alt && keycode == 45);
				var slash   = (!shift && !ctrl && !alt && keycode == 47);
				var digit   = (!shift && !ctrl && !alt && keycode >= 48 && keycode <= 57);
	
				//document.frmSearch.lstSeasons.value = 'none';
				//document.frmSearch.lstGroups.value = 'none';
				//document.frmSearch.lstStyles.value = 'none';
				//document.frmSearch.lstPartTypes.value = 'none';
	
				//if (keycode == 13) checkForm();
				if (!dash && !digit && !slash && !space) return false;
				if (dash) return false;
				if (pos == 1  && digit) return true;
				if (pos == 2  && digit) return true;
				if (pos == 3  && dash)   { obj.value += '-'; return false; }
				if (pos == 3  && slash)  { obj.partSNum.value += '-'; return false; }
				if (pos == 3  && space)  { obj.value += '-'; return false; }
				if (pos == 3  && digit)  { obj.value += '-'; return true; }
				if (pos == 4  && digit) return true;
				if (pos == 5  && digit) return true;
				if (pos == 6  && digit) return true;
				if (pos == 7  && digit) return true;
				if (pos == 8  && digit) return true;
				if (pos == 9  && digit) return true;
				if (pos == 10  && digit) return true;
		  } 
			else
			{
				keycode = evt.which;
				var bs = String.fromCharCode(evt.which);
				if (keycode >= 48 && keycode <= 57) return true;
				if (keycode == 0) return true;
				if ((keycode == 32) || (keycode >= 40 && keycode <= 41) || (keycode >= 45 && keycode <= 46)) return true;
				if (bs == "\b") return true;
				//if (keycode == 13) checkForm();
				return false;
    	}
		return false;
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function SetFocus(obj)
	{
		document.getElementById(obj).focus();
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function textClear(obj)
	{
		document.getElementById(obj).value = '';
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function InvSearch(subType, selNbr)
	{
		if(selNbr == 0)
		{
		  document.frmSearch.lstGroups.value = 'none'
			document.frmSearch.lstStyles.value = 'none'
			document.frmSearch.lstPartTypes.value = 'none'
		}
		else if(selNbr == 1) 
		{
			document.frmSearch.lstStyles.value = 'none'
			document.frmSearch.lstPartTypes.value = 'none'
		}
		else if(selNbr == 2) 
		{
		  document.frmSearch.lstPartTypes.value = 'none'
		}
		document.frmSearch.funcType.value = subType;
		if(subType == 1)
		{
		VF_frmSearch();
		}
		else
		{
		document.frmSearch.submit();
		}
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function InvReturnHit(evt)
		{
			IE = document.all;
			if (IE)
			{  
				var keycode = window.event.keyCode;
				//if (keycode < 48 || keycode > 57) return false;
				if (keycode == 13)
				{
				InvSearch(1, 9)
				}
			} 
			else
			{
				keycode = evt.which;
				var bs = String.fromCharCode(evt.which);
				//if (keycode < 48 || keycode > 57) return false;
				if (keycode == 13)
				{
				InvSearch(1, 9)
				}
			}
		//return false;
		}
  ///////////////////////////////////////////////////////////////////////////////////////////////////////
	function InvStandardKeyOnly(evt)
		{
			IE = document.all;
			if (IE)
			{  
				var keycode = window.event.keyCode;
				//if (keycode < 48 || keycode > 57) return false;
				if (keycode == 34 || keycode == 37 || keycode == 39)
				{
				window.event.keyCode = 0;
				return false;
				}
			} 
			else
			{
				keycode = evt.which;
				var bs = String.fromCharCode(evt.which);
				//if (keycode < 48 || keycode > 57) return false;
				if (keycode == 34 || keycode == 37 || keycode == 39)
				{
				evt.which = 0;
				return false;
				}
			}
		//return false;
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function getwindowsize()
	{
	  if (navigator.userAgent.indexOf("MSIE") > 0)
		{ //internet browser
	    clientWinWidth = screen.width //document.body.clientWidth
	    clientWinHeight = screen.height //document.body.clientHeight
	  } 
	  else 
	  {     //netscape browser  
	    clientWinWidth = screen.width //window.outerWidth
	    clientWinHeight =  screen.height //window.outerHeight
	  }
	  return (clientWinWidth+'x'+clientWinHeight);      
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function AltPart(partNbr)
		{
			document.frmAltQty.partSNum.value = partNbr
		  document.frmAltQty.submit()
		}
  ///////////////////////////////////////////////////////////////////////////////////////////////////////
	function UViewType(viewState, viewUsers)
		{
			document.frmViewType.viewType.value = viewState
			document.frmViewType.viewUType.value = viewUsers
		  document.frmViewType.submit()
		}
  ///////////////////////////////////////////////////////////////////////////////////////////////////////
	function NewsEditSubmit(newsID1, funcType1)
		{
			document.frmList.newsID.value = newsID1
			document.frmList.funcType.value = funcType1
		  document.frmList.submit()
		}
  ///////////////////////////////////////////////////////////////////////////////////////////////////////
	function MoveUp(ID)
    {
	  document.frmMove.NewsID.value = ID;
	  document.frmMove.UpDown.value = 'Up'
	  document.frmMove.submit();
	}
  ///////////////////////////////////////////////////////////////////////////////////////////////////////
  function MoveDown(ID)
   {
	  document.frmMove.NewsID.value = ID;
	  document.frmMove.UpDown.value = 'Down'
	  document.frmMove.submit();	  
	}
  ///////////////////////////////////////////////////////////////////////////////////////////////////////
	function SetIEnter(tmpFuncType, tmpValue)
	{
		document.frmSearch.funcType.value = tmpFuncType
		if(tmpValue != '' && tmpValue != null)
		{
			document.frmSearch.tmpVal.value = tmpValue;
		}
		document.frmSearch.submit()
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function SetItem(BoxNum, ItemNum)
	{
		document.getElementById('partSNum'+BoxNum).value = ItemNum;
		SetFocus('partSQty'+BoxNum);
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function SetBOValues(CustNum, BONum, BOItm)
	{
		document.frmConfirm.cNum.value = CustNum;
		document.frmConfirm.boNum.value = BONum;
		document.frmConfirm.boItm.value = BOItm;
		document.frmConfirm.submit();
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function GetBoxValue(BoxNum)
	{
		bValue = document.getElementById('partSNum'+BoxNum).value;
		return bValue;
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function CheckOEBoxes()
	{
		i = 1
		allFilled = true
		while (i < 16)
		{
			tmpI = i+'';
			vQty = document.getElementById('partSQty'+tmpI).value;
			vPart = document.getElementById('partSNum'+tmpI).value;
			if (vQty.length == 0 || vPart.length == 0)
			{
				allFilled = false;
				break;
			}
			i++;
		}
		if (allFilled == true)
		{
			document.frmSearch.mButton.disabled = false;
		}
		else
		{
			document.frmSearch.mButton.disabled = true;
		}
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function GetOrdersToCombine()
  {
	var field = document.frmCombineOrders.orders
	var CheckList = ''
	var UnCheckList = ''
	var fLength = 1
	  
	if (field.length >= 0) 
	{
	  fLength = field.length
	}
	
	if (document.frmCombineOrders.numFields.value != "" && document.frmCombineOrders.numFields.value != "0")
	{
	    for (i = 0; i < fLength; i++)
	    {
		  if (fLength > 1)
		  {
		    if (field[i].checked == true) 
	        {
			  CheckList = CheckList + field[i].value + ';'
		    }   
				else
				{
			  UnCheckList = UnCheckList + field[i].value + ';'
				} 
		  }
		  else
		  {
		    if (field.checked == true) 
	        {
			  CheckList = CheckList + field.value + ';'
					}
				else
				  {
				UnCheckList = UnCheckList + field.value + ';'
		      } 
		  }
		}
    }
	document.frmCombineOrders.OrdList.value = CheckList;
	document.frmCombineOrders.submit();
  }
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function checkFields()
  {
    var field = document.frmCombineOrders.orders
	  var haveCheck = false
	  
	  var fLength = 1
		var numChecked = 0
	  
	  if (field.length >= 0) 
	  {
	    fLength = field.length
	  }
	  
	  if (document.frmCombineOrders.numFields.value != "" && document.frmCombineOrders.numFields.value != "0")
	  {
	      for (i = 0; i < fLength; i++)
	 	  {
			if (fLength > 1)
			{
		      if (field[i].checked == true) 
			  {
			    haveCheck = true
					numChecked++
			  }
			}
			else
			{
			  if (field.checked == true) 
			  {
			    haveCheck = true
					numChecked++
			  }  
			}
		  }
		  
		  if (haveCheck == true && numChecked >= 2)
		  {
			document.frmCombineOrders.btnCombine.disabled = false
		  }
		  else
		  {
			document.frmCombineOrders.btnCombine.disabled = true
		  }
	  }
  }
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function GetUserGroups()
  {
	  var tmpValue = ''
		var obj = document.frmRepInfo
	  for (i=0; i<obj.lstAssignGrps.options.length; i++)
	  {
	    tmpValue = tmpValue + obj.lstAssignGrps.options[i].value + '|'
	  }
	  obj.assignedgrps.value = tmpValue
  }
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function GetGroupPages()
  {
	  var tmpValue = ''
		var obj = document.frmGroupPages
	  for (i=0; i<obj.lstAssignGrps.options.length; i++)
	  {
	    tmpValue = tmpValue + obj.lstAssignGrps.options[i].value + '|'
	  }
	  obj.assignedgrps.value = tmpValue
		obj.submit()
  }
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function EditPage(pageID, funcType)
		{
			document.frmPages.pID.value = pageID
			document.frmPages.fType.value = funcType
		  document.frmPages.submit()
		}
  ///////////////////////////////////////////////////////////////////////////////////////////////////////
	function EditCalendar(eventID, funcType)
		{
			document.frmCalendar.eID.value = eventID
			document.frmCalendar.fType.value = funcType
		  document.frmCalendar.submit()
		}
  ///////////////////////////////////////////////////////////////////////////////////////////////////////
	function ReprintOrd(ordNbr)
		{
			document.frmReprint.ordNum.value = ordNbr
		  document.frmReprint.submit()
		}
  ///////////////////////////////////////////////////////////////////////////////////////////////////////
	function addEmail(eAddr, optNbr)
	{
		var bgColor = document.getElementById('contacts').options[optNbr].style.background
		if (bgColor == '#cccccc')
		{
			var emailList = document.getElementById('to').value;
			var rEAddr = eAddr+';';
			nEmailList = emailList.replace(rEAddr, '');
			document.getElementById('to').value = nEmailList;
			document.getElementById('contacts').options[optNbr].style.background='';
			numCustEmail--;
			if (numCustEmail == 1)
			{
				document.getElementById('numCustEmail').innerHTML = '&nbsp;'+numCustEmail+' Customer Added';
			}
			else
			{
			  document.getElementById('numCustEmail').innerHTML = '&nbsp;'+numCustEmail+' Customers Added';
			}
		}
		else
		{
			document.getElementById('to').value = document.getElementById('to').value + eAddr + ';'
			document.getElementById('contacts').options[optNbr].style.background='#cccccc'
			numCustEmail++;
			if (numCustEmail == 1)
			{
				document.getElementById('numCustEmail').innerHTML = '&nbsp;'+numCustEmail+' Customer Added';
			}
			else
			{
			  document.getElementById('numCustEmail').innerHTML = '&nbsp;'+numCustEmail+' Customers Added';
			}
		}
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function addAllEmail()
	{
		var tmpValue = '';
		var obj = document.getElementById('contacts');
	  for (i=0; i<obj.options.length; i++)
	  {
			var bgColor = document.getElementById('contacts').options[i].style.background
			if (bgColor != '#cccccc')
			{
				tmpValue = obj.options[i].value;
				document.getElementById('to').value = document.getElementById('to').value + tmpValue + ';'
				document.getElementById('contacts').options[i].style.background='#cccccc'
				numCustEmail++;
				if (numCustEmail == 1)
				{
					document.getElementById('numCustEmail').innerHTML = '&nbsp;'+numCustEmail+' Customer Added';
				}
				else
				{
					document.getElementById('numCustEmail').innerHTML = '&nbsp;'+numCustEmail+' Customers Added';
				}
			}
	  }
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function onlyBackspace()
	{
		IE = document.all;
		if (IE)
		{  
			var keycode = window.event.keyCode;
			//if (keycode < 48 || keycode > 57) return false;
			if (keycode == 8)
			{
			return true;
			}
			else
			{
			window.event.keyCode = 0;
			return false;
			}
		} 
		else
		{
			keycode = evt.which;
			var bs = String.fromCharCode(evt.which);
			//if (keycode < 48 || keycode > 57) return false;
			if (keycode == 8)
			{
			return true;
			}
			else
			{
			evt.which = 0;
			return false;
			}
		}
	//return false;
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function formatCurrency(num) {
	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;
	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);
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function FormatPartNum(obj, evt)
		{
			IE = document.all;

			if (IE) 
			{
				var keycode = window.event.keyCode;
				var shift   = window.event.shiftKey;
				var ctrl    = window.event.ctrlKey;
				var alt     = window.event.altKey;
				var tmpStr = obj.value;
				var pos     = tmpStr.length + 1;
				var lparen  = (shift  && !ctrl && !alt && keycode == 40);
				var rparen  = (shift  && !ctrl && !alt && keycode == 41);
				var space   = (!shift && !ctrl && !alt && keycode == 32);
				var dash    = (!shift && !ctrl && !alt && keycode == 45);
				var slash   = (!shift && !ctrl && !alt && keycode == 47);
				var digit   = (!shift && !ctrl && !alt && keycode >= 48 && keycode <= 57);
	
				//document.frmSearch.lstSeasons.value = 'none';
				//document.frmSearch.lstGroups.value = 'none';
				//document.frmSearch.lstStyles.value = 'none';
				//document.frmSearch.lstPartTypes.value = 'none';
	
				//if (keycode == 13) checkForm();
				if (!dash && !digit && !slash && !space) return false;
				if (dash) return false;
				if (pos == 1  && digit) return true;
				if (pos == 2  && digit) return true;
				if (pos == 3  && dash)   { obj.value += '-'; return false; }
				if (pos == 3  && slash)  { obj.value += '-'; return false; }
				if (pos == 3  && space)  { obj.value += '-'; return false; }
				if (pos == 3  && digit)  { obj.value += '-'; return true; }
				if (pos == 4  && digit) return true;
				if (pos == 5  && digit) return true;
				if (pos == 6  && digit) return true;
				if (pos == 7  && digit) return true;
				if (pos == 8  && digit) return true;
				if (pos == 9  && digit) return true;
				if (pos == 10  && digit) return true;
		  } 
			else
			{
				keycode = evt.which;
				var bs = String.fromCharCode(evt.which);
				if (keycode >= 48 && keycode <= 57) return true;
				if (keycode == 0) return true;
				if ((keycode == 32) || (keycode >= 40 && keycode <= 41) || (keycode >= 45 && keycode <= 46)) return true;
				if (bs == "\b") return true;
				//if (keycode == 13) checkForm();
				return false;
    	}
		return false;
		}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function chkdate(objName) {
	var strDatestyle = "US"; //United States date style
	//var strDatestyle = "EU";  //European date style
	var strDate;
	var strDateArray;
	var strDay;
	var strMonth;
	var strYear;
	var intday;
	var intMonth;
	var intYear;
	var booFound = false;
	var datefield = objName;
	var strSeparatorArray = new Array("-"," ","/",".");
	var intElementNr;
	var err = 0;
	var strMonthArray = new Array(12);
	strMonthArray[0] = "Jan";
	strMonthArray[1] = "Feb";
	strMonthArray[2] = "Mar";
	strMonthArray[3] = "Apr";
	strMonthArray[4] = "May";
	strMonthArray[5] = "Jun";
	strMonthArray[6] = "Jul";
	strMonthArray[7] = "Aug";
	strMonthArray[8] = "Sep";
	strMonthArray[9] = "Oct";
	strMonthArray[10] = "Nov";
	strMonthArray[11] = "Dec";
	strDate = datefield.value;
	if (strDate.length < 1) {
	return true;
	}
	for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
	if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
	strDateArray = strDate.split(strSeparatorArray[intElementNr]);
	if (strDateArray.length != 3) {
	err = 1;
	return false;
	}
	else {
	strDay = strDateArray[0];
	strMonth = strDateArray[1];
	strYear = strDateArray[2];
	}
	booFound = true;
		 }
	}
	if (booFound == false) {
	if (strDate.length>5) {
	strDay = strDate.substr(0, 2);
	strMonth = strDate.substr(2, 2);
	strYear = strDate.substr(4);
		 }
	}
	if (strYear.length == 2) {
	strYear = '20' + strYear;
	}
	// US style
	if (strDatestyle == "US") {
	strTemp = strDay;
	strDay = strMonth;
	strMonth = strTemp;
	}
	intday = parseInt(strDay, 10);
	if (isNaN(intday)) {
	err = 2;
	return false;
	}
	intMonth = parseInt(strMonth, 10);
	if (isNaN(intMonth)) {
	for (i = 0;i<12;i++) {
	if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
	intMonth = i+1;
	strMonth = strMonthArray[i];
	i = 12;
		 }
	}
	if (isNaN(intMonth)) {
	err = 3;
	return false;
		 }
	}
	intYear = parseInt(strYear, 10);
	if (isNaN(intYear)) {
	err = 4;
	return false;
	}
	if (intMonth>12 || intMonth<1) {
	err = 5;
	return false;
	}
	if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
	err = 6;
	return false;
	}
	if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
	err = 7;
	return false;
	}
	if (intMonth == 2) {
	if (intday < 1) {
	err = 8;
	return false;
	}
	if (LeapYear(intYear) == true) {
	if (intday > 29) {
	err = 9;
	return false;
	}
	}
	else {
	if (intday > 28) {
	err = 10;
	return false;
	}
	}
	}
	if (strDatestyle == "US") {
	//datefield.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
	}
	else {
	//datefield.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
	}
	return true;
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function LeapYear(intYear) {
	if (intYear % 100 == 0) {
	if (intYear % 400 == 0) { return true; }
	}
	else {
	if ((intYear % 4) == 0) { return true; }
	}
	return false;
	}
  ///////////////////////////////////////////////////////////////////////////////////////////////////////
	function Trim(sInString) {
		sInString = sInString.replace( /^\s+/g, "" );// strip leading
		return sInString.replace( /\s+$/g, "" );// strip trailing
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function Chr(AsciiNum)
	{
		return String.fromCharCode(AsciiNum)
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	function Asc(String)
	{
		return String.charCodeAt(0);
	}
	///////////////////////////////////////////////////////////////////////////////////////////////////////
