// email validation script 

function validMail(obj)	{				
	var EmailOk  = true
	var Temp     = obj
	var AtSym    = Temp.value.indexOf('@')
	var Period   = Temp.value.lastIndexOf('.')
	var Space    = Temp.value.indexOf(' ')
	var Length   = Temp.value.length - 1   // Array is from 0 to length-1

	if(obj.value !=""){
		if ((AtSym < 1) ||                     // '@' cannot be in first position
		    (Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
		    (Period == Length ) ||             // Must be atleast one valid char after '.'
		    (Space  != -1))                    // No empty spaces permitted
			   {  
		      EmailOk = false
		      alert("Please enter a valid e-mail address!");
			      Temp.value="";
			      Temp.focus();
		      return EmailOk;
   			}
		}
	}

// user/newuser.php

function Form1_Validator(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOk.length;  j++)
		if (ch == checkOk.charAt(j))
			break;
			if (j == checkOk.length) {
			 allValid = false;
			 break;
			}
		}
	  if (!allValid) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	//Client Name
	theForm.clientName.value = LTrim(theForm.clientName.value);
	theForm.clientName.value = RTrim(theForm.clientName.value);
	if (!emptystring(theForm.clientName.value))
		 {
			alert("Please enter your Client Name");
			theForm.clientName.focus();
			flag=false;
			return (false);
		}
  
	   else {

           var checkOk = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' .";
			if (!(validate(theForm.clientName.value,checkOk)))
				{
				alert("Please enter the Client Name properly");
				theForm.clientName.focus();
				flag=false;
				return (false);
				}
		}
		
	//Client Description
	theForm.clientDesc.value = LTrim(theForm.clientDesc.value);
	theForm.clientDesc.value = RTrim(theForm.clientDesc.value);
	if (!emptystring(theForm.clientDesc.value))
		 {
			alert("Please enter your Client Description");
			theForm.clientDesc.focus();
			flag=false;
			return (false);
		}
		
	//Address1
	theForm.clientAdd1.value = LTrim(theForm.clientAdd1.value);
	theForm.clientAdd1.value = RTrim(theForm.clientAdd1.value);
	if (!emptystring(theForm.clientAdd1.value))
		 {
			alert("Please enter the Address1");
			theForm.clientAdd1.focus();
			flag=false;
			return (false);
		}
		
		//Client City

	theForm.clientCity.value = LTrim(theForm.clientCity.value);
	theForm.clientCity.value = RTrim(theForm.clientCity.value);
	if (!emptystring(theForm.clientCity.value))
		 {
			alert("Please enter your Client City");
			theForm.clientCity.focus();
			flag=false;
			return (false);
		}
		
		//Client State

	theForm.clientState.value = LTrim(theForm.clientState.value);
	theForm.clientState.value = RTrim(theForm.clientState.value);
	if (!emptystring(theForm.clientState.value))
		 {
			alert("Please enter your Client State");
			theForm.clientState.focus();
			flag=false;
			return (false);
		}
	//Email
	theForm.clientEmail.value = LTrim(theForm.clientEmail.value);
	theForm.clientEmail.value = RTrim(theForm.clientEmail.value);
	if (!emptystring(theForm.clientEmail.value))
		 {
			alert("Please enter the Email Address");
			theForm.clientEmail.focus();
			flag=false;
			return (false);
		}

	//Set this return value to true when you want to submit the form
	return (flag);
}
function Form2_Validator(theForm)
{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOk.length;  j++)
		if (ch == checkOk.charAt(j))
			break;
			if (j == checkOk.length) {
			 allValid = false;
			 break;
			}
	}
	  if (!allValid) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	//Profile Name
	theForm.profileName.value = LTrim(theForm.profileName.value);
	theForm.profileName.value = RTrim(theForm.profileName.value);
	if (!emptystring(theForm.profileName.value))
		 {
			alert("Please enter the Profile Name");
			theForm.profileName.focus();
			flag=false;
			return (false);
		}
		
	//Profile Description
	theForm.profileDesc.value = LTrim(theForm.profileDesc.value);
	theForm.profileDesc.value = RTrim(theForm.profileDesc.value);
	if (!emptystring(theForm.profileDesc.value))
		 {
			alert("Please enter the Profile Description");
			theForm.profileDesc.focus();
			flag=false;
			return (false);
		}
	//ship
		
			if (document.form.shipName.selectedIndex==0){
			alert('Please select the Ship');
			document.form.shipName.focus();
			return false;
			}

	
	//Set this return value to true when you want to submit the form
	return (flag);
}

