	function forgotPassword()
	{
		if (!validateEmail(this,document.forms[1].email,document.forms[1].email.value) || (trim(document.forms[1].email) == ""))
		{
			alert("Please enter a valid E-mail Address.");			
		}
		else
			linkSubmitForm("","../registration/emailme.cfm");
	}
	
	function loginValidate(flag)
	{	
			email = document.forms.cfForm.email.value;
			password = document.forms.cfForm.passwordtxt.value;

			if (email==""){
				alert("Please enter the User Id");
				document.forms.cfForm.email.focus();
				if (flag == 'yes')
					return false;
				else
					return;	
			}
			if (password==""){
				alert("Please enter Password");
				document.forms.cfForm.passwordtxt.focus();
				if (flag == 'yes')
					return false;
				else
				    return;
			}

/*						param1 = document.forms[1].param11.value;
						param2 = document.forms[1].param12.value;
						param3 = document.forms[1].param13.value;
						param4 = document.forms[1].param14.value;
						param5 = document.forms[1].param15.value;*/
						param1 = "";
						param2 = "";
						param3 = "";
						param4 = "";
						param5 = "";
	
			
    	   	//linkSubmitForm("","../registration/loginvalidate.cfm",param1,param2,param3,param4,param5);
		document.forms.cfForm.action = "../registration/loginvalidate.cfm?requesttimeout=5000";
		document.forms.cfForm.submit();
	}

	function updateShipBillInfo(selfPath,targetPage,param1,param2,param3,param4,param5)
	{
		if (_CF_checkcfForm(document.forms[1]))
		{
					linkSubmitForm("",targetPage,param1,param2,param3,param4,param5);
		}
	}
	
	// this function is called from order confirmation
	function verifyemailRegister()
	{
	email = trim(document.forms[1].reg_user_name);
	if (_CF_checkcfForm(document.forms[1]))
		{
			if (email==""){
				alert("Email Id is a required field");
				document.cfForm.email.focus();
				return;
			}
						
				linkSubmitForm("/customerservice/customeraccounttmp.cfm","../registration/regconfirm.cfm","NEWUSER","","","","ORDERCONREG");
						
		}
	}
	
	function verifyPwdandRegister(usermode)
	{
	
	if (_CF_checkcfForm(document.forms[1]))
		{
			if(usermode == "REGISTERNEWGHOSTUSER")
			{
				linkSubmitForm("/customerservice/customeraccounttmp.cfm","../registration/myprofile.cfm","","","","","REGISTERNEWGHOSTUSER");
			}
			else	
			{
				linkSubmitForm("/customerservice/customeraccounttmp.cfm","../registration/profile.cfm","","","","","UPDATEUSER");
			}
		}
	}
	
//Used in personal info:	
	function verifyPersonalinfo(usermode)
	{
/*	pwd1 = trim(document.forms[1].passwordtxt)
	pwd2 = trim(document.forms[1].cpasswordtxt)
*/	
	if (_CF_checkcfForm(document.forms[1]))
		{
			//if (pwd1 != pwd2)
		/*
			if (pwd1.toUpperCase() != pwd2.toUpperCase())
			 	{
				alert("Passwords do not match. Please re-enter passwords again.");
				document.forms[1].passwordtxt.focus();
				return;
				}
			else
				{	
				
					if(usermode == "REGISTERNEWGHOSTUSER")
					{
						linkSubmitForm("/customerservice/customeraccounttmp.cfm","../registration/myprofile.cfm","","","","","REGISTERNEWGHOSTUSER");
					}
					else	
					{
			*/
						linkSubmitForm("/customerservice/customeraccounttmp.cfm","../registration/profile.cfm","","","","","UPDATEUSER");
			/*		}
				}
			*/
		}
	}
	
	function changepwd()
	{

		pwd1 = document.forms.cfForm.passwordtxt.value;
		pwd2 = document.forms.cfForm.cpasswordtxt.value;
	
			if (pwd1.toUpperCase() != pwd2.toUpperCase())
			 	{
					alert("Passwords do not match. Please re-enter passwords again.");
					document.forms.cfForm.passwordtxt.focus();
					return;
				}
			else
				{	
				document.forms.cfForm.param5.value = "PASSWORDCHANGE";
				document.forms.cfForm.action = "../registration/passwordview.cfm";
				document.forms.cfForm.submit();
				}

	}



	function passwordChange(actionPage,targetPage,param1,param2,param3,param4,param5)
	{
	pwd1 = trim(document.forms[1].passwordtxt)
	pwd2 = trim(document.forms[1].cpasswordtxt)
	if (_CF_checkcfForm(document.forms[1]))
		{
			//if (pwd1 != pwd2)
			if (pwd1.toUpperCase() != pwd2.toUpperCase())
			 	{
				alert("Passwords do not match. Please re-enter passwords again.");
				document.forms[1].passwordtxt.focus();
				return;
				}
				else
				{
					document.forms[1].username.value = document.forms[1].regusername.value;
					linkSubmitForm(actionPage,targetPage,param1,param2,param3,param4,param5);
				}		
		}
	}
	
