function verifForm(obj){
	myAlert.temp=5;
	testMail = verifMail('inscription','email_client');
	if(!obj.statut_client1.checked && !obj.statut_client2.checked){
		obj.statut_client1.focus();
		messageAlert('<br /><br />You have to chose a status !');
		return false;
	}
	if(obj.civilite_client.value=="0"){
		obj.civilite_client.focus();
		messageAlert('<br /><br />You have to chose a civility !',"civilite_client");
		return false;
	}
	if(obj.nom_client.value==""){
		obj.civilite_client.focus();
		messageAlert('<br /><br />You have to enter a name !',"nom_client");
		return false;
	}
	if(obj.adresse_factu_client.value==""){
		obj.civilite_client.focus();
		messageAlert('<br /><br />You have to enter an adress !',"adresse_factu_client");
		return false;
	}
	if(obj.cp_factu_client.value==""){
		obj.civilite_client.focus();
		messageAlert('<br /><br />You have to enter a zip code !',"cp_factu_client");
		return false;
	}
	if(obj.ville_factu_client.value==""){
		obj.civilite_client.focus();
		messageAlert('<br /><br />You have to enter a city !',"ville_factu_client");
		return false;
	}
	if(obj.pays_factu_client.value=="0"){
		obj.civilite_client.focus();
		messageAlert('<br /><br />You have to enter a country !',"pays_factu_client");
		return false;
	}
	if(obj.pays_factu_client.value=="99" && obj.pays2_factu_client.value==""){
		obj.civilite_client.focus();
		messageAlert('<br /><br />You have to enter a country !',"pays2_factu_client");
		return false;
	}
	if(obj.email_client.value==""){
		obj.civilite_client.focus();
		messageAlert('<br /><br />You have to enter a mail !',"email_client");
		return false;
	}
	if(testMail == false){
		obj.civilite_client.focus();
		messageAlert('<br /><br />You mail is not valid !',"email_client");
		return false;
	}
	if(obj.passw_client.value==""){
		obj.civilite_client.focus();
		messageAlert('<br /><br />You have to choose a password !',"passw_client");
		return false;
	}
	if(obj.pass2_client.value==""){
		obj.civilite_client.focus();
		messageAlert('<br /><br />You have to confirm your password !',"pass2_client");
		return false;
	}
	if(obj.passw_client.value != obj.pass2_client.value){
		obj.civilite_client.focus();
		messageAlert('<br /><br />Password confirmation is different from your password !',"pass2_client");
		return false;
	}
	if(obj.adresse_livr_client.value==""){
		obj.adresse_livr_client.focus();
		messageAlert('<br /><br />You have to enter an adress !',"adresse_livr_client");
		return false;
	}
	if(obj.cp_livr_client.value==""){
		obj.cp_livr_client.focus();
		messageAlert('<br /><br />You have to enter a zip code !',"cp_livr_client");
		return false;
	}
	if(obj.ville_livr_client.value==""){
		obj.ville_livr_client.focus();
		messageAlert('<br /><br />You have to enter a city !',"ville_livr_client");
		return false;
	}
	if(obj.pays_livr_client.value=="0"){
		obj.pays_livr_client.focus();
		messageAlert('<br /><br />You have to enter a country !',"pays_livr_client");
		return false;
	}
	if(obj.pays_livr_client.value=="99" && obj.pays2_livr_client.value==""){
		obj.pays2_livr_client.focus();
		messageAlert('<br /><br />You have to enter a country !',"pays2_livr_client");
		return false;
	}	
    if(trim(obj.tel_contact_livr_client.value)==""){
		obj.tel_contact_livr_client.focus();
		messageAlert('<br /><br />You must fill a correct phone number for the delivery !',"tel_contact_livr_client");
		return false;
	}
	if(!obj.news_client1.checked && !obj.news_client2.checked){
		obj.news_client1.focus();
		messageAlert('<br /><br />You have to choose yes or no for the newsletter !','news_client');
		return false;
	}
	document.getElementById("pays_livr_client").disabled = false;
	
	return true;
}

function changePays(obj){
	if(obj[obj.selectedIndex].value!=99){
		document.getElementById("lab_pays2_factu_client").style.color = '#989696';
		document.getElementById("pays2_factu_client").value = '';
		document.getElementById("pays2_factu_client").disabled = true;
	}else{
		document.getElementById("lab_pays2_factu_client").style.color = '#71618e';
		document.getElementById("pays2_factu_client").disabled = false;
	}
}