//Login
function Form3_Validator(theForm)
{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOk.length;  j++)
		if (ch == checkOk.charAt(j))
			break;
			if (j == checkOk.length) {
			 allValid = false;
			 break;
			}
		}
	  if (!allValid) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	//Ship Name
	theForm.shipName.value = LTrim(theForm.shipName.value);
	theForm.shipName.value = RTrim(theForm.shipName.value);
	if (!emptystring(theForm.shipName.value))
		 {
			alert("Please enter the Ship Name");
			theForm.shipName.focus();
			flag=false;
			return (false);
		}
  
	   
		
	//Ship Desc Name
	theForm.shipDesc.value = LTrim(theForm.shipDesc.value);
	theForm.shipDesc.value = RTrim(theForm.shipDesc.value);
	if (!emptystring(theForm.shipDesc.value))
		 {
			alert("Please enter the Ship Description");
			theForm.shipDesc.focus();
			flag=false;
			return (false);
		}
  
	
	//Set this return value to true when you want to submit the form
	return (flag);
}
function Form4_Validator(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOk.length;  j++)
		if (ch == checkOk.charAt(j))
			break;
			if (j == checkOk.length) {
			 allValid = false;
			 break;
			}
		}
	  if (!allValid) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	
	//Username
	theForm.userName.value = LTrim(theForm.userName.value);
	theForm.userName.value = RTrim(theForm.userName.value);
	if (!emptystring(theForm.userName.value))
		 {
			alert("Please enter the Name");
			theForm.userName.focus();
			flag=false;
			return (false);
		}
  
	   else {

           var checkOk = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' .";
			if (!(validate(theForm.userName.value,checkOk)))
				{ 
				alert("Please enter the Name properly");
				theForm.userName.focus();
				flag=false;
				return (false);
				}
			else 
					{
					var pWord = theForm.userName.value;
					if (pWord.length < '7')
					{
					alert("Your User Name must be atleast 7 characters");
					theForm.userName.value="";
					theForm.userName.focus();
					flag=false;
					return (false);
					}
				}
		}
	//Password
	theForm.password.value = LTrim(theForm.password.value);
	theForm.password.value = RTrim(theForm.password.value);
	if (!emptystring(theForm.password.value))
		 {
			alert("Please enter the Password");
			theForm.password.focus();
			flag=false;
			return (false);
		}
   else 
		{
	var pWord = theForm.password.value;
	if (pWord.length < '7')
		{
		alert("Your Password must be atleast 7 characters");
				theForm.password.value="";
				theForm.password.focus();
				flag=false;
				return (false);
				}
		}
	//Confirm Password
	theForm.confirmPword.value = LTrim(theForm.confirmPword.value);
	theForm.confirmPword.value = RTrim(theForm.confirmPword.value);
	if (!emptystring(theForm.confirmPword.value))
		 {
			alert("Please enter the Confirm Password");
			theForm.confirmPword.focus();
			flag=false;
			return (false);
		}
		
	//Compare username and password
	theForm.userName.value = LTrim(theForm.userName.value);
	theForm.userName.value = RTrim(theForm.userName.value);
	theForm.password.value = LTrim(theForm.password.value);
	theForm.password.value = RTrim(theForm.password.value);

	if (theForm.userName.value == theForm.password.value)
		 {
			alert("Try another password ....");
			theForm.password.value="";
			theForm.password.focus();
			flag=false;
			return (false);
		}
	//Compare password
	theForm.password.value = LTrim(theForm.password.value);
	theForm.password.value = RTrim(theForm.password.value);
	theForm.confirmPword.value = LTrim(theForm.confirmPword.value);
	theForm.confirmPword.value = RTrim(theForm.confirmPword.value);

	if (theForm.password.value != theForm.confirmPword.value)
		 {
			alert("Password mismatching....");
			theForm.password.value="";
			theForm.confirmPword.value="";
			theForm.password.focus();
			flag=false;
			return (false);
		}
	//Profile
	
		if (document.form.profileName.selectedIndex==0){
			alert('Please select the Profile');
			document.form.profileName.focus();
			return false;
			}
			
	//Email
	theForm.clientEmail.value = LTrim(theForm.clientEmail.value);
	theForm.clientEmail.value = RTrim(theForm.clientEmail.value);
	if (!emptystring(theForm.clientEmail.value))
		 {
			alert("Please enter the Email Address");
			theForm.clientEmail.focus();
			flag=false;
			return (false);
		}
	//Set this return value to true when you want to submit the form
	return (flag);
}
function Form5_Validator(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOk.length;  j++)
		if (ch == checkOk.charAt(j))
			break;
			if (j == checkOk.length) {
			 allValid = false;
			 break;
			}
		}
	  if (!allValid) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	
	//Username
	theForm.userName.value = LTrim(theForm.userName.value);
	theForm.userName.value = RTrim(theForm.userName.value);
	if (!emptystring(theForm.userName.value))
		 {
			alert("Please enter the Name");
			theForm.userName.focus();
			flag=false;
			return (false);
		}
  
	   else {

           var checkOk = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' .";
			if (!(validate(theForm.userName.value,checkOk)))
				{ 
				alert("Please enter the Name properly");
				theForm.userName.focus();
				flag=false;
				return (false);
				}
			else 
					{
					var pWord = theForm.userName.value;
					if (pWord.length < '7')
					{
					alert("Your User Name must be atleast 7 characters");
					theForm.userName.value="";
					theForm.userName.focus();
					flag=false;
					return (false);
					}
				}
		}
	//Password
	theForm.password.value = LTrim(theForm.password.value);
	theForm.password.value = RTrim(theForm.password.value);
	if (!emptystring(theForm.password.value))
		 {
			alert("Please enter the Password");
			theForm.password.focus();
			flag=false;
			return (false);
		}
   else 
		{
	var pWord = theForm.password.value;
	if (pWord.length < '7')
		{
		alert("Your Password must be atleast 7 characters");
				theForm.password.value="";
				theForm.password.focus();
				flag=false;
				return (false);
				}
		}
	//Confirm Password
	theForm.confirmPword.value = LTrim(theForm.confirmPword.value);
	theForm.confirmPword.value = RTrim(theForm.confirmPword.value);
	if (!emptystring(theForm.confirmPword.value))
		 {
			alert("Please enter the Confirm Password");
			theForm.confirmPword.focus();
			flag=false;
			return (false);
		}
		
	//Compare username and password
	theForm.userName.value = LTrim(theForm.userName.value);
	theForm.userName.value = RTrim(theForm.userName.value);
	theForm.password.value = LTrim(theForm.password.value);
	theForm.password.value = RTrim(theForm.password.value);

	if (theForm.userName.value == theForm.password.value)
		 {
			alert("Try another password ....");
			theForm.password.value="";
			theForm.password.focus();
			flag=false;
			return (false);
		}
	//Compare password
	theForm.password.value = LTrim(theForm.password.value);
	theForm.password.value = RTrim(theForm.password.value);
	theForm.confirmPword.value = LTrim(theForm.confirmPword.value);
	theForm.confirmPword.value = RTrim(theForm.confirmPword.value);

	if (theForm.password.value != theForm.confirmPword.value)
		 {
			alert("Password mismatching....");
			theForm.password.value="";
			theForm.confirmPword.value="";
			theForm.password.focus();
			flag=false;
			return (false);
		}
	
	//Set this return value to true when you want to submit the form
	return (flag);
}

