  // 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;
   			}
		}
	}

//clientprofile.php

function Form21_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);
	 }
		
	//firstName
	 
	theForm.firstName.value = LTrim(theForm.firstName.value);
	theForm.firstName.value = RTrim(theForm.firstName.value);
	if (!emptystring(theForm.firstName.value))
		 {
			alert("Please enter the First Name");
			theForm.firstName.focus();
			flag=false;
			return (false);
		}
	//lastName
	 
	theForm.lastName.value = LTrim(theForm.lastName.value);
	theForm.lastName.value = RTrim(theForm.lastName.value);
	if (!emptystring(theForm.lastName.value))
		 {
			alert("Please enter the Last Name");
			theForm.lastName.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 Email Address");
			theForm.eMail.focus();
			flag=false;
			return (false);
		}
	//passportNo
	 
	theForm.passportNo.value = LTrim(theForm.passportNo.value);
	theForm.passportNo.value = RTrim(theForm.passportNo.value);
	if (!emptystring(theForm.passportNo.value))
		 {
			alert("Please enter the Passport Number");
			theForm.passportNo.focus();
			flag=false;
			return (false);
		}
	//applicants
	theForm.noAdult.value = LTrim(theForm.noAdult.value);
	theForm.noAdult.value = RTrim(theForm.noAdult.value);

           var checkOk = "0123456789' .";
			if (!(validate(theForm.noAdult.value,checkOk)))
				{
				alert("Please Enter the Number of Adult Applicants properly");
				theForm.noAdult.focus();
				flag=false;
				return (false);
				}
	//applicants
	theForm.noChildren.value = LTrim(theForm.noChildren.value);
	theForm.noChildren.value = RTrim(theForm.noChildren.value);

           var checkOk = "0123456789' .";
			if (!(validate(theForm.noChildren.value,checkOk)))
				{
				alert("Please Enter the Number of Children Applicants properly");
				theForm.noChildren.focus();
				flag=false;
				return (false);
				}
	

	//Set this return value to true when you want to submit the form
	return (flag);
}

// adduser.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 Id
	 
	 theForm.clientId.value = LTrim(theForm.clientId.value);
	theForm.clientId.value = RTrim(theForm.clientId.value);
	if (!emptystring(theForm.clientId.value))
		 {
			alert("Please enter the Client Id");
			theForm.clientId.focus();
			flag=false;
			return (false);
		}
			//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);
				}
		}

	//firstName
	 
	theForm.firstName.value = LTrim(theForm.firstName.value);
	theForm.firstName.value = RTrim(theForm.firstName.value);
	if (!emptystring(theForm.firstName.value))
		 {
			alert("Please enter the First Name");
			theForm.firstName.focus();
			flag=false;
			return (false);
		}
	//lastName
	 
	theForm.lastName.value = LTrim(theForm.lastName.value);
	theForm.lastName.value = RTrim(theForm.lastName.value);
	if (!emptystring(theForm.lastName.value))
		 {
			alert("Please enter the Last Name");
			theForm.lastName.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 Email Address");
			theForm.eMail.focus();
			flag=false;
			return (false);
		}
	//passportNo
	 
	theForm.passportNo.value = LTrim(theForm.passportNo.value);
	theForm.passportNo.value = RTrim(theForm.passportNo.value);
	if (!emptystring(theForm.passportNo.value))
		 {
			alert("Please enter the Passport Number");
			theForm.passportNo.focus();
			flag=false;
			return (false);
		}
	//applicants
	theForm.noAdult.value = LTrim(theForm.noAdult.value);
	theForm.noAdult.value = RTrim(theForm.noAdult.value);

           var checkOk = "0123456789' .";
			if (!(validate(theForm.noAdult.value,checkOk)))
				{
				alert("Please Enter the Number of Adult Applicants properly");
				theForm.noAdult.focus();
				flag=false;
				return (false);
				}
	//applicants
	theForm.noChildren.value = LTrim(theForm.noChildren.value);
	theForm.noChildren.value = RTrim(theForm.noChildren.value);

           var checkOk = "0123456789' .";
			if (!(validate(theForm.noChildren.value,checkOk)))
				{
				alert("Please Enter the Number of Children Applicants properly");
				theForm.noChildren.focus();
				flag=false;
				return (false);
				}
	//Username
	
	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);
		}
  /* 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);
}

// Case Summary
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);
	 }
	 //Visa Category
	 /*if (document.form.visaCategory.selectedIndex==0){
			alert('Please select the Visa Category');
			document.form.visaCategory.focus();
			return false;
			}*/
	//class case
	theForm.subClass.value = LTrim(theForm.subClass.value);
	theForm.subClass.value = RTrim(theForm.subClass.value);
	if (!emptystring(theForm.subClass.value))
		 {
			alert("Please Enter the Subclass Name");
			theForm.subClass.focus();
			flag=false;
			return (false);
		}
		
		//Visa Category
	/* if (document.form.visaType.selectedIndex==0){
			alert('Please select the Temp/Perm Visa');
			document.form.visaType.focus();
			return false;
			}
			//Visa Category
	 if (document.form.visaLocation.selectedIndex==0){
			alert('Please select the Offshore/Onshore');
			document.form.visaLocation.focus();
			return false;
			}*/
	//Set this return value to true when you want to submit the form
	return (flag);
}

	//Admin Profile

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);
	 }
	 
	
	//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);
}

