// JavaScript Document
function goPage()
{
	if(document.frmquick.page1.value!="")
	{
		if(document.frmquick.page1.value == 1)
		{
			location.replace("index.php");
		}
		if(document.frmquick.page1.value == 2)
		{
			location.replace("profile.php");
		}
		if(document.frmquick.page1.value == 3)
		{
			location.replace("process.php");
		}
		if(document.frmquick.page1.value == 4)
		{
			location.replace("quality.php");
		}
		if(document.frmquick.page1.value == 5)
		{
			location.replace("products.php");
		}
		if(document.frmquick.page1.value == 6)
		{
			location.replace("contact.php");
		}
		if(document.frmquick.page1.value == 7)
		{
			location.replace("enquiry.php");
		}
		if(document.frmquick.page1.value == 8)
		{
			location.replace("e-brochure.php");
		}		
	}
}


function submitquick()
{
	 mErr = "";
	 setfocusField="";
	 
	 if( document.quickcon.fname.value == null || document.quickcon.fname.value == ""){
	  mErr += "Enter Name\n";
	  if(setfocusField=="")  setfocusField="fname";
	 } 
	  if (validEmail(document.quickcon.email.value) == false || validEmail(document.quickcon.email.value) == null || validEmail(document.quickcon.email.value) == ""){
	  mErr += "Enter Valid Email\n";
	  if(setfocusField=="")  setfocusField="email";
	 }
	 if( document.quickcon.comment.value == null || document.quickcon.comment.value == ""){
	  mErr += "Enter Comment Detail\n";
	  if(setfocusField=="")  setfocusField="comment";
	 } 
	
	if (mErr=="")
	{
			return true;
	}
	else
	{
	  alert ("Please enter following:\n\n" + mErr);
	  errorbox = eval('document.quickcon.' +setfocusField);
	  errorbox.focus();  
	  return false;
	}
}
	
function validEmail(email) {
	 var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
	 var checkend=/\.[a-zA-Z]{2,3}$/;
	
	 if((email.search(exclude) != -1) || (email.search(checkend) == -1))	return false;
	
	 atPos = email.indexOf("@",0);
	 pPos1 = email.indexOf(".",0);
	 periodPos = email.indexOf(".",atPos);
	 pos1 = pPos1;
	 pos2 = 0;
	 while (pos2 > -1) {
	  pos2 = email.indexOf(".",pos1+1);
	  if (pos2 == pos1+1)  return false;
	  else  pos1 = pos2;
	 }
	 if (atPos == -1)	return false;
	 if (atPos == 0)	return false;
	 if (pPos1 == 0)	return false;
	 if(email.indexOf("@",atPos+1) > -1)	return false;
	 if (periodPos == -1)	return false;
	 if (atPos+1 == periodPos)	return false;
	 if (periodPos+3 > email.length)	return false;
	
	 return true;
 }
 
 
function validphone()
{
	var phone1=document.quickcon.phone.value;
	var s = "()[]-0123456789";
	for(var i=0; i<=phone1.length; i++)
	{
		if (phone1.substring(0,1) == ("-"))
		{
			alert("No '-' at the first Position...")
			document.quickcon.phone.focus();
			document.quickcon.phone.select();
			return false;
			break;
		}
		if (s.indexOf(phone1.charAt(i)) < 0)
		{
			alert("Please enter numeric values...")
			document.quickcon.phone.focus();
			document.quickcon.phone.select();
			return false;
			break;
		}
	}
}