function validate()
{	
		
		if(document.form.realname.value=="")
		{
		alert("Enter Name !");
		return false;
		}
		 if(document.form.email.value=="" || !isValidEmail(document.form.email.value))
		{
		alert("Enter Proper Email Id!");
		return false;
		}
		
	
		 if(document.form.Address.value=="")
		{
		alert("Enter Address !");
		return false;
		}
		 if(document.form.City.value=="")
		{
		alert("Enter City !");
		return false;
		}
		 if(document.form.State.value=="")
		{
		alert("Enter State !");
		return false;
		}
		 if(document.form.zip.value=="")
		{
		alert("Enter zip !");
		return false;
		}
		 if(document.form.Country.value=="")
		{
		alert("Enter Country !");
		return false;
		}
		 if(document.form.Phone.value=="" || !isValidphone1(document.form.Phone.value))
		{
		alert("Enter Phone !");
		return false;
		}
		

}
function isValidphone1(string)
{

	if (string.length >0) {
	 i=string.indexOf("-")
	 
	 j=string.indexOf(",")
	// k=string.indexOf("[0-9]")
	// kk=string.indexOf(" ")
	// jj=string.lastIndexOf(".")+1
	 len=string.length
	 
if(len<=15){
 	if ((isNaN(string)==false) || (i>=0) || (j>=0)) 
 		return true;	
 	else 
		return false;
 }
}
}


function isValidEmail(string)
{

	if (string.length >0) {
	 i=string.indexOf("@")
	 j=string.indexOf(".",i)
	 k=string.indexOf(",")
	 kk=string.indexOf(" ")
	 jj=string.lastIndexOf(".")+1
	 len=string.length

 	if ((i>0) && (j>(1+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=3)) 
 		return true;	
 	else 
		return false;
 }

}


function verify()
{
	if(document.form.realname.value=="")
	{
	alert("Please Enter Name ");
	return false;
	}
	if(document.form.email.value=="")
	{
	alert("Enter Email !");
	return false;
	}
	else
		{   var em=document.form.email.value;
			var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
			var matchArray = em.match(emailPat);
			if (matchArray == null) 
			{
				alert(" Your Email address seems incorrect. Please check the '@' and '.' in the email address\n");
				return false;
			}
		}
	if(document.form.Address.value=="")
	{
	alert("Enter Address !");
	return false;
	}
	if(document.form.City.value=="")
	{
	alert("Enter City !");
	return false;
	}
	if(document.form.State.value=="")
	{
	alert("Enter State !");
	return false;
	}
	if(document.form.zip.value=="")
	{
	alert("Enter zip !");
	return false;
	}
	if(document.form.Country.value=="")
	{
	alert("Enter Country !");
	return false;
	}
	if(document.form.Phone.value=="" || !isValidphone1(document.form.Phone.value))
	{
	alert("Enter Phone !");
	return false;
	}
	
}
/*
function phone1()
{
var ValidChars = "0123456789/-.";
var IsNumber=true;
var Char;
sText=obj.phone.value;	
for (i = 0; i < sText.length && IsNumber == true; i++) 
{ 
Char = sText.charAt(i); 
if (ValidChars.indexOf(Char) == -1) 
{alert('Please enter only Positive numbers in Telephone field') ;
obj.phone.value='';
obj.phone.focus(); 
IsNumber = false;
}
}
return IsNumber;
}

function name1()
{
	var IsNumber=true;
	var Char;
	string=obj.name.value;
	var iChars = "*|,\":<>[]{}`\';()@&$#%0123456789";
	for (var i = 0; i < string.length; i++) 
	{
		if (iChars.indexOf(string.charAt(i)) != -1)
			IsNumber=false;
		if(IsNumber==false)
		{
			alert('Please enter only Alphabets in the Name field');
			obj.name.value='';
			obj.name.focus(); 
			return IsNumber;
		}
	}
	return IsNumber;
}


function removeLeadingSpaces(str)
{
   var whitespace = new String(" \\t\\n\\r");
   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1)
    {
      var j=0, i = s.length;
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)  j++;
      s = s.substring(j, i);
    }
   return s;
}
//######################################################################################################

//######################################################################################################
// This method is used to remove Trailing spaces.
// It takes argument of the string which Trailing Spaces has to removed.

function removeTrailingSpaces(str)
{
   var whitespace = new String(" \\t\\n\\r");
   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1)
   {
      var i = s.length - 1;       // Get length of string
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) i--;

      // Get the substring from the front of the string to
      // where the last non-whitespace character is...
      s = s.substring(0, i+1);
   }

   return s;
}
//######################################################################################################
// Removes both Leading and Trailing blanks.
//

function removeAllSpaces(str)
{
   str = removeLeadingSpaces(str); //Remove Leading Spaces
   str = removeTrailingSpaces(str); //Remove Trailing Spaces
   return str;
}

function checkform(){
	alert();
	var msg='';
	if (removeAllSpaces(document.form.name.value)==""){msg="Following Error occurred..\n\n Your Name can't be Left Blank\n";}
	
	if (removeAllSpaces(document.form.email.value)=="")
	{
		msg= msg + " Your Email can't be left Blank\n";
	}
	else
	{   var em=document.form.youremail2.value;
		var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
		var matchArray = em.match(emailPat);
		if (matchArray == null) 
		{
			msg= msg + " Your Email address seems incorrect. Please check the '@' and '.' in the email address\n";
		}
	}

if (removeAllSpaces(document.form.Address.value)==""){msg+="Following Error occurred..\n\n Your Address can't be Left Blank\n";}
if (removeAllSpaces(document.form.City.value)==""){msg+="Following Error occurred..\n\n Your City can't be Left Blank\n";}	
if (removeAllSpaces(document.form.State.value)==""){msg+="Following Error occurred..\n\n Your State can't be Left Blank\n";}
if (removeAllSpaces(document.form.zip.value)==""){msg+="Following Error occurred..\n\n Your zip can't be Left Blank\n";}
if (removeAllSpaces(document.form.Country.value)==""){msg+="Following Error occurred..\n\n Your country can't be Left Blank\n";}
if (removeAllSpaces(document.form.Phone.value)==""){msg+="Following Error occurred..\n\n Your Phone can't be Left Blank\n";}
if (removeAllSpaces(document.form.comment.value)==""){msg+= " Comment can't be left Blank\n";}
alert(msg);
	
}

function validate(){

	
	var msg='';
	if (removeAllSpaces(document.form3.name.value)==""){msg="Following Error occured..\n\n Name can't be left Blank\n"; obj.name.value='';
	obj.name.focus();}
	if (removeAllSpaces(document.form3.email.value)==""){msg= msg + " Email can't be left Blank\n"; obj.email.value=''; obj.email.focus();}
	else
	{   var em=document.form3.email.value;
		var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
		var matchArray = em.match(emailPat);
		if (matchArray == null) 
		{
			msg= msg + " Email address seems incorrect. Please check the '@' and '.' in the email address\n";
			obj.email.value='';
			obj.email.focus();
		}
	}
	if (removeAllSpaces(document.form3.comment.value)==""){msg=msg + "Comments can't be left Blank\n"; 
	obj.comment.value='';
	obj.comment.focus();}

	if (msg!=""){
		alert (msg);
		return false;
	}
	

}*/
