function toggleLayer(whichLayer, view)
{
	
		//visible
		//
		// this is the way nn4 works
		  var styleObject = getStyleObject(whichLayer);
		    if(styleObject) {
			styleObject.visibility = view;
			//return true;
		    } else {
			// we couldn't find the object, so we can't change its visibility
			//return false;
		    }
	
}


function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject


function validate()
{
	
var doc;
if (document.layers && document.layers['commentform']) 
{

	doc = document.layers['commentform'].document;
    } else {
	doc= document
    }	
	
if (document.entryform.radiolivraison[0].checked==true)
{
document.entryform.client2.value = document.entryform.client1.value
document.entryform.email2.value = document.entryform.email1.value
document.entryform.contact2.value = document.entryform.contact1.value
document.entryform.adresse2.value = document.entryform.adresse1.value
document.entryform.code_postal2.value = document.entryform.code_postal1.value
document.entryform.ville2.value = document.entryform.ville1.value
document.entryform.pays2.value = document.entryform.pays1.value	
}
else
{
document.entryform.client2.value = doc.entryform1.client2.value
document.entryform.email2.value = doc.entryform1.email2.value
document.entryform.contact2.value = doc.entryform1.contact2.value
document.entryform.adresse2.value = doc.entryform1.adresse2.value
document.entryform.code_postal2.value = doc.entryform1.code_postal2.value
document.entryform.ville2.value = doc.entryform1.ville2.value
document.entryform.pays2.value = doc.entryform1.pays2.value

}

document.entryform.submit();
//alert (document.entryform.client2.value)

}

//Fonction de visibilité des option de paiement
function display_payment(id_choix){
	if(id_choix == 14 || id_choix == 20 || id_choix == 18 || id_choix == 19 || id_choix == 27 || id_choix == 29)
	{
		document.getElementById("one_payment").style.display="block";
		document.getElementById("two_payment").style.display="none";
		document.getElementById("three_payment").style.display="none";
		document.getElementById("fourth_payment").style.display="none";
	}
	else if(id_choix == 21 || id_choix == 15 || id_choix == 30 || id_choix == 40)
	{
		document.getElementById("one_payment").style.display="none";
		document.getElementById("two_payment").style.display="block";
		document.getElementById("three_payment").style.display="none";
		document.getElementById("fourth_payment").style.display="none";
	}
	else if(id_choix == 22 || id_choix == 16 || id_choix == 31 || id_choix == 41)
	{
		document.getElementById("one_payment").style.display="none";
		document.getElementById("two_payment").style.display="none";
		document.getElementById("three_payment").style.display="block";
		document.getElementById("fourth_payment").style.display="none";
	}
	else if(id_choix == 23 || id_choix ==17 || id_choix ==32 || id_choix ==42)
	{
		document.getElementById("one_payment").style.display="none";
		document.getElementById("two_payment").style.display="none";
		document.getElementById("three_payment").style.display="none";
		document.getElementById("fourth_payment").style.display="block";
	}
	else 
	{
		document.getElementById("one_payment").style.display="none";
		document.getElementById("two_payment").style.display="none";
		document.getElementById("three_payment").style.display="none";
		document.getElementById("fourth_payment").style.display="none";
	}	
}

//Contrôle de saisie de versement
function verif_nombre(champ)
{
	var chiffres = new RegExp("[0-9\.]");
	var verif;
	var points = 0;

	for(x = 0; x < champ.value.length; x++)
	{
		verif = chiffres.test(champ.value.charAt(x));
		if(champ.value.charAt(x) == "."){points++;}
		if(points > 1){verif = false; points = 1;}
		if(verif == false){champ.value = champ.value.substr(0,x) + champ.value.substr(x+1,champ.value.length-x+1); x--;}
	}
}