//manage_admin_profile
function Form15_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 UserName");
			theForm.userName.focus();
			flag=false;
			return (false);
		}
	 //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);
}

// Login 
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);
	 }
	//userName
	
	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);
}




// Manage Document summary
function Manage_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);
	 }
	 
	//class case
	theForm.documentNew.value = LTrim(theForm.documentNew.value);
	theForm.documentNew.value = RTrim(theForm.documentNew.value);
	if (!emptystring(theForm.documentNew.value))
		 {
			alert("Please Enter the Document Name");
			theForm.documentNew.focus();
			flag=false;
			return (false);
		}
	
	//Set this return value to true when you want to submit the form
	return (flag);
}

//User manageprofile
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);
	 }
	 
	//Password
	
	theForm.currentPassword.value = LTrim(theForm.currentPassword.value);
	theForm.currentPassword.value = RTrim(theForm.currentPassword.value);
	if (!emptystring(theForm.currentPassword.value))
		 {
			alert("Please enter the Current Password");
			theForm.currentPassword.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);
				}
		}*/
   //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);
		}
		
	//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 password
	theForm.newPassword.value = LTrim(theForm.newPassword.value);
	theForm.newPassword.value = RTrim(theForm.newPassword.value);
	theForm.confirmPword.value = LTrim(theForm.confirmPword.value);
	theForm.confirmPword.value = RTrim(theForm.confirmPword.value);

	if (theForm.newPassword.value != theForm.confirmPword.value)
		 {
			alert("Password mismatching....");
			theForm.newPassword.value="";
			theForm.confirmPword.value="";
			theForm.newPassword.focus();
			flag=false;
			return (false);
		}
	

	//Set this return value to true when you want to submit the form
	return (flag);
}

//Contact Admin
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);
	 }
	 
	//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 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);
				}
		}
		
	//Email
	
	theForm.eMail.value = LTrim(theForm.eMail.value);
	theForm.eMail.value = RTrim(theForm.eMail.value);
	if (!emptystring(theForm.eMail.value))
		 {
			alert("Please enter the Email Address");
			theForm.eMail.focus();
			flag=false;
			return (false);
		}
		
	//Set this return value to true when you want to submit the form
	return (flag);
}