function Form6_Validator(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOk.length;  j++)
		if (ch == checkOk.charAt(j))
			break;
			if (j == checkOk.length) {
			 allValid = false;
			 break;
			}
		}
	  if (!allValid) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	 
	 //Old Password
	theForm.oldPassword.value = LTrim(theForm.oldPassword.value);
	theForm.oldPassword.value = RTrim(theForm.oldPassword.value);
	if (!emptystring(theForm.oldPassword.value))
		 {
			alert("Please enter the Current Password");
			theForm.oldPassword.focus();
			flag=false;
			return (false);
		}
  
	
	//New Password
	theForm.newPassword.value = LTrim(theForm.newPassword.value);
	theForm.newPassword.value = RTrim(theForm.newPassword.value);
	if (!emptystring(theForm.newPassword.value))
		 {
			alert("Please enter the New Password");
			theForm.newPassword.focus();
			flag=false;
			return (false);
		}
   else 
		{
	var pWord = theForm.newPassword.value;
	if (pWord.length < '7')
		{
		alert("Your Password must be atleast 7 characters");
				theForm.newPassword.value="";
				theForm.newPassword.focus();
				flag=false;
				return (false);
				}
		}
	//Confirm Password
	theForm.confirmPassword.value = LTrim(theForm.confirmPassword.value);
	theForm.confirmPassword.value = RTrim(theForm.confirmPassword.value);
	if (!emptystring(theForm.confirmPassword.value))
		 {
			alert("Please enter the Confirm Password");
			theForm.confirmPassword.focus();
			flag=false;
			return (false);
		}
		
	
	//Compare password
	theForm.newPassword.value = LTrim(theForm.newPassword.value);
	theForm.newPassword.value = RTrim(theForm.newPassword.value);
	theForm.confirmPassword.value = LTrim(theForm.confirmPassword.value);
	theForm.confirmPassword.value = RTrim(theForm.confirmPassword.value);

	if (theForm.newPassword.value != theForm.confirmPassword.value)
		 {
			alert("Password mismatching....");
			theForm.newPassword.value="";
			theForm.confirmPassword.value="";
			theForm.newPassword.focus();
			flag=false;
			return (false);
		}
	
	//Set this return value to true when you want to submit the form
	return (flag);
}

