//<SCRIPT LANGUAGE="JavaScript">

function new_window(file) {
popupWin = window.open(file,'WindowName','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=420')
}

function new_window650_550(file) {
popupWin = window.open(file,'DealWin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=650,height=550')
}

function new_window650_600(file) {
popupWin = window.open(file,'DealWin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=650,height=600')
}

function new_window650_830(file) {
popupWin = window.open(file,'DealWin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=650,height=830')
}

function new_window2(file,clause) {
popupWin = window.open(file,'WindowName',clause)
}

function new_window600(file) {
popupWin = window.open(file,'Wide_w600','toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=600,height=600')
}

function new_window_wide(file) {
popupWin = window.open(file,'Wide_Window','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=840,height=450')
}

function new_comm_window_wide(file) {
popupWin = window.open(file,'Cmt_Window','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=600')
}

function new_window800(file) {
popupWin = window.open(file,'Wide_W800','toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=840,height=650')
}
function new_window600x400(file) {
popupWin = window.open(file,'Wide_600x400','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=400')
}

function new_window880(file) {
popupWin = window.open(file,'Wide_W880','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=890,height=650')
}
function new_windowNorm(file) {
popupWin = window.open(file,'Norm_W800','toolbar=1,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=830,height=650')
}

function NewEmpHand(user,sessn) {
popup = window.open("/newemphand.htm?User=" + user + "&Sessn=" + sessn,"","height=250,width=275,left=60,top=150,scrollbars=no");
}
function NewAlert(User) {
// popup = window.open("/alert_mess.htm?User=" + User,"","height=500,width=450,left=60,top=150,scrollbars=yes");
window.top.detail.location.href='/alert_mess.htm?User=' + User;
}
function CustNewAlert(User) {
popup = window.open("/calert_mess.htm?User=" + User,"","height=300,width=350,left=150,top=150,scrollbars=yes");
}

function HelpPopUp(helpf) {
popup = window.open(helpf,"","height=225,width=275,scrollbars=no");
}

function HPopUp(helpf) {                                         
popup = window.open(helpf,"","height=580,width=460,scrollbars=yes,resizable=yes"); 
}
function new_reason(file,usr,cntr) {
popupWin = window.open(file + "?User=" + usr +  "&cntr=" + cntr,'reason_window','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=400')
}
function new_mailwin(file) {
popupWin = window.open(file,'MailWin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=614,height=440')
}
function new_dealerwin(file) {
popupWin = window.open(file,'DealWin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=614,height=470')
}
function new_contwin(file) {
popupWin = window.open(file,'ContactWin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=750,height=650')
}
function new_inv_window(file) {
popupWin = window.open(file,'InvWin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=500')
}
function new_window600Mail(file) {
popupWin = window.open(file,'Wide_Mw600','toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=650,height=600')
}

<!-- Begin Stop Watch function
	var up,down;var min1,sec1;
	var cmin1,csec1,cmin2,csec2;
	var ms;
	function Minutes(data) {
	for(var i=0;i<data.length;i++) 
	if(data.substring(i,i+1)==":") 
	break;  
	return(data.substring(0,i)); 
	}
	function Seconds(data) {        
	for(var i=0;i<data.length;i++) 
	if(data.substring(i,i+1)==":") 
	break;  
	return(data.substring(i+1,data.length)); 
	}
	function Display(min,sec) {     
	var disp;       
	if(min<=9) disp=" 0";   
	else disp=" ";  
	disp+=min+" min : ";  
	if(sec<=9) disp+="0"+sec;       
	else disp+=sec; 
	disp+=" sec"
	return(disp); 
	}
	function Down(mmss) {
	ms = mmss;
	cmin2=1*Minutes(mmss);        
	csec2=0+Seconds(mmss);
	DownRepeat(); 
	}
	function DownRepeat() { 
	csec2--;        
	if(csec2==-1) { 
	csec2=59; cmin2--;
	}       
	function LoopBack(ms) {
	SessExp('/sessexp.htm');
	Down(ms);
	}
	
//	document.timeForm.input1.value=Display(cmin2,csec2);
	if (cmin2==0) LoopBack(ms)
	else down=setTimeout("DownRepeat()",1000); 
	}
// End Stop Watch function -->

function SessExp(URL) 
{
	winpop = window.open(URL, 'winpopup','scrollbars=0,resizable=1,width=320,height=100');
	winpop.document.SessN.Empln.value=document.pval.Empln.value;
	winpop.document.SessN.REQST.value=document.pval.REQST.value;
	winpop.document.SessN.Sessn.value=document.pval.Sessn.value;
	winpop.document.SessN.loipn.value=document.pval.loipn.value;
}

function checkuserid()
{      
     if((document.forms[0].Login.value=='sug') || (document.forms[0].Login.value=='SUG'))
        return true;
        aa=document.forms[0].Login.value.substring(0,1)
     if((aa =='v') || (aa=='V'))
        return true;
                
     for( var i=1;i<=document.forms[0].Login.value.length-1;i++)
     {
       xx=document.forms[0].Login.value.substring(i,i+1);
       if(xx>='0' && xx<='9') { }
          else { alert('Invalid user id');return false;} 
       }
 return true; 
}

