

function frm_val(){

	if (document.form1.name.value=="")
	{
	alert("Contact person field could not be blank.");
	document.form1.name.focus();
	return false;
	}

	if (document.form1.address.value=="")
	{
	alert("Street address field could not be blank.");
	document.form1.address.focus();
	return false;
	}

	if (document.form1.phone.value=="")
	{
	alert("Phone field could not be blank.");
	document.form1.phone.focus();
	return false;
	}


	if (document.form1.phone.value=="")
	{
	alert("Phone field could not be blank.");
	document.form1.phone.focus();
	return false;
	}
	
	var p=document.forms["form1"]["phone"].value
	
	if(isNaN(p))
	{
	alert("Phone field could not be character.");
	document.form1.phone.focus();
	return false;
	}
	var maxlan = 9;
	if(p.length < maxlan)
	{
	alert("Phone field not valid.");
	document.form1.phone.focus();
	return false;	
	}
	
	if (document.form1.email.value=="")
	{
	alert("Email field could not be blank.");
	document.form1.email.focus();
	return false;
	}


	var x=document.forms["form1"]["email"].value
	var atpos=x.indexOf("@");
	var dotpos=x.lastIndexOf(".");
	if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
	  {
	  alert("Not a valid e-mail address \n eg. abc@zyx.com");
	  document.form1.email.focus();
	  return false;
	  }
	

	if (document.form1.country.value=="")
	{
	alert(" Please select country name");
	document.form1.country.focus();
	return false;
	}


	if (document.form1.products.value=="")
	{
	alert("products field could not be blank.");
	document.form1.products.focus();
	return false;
	}

	
//captcha code 
	if (document.form1.letters_code.value=="")
	{
	alert(" Please enter the 6 digit code shown on image \n captcha field could not be blank. ");
	document.form1.letters_code.focus();
	return false;
	}
}
function refreshcaptcha()
{
	var img = document.images['captchaimg'];
	img.src = img.src.substring(0,img.src.lastindexof("?"))+"?rand="+math.random()*1000;
}