function Form7_Validator(theForm)
{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOk.length;  j++)
		if (ch == checkOk.charAt(j))
			break;
			if (j == checkOk.length) {
			 allValid = false;
			 break;
			}
		}
	  if (!allValid) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	//Ship Name
	theForm.shipName.value = LTrim(theForm.shipName.value);
	theForm.shipName.value = RTrim(theForm.shipName.value);
	if (!emptystring(theForm.shipName.value))
		 {
			alert("Please enter the Ship Name");
			theForm.shipName.focus();
			flag=false;
			return (false);
		}
		
	//Client Desc Name
	theForm.clientDesc.value = LTrim(theForm.clientDesc.value);
	theForm.clientDesc.value = RTrim(theForm.clientDesc.value);
	if (!emptystring(theForm.clientDesc.value))
		 {
			alert("Please enter the Client Description");
			theForm.clientDesc.focus();
			flag=false;
			return (false);
		}
	
	//Set this return value to true when you want to submit the form
	return (flag);
}

//Login
function Form8_Validator(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOk.length;  j++)
		if (ch == checkOk.charAt(j))
			break;
			if (j == checkOk.length) {
			 allValid = false;
			 break;
			}
		}
	  if (!allValid) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	 //Company code
	theForm.clientId.value = LTrim(theForm.clientId.value);
	theForm.clientId.value = RTrim(theForm.clientId.value);
	if (!emptystring(theForm.clientId.value))
		 {
			alert("Please enter the Company code");
			theForm.clientId.focus();
			flag=false;
			return (false);
		}
  

	//User Name
	theForm.userName.value = LTrim(theForm.userName.value);
	theForm.userName.value = RTrim(theForm.userName.value);
	if (!emptystring(theForm.userName.value))
		 {
			alert("Please enter the User Name");
			theForm.userName.focus();
			flag=false;
			return (false);
		}
  
	//Password
	theForm.password.value = LTrim(theForm.password.value);
	theForm.password.value = RTrim(theForm.password.value);
	if (!emptystring(theForm.password.value))
		 {
			alert("Please enter the Password");
			theForm.password.focus();
			flag=false;
			return (false);
		}
	 
	//Set this return value to true when you want to submit the form
	return (flag);
}
function Form9_Validator(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOk.length;  j++)
		if (ch == checkOk.charAt(j))
			break;
			if (j == checkOk.length) {
			 allValid = false;
			 break;
			}
		}
	  if (!allValid) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	
	//Name
	theForm.name.value = LTrim(theForm.name.value);
	theForm.name.value = RTrim(theForm.name.value);
	if (!emptystring(theForm.name.value))
		 {
			alert("Please enter the Name");
			theForm.name.focus();
			flag=false;
			return (false);
		}
  
	   else {

           var checkOk = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' .";
			if (!(validate(theForm.name.value,checkOk)))
				{ 
				alert("Please enter the Name properly");
				theForm.name.focus();
				flag=false;
				return (false);
				}
		}
	//Message
	theForm.message.value = LTrim(theForm.message.value);
	theForm.message.value = RTrim(theForm.message.value);
	if (!emptystring(theForm.message.value))
		 {
			alert("Please enter the Message");
			theForm.message.focus();
			flag=false;
			return (false);
		}
	//Email
	theForm.email.value = LTrim(theForm.email.value);
	theForm.email.value = RTrim(theForm.email.value);
	if (!emptystring(theForm.email.value))
		 {
			alert("Please enter the E-mail");
			theForm.email.focus();
			flag=false;
			return (false);
		}
		
	//Set this return value to true when you want to submit the form
	return (flag);
}
function Form10_Validator(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOk.length;  j++)
		if (ch == checkOk.charAt(j))
			break;
			if (j == checkOk.length) {
			 allValid = false;
			 break;
			}
		}
	  if (!allValid) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	
	//Name
	theForm.name.value = LTrim(theForm.name.value);
	theForm.name.value = RTrim(theForm.name.value);
	if (!emptystring(theForm.name.value))
		 {
			alert("Please enter the Name");
			theForm.name.focus();
			flag=false;
			return (false);
		}
  
	   else {

           var checkOk = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' .";
			if (!(validate(theForm.name.value,checkOk)))
				{ 
				alert("Please enter the Name properly");
				theForm.name.focus();
				flag=false;
				return (false);
				}
		}
	//Address1
	theForm.Address1.value = LTrim(theForm.Address1.value);
	theForm.Address1.value = RTrim(theForm.Address1.value);
	if (!emptystring(theForm.Address1.value))
		 {
			alert("Please enter the Address1");
			theForm.Address1.focus();
			flag=false;
			return (false);
		}
		
	//Email
	theForm.Email.value = LTrim(theForm.Email.value);
	theForm.Email.value = RTrim(theForm.Email.value);
	if (!emptystring(theForm.Email.value))
		 {
			alert("Please enter the E-mail");
			theForm.Email.focus();
			flag=false;
			return (false);
		}
	//Message
	theForm.Comments.value = LTrim(theForm.Comments.value);
	theForm.Comments.value = RTrim(theForm.Comments.value);
	if (!emptystring(theForm.Comments.value))
		 {
			alert("Please enter the Comments");
			theForm.Comments.focus();
			flag=false;
			return (false);
		}
		
	//Set this return value to true when you want to submit the form
	return (flag);
}
function Form11_Validator(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOk.length;  j++)
		if (ch == checkOk.charAt(j))
			break;
			if (j == checkOk.length) {
			 allValid = false;
			 break;
			}
		}
	  if (!allValid) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	//User Name
	theForm.userName.value = LTrim(theForm.userName.value);
	theForm.userName.value = RTrim(theForm.userName.value);
	if (!emptystring(theForm.userName.value))
		 {
			alert("Please enter the User Name");
			theForm.userName.focus();
			flag=false;
			return (false);
		}
  
	//Password
	theForm.password.value = LTrim(theForm.password.value);
	theForm.password.value = RTrim(theForm.password.value);
	if (!emptystring(theForm.password.value))
		 {
			alert("Please enter the Password");
			theForm.password.focus();
			flag=false;
			return (false);
		}
	 
	//Set this return value to true when you want to submit the form
	return (flag);
}
//Document validation
function Form12_Validator(theForm)
	{
	//Validate Function 
	function validate(value,checkOk)
	{
	var checkStr = value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOk.length;  j++)
		if (ch == checkOk.charAt(j))
			break;
			if (j == checkOk.length) {
			 allValid = false;
			 break;
			}
		}
	  if (!allValid) {
		return (false);
	  }
	else { return (true); }
  }

		//Trim script
		function Trim(STRING){
		STRING = LTrim(STRING);
		return RTrim(STRING);
		}

		function RTrim(STRING){
		while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
		}
		return STRING;
		}

		function LTrim(STRING){
		while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
		}
		return STRING;
		}
	 // emptycheck
	 var flag=true;
	 function emptystring(value)
	 {
	   if (value=="") return (false);
	   else return(true);
	 }
	//User Name
	theForm.textdocumentName1.value = LTrim(theForm.textdocumentName1.value);
	theForm.textdocumentName2.value = LTrim(theForm.textdocumentName2.value);
	theForm.textdocumentName3.value = LTrim(theForm.textdocumentName3.value);
	theForm.textdocumentName4.value = LTrim(theForm.textdocumentName4.value);
	theForm.textdocumentName5.value = LTrim(theForm.textdocumentName5.value);
	theForm.textdocumentName6.value = LTrim(theForm.textdocumentName6.value);
	theForm.textdocumentName7.value = LTrim(theForm.textdocumentName7.value);
	theForm.textdocumentName8.value = LTrim(theForm.textdocumentName8.value);
	theForm.textdocumentName9.value = LTrim(theForm.textdocumentName9.value);
	theForm.textdocumentName10.value = LTrim(theForm.textdocumentName10.value);
	theForm.textdocumentName11.value = LTrim(theForm.textdocumentName11.value);
	theForm.textdocumentName12.value = LTrim(theForm.textdocumentName12.value);
	theForm.textdocumentName13.value = LTrim(theForm.textdocumentName13.value);
	theForm.textdocumentName14.value = LTrim(theForm.textdocumentName14.value);
	theForm.textdocumentName15.value = LTrim(theForm.textdocumentName15.value);
	theForm.textdocumentName1.value = RTrim(theForm.textdocumentName1.value);
	theForm.textdocumentName2.value = RTrim(theForm.textdocumentName2.value);
	theForm.textdocumentName3.value = RTrim(theForm.textdocumentName3.value);
	theForm.textdocumentName4.value = RTrim(theForm.textdocumentName4.value);
	theForm.textdocumentName5.value = RTrim(theForm.textdocumentName5.value);
	theForm.textdocumentName6.value = RTrim(theForm.textdocumentName6.value);
	theForm.textdocumentName7.value = RTrim(theForm.textdocumentName7.value);
	theForm.textdocumentName8.value = RTrim(theForm.textdocumentName8.value);
	theForm.textdocumentName9.value = RTrim(theForm.textdocumentName9.value);
	theForm.textdocumentName10.value = RTrim(theForm.textdocumentName10.value);
	theForm.textdocumentName11.value = RTrim(theForm.textdocumentName11.value);
	theForm.textdocumentName12.value = RTrim(theForm.textdocumentName12.value);
	theForm.textdocumentName13.value = RTrim(theForm.textdocumentName13.value);
	theForm.textdocumentName14.value = RTrim(theForm.textdocumentName14.value);
	theForm.textdocumentName15.value = RTrim(theForm.textdocumentName15.value);

	 if ((!emptystring(theForm.textdocumentName1.value)) && (!emptystring(theForm.textdocumentName2.value)) && (!emptystring(theForm.textdocumentName3.value)) && (!emptystring(theForm.textdocumentName4.value)) && (!emptystring(theForm.textdocumentName5.value))
		&& (!emptystring(theForm.textdocumentName6.value)) && (!emptystring(theForm.textdocumentName7.value)) && (!emptystring(theForm.textdocumentName8.value)) && (!emptystring(theForm.textdocumentName9.value))
			&& (!emptystring(theForm.textdocumentName10.value)) && (!emptystring(theForm.textdocumentName11.value)) && (!emptystring(theForm.textdocumentName12.value)) && (!emptystring(theForm.textdocumentName13.value))
				&& (!emptystring(theForm.textdocumentName14.value)) && (!emptystring(theForm.textdocumentName15.value)))
	 { 
	 		alert("Please Upload the document");
			theForm.textdocumentName1.focus();
			flag=false;
			return (false);
	}			
	 
	//Set this return value to true when you want to submit the form
	return (flag);
}