function checkemailaddress ()
{
	aa=document.forms[0].Login.value 
	aa=aa.substring(0,1)
//	if ((aa!="e") && (aa!="s") && (aa!="v"))
	if ((aa!="e") && (aa!="s"))
	//then ask for the email address
	{
/*
        if (document.forms[0].EMAIL.value.length ==0)
		{
			alert("Please enter an Email Address.")
			return false
		}

		if (document.forms[0].EMAIL.value.length >0)
		{
			i=document.forms[0].EMAIL.value.indexOf("@")
			j=document.forms[0].EMAIL.value.indexOf(".",i)
			k=document.forms[0].EMAIL.value.indexOf(",")
			kk=document.forms[0].EMAIL.value.indexOf(" ")
			jj=document.forms[0].EMAIL.value.lastIndexOf(".")+1
			len=document.forms[0].EMAIL.value.length
	   
			if ((i>0) && (j>(i+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=3)) 
			{
				//it's ok, do nothing
			}
			else
			{
				alert("Please enter an exact email address.\n '" + 
				document.forms[0].EMAIL.value + "' is invalid.")
				return false
			}
		}
*/		
        var EmailPat = /^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
		var vrfyemail = document.forms[0].EMAIL.value.toLowerCase();
        var matchArray = vrfyemail.match(EmailPat); // is format OK?
        if (matchArray == null) {
				alert("Please enter a valid email address.\n '" + 
				document.forms[0].EMAIL.value + "' is invalid.")
				return false
        } 

		
		
		
	}
	// do not allow empty password field
	if (document.forms[0].Pinno.value.length ==0)
	{
		alert("Please enter your password")
		return false
	}
}

function checkPWD() {
// do not allow empty password field
  if (document.forms[0].Pinno.value.length ==0)
      {
         alert("Please enter your password")
         return false
       }
// allow only 10 chars as the pwd
  if (document.forms[0].Pinno.value.length >10)
      {
         alert("Please enter your password maximum 10 charcters")
         return false
       }

}

function disableForm(theform) {
  if (document.all || document.getElementById) {
    for (i = 0; i < theform.length; i++) {
      var tempobj = theform.elements[i];
      if (tempobj.type.toLowerCase() == "submit") {
        tempobj.value="Processing... Please Wait....";
        tempobj.disabled = true;
		}
      if (tempobj.type.toLowerCase() == "reset") {
        tempobj.disabled = true;
		}
      }
      //alert("Your request is currently processed.  Click on OK and Please Wait.");
      return true;
 
  }
}
function validateOrdSt(theForm) {
  if (document.forms[0].CCode.value.length ==0)
      {
	     document.forms[0].CCode.focus();
         alert("Please enter customer number");
         return false
       }
  if (document.forms[0].Cpono.value.length ==0)
      {
	     document.forms[0].Cpono.focus();
         alert("Please enter PO number");
         return false
       }
	   
  disableForm(theForm);
}
function validateFaxInv(theForm) {
  if (document.forms[0].CUSTN.value.length ==0)
      {
	     document.forms[0].CUSTN.focus();
         alert("Please enter customer number");
         return false
       }

  if (document.forms[0].CINVN.value.length ==0)
      {
	     document.forms[0].CINVN.focus();
         alert("Please enter invoice number");
         return false
       }
  if (document.forms[0].FACOD.value.length ==0)
      {
	     document.forms[0].FACOD.focus();
         alert("Please enter fax area code");
         return false
       }
  if (document.forms[0].FPRFX.value.length ==0)
      {
	     document.forms[0].FPRFX.focus();
         alert("Please enter fax number");
         return false
       }
  if (document.forms[0].FSUFX.value.length ==0)
      {
	     document.forms[0].FSUFX.focus();
         alert("Please enter fax number");
         return false
       }
	   
  disableForm(theForm);
}
function validateEmailPDF(theForm) {
  if (document.forms[0].CUSTN.value.length ==0)
      {
	     document.forms[0].CUSTN.focus();
         alert("Please enter customer number");
         return false
       }
  if (document.forms[0].CINVN.value.length ==0)
      {
	     document.forms[0].CINVN.focus();
         alert("Please enter invoice number");
         return false
       }
/*
      if (document.forms[0].EMAIL.value.length ==0)
      {
	     document.forms[0].EMAIL.focus();
         alert("Please enter a valid email address");
         return false
       }
	   
		if (document.forms[0].EMAIL.value.length >0)
		{
			i=document.forms[0].EMAIL.value.indexOf("@")
			j=document.forms[0].EMAIL.value.indexOf(".",i)
			k=document.forms[0].EMAIL.value.indexOf(",")
			kk=document.forms[0].EMAIL.value.indexOf(" ")
			jj=document.forms[0].EMAIL.value.lastIndexOf(".")+1
			len=document.forms[0].EMAIL.value.length
			if ((i>0) && (j>(i+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=3)) 
			{
				//it's ok, do nothing
			}
			else
			{
		        document.forms[0].EMAIL.focus();
				alert("Please enter an exact email address.\n '" + 
				document.forms[0].EMAIL.value + "' is invalid.")
				return false
			}
		}
*/		
        var EmailPat = /^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
		var vrfyemail = document.forms[0].EMAIL.value.toLowerCase();
		
        var matchArray = vrfyemail.match(EmailPat); // is format OK?
        if (matchArray == null) {
			alert("Please enter a valid email address.\n '" + 
			document.forms[0].EMAIL.value + "' is invalid.")
			return false
        } 
   
  disableForm(theForm);
}
		
//</SCRIPT>