function validatenoticepage(){
	var cateSelected = 0;
	for( var i=0; i < document.forms[1].notice_for.length; i++)
	{
		if (document.forms[1].notice_for.options[i].selected && (!document.forms[1].notice_for.options[i].value == ""))
		 {
		    cateSelected++;
		 }	
	}
	if ( cateSelected == 0  ) 
	    { 	
				alert("Please select the Category/Manufacturer");
    			document.forms[1].notice_type.focus();
	    }		
	else
		linkSubmitForm('','../registration/myprofile.cfm','','','','','ADD');
}

function setBillEqShip(){
if(document.forms[1].billEqShip.checked)
	 {
		if (trim(document.forms[1].recipientfname) == "")
			{
			alert("Ship to First Name is a required field");
			document.forms[1].recipientfname.focus();
			return;
			}
		else
		if (trim(document.forms[1].recipientlname) == "")
			{
			alert("Ship to Last Name is a required field");
			document.forms[1].recipientlname.focus();
			return;
			}
		else 
			if (trim(document.forms[1].recipientphone) == "")
			{
			alert("Ship to Phone No is a required field");
			document.forms[1].recipientphone.focus();
			return;
			}
		else
			if (trim(document.forms[1].add1) == "")
			{
			alert("Ship to Address1 is a required field");
			document.forms[1].add1.focus();
			return;
			}
		else
			if (trim(document.forms[1].city) == "")
			{
			alert("Ship to City is a required field");
			document.forms[1].city.focus();
			return;
			}
		else
			if (trim(document.forms[1].state) == "")
			{
			alert("Ship to State is a required field");
			document.forms[1].state.focus();
			return;
			}		
		else
			if (trim(document.forms[1].zip) == "")
			{
			alert("Ship to City is a required field");
			document.forms[1].zip.focus();
			return;
			}
		else
		{
			document.forms[1].bBillto.value = trim(document.forms[1].shipto);
			document.forms[1].brecipientfname.value = trim(document.forms[1].recipientfname);
			document.forms[1].brecipientlname.value = trim(document.forms[1].recipientlname);
			document.forms[1].brecipientphone.value = trim(document.forms[1].recipientphone);
			document.forms[1].bemail.value = trim(document.forms[1].email);
			document.forms[1].badd1.value = trim(document.forms[1].add1);
			document.forms[1].badd2.value = trim(document.forms[1].add2);
			document.forms[1].bcity.value = trim(document.forms[1].city);
			document.forms[1].bstate.value = trim(document.forms[1].state);
			document.forms[1].bzip.value = trim(document.forms[1].zip);
			document.forms[1].bcountry.selectedIndex = document.forms[1].country.selectedIndex;
		}	
 }
}

function clearForm(){
	var c1 = 0;
			for (i=0;i<document.forms[1].bcountry.length;i++){
				if (document.forms[1].bcountry.options[i].value == "US"){
					c1 = i;
				}
			}
			document.forms[1].shipto.value = "";
			document.forms[1].recipientfname.value = "";
			document.forms[1].recipientlname.value = "";
			document.forms[1].recipientphone.value = "";
			document.forms[1].add1.value = "";
			document.forms[1].add2.value = "";
			document.forms[1].city.value = "";
			document.forms[1].state.value = "";
			document.forms[1].zip.value = "";
			document.forms[1].country.selectedIndex = c1;			
			document.forms[1].billEqShip.checked = false;
			document.forms[1].bBillto.value = "";
			document.forms[1].brecipientfname.value = "";
			document.forms[1].brecipientlname.value = "";
			document.forms[1].brecipientphone.value = "";
			document.forms[1].badd1.value = "";
			document.forms[1].badd2.value = "";
			document.forms[1].bcity.value = "";
			document.forms[1].bstate.value = "";
			document.forms[1].bzip.value = "";
			document.forms[1].bcountry.selectedIndex = c1;
}	


// new for the navicp project..

function checkemail()
{
	if( trim(document.forms[1].cotrnumber) == "")
	{  
		alert("cotrnumber is required field");
		document.forms[1].cotrnumber.focus();
		return;		   
	} 
	else if( trim(document.forms[1].cotrfirstname) == "")
	{  
		alert("cotrfirstname  is required field");
		document.forms[1].cotrfirstname.focus();
		return;
	} 
	else if( trim(document.forms[1].cotrlastname) == "")
	{  
		alert("cotrlastname  is required field");
		document.forms[1].cotrlastname.focus();
		return;
	} 
	else if( trim(document.forms[1].cotremail) == "")
	{  
		alert("cotremail  is required field");
		document.forms[1].cotremail.focus();
		return;
	} 
	else if(!isCOTREmail(document.forms[1].cotremail))
	{
		alert("not a valid eamil of a gov offical");
		document.forms[1].cotremail.focus();
		return;
	}
	else
	{
		linkSubmitForm('','../registration/regconfirm.cfm','','','','','COTR');
	}
}


