// vlidate function for contact form
  function contactvalidate()
  {
	  if(isEmpty(document.form1.name.value))
		  {
			  alert("Please enter your name");
			  document.form1.name.focus();
			  return false;
		  }
	  if(isEmpty(document.form1.title.value))
		  {
			  alert("Please enter job title");
			  document.form1.title.focus();
			  return false;
		  }
	  if(isEmpty(document.form1.company.value))
		  {
			  alert("Please enter your company");
			  document.form1.company.focus();
			  return false;
		  }
	  if(isEmpty(document.form1.address.value))
		  {
			  alert("Please enter your address");
			  document.form1.address.focus();
			  return false;
		  }
	  if(isEmpty(document.form1.phone.value))
		  {
			  alert("Please enter your phone number");
			  document.form1.phone.focus();
			  return false;
		  }
	if(isEmpty(document.form1.mailid.value))
		  {
		  	alert("Please enter your email address");
		  	document.form1.mailid.focus();
		  	return false;
		  }
	if(document.form1.heard.selectedIndex == 0)
		 {
		 	if(isEmpty(document.form1.other.value))
		 	 {
		 	  alert("Please select");
		 	  document.form1.other.focus();
		 	  return false;
		 	 }
	     }
  function Trim(str)
  {
  	var reg=/\s/ig;
  	//var reg = new RegExp("\s",'gi') ;
  	var tempChar=new String();
  	var inString = new String();
  	inString = str;
  	var newstring=new String("");
  	// for loop is for traversing purpose through it 's length
  	for (i=1; i<=inString.length; i++)
  	{
  		tempChar=inString.charAt(i-1);
  		if (tempChar.search(reg) == "-1")
  		{
  			newstring=newstring.concat(tempChar);
  		}
  	}
  	return newstring;
  }

  function isEmpty(strValue)
  {
  	if(Trim(strValue).length==0)
  	{
  		return true;
  	}
  	else
  	{
  		return false;
  	}
}

  var re = /^[_\.0-9a-z-]+\@([0-9a-z][0-9a-z-]*\.)+([a-z]{2,4})+$/i
  if (!document.form1.mailid.value.match(re))
  {
  alert('Enter valid email address');
  document.form1.mailid.focus();
  return false;
  }
}
// Validate function for request for info 

  function req_info_validate()
  {
	  if(isEmpty(document.form1.fname.value))
		  {
			  alert("Please enter your first name");
			  document.form1.fname.focus();
			  return false;
		  }
	  if(isEmpty(document.form1.lname.value))
		  {
			  alert("Please enter your last name");
			  document.form1.lname.focus();
			  return false;
		  }
	  if(isEmpty(document.form1.title.value))
		  {
			  alert("Please enter job title");
			  document.form1.title.focus();
			  return false;
		  }
	  if(isEmpty(document.form1.company.value))
		  {
			  alert("Please enter your company");
			  document.form1.company.focus();
			  return false;
		  }
	  if(isEmpty(document.form1.address.value))
		  {
			  alert("Please enter your address");
			  document.form1.address.focus();
			  return false;
		  }
	  if(isEmpty(document.form1.phone.value))
		  {
			  alert("Please enter your phone number");
			  document.form1.phone.focus();
			  return false;
		  }
	if(isEmpty(document.form1.mailid.value))
		  {
		  	alert("Please enter your email address");
		  	document.form1.mailid.focus();
		  	return false;
		  }
  function Trim(str)
  {
  	var reg=/\s/ig;
  	//var reg = new RegExp("\s",'gi') ;
  	var tempChar=new String();
  	var inString = new String();
  	inString = str;
  	var newstring=new String("");
  	// for loop is for traversing purpose through it 's length
  	for (i=1; i<=inString.length; i++)
  	{
  		tempChar=inString.charAt(i-1);
  		if (tempChar.search(reg) == "-1")
  		{
  			newstring=newstring.concat(tempChar);
  		}
  	}
  	return newstring;
  }

  function isEmpty(strValue)
  {
  	if(Trim(strValue).length==0)
  	{
  		return true;
  	}
  	else
  	{
  		return false;
  	}
}

  var re = /^[_\.0-9a-z-]+\@([0-9a-z][0-9a-z-]*\.)+([a-z]{2,4})+$/i
  if (!document.form1.mailid.value.match(re))
  {
  alert('Enter valid email address');
  document.form1.mailid.focus();
  return false;
  }
}

