// JavaScript Document
// contact us Services
function check_contacts()
{
	var array_champstxt = new Array("company_name","last_name","first_name","address","city","country","email","aircraft_model");
	var ok = true;
 //var msg = "Some information are missing : \n\n";
	var msg = "Some information are missing :\n";
 var array_champstxt_en = new Array("company name","last name","first name","address","city","country","e-mail","aircraft model");

	for(i=0; i<array_champstxt.length; i++) 
	{
		if (eval('document.quote.'+array_champstxt[i]+'.value') == "")
		{
			ok = false;
			//msg += "\tThe field \""+array_champstxt_en[i]+"\" has not been filed. \n";
			msg += "The field '"+array_champstxt_en[i]+"' has not been filed. \n";
		}
	}

	if (ok)
	{
	//document.quote.action = "sendmail.php";
	document.quote.submit();
	} else {
	alert(msg);
	}

}

// contact request for quote
function checkForm_contacts()
{
	var array_champstxt = new Array("company_name","last_name","first_name","address","city","country","email");
	var ok = true;
 //var msg = "Some information are missing : \n\n";
	var msg = "Some information are missing :\n";
 var array_champstxt_en = new Array("company name","last name","first name","address","city","country","e-mail","aircraft model");

	for(i=0; i<array_champstxt.length; i++) 
	{
		if (eval('document.quote.'+array_champstxt[i]+'.value') == "")
		{
			ok = false;
			//msg += "\tThe field \""+array_champstxt_en[i]+"\" has not been filed. \n";
			msg += "The field '"+array_champstxt_en[i]+"' has not been filed. \n";
		}
	}

	if (ok)
	{
	//document.quote.action = "sendmail.php";
	document.quote.submit();
	} else {
	alert(msg);
	}

}

// contact general
function verif_gb()
{
var ok = true;
var msg = "";
	
	if(document.contact.email.value =='')
	{
	msg = "e-mail address needed";
	//document.contact.email.focus();
	ok = false;
	}
	
	if(document.contact.email.value != "" )
	{
		if (document.contact.email.value.search(/^[-a-zA-Z0-9._]*[-a-zA-Z0-9_]@[-a-zA-Z0-9_]+(\.[-a-zA-Z0-9_]+)*\.[a-zA-Z]{2,3}$/) < 0)
		{
			msg = "Bad email address";
			//document.contact.email.focus();
			ok =  false;
		};
	};
	
		if(document.contact.request.value.search(/[a-zA-F]/)==-1)
	{
	msg = "Your message is missing";
	//document.contact.request.focus();
	ok = false;
	}
	
	if (ok)
	{
	//document.contact.action = "sendmail.php";
	document.contact.submit();
	} else {
	alert(msg);
	}
};

// contact request for catalogue tooling
function checkForm_cata()
{
	var array_champstxt = new Array("company_name","last_name","email");
	var ok = true;
 //var msg = "Some information are missing : \n\n";
	var msg = "Some information are missing :\n";
 var array_champstxt_en = new Array("company name","last name","e-mail");

	for(i=0; i<array_champstxt.length; i++) 
	{
		if (eval('document.quote.'+array_champstxt[i]+'.value') == "")
		{
			ok = false;
			//msg += "\tThe field \""+array_champstxt_en[i]+"\" has not been filed. \n";
			msg += "The field '"+array_champstxt_en[i]+"' has not been filed. \n";
		}
	}

	if (ok)
	{
	//document.quote.action = "sendmail.php";
	document.quote.submit();
	} else {
	alert(msg);
	}

}
	