// JavaScript Document
//validation
var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;

var iChars = "!@#$^*=[]\':;{}|\"<>";
var iChars1 = "!@#$^*=[]\'{}|\"<>";
//var iChars1 = "!@$^*()=[]\';{}|\"<>";

// Check Text or Not
			function isText(str)
			{
			var i=0;
			if(str.charAt(0)==' ')i++;
			while(i<str.length)
			{
			if (str.charAt(i)>='0' && str.charAt(i)<= '9' || str.charAt(i)=='+' || str.charAt(i)=='-' || str.charAt(i)=='*' || str.charAt(i)=='/' || str.charAt(i)=='\\' || str.charAt(i)=='\'' || str.charAt(i)=='@' || str.charAt(i)=='!' || str.charAt(i)=='~' || str.charAt(i)=='`' || str.charAt(i)=='#' || str.charAt(i)=='$' || str.charAt(i)=='%' || str.charAt(i)=='^' || str.charAt(i)=='&' || str.charAt(i)=='(' || str.charAt(i)==')' || str.charAt(i)=='_' || str.charAt(i)=='=' || str.charAt(i)=='?' || str.charAt(i)=='.' || str.charAt(i)==',' || str.charAt(i)==';' || str.charAt(i)==':' || str.charAt(i)=='"' || str.charAt(i)=='{' || str.charAt(i)=='}' || str.charAt(i)=='[' || str.charAt(i)==']' || str.charAt(i)=='<' || str.charAt(i)=='>' || str.charAt(i)=='|')
			return false;
			i++;
			}
			return true;
			}
// validation for Text box
function validRequired(formField,fieldLabel){
	var result = true;
	
	if (formField.value == "") {
		alert('Please enter your "' + fieldLabel +'" field.');
		formField.focus();
		result = false;
	}	
	return result;
}
			
// Remove the empty space
			function trim(String)
			{
			if (String == null)
			{   
			return ("");
			}
			return String.replace(/(^\s+)|(\s+$)/g,"");
			}
			

function ValidateContact()
{
	if (emailfilter.test(document.getElementById("txtEmail").value)==false) {
		alert ("Please enter valid E-Mail ID");
		document.getElementById("txtEmail").focus();
		return false;
	}
	if (document.getElementById("txtFirstName").value==0){
		alert ("Please enter your first name");
		document.getElementById("txtFirstName").focus();
		return false;}
		else if(!isText(document.getElementById("txtFirstName").value))
				{
				alert("First name only accept alphabetic values");
				document.getElementById("txtFirstName").focus();
				return false;
				}
	if (document.getElementById("txtLastName").value==0){
		alert ("Please enter your Last name");
		document.getElementById("txtLastName").focus();
		return false;}
		else if(!isText(document.getElementById("txtLastName").value))
				{
				alert("Last name only accept alphabetic values");
				document.getElementById("txtLastName").focus();
				return false;
				}
	if (document.getElementById("txtCompany").value==0){
		alert ("Please enter your company name");
		document.getElementById("txtCompany").focus();
		return false;}
   for (var i = 0; i < document.getElementById("txtCompany").value.length; i++) {
  	if (iChars.indexOf(document.getElementById("txtCompany").value.charAt(i)) != -1) {
  	alert ("Company field accept these special characters (& (  ) - _  , .) only");
  	return false;
  	}
}
if (document.getElementById("txtTitle").value==0){
		alert ("Please enter title");
		document.getElementById("txtTitle").focus();
		return false;}
   for (var i = 0; i < document.getElementById("txtTitle").value.length; i++) {
  	if (iChars.indexOf(document.getElementById("txtTitle").value.charAt(i)) != -1) {
  	alert ("Title field accept these special characters (& (  ) -  _ , . : ;) only");
  	return false;
  	}
}	
if (document.getElementById("ddlCountry").value==0){
		alert ("Please select your country");
		document.getElementById("ddlCountry").focus();
		return false;}
if (document.getElementById("txtPhone").value==0){
		alert ("Please enter your phone #");
		document.getElementById("txtPhone").focus();
		return false;}
if (document.getElementById("txtContactReason").value==0){
		alert ("Please enter contact reason field");
		document.getElementById("txtContactReason").focus();
		return false;}
   for (var i = 0; i < document.getElementById("txtContactReason").value.length; i++) {
  	if (iChars1.indexOf(document.getElementById("txtContactReason").value.charAt(i)) != -1) {
  	alert ("Contact Reason field accept these special characters (& (  ) -  _ , . : ;) only");
  	return false;
  	}
}	
if(document.frmContact.recaptcha_response_field.value==0){
				  alert("Please enter captcha code");
				  document.frmContact.recaptcha_response_field.focus();
				  return false;
				  }
return true;
}
function ValidateScheduleDemo(){
	if (emailfilter.test(document.getElementById("txtEmail").value)==false) {
		alert ("Please enter valid E-Mail ID");
		document.getElementById("txtEmail").focus();
		return false;
	}
	if (document.getElementById("txtFirstName").value==0){
		alert ("Please enter your first name");
		document.getElementById("txtFirstName").focus();
		return false;}
		else if(!isText(document.getElementById("txtFirstName").value))
				{
				alert("First name only accept alphabetic values");
				document.getElementById("txtFirstName").focus();
				return false;
				}
	if (document.getElementById("txtLastName").value==0){
		alert ("Please enter your Last name");
		document.getElementById("txtLastName").focus();
		return false;}
		else if(!isText(document.getElementById("txtLastName").value))
				{
				alert("Last name only accept alphabetic values");
				document.getElementById("txtLastName").focus();
				return false;
				}
	if (document.getElementById("txtCompany").value==0){
		alert ("Please enter your company name");
		document.getElementById("txtCompany").focus();
		return false;}
   for (var i = 0; i < document.getElementById("txtCompany").value.length; i++) {
  	if (iChars.indexOf(document.getElementById("txtCompany").value.charAt(i)) != -1) {
  	alert ("Company field accept these special characters (& (  ) - _  , .) only");
  	return false;
  	}
}
if (document.getElementById("txtTitle").value==0){
		alert ("Please enter title");
		document.getElementById("txtTitle").focus();
		return false;}
   for (var i = 0; i < document.getElementById("txtTitle").value.length; i++) {
  	if (iChars.indexOf(document.getElementById("txtTitle").value.charAt(i)) != -1) {
  	alert ("Title field accept these special characters (& (  ) -  _ , . : ;) only");
  	return false;
  	}
}	
if (document.getElementById("ddlCountry").value==0){
		alert ("Please select your country");
		document.getElementById("ddlCountry").focus();
		return false;}
if (document.getElementById("txtPhone").value==0){
		alert ("Please enter your phone #");
		document.getElementById("txtPhone").focus();
		return false;}
if (document.getElementById("txtDate").value==0){
		alert ("Please select your Date/Time of Presentation");
		document.getElementById("txtDate").focus();
		return false;}
if (document.getElementById("txtContactReason").value==0){
		alert ("Please enter comments field");
		document.getElementById("txtContactReason").focus();
		return false;}
   for (var i = 0; i < document.getElementById("txtContactReason").value.length; i++) {
  	if (iChars1.indexOf(document.getElementById("txtContactReason").value.charAt(i)) != -1) {
  	alert ("Contact Reason field accept these special characters (& (  ) -  _ , . : ;) only");
  	return false;
  	}
}
if(document.frmContact.recaptcha_response_field.value==0){
				  alert("Please enter captcha code");
				  document.frmContact.recaptcha_response_field.focus();
				  return false;
				  }	
return true;
}