﻿// JavaScript Document

function changeQty(oForm,idArticle,idField,operation) {
	document.getElementById('idProduit').value=idArticle;
	if(operation=='+') {document.getElementById(idField).value++;}
	if(operation=='-') {document.getElementById(idField).value--;}
	oForm.submit();
}

function copyAddress(oForm) {
	for (i=0; i<oForm.civilite.length; i++) oForm.civilite_facturation[i].checked = oForm.civilite[i].checked;
	oForm.civilite_facturation.value = oForm.civilite.value;
	oForm.nom_facturation.value = oForm.nom.value;
	oForm.prenom_facturation.value = oForm.prenom.value;
	oForm.adresseL1_facturation.value = oForm.adresseL1.value;
	oForm.adresseL2_facturation.value = oForm.adresseL2.value;
	oForm.cp_facturation.value = oForm.cp.value;
	oForm.ville_facturation.value = oForm.ville.value;
	oForm.pays_facturation.value = oForm.pays.value;
	oForm.telephone_facturation.value = oForm.telephone.value;
}

function copyAddress2(oForm) {
	for (i=0; i<oForm.civilite_facturation.length; i++) oForm.civilite[i].checked = oForm.civilite_facturation[i].checked;
	oForm.civilite.value = oForm.civilite_facturation.value;
	oForm.nom.value = oForm.nom_facturation.value;
	oForm.prenom.value = oForm.prenom_facturation.value;
	oForm.adresseL1.value = oForm.adresseL1_facturation.value;
	oForm.adresseL2.value = oForm.adresseL2_facturation.value;
	oForm.cp.value = oForm.cp_facturation.value;
	oForm.ville.value = oForm.ville_facturation.value;
	oForm.pays.value = oForm.pays_facturation.value;
	oForm.telephone.value = oForm.telephone_facturation.value;
}

function testCGV(oForm) {
	if (!oForm.cgv.checked) {
		switch (oForm.lang.value) { 
			case 'fr': 
				alert("Accepter les conditions générales de vente");
				return false;
				break; 
			case 'gb': 
				alert("Accept Terms and Conditions of Sale");
				return false;
				break;
			default:
				return false;
				break;
		}
	} 
	else {return true;}
}

/*function windowTopDealers(listCountry) {
	var selectedPays=document.getElementById('pays_facturation').value;
	var selectedCP=document.getElementById('cp_facturation').value;
	var aIdPaysFrance = listCountry;
	var isFrance = false;
	if (args.length > 1) selectedCP = selectedCP + args[1];
}

function showTopDealers(oForm,listCountry) {
	var args = showTopDealers.arguments;
	var txt = document.getElementById("cpSrc");
	var selectedCP = "cp";
	var selectedPays = "pays";
	var aIdPaysFrance = listCountry;
	var isFrance = false;
	if (args.length > 1) selectedCP = selectedCP + args[1];
	if (args.length > 1) selectedPays = selectedPays + args[1];
	selectedCP = oForm.elements[selectedCP].value;
	selectedPays = oForm.elements[selectedPays].options[oForm.elements[selectedPays].selectedIndex].value;
	aIdPaysFrance = aIdPaysFrance.split(",");
	for (i=0; i<aIdPaysFrance.length;i++) {
		if (aIdPaysFrance[i] == selectedPays) {
			isFrance = true;
			break;
		}
	}
	if (isFrance) {
		txt.value=selectedCP;
		ColdFusion.Window.show('zoomTopDealersWindow');
	}
}*/