//AddAdmin
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);
	 }
	 
	//username
	
	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.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);
		}
		
	//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);
		}
		//Email
	
	theForm.eMail.value = LTrim(theForm.eMail.value);
	theForm.eMail.value = RTrim(theForm.eMail.value);
	if (!emptystring(theForm.eMail.value))
		 {
			alert("Please enter the Email Address");
			theForm.eMail.focus();
			flag=false;
			return (false);
		}
		
	

	//Set this return value to true when you want to submit the form
	return (flag);
}
function changeClient() {
   var clientName = document.form.clientName.value;
	document.form.userName.value = clientName;
}
function assFees() {
	var assAmt1 = document.form.assFeeType.value;
	var assIRec = document.form.assIRec.value;
	var split_to = assAmt1.split("-");
	var assAmt = split_to[0];
	var assCat = split_to[1];
	document.form.assIAmt.value = assAmt;
	var balance = parseFloat(assAmt) -  parseFloat(assIRec);
	document.form.assIBalance.value = balance;
}
function balanceFeesI() {
	var profIAmt = document.form.profIAmt.value;
	var profIRec = document.form.profIRec.value;
	if(isNaN(profIAmt)) {
	alert("Please enter the amount properly");
	document.form.profIAmt.value = "0";
	document.form.profIAmt.focus();
	}
	if (isNaN(profIRec)) {
	alert("Please enter the amount properly");
	document.form.profIRec.value = "0";
	document.form.profIRec.focus();
	} else {
	var balance = parseFloat(profIAmt) -  parseFloat(profIRec);
	document.form.profIBalance.value = balance;
	}
}
function balanceFeesII() {
	var profIAmt = document.form.profIAmt.value;
	var profIRec = document.form.profIRec.value;
	var profIIRec = document.form.profIIRec.value;
	if (isNaN(profIIRec)) {
	alert("Please enter the amount properly");
	document.form.profIIRec.value = "0";
	document.form.profIIRec.focus();
	} else {
	var profRec = parseFloat(profIRec) + parseFloat(profIIRec);
	var balance = parseFloat(profIAmt) -  parseFloat(profRec);
	document.form.profIBalance.value = balance;
	}
}
function balanceFeesIII() {
	var profIAmt = document.form.profIAmt.value;
	var profIRec = document.form.profIRec.value;
	var profIIRec = document.form.profIIRec.value;
	var profIIIRec = document.form.profIIIRec.value;
	if (isNaN(profIIIRec)) {
	alert("Please enter the amount properly");
	document.form.profIIIRec.value = "0";
	document.form.profIIIRec.focus();
	} else {
	var profRec = parseFloat(profIRec) + parseFloat(profIIRec) + parseFloat(profIIIRec);
	var balance = parseFloat(profIAmt) -  parseFloat(profRec);
	document.form.profIBalance.value = balance;
	}
}
function balanceFeesIV() {
	var profIAmt = document.form.profIAmt.value;
	var profIRec = document.form.profIRec.value;
	var profIIRec = document.form.profIIRec.value;
	var profIIIRec = document.form.profIIIRec.value;
	var profIVRec = document.form.profIVRec.value;
	if (isNaN(profIVRec)) {
	alert("Please enter the amount properly");
	document.form.profIVRec.value = "0";
	document.form.profIVRec.focus();
	} else {
	var profRec = parseFloat(profIRec) + parseFloat(profIIRec) + parseFloat(profIIIRec) + parseFloat(profIVRec);
	var balance = parseFloat(profIAmt) -  parseFloat(profRec);
	document.form.profIBalance.value = balance;
	}
}
function balanceFees1() {
    var assIAmt = document.form.assIAmt.value;
	var assIRec = document.form.assIRec.value;
	if(isNaN(assIAmt)) {
	alert("Please enter the amount properly");
	document.form.assIAmt.value = "0";
	document.form.assIAmt.focus();
	}
	if (isNaN(assIRec)) {
	alert("Please enter the amount properly");
	document.form.assIRec.value = "0";
	document.form.assIRec.focus();
	} else {
	var balance1 = parseFloat(assIAmt) -  parseFloat(assIRec);
	document.form.assIBalance.value= balance1;
	}
}
function balanceFees2() {
	var procIIAmt = document.form.procIIAmt.value;
	var procIIRec = document.form.procIIRec.value;
	if(isNaN(procIIAmt)) {
	alert("Please enter the amount properly");
	document.form.procIIAmt.value = "0";
	document.form.procIIAmt.focus();
	}
	if (isNaN(procIIRec)) {
	alert("Please enter the amount properly");
	document.form.procIIRec.value = "0";
	document.form.procIIRec.focus();
	} else {
	var balance2 = parseFloat(procIIAmt) -  parseFloat(procIIRec);
	document.form.procIIBalance.value= balance2;
	}
}
function balanceFees3I() {
	var profIIIAmt = document.form.profIIIAmt.value;
	var profIII1Rec = document.form.profIII1Rec.value;
	if(isNaN(profIIIAmt)) {
	alert("Please enter the amount properly");
	document.form.profIIIAmt.value = "0";
	document.form.profIIIAmt.focus();
	}
	if (isNaN(profIII1Rec)) {
	alert("Please enter the amount properly");
	document.form.profIII1Rec.value = "0";
	document.form.profIII1Rec.focus();
	} else {
	var balance3 = parseFloat(profIIIAmt) -  parseFloat(profIII1Rec);
	document.form.profIIIBalance.value= balance3;
	}
}
function balanceFees3II() {
	var profIIIAmt = document.form.profIIIAmt.value;
	var profIII1Rec = document.form.profIII1Rec.value;
	var profIII2Rec = document.form.profIII2Rec.value;
	if (isNaN(profIII2Rec)) {
	alert("Please enter the amount properly");
	document.form.profIII2Rec.value = "0";
	document.form.profIII2Rec.focus();
	} else {
	var rec = parseFloat(profIII1Rec) + parseFloat(profIII2Rec);
	var balance3 = parseFloat(profIIIAmt) -  parseFloat(rec);
	document.form.profIIIBalance.value= balance3;
	}
}
function balanceFees3III() {
	var profIIIAmt = document.form.profIIIAmt.value;
	var profIII1Rec = document.form.profIII1Rec.value;
	var profIII2Rec = document.form.profIII2Rec.value;
	var profIII3Rec = document.form.profIII3Rec.value;
	if (isNaN(profIII3Rec)) {
	alert("Please enter the amount properly");
	document.form.profIII3Rec.value = "0";
	document.form.profIII3Rec.focus();
	} else {
	var rec = parseFloat(profIII1Rec) + parseFloat(profIII2Rec) + parseFloat(profIII3Rec);
	var balance3 = parseFloat(profIIIAmt) -  parseFloat(rec);
	document.form.profIIIBalance.value= balance3;
	}
}
function balanceFees3IV() {
	var profIIIAmt = document.form.profIIIAmt.value;
	var profIII1Rec = document.form.profIII1Rec.value;
	var profIII2Rec = document.form.profIII2Rec.value;
	var profIII3Rec = document.form.profIII3Rec.value;
	var profIII4Rec = document.form.profIII4Rec.value;
	if (isNaN(profIII4Rec)) {
	alert("Please enter the amount properly");
	document.form.profIII4Rec.value = "0";
	document.form.profIII4Rec.focus();
	} else {
	var rec = parseFloat(profIII1Rec) + parseFloat(profIII2Rec) + parseFloat(profIII3Rec) + parseFloat(profIII4Rec);
	var balance3 = parseFloat(profIIIAmt) -  parseFloat(rec);
	document.form.profIIIBalance.value= balance3;
	}
}
function balanceFees4() {
	var visaAmt = document.form.visaAmt.value;
	var visaRec = document.form.visaRec.value;
	if(isNaN(visaAmt)) {
	alert("Please enter the amount properly");
	document.form.visaAmt.value = "0";
	document.form.visaAmt.focus();
	}
	if (isNaN(visaRec)) {
	alert("Please enter the amount properly");
	document.form.visaRec.value = "0";
	document.form.visaRec.focus();
	} else {
	var balance4 = parseFloat(visaAmt) -  parseFloat(visaRec);
	document.form.visaBalance.value= balance4;
	}
}
function balanceFees5() {
	var additionalAmt = document.form.additionalAmt.value;
	var additionalRec = document.form.additionalRec.value;
	if(isNaN(additionalAmt)) {
	alert("Please enter the amount properly");
	document.form.additionalAmt.value = "0";
	document.form.additionalAmt.focus();
	}
	if (isNaN(additionalRec)) {
	alert("Please enter the amount properly");
	document.form.additionalRec.value = "0";
	document.form.additionalRec.focus();
	} else {
	var balance5 = parseFloat(additionalAmt) -  parseFloat(additionalRec);
	document.form.additionalBalance.value= balance5;
	}
}
function balanceFees6() {
	var resumeResAmt = document.form.resumeResAmt.value;
	var resumeResRec = document.form.resumeResRec.value;
	if(isNaN(resumeResAmt)) {
	alert("Please enter the amount properly");
	document.form.resumeResAmt.value = "0";
	document.form.resumeResAmt.focus();
	}
	if (isNaN(resumeResRec)) {
	alert("Please enter the amount properly");
	document.form.resumeResRec.value = "0";
	document.form.resumeResRec.focus();
	} else {
	var balance6 = parseFloat(resumeResAmt) -  parseFloat(resumeResRec);
	document.form.resumeResBalance.value= balance6;
	}
}
function balanceFees7() {
	var airportpickAmt = document.form.airportpickAmt.value;
	var airportpickRec = document.form.airportpickRec.value;
	if(isNaN(airportpickAmt)) {
	alert("Please enter the amount properly");
	document.form.airportpickAmt.value = "0";
	document.form.airportpickAmt.focus();
	}
	if (isNaN(airportpickRec)) {
	alert("Please enter the amount properly");
	document.form.airportpickRec.value = "0";
	document.form.airportpickRec.focus();
	} else {
	var balance7 = parseFloat(airportpickAmt) -  parseFloat(airportpickRec);
	document.form.airportpickBalance.value= balance7;
	}
}
function balanceFees8() {
	var accomodationAmt = document.form.accomodationAmt.value;
	var accomodationRec = document.form.accomodationRec.value;
	if(isNaN(accomodationAmt)) {
	alert("Please enter the amount properly");
	document.form.accomodationAmt.value = "0";
	document.form.accomodationAmt.focus();
	}
	if (isNaN(accomodationRec)) {
	alert("Please enter the amount properly");
	document.form.accomodationRec.value = "0";
	document.form.accomodationRec.focus();
	} else {
	var balance8 = parseFloat(accomodationAmt) -  parseFloat(accomodationRec);
	document.form.accomodationBalance.value= balance8;
	}
}
function balanceSecAss() {
	var assSecAmt = document.form.assSecAmt.value;
	var assSecRec = document.form.assSecRec.value;
	if(isNaN(assSecAmt)) {
	alert("Please enter the amount properly");
	document.form.assSecAmt.value = "0";
	document.form.assSecAmt.focus();
	}
	if (isNaN(assSecRec)) {
	alert("Please enter the amount properly");
	document.form.assSecRec.value = "0";
	document.form.assSecRec.focus();
	} else {
	var balance8 = parseFloat(assSecAmt) -  parseFloat(assSecRec);
	document.form.assSecBalance.value= balance8;
	}
}
function balanceSpoAss() {
	var assSpoAmt = document.form.assSpoAmt.value;
	var assSpoRec = document.form.assSpoRec.value;
	if(isNaN(assSpoAmt)) {
	alert("Please enter the amount properly");
	document.form.assSpoAmt.value = "0";
	document.form.assSpoAmt.focus();
	}
	if (isNaN(assSpoRec)) {
	alert("Please enter the amount properly");
	document.form.assSpoRec.value = "0";
	document.form.assSpoRec.focus();
	} else {
	var balance8 = parseFloat(assSpoAmt) -  parseFloat(assSpoRec);
	document.form.assSpoBalance.value= balance8;
	}
}
function balanceMedFees() {
	var profMedAmt = document.form.profMedAmt.value;
	var profMedRec = document.form.profMedRec.value;
	if(isNaN(profMedAmt)) {
	alert("Please enter the amount properly");
	document.form.profMedAmt.value = "0";
	document.form.profMedAmt.focus();
	}
	if (isNaN(profMedRec)) {
	alert("Please enter the amount properly");
	document.form.profMedRec.value = "0";
	document.form.profMedRec.focus();
	} else {
	var balance8 = parseFloat(profMedAmt) -  parseFloat(profMedRec);
	document.form.profMedBalance.value= balance8;
	}
}
function phoneValidation() {
	var countryCode = document.form.countryCode.value;
	var areaCode = document.form.areaCode.value;
	var mobileNumber = document.form.mobileNumber.value;
	var homePhone = document.form.homePhone.value;
	if (isNaN(homePhone)) {
	alert("Please enter the Phone Number Properly");
	document.form.homePhone.value = "";
	document.form.homePhone.focus();
	}
	if (isNaN(countryCode)) {
	alert("Please enter the Country Code Properly");
	document.form.countryCode.value = "";
	document.form.countryCode.focus();
	}
	if (isNaN(areaCode)) {
	alert("Please enter the Area Code Properly");
	document.form.areaCode.value = "";
	document.form.areaCode.focus();
	}
	if (isNaN(mobileNumber)) {
	alert("Please enter the Mobile Number Properly");
	document.form.mobileNumber.value = "";
	document.form.mobileNumber.focus();
	}
}