function changePaysFactu(obj){
	if(obj[obj.selectedIndex].value!=99){
		document.getElementById("lab_pays2_livr_client").style.color = '#989696';
		document.getElementById("pays2_livr_client").value = '';
		document.getElementById("pays2_livr_client").disabled = true;

	}else{
		document.getElementById("lab_pays2_livr_client").style.color = '#71618e';
		document.getElementById("pays2_livr_client").disabled = false;
	}
}

function CheckLen(Target,maxLength,type) {
	if (Target.value.length > maxLength) {
		Target.value = Target.value.substring(0,maxLength);
		CharsLeft = 0;
		myAlert.temp=5;
	} else {
		CharsLeft = maxLength - Target.value.length;      
	}
	var carac = eval("document.getElementById('"+type+"')");
	carac.value = CharsLeft;
}

function verifEnlev(obj,form,num){
    if(obj.value==1){
	    document.getElementById(form).adresse_livr_client.value='ZI Nord - 6 Av de la croix boisseliere';
		document.getElementById(form).adresse_livr_client.readOnly = true;
		document.getElementById(form).adresse_livr_client.style.backgroundColor = '#EDEBEB';
		document.getElementById(form).cp_livr_client.value='91490';
		document.getElementById(form).cp_livr_client.readOnly = true;
		document.getElementById(form).cp_livr_client.style.backgroundColor = '#EDEBEB';
		document.getElementById(form).ville_livr_client.value='MORANGIS';
		document.getElementById(form).ville_livr_client.readOnly = true;
		document.getElementById(form).ville_livr_client.style.backgroundColor = '#EDEBEB';
		document.getElementById(form).pays_livr_client.value='1';
		document.getElementById(form).pays_livr_client.disabled = true;		
		document.getElementById(form).pays_livr_client.style.backgroundColor = '#EDEBEB';
		myAlert.temp=10;
		if(num==1){
			messageAlert("<br /><br /><p align=left>Openings : <br /> Monday Thursday : 8-12am - 1-5pm - <br /> Friday - 8-12am</p>");
		}
		document.getElementById("lab_pays2_livr_client").style.color = '#989696';
		document.getElementById("pays2_livr_client").value = '';
		document.getElementById("pays2_livr_client").disabled = true;
	}
    if(obj.value==0){
	    document.getElementById(form).adresse_livr_client.value='';
		document.getElementById(form).adresse_livr_client.readOnly = false;
		document.getElementById(form).adresse_livr_client.style.backgroundColor = '#FFFFFF';
		document.getElementById(form).cp_livr_client.value='';
		document.getElementById(form).cp_livr_client.readOnly = false;
		document.getElementById(form).cp_livr_client.style.backgroundColor = '#FFFFFF';
		document.getElementById(form).ville_livr_client.value='';
		document.getElementById(form).ville_livr_client.readOnly = false;
		document.getElementById(form).ville_livr_client.style.backgroundColor = '#FFFFFF';
		document.getElementById(form).pays_livr_client.value='0';
		document.getElementById(form).pays_livr_client.disabled = false;
		document.getElementById(form).pays_livr_client.style.backgroundColor = '#FFFFFF';
		document.getElementById("lab_pays2_livr_client").style.color = '#71618e';
		document.getElementById("pays2_livr_client").disabled = true;
	}
}
function idemadresse(obj,form){
    if(obj.checked){		
	    document.getElementById(form).nom_contact_livr_client.value=document.getElementById(form).nom_client.value;		
	    document.getElementById(form).prenom_contact_livr_client.value=document.getElementById(form).prenom_client.value;		
	    document.getElementById(form).adresse_livr_client.value=document.getElementById(form).adresse_factu_client.value;
		document.getElementById(form).cp_livr_client.value=document.getElementById(form).cp_factu_client.value;		
		document.getElementById(form).ville_livr_client.value=document.getElementById(form).ville_factu_client.value;		
		document.getElementById(form).pays_livr_client.selectedIndex=document.getElementById(form).pays_factu_client.selectedIndex;
	    document.getElementById(form).pays2_livr_client.value=document.getElementById(form).pays2_factu_client.value;		
		document.getElementById(form).tel_contact_livr_client.value=document.getElementById(form).tel_client.value;
	}
	obj.blur();
}
