// JavaScript Document

/////////////////////////////////////numeric check///////////////////////////////////

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-()+ ";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
///////////////////////////validate() procedure////////////////////////

function validate()
{

var txt_name = document.getElementById("txt_name"),
    txt_des1 = document.getElementById("txt_des1"),
	txt_compN = document.getElementById("txt_compN"),
	txt_compA = document.getElementById("txt_compA"),
	txt_ph = document.getElementById("txt_ph"),
	txt_email = document.getElementById("txt_email"),
	txt_description = document.getElementById("txt_description");
		
	if(txt_name.value ==""){
		alert("Please specify your name!")
		txt_name.focus();
		return false;
	}
	if(txt_des1.value ==""){
		alert("Please specify your designation!")
		txt_des1.focus();
		return false;
	}
	if(txt_compN.value == ""){
		alert("Please specify your company name!")
		txt_compN.focus();
		return false;
	}

	
	if(txt_compA.value ==""){
		alert("Please specify your company address!")
		txt_compA.focus();
		return false;
	}

	if(txt_ph.value == ""){
		alert("Please specify your Tel number!")
		txt_ph.focus();
		return false;
	}
	
	if(!IsNumeric(txt_ph.value)){
		alert("Please specify your correct Tel number!")
		txt_ph.focus();
		return false;
	}


	if(txt_email.value==""){
		alert("Please specify your email address!")
		txt_email.focus();
		return false;
	}
	var at=txt_email.value.indexOf("@");
	var dot=txt_email.value.lastIndexOf(".");	
	if(dot<=at){
		alert("Your email address does not seems to be valid!")
		txt_email.focus();
		return false;
	}

	if(txt_description.value ==""){
		alert("Please specify your description!")
		txt_description.focus();
		return false;
	}

return true	
}



//////////////////////////////////////////////////////////////////////////////////////////////