function subclassName() {
	var visaType = document.form.visaCategory.options[document.form.visaCategory.selectedIndex].innerText;
	var subLen1 = visaType.length;
	var subStart = parseInt(subLen1) - 4;
	var subFinal = visaType.substr(subStart,3);
	document.form.subClass.value = subFinal;
}

function cms_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);
	 }
	//Category Name
	if(theForm.pagename.selectedIndex==0)
		{
			alert("Please select Pagename");
			theForm.pagename.focus();
			return false;
		}
		
	theForm.title.value = LTrim(theForm.title.value);
	theForm.title.value = RTrim(theForm.title.value);
	if (!emptystring(theForm.title.value))
		 {
			alert("Please Enter Title");
			theForm.title.focus();
			flag=false;
			return (false);
		}
		
	theForm.keywords.value = LTrim(theForm.keywords.value);
	theForm.keywords.value = RTrim(theForm.keywords.value);
	if (!emptystring(theForm.keywords.value))
		 {
			alert("Please Enter Keywords");
			theForm.keywords.focus();
			flag=false;
			return (false);
		}
		
	theForm.metadesc.value = LTrim(theForm.metadesc.value);
	theForm.metadesc.value = RTrim(theForm.metadesc.value);
	if (!emptystring(theForm.metadesc.value))
		 {
			alert("Please Enter Meta Description");
			theForm.metadesc.focus();
			flag=false;
			return (false);
		}
	
	//Set this return value to true when you want to submit the form
	return (flag);
}
