function validRequired(formField,fieldLabel)
{
	var result = true;
	
	if (formField.value == "")
	{
		alert(fieldLabel);
		formField.focus();
		result = false;
	}
	
	return result;
}
// Email Validation
function checkEmail(myForm,mess)
{
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(myForm.value))
 {
	return (true)
 }
	alert(mess);
	myForm.focus();
	return (false)
}

function isNotNumeric(str){
		for (var i = 0; i < str.length; i++)
		{
				var ch = str.substring(i, i + 1);
				if((ch < '0' || '9' < ch)) 
				{
					if(ch == "+" || ch == "-" || ch == "." || ch == ")" || ch == "("  || ch == " ") continue;
					return true;
				}
		}
		return false;
}
function isNotAlphabets(str){
		for (var i = 0; i < str.length; i++)
		{
				re = / /gi				//Replace the space between words with no space
				str = str.replace(re,"");
			
				var ch = str.substring(i, i + 1);
				
				if((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) 
				{
					return true;
				}
		}
		return false;
}

function contact_us_form(nForm) {
		
		 if(!validRequired(document.ChronoContact_contact_us.first_name,"Please enter your First Name"))
			return false;
		 if(isNotAlphabets(document.ChronoContact_contact_us.first_name.value))
		 {
			alert("Invalid characters in First Name.");
			document.ChronoContact_contact_us.first_name.focus();
			return false;
		 }
		if(!validRequired(document.ChronoContact_contact_us.last_name,"Please enter your Last Name"))
			return false;
		 if(isNotAlphabets(document.ChronoContact_contact_us.last_name.value))
		 {
			alert("Invalid characters in Last Name.");
			document.ChronoContact_contact_us.last_name.focus();
			return false;
		 }
		if (!checkEmail(document.ChronoContact_contact_us.email,"Please enter valid Email"))
			return false;
					
										
		/*if (!validRequired(document.ChronoContact_contact_us.phone,"Please enter your Phone Number"))
			return false;			
						
	 if(isNotNumeric(document.ChronoContact_contact_us.phone.value))
	 {
		alert("Invalid characters in Phone Number.");
		document.ChronoContact_contact_us.phone.focus();
		return false;
	 }	*/
	 if (!validRequired(document.ChronoContact_contact_us.company,"Please enter your Company"))
			return false;			
		if (!validRequired(document.ChronoContact_contact_us.title,"Please enter your Title"))
			return false;			
	//	if (!validRequired(document.ChronoContact_contact_us.website,"Please enter your website URL"))
	//		return false;
	if (!validRequired(document.ChronoContact_contact_us.chrono_verification,"Please enter verification code"))
			return false;
return true;
}


function download(nForm) {
		
		 if(!validRequired(document.ChronoContact_download.first_name,"Please enter your First Name"))
			return false;
		 if(isNotAlphabets(document.ChronoContact_download.first_name.value))
		 {
			alert("Invalid characters in First Name.");
			document.ChronoContact_download.first_name.focus();
			return false;
		 }
		if(!validRequired(document.ChronoContact_download.last_name,"Please enter your Last Name"))
			return false;
		 if(isNotAlphabets(document.ChronoContact_download.last_name.value))
		 {
			alert("Invalid characters in Last Name.");
			document.ChronoContact_download.last_name.focus();
			return false;
		 }
		if (!checkEmail(document.ChronoContact_download.email,"Please enter valid Email"))
			return false;
					
										
		if (!validRequired(document.ChronoContact_download.phone,"Please enter your Phone Number"))
			return false;			
						
	 if(isNotNumeric(document.ChronoContact_download.phone.value))
	 {
		alert("Invalid characters in Phone Number.");
		document.ChronoContact_download.phone.focus();
		return false;
	 }	
	 if (!validRequired(document.ChronoContact_download.company,"Please enter your Company"))
			return false;			
		if (!validRequired(document.ChronoContact_download.title,"Please enter your Title"))
			return false;			
	if (!validRequired(document.ChronoContact_download.chrono_verification,"Please enter verification code"))
			return false;
return true;
}

function event_us_form(nForm) {
		
		 if(!validRequired(document.ChronoContact_event.first_name,"Please enter your First Name"))
			return false;
		 if(isNotAlphabets(document.ChronoContact_event.first_name.value))
		 {
			alert("Invalid characters in First Name.");
			document.ChronoContact_event.first_name.focus();
			return false;
		 }
		if(!validRequired(document.ChronoContact_event.last_name,"Please enter your Last Name"))
			return false;
		 if(isNotAlphabets(document.ChronoContact_event.last_name.value))
		 {
			alert("Invalid characters in Last Name.");
			document.ChronoContact_event.last_name.focus();
			return false;
		 }
		if (!checkEmail(document.ChronoContact_event.email,"Please enter valid Email"))
			return false;
					
										
		/*if (!validRequired(document.ChronoContact_event.phone,"Please enter your Phone Number"))
			return false;			
						
	 if(isNotNumeric(document.ChronoContact_event.phone.value))
	 {
		alert("Invalid characters in Phone Number.");
		document.ChronoContact_event.phone.focus();
		return false;
	 }	*/
	 if (!validRequired(document.ChronoContact_event.company,"Please enter your Company"))
			return false;			
		if (!validRequired(document.ChronoContact_event.title,"Please enter your Title"))
			return false;			
	if (!validRequired(document.ChronoContact_event.chrono_verification,"Please enter verification code"))
			return false;
return true;
}

function event_us_form_event(nForm) {
		
		 if(!validRequired(document.ChronoContact_event_2010.first_name,"Please enter your First Name"))
			return false;
		 if(isNotAlphabets(document.ChronoContact_event_2010.first_name.value))
		 {
			alert("Invalid characters in First Name.");
			document.ChronoContact_event_2010.first_name.focus();
			return false;
		 }
		if(!validRequired(document.ChronoContact_event_2010.last_name,"Please enter your Last Name"))
			return false;
		 if(isNotAlphabets(document.ChronoContact_event_2010.last_name.value))
		 {
			alert("Invalid characters in Last Name.");
			document.ChronoContact_event_2010.last_name.focus();
			return false;
		 }
		if (!checkEmail(document.ChronoContact_event_2010.email,"Please enter valid Email"))
			return false;
					
										
		/*if (!validRequired(document.ChronoContact_event_2010.phone,"Please enter your Phone Number"))
			return false;			
						
	 if(isNotNumeric(document.ChronoContact_event_2010.phone.value))
	 {
		alert("Invalid characters in Phone Number.");
		document.ChronoContact_event_2010.phone.focus();
		return false;
	 }	*/
	 if (!validRequired(document.ChronoContact_event_2010.company,"Please enter your Company"))
			return false;			
		if (!validRequired(document.ChronoContact_event_2010.title,"Please enter your Title"))
			return false;			
	if (!validRequired(document.ChronoContact_event_2010.chrono_verification,"Please enter verification code"))
			return false;
return true;
}
function newsletter(nForm) {
	if (!checkEmail(document.subscribeFormModule.email,"Please enter valid Email"))
			return false;
}
function newsletter_focus(val)
{
	if(val.value=="Entrez votre adresse email")
	{
		val.value=""
		val.focus();
	}
}
function newsletter_blur(val)
{
	if(val.value=="")
	{
		val.value="Entrez votre adresse email"
	}
}