function order_validate()
{

	name=document.frm_order.name;
	if(name.value=="")
	{
		alert("Enter the Full name");
		name.focus();
		return false;
	}
		email=document.frm_order.email;
	if(email.value=="")
	{
		alert("Enter the Email");
		email.focus();
		return false;
	}
	if (!validateEmail(email.value,1,1)){
		email.focus();
		return false;
	}
	BAddress1=document.frm_order.address1;
	if(BAddress1.value=="")
	{
		alert("Enter the Address Line1");
		BAddress1.focus();
		return false;
	}
		
	BCity=document.frm_order.city;
	if(BCity.value=="")
	{
		alert("Enter the City");
		BCity.focus();
		return false;
	}
	if(document.frm_order.state.value==0)
	{
		alert("Select the State");
		document.frm_order.state.focus();
		return false;
	}
	if(document.frm_order.zipcode.value=="")
	{
		alert("Enter the Zipcode");
		document.frm_order.zipcode.focus();
		return false;
	}
		if(document.frm_order.country.value=="")
	{
		alert("Select  the Country");
		document.frm_order.country.focus();
		return false;
	}
	/*if(document.frm_order.phone.value=="")
	{
		alert("Enter  the Phone number");
		document.frm_order.phone.focus();
		return false;
	}*/
}
function validateEmail(addr,man,db) {
	if (addr == '' && man) {
	   if (db) alert('Email address is mandatory');
	   return false;
	}
	var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
	for (i=0; i<invalidChars.length; i++) {
	   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
		  if (db) alert('Email address contains invalid characters');
		  return false;
	   }
	}
	for (i=0; i<addr.length; i++) {
	   if (addr.charCodeAt(i)>127) {
		  if (db) alert("Email address contains non ascii characters.");
		  return false;
	   }
	}

	var atPos = addr.indexOf('@',0);
	if (atPos == -1) {
	   if (db) alert('Email address must contain an @');
	   return false;
	}
	if (atPos == 0) {
	   if (db) alert('Email address must not start with @');
	   return false;
	}
	if (addr.indexOf('@', atPos + 1) > - 1) {
	   if (db) alert('Email address must contain only one @');
	   return false;
	}
	if (addr.indexOf('.', atPos) == -1) {
	   if (db) alert('Email address must contain a period in the domain name');
	   return false;
	}
	if (addr.indexOf('@.',0) != -1) {
	   if (db) alert('period must not immediately follow @ in email address');
	   return false;
	}
	if (addr.indexOf('.@',0) != -1){
	   if (db) alert('period must not immediately precede @ in email address');
	   return false;
	}
	if (addr.indexOf('..',0) != -1) {
	   if (db) alert('two periods must not be adjacent in email address');
	   return false;
	}
	var suffix = addr.substring(addr.lastIndexOf('.')+1);
	if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
	   if (db) alert('invalid primary domain in email address');
	   return false;
	}
return true;
}
         
function first()
{
		name=document.frm_order.name;
	if(name.value=="")
	{
		alert("Enter the Full name");
		name.focus();
		return false;
	}
		email=document.frm_order.email;
	if(email.value=="")
	{
		alert("Enter the Email");
		email.focus();
		return false;
	}
		if (!validateEmail(email.value,1,1)){
		email.focus();
		return false;
	}
}

function sendemail()
{
	 if (document.form1.name.value== "" )
		 { 
			 alert ("Please enter the name");
			 document.form1.name.focus();
			 return false;
		 }
if (document.form1.email.value== "" )
		 { 
			 alert ("Please enter your email address");
			 document.form1.email.focus();
			 return false;
		 }
		  if (!validateEmail(document.form1.email.value,1,1)) 
		 {
		 document.form1.email.focus();
		 return false;
		 }		
		 if (document.form1.message.value== "" )
		 { 
			 alert ("Please enter the message");
			 document.form1.message.focus();
			 return false;
		 }
}
function validateEmail(addr,man,db) {
	if (addr == '' && man) {
	   if (db) alert('Email address is mandatory');
	   return false;
	}
	var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
	for (i=0; i<invalidChars.length; i++) {
	   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
		  if (db) alert('Email address contains invalid characters');
		  return false;
	   }
	}
	for (i=0; i<addr.length; i++) {
	   if (addr.charCodeAt(i)>127) {
		  if (db) alert("Email address contains non ascii characters.");
		  return false;
	   }
	}
	var atPos = addr.indexOf('@',0);
	if (atPos == -1) {
	   if (db) alert('Email address must contain an @');
	   return false;
	}
	if (atPos == 0) {
	   if (db) alert('Email address must not start with @');
	   return false;
	}
	if (addr.indexOf('@', atPos + 1) > - 1) {
	   if (db) alert('Email address must contain only one @');
	   return false;
	}
	if (addr.indexOf('.', atPos) == -1) {
	   if (db) alert('Email address must contain a period in the domain name');
	   return false;
	}
	if (addr.indexOf('@.',0) != -1) {
	   if (db) alert('period must not immediately follow @ in email address');
	   return false;
	}
	if (addr.indexOf('.@',0) != -1){
	   if (db) alert('period must not immediately precede @ in email address');
	   return false;
	}
	if (addr.indexOf('..',0) != -1) {
	   if (db) alert('two periods must not be adjacent in email address');
	   return false;
	}
	var suffix = addr.substring(addr.lastIndexOf('.')+1);
	if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
	   if (db) alert('invalid primary domain in email address');
	   return false;
	}
return true;
}