// validate function for req for info OPI form

function req_info_opi()
  {
	  if(isEmpty(document.form1.count.value))
		  {
			  alert("Please enter No. of people");
			  document.form1.count.focus();
			  return false;
		  }
		  if(isEmpty(document.form1.date.value))
		  {
			  alert("Please enter preferred date");
			  document.form1.date.focus();
			  return false;
		  }
		  if(isEmpty(document.form1.time.value))
		  {
			  alert("Please enter preferred time");
			  document.form1.time.focus();
			  return false;
		  }
	  if(isEmpty(document.form1.fname.value))
		  {
			  alert("Please enter your first name");
			  document.form1.fname.focus();
			  return false;
		  }
	  if(isEmpty(document.form1.lname.value))
		  {
			  alert("Please enter your last name");
			  document.form1.lname.focus();
			  return false;
		  }
	  if(isEmpty(document.form1.title.value))
		  {
			  alert("Please enter job title");
			  document.form1.title.focus();
			  return false;
		  }
	  if(isEmpty(document.form1.company.value))
		  {
			  alert("Please enter your company");
			  document.form1.company.focus();
			  return false;
		  }
	  if(isEmpty(document.form1.address.value))
		  {
			  alert("Please enter your address");
			  document.form1.address.focus();
			  return false;
		  }
	   var Num = /^[0-9]+$/
	  if(!document.form1.phone.value.match(Num))
		  {
			  alert("Please enter your phone number");
			  document.form1.phone.focus();
			  return false;
		  }
	var re = /^[_\.0-9a-z-]+\@([0-9a-z][0-9a-z-]*\.)+([a-z]{2,4})+$/i
	if(!document.form1.mailid.value.match(re))
		  {
		  	alert("Please enter valid email address");
		  	document.form1.mailid.focus();
		  	return false;
		  }
	if(document.form1.country.selectedIndex == 0)
		  {
		  	alert("Please Select your Country");
		  	document.form1.country.focus();
		  	return false;
		  }
	  if(document.form1.industry.selectedIndex == 0)
		 {
		 	if(isEmpty(document.form1.other.value))
		 	 {
		 	  alert("Please describe about your Industry");
		 	  document.form1.other.focus();
		 	  return false;
		 	 }
	     }
	    if(document.form1.eam.selectedIndex == 0)
		  {
		  	alert("Please Select your EAM");
		  	document.form1.eam.focus();
		  	return false;
		  }
		 if(document.form1.emp.selectedIndex == 0)
		  {
		  	alert("Please Select your No. of Employees");
		  	document.form1.emp.focus();
		  	return false;
		  }
  function Trim(str)
  {
  	var reg=/\s/ig;
  	//var reg = new RegExp("\s",'gi') ;
  	var tempChar=new String();
  	var inString = new String();
  	inString = str;
  	var newstring=new String("");
  	// for loop is for traversing purpose through it 's length
  	for (i=1; i<=inString.length; i++)
  	{
  		tempChar=inString.charAt(i-1);
  		if (tempChar.search(reg) == "-1")
  		{
  			newstring=newstring.concat(tempChar);
  		}
  	}
  	return newstring;
  }

  function isEmpty(strValue)
  {
  	if(Trim(strValue).length==0)
  	{
  		return true;
  	}
  	else
  	{
  		return false;
  	}
}
}
