//FORMULAIRE CONTACT PARTNERS//

function validateEmail()
{
	var result = "";
	var txtMail = document.getElementById("email").value;
	
	if(txtMail.indexOf(".") < 0 && txtMail.indexOf("@") < 0) 
		result = "- E-Mail must be filled in.\n";
		
	return result;
}

function validateSociete()
{
	var result = "";
	var txtSociete = document.getElementById("Company name").value;
	
	if(txtSociete == "") 
		result = "- Company name must be filled in.\n";
		
	return result;
}

function validateEffectif1()
{
	var result = "";
	var cb1 = document.getElementById("data.8");
	
	if(cb1.selectedIndex == 0)
		result = "- Select the number of Employees.\n";
		
	return result;
}

function validateEffectif2()
{
	var result = "";
	var cb1 = document.getElementById("data.9");
	
	if(cb1.selectedIndex == 0)
		result = "- Select the number of Employees (Commercial).\n";
		
	return result;
}

function validateKnoww()
{
	var result = true;
	var i = 0;
	var str = document.getElementById("cp").value;
	var country = document.getElementById("country").value;
	
	if(country == "FRANCIA")
	{
		if(str.length == 0)
			result = false;
		else
		{
			str = str.replace(/ /g, "");
			
			if(str.length != 5)
				result = false;
			else
			{
				while(result && i < str.length)
				{
					result = (str.charAt(i) >= '0' && str.charAt(i) <= '9')
					i++;
				}
			}
		}
	}
	
	if(result)
		return "";
	else
		return "- Enter a valid Zip/Postal Code.\n";
}


function validatecp()
{
	var result = "";
	var txtcp = document.getElementById("cp").value;
	
	if(txtcp == "") 
		result = "- Zip/Postal Code must be filled in.\n";
		
	return result;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' doit contenir une adresse E-mail.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' doit contenir un numéro.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' doit contenir un numéro entre '+min+' et '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' must be filled in.\n'; }
  }
  
  errors = errors +validateEmail()+validateSociete()+validateEffectif1()+validateEffectif2()+validateKnoww()+validatecp();
  
  if (errors) alert('Please fill in the mandatory fields:\n'+errors);
  
  document.MM_returnValue = (errors == '');
}
//////////////////////////////////////////////////////////////





//MENU DES LANGUES//
function doJump(menu) { 
window.location = menu.options[menu.selectedIndex].value;
} 
//////////////////////////////////////////////////////////////




//FONCTION GENERAL DES FORMULAIRES//
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//////////////////////////////////////////////////////////////