function checkRevokeSelection()
{
	revokeReason = null;
	flag = false;

	for (i = 0; i < document.forms[1].revokingReason.length; i++)
	{	if( document.forms[1].revokingReason[i].checked )
		{	revokeReason = i;
			flag = true;
			break; }
	}

	if(flag)
	{
		linkSubmitForm('','../registration/revokeconfirmation.cfm',document.forms[1].reg_user_name.value,'','','','','');
	}
	else
	{
		alert("Please select the reason for revoking.");
	}
}


function blipTextWindow ()
{
	 msgWindow=window.open("","displayWindow","titlebar=no,menubar=no,width=500,height=310,resizable=no");
 			 msgWindow.document.write("<HEAD><TITLE>Primary Contract Number</TITLE>");
	 msgWindow.document.write("</HEAD>");
	 msgWindow.document.write("<BODY bgcolor=#ffffff>");
	 msgWindow.document.write('<form action=" "  method="post">');
	 msgWindow.document.write('<table cellspacing="0"><tr><td><ul><li><font face="Arial" pointsize="6">If supporting multiple contracts, give contract number and COTR information for most relevant contract.</font></td></tr>');
	 msgWindow.document.write('<tr><td align="center"><br><a href="javascript:self.close();"><img src="/webdata/img/close.gif" border="0"></a></td></tr></table>');
	 msgWindow.document.write('<br><div align="center"><img src="/webdata/img/seal5.gif" border="0"></div>');
	 msgWindow.document.write("</form></body>");
}
function checkUserId(){

	userId = trim(document.forms[1].reg_user_name);
	if (userId == "")
	{	
		alert("Please enter the user ID ");
		document.forms[1].reg_user_name.focus();
		return;
	}
	else if (!emailCheck(userId)){
		alert("Please enter a valid e-mail address");
		document.forms[1].reg_user_name.focus();
		return;
	}
	else
		linkSubmitForm('','../customerservice/AddModifyUser.cfm');
}
		
function checkProcessOption(isContractor)
{
	processRegOption = null;
	flag = false;

	for (i = 0; i < document.forms[1].processRegOption.length; i++)
	{	if( document.forms[1].processRegOption[i].checked )
		{	processRegOption = i;
			flag = true;
			break; }
	}

	if(flag)
	{
	  document.forms[1].reg_user_name.value = trim(document.forms[1].reg_user_name);	
	  if(isContractor == "Y")
	     {
		  if(processRegOption == 0)
			{ linkSubmitForm('','../registration/regcustserv.cfm',document.forms[1].reg_user_name.value,'','','','APPROVE'); }
		  else if(processRegOption == 1) 	
	   		{ linkSubmitForm('','../registration/regreject.cfm',document.forms[1].reg_user_name.value,'','','',''); }
		  else if(processRegOption == 2) 	
	 		{ linkSubmitForm('','../registration/regcustserv.cfm',document.forms[1].reg_user_name.value,'','','','HARDAPPROVE'); }
		  else 	
			{ linkSubmitForm('','../registration/regcustserv.cfm',document.forms[1].reg_user_name.value,'','','','SOFTREVOKE'); }
   		 }
	   else 	 
	   	  {
		  if(processRegOption == 0)
			{ linkSubmitForm('','../registration/regcustserv.cfm',document.forms[1].reg_user_name.value,'','','','APPROVE'); }
		  else if(processRegOption == 1) 	
	   		{ linkSubmitForm('','../registration/regreject.cfm',document.forms[1].reg_user_name.value,'','','',''); }
		  else 
	   		{ linkSubmitForm('','../registration/regcustserv.cfm',document.forms[1].reg_user_name.value,'','','','COLLEAGUE'); }
	 	
   		 }

	}
	else
	{
		alert("Please select the required option for Processing the Request.");
	}
}
		
function checkRejectOption()
{
	RejectOption = null;
	flag = false;

	for (i = 0; i < document.forms[1].rejectReason.length; i++)
	{	if( document.forms[1].rejectReason[i].checked )
		{	RejectOption = i;
			flag = true;
			break; }
	}

	if(flag)
	{
	  remark = trim(document.forms[1].remark);
	  if (RejectOption == 3 && remark == "")
	  {
	     alert("Please explain why you are rejecting this registration.");
		 return;
	  }
	  else
	  {
  		 linkSubmitForm('','../registration/regreject.cfm',document.forms[1].reg_user_name.value,'','','','REJECT'); 
	  }
	  
	}
	else
	{
		alert("Please select one of the reason for rejecting this registration.");
		return;
	}
}
		
