function (p) { return document.getElementById(p); }
function n(p) { return document.getElementsByName(p); }

function ajaxRequest(target,data) { // target : page appele, data : donne(s) envoye(s)

	var xhr_object = null;

	if(window.XMLHttpRequest) // Mozilla Firefox
		xhr_object = new XMLHttpRequest();
		if (xhr_object.overrideMimeType) { xhr_object.overrideMimeType('text/html; charset=ISO-8859-1'); }

	else if(window.ActiveXObject) // Windows Internet Explorer
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non support par le navigateur
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
		return;
	}
	
	xhr_object.open("POST", "ajax/"+target+".php", true);

	xhr_object.onreadystatechange = function() {
		// 0 : non initialise - 1 : en chargement - 2 : charge - 3 : en cours de traitement - 4 : termine
		if(xhr_object.readyState == 4) {
			eval(xhr_object.responseText);
		}
	}
	
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.send(data);

}

function menu(name) {
	var sel = eval('("'+name+'")');
	var cpt=0;
	while(lyr=eval('("menu['+cpt+']")')) { lyr.style.display='none';cpt++; }
	if(sel.style.display=='none') {
		sel.style.display = 'block';
	} else {
		sel.style.display = 'none';
	}
}


function ajoutArticle(ref) {

	var cmdtype = new Array('','echant','vierge','perso');
	var ctrl_type=false;type_val='';QteMin='';QteMax='';
	
	QteMin=('QteMin['+ref+']').value;
	if((('QteMax['+ref+']').value=='') || (('QteMax['+ref+']').value=='999999')) { QteMax=999999; } else { QteMax=('QteMax['+ref+']').value; }
	
	for(i=0;i<=3;i++) { // Slection du type de commande
		if(('ArtType['+ref+']['+i+']').checked==true) {
			ctrl_type=true;
			type_val=cmdtype[i];
			break;
		}
	}
		
	if(ctrl_type==true) {
		if (type_val==cmdtype[1]) { // chantillon
			ajaxRequest('basket','id='+('XArticle['+ref+']').value+'&lbl='+addslashes(('Article['+ref+']').value)+'&ref='+('RefInterne['+ref+']').value+'&type='+type_val+'&qte=1&action=ajouter');
		} else {
			if(('ArtQte['+ref+']').value=='' || isNaN(('ArtQte['+ref+']').value)) { // Aucune quantit saisie
				alert('Veuillez saisir une quantit.');
				('ArtQte['+ref+']').value='';
				('ArtQte['+ref+']').focus();
			} else {
				if(eval(('ArtQte['+ref+']').value)<QteMin || eval(('ArtQte['+ref+']').value)>QteMax) { // Minimum/Maximum en commande
					if(eval(('ArtQte['+ref+']').value)<QteMin) {
						alert(QteMin+' exemplaire(s) minimum pour cette rfrence article.');
						('ArtQte['+ref+']').value=QteMin;
						('ArtQte['+ref+']').select();
					}
					if(eval(('ArtQte['+ref+']').value)>QteMax) {
						alert(QteMax+' exemplaire(s) maximum pour cette rfrence article.');
						('ArtQte['+ref+']').value=QteMax;
						('ArtQte['+ref+']').select();
					}
				} else {
					ajaxRequest('basket','id='+('XArticle['+ref+']').value+'&lbl='+addslashes(('Article['+ref+']').value)+'&ref='+('RefInterne['+ref+']').value+'&type='+type_val+'&qte='+('ArtQte['+ref+']').value+'&action=ajouter');
					//alert('id='+('XArticle['+ref+']').value+'&lbl='+addslashes(('Article['+ref+']').value)+'&ref='+('RefInterne['+ref+']').value+'&type='+type_val+'&qte='+('ArtQte['+ref+']').value+'&action=ajouter');
				}
			}
		}
	} else {
		alert('Veuillez slectionner un type de commande.');
	}
}


function modifArticle(id,ref,type) {
	QteDef=('QteDef['+id+']['+ref+']['+type+']').value;
	QteMin=('QteMin['+id+']['+ref+']['+type+']').value;
	if((('QteMax['+id+']['+ref+']['+type+']').value=='') || (('QteMax['+id+']['+ref+']['+type+']').value=='999999')) { QteMax=999999; } else { QteMax=('QteMax['+id+']['+ref+']['+type+']').value; }
	if(('ArtQte['+id+']['+ref+']['+type+']').value=='' || isNaN(('ArtQte['+id+']['+ref+']['+type+']').value)) { // Aucune quantit saisie
		alert('Veuillez saisir une quantit.');
		('ArtQte['+id+']['+ref+']['+type+']').value='';
		('ArtQte['+id+']['+ref+']['+type+']').focus();
	} else {
		if(eval(('ArtQte['+id+']['+ref+']['+type+']').value)<QteMin || eval(('ArtQte['+id+']['+ref+']['+type+']').value)>QteMax) { // Minimum/Maximum en commande
			if(eval(('ArtQte['+id+']['+ref+']['+type+']').value)<QteMin) {
				alert(QteMin+' exemplaire(s) minimum pour cette rfrence article.');
				('ArtQte['+id+']['+ref+']['+type+']').value=QteDef;
				('ArtQte['+id+']['+ref+']['+type+']').select();
			}
			if(eval(('ArtQte['+id+']['+ref+']['+type+']').value)>QteMax) {
				alert(QteMax+' exemplaire(s) maximum pour cette rfrence article.');
				('ArtQte['+id+']['+ref+']['+type+']').value=QteDef;
				('ArtQte['+id+']['+ref+']['+type+']').select();
			}
		} else {
			ajaxRequest('basket','id='+id+'&ref='+ref+'&type='+type+'&qte='+('ArtQte['+id+']['+ref+']['+type+']').value+'&action=modifier');
		}
	}
}

function supprArticle(id,ref,type) {
	ajaxRequest('basket','id='+id+'&ref='+ref+'&type='+type+'&categorie=article&action=supprimer');
}

function supprSupplement(id,art,ref) {
	ajaxRequest('basket','id='+id+'&art='+art+'&ref='+ref+'&categorie=supplement&action=supprimer');
}

function validPaiement(cpt) {
	if(cpt==0) {
		('form').submit();
	} else {
		if(('rgl1').checked==true) { ajaxRequest('updModeReglement','rgl=1');('form1').submit(); }
		if(('rgl2').checked==true) { ajaxRequest('updModeReglement','rgl=2');('form2').submit(); }
		if(('rgl3').checked==true) { ajaxRequest('updModeReglement','rgl=3');('form').submit(); }
		if(('rgl4').checked==true) { ajaxRequest('updModeReglement','rgl=4');('form').submit(); }
		if(('rgl6').checked==true) { ajaxRequest('updModeReglement','rgl=6');('form').submit(); }
	}
}

function accordeon1(name) {
	var NbCalques1=5;
	var sel = eval('("'+name+'")');
	if(sel.style.display=='none') {
		sel.style.display = 'block';
	} else {
		sel.style.display = 'none';
	}
	for(i=1;i<=NbCalques1;i++) {
		if(eval('("calque1'+i+'")')!=sel) eval('("calque1'+i+'")').style.display='none';
	}
}

function accordeon2(name,form) {
	var NbCalques2=4;
	var sel = eval('("'+name+'")');
	var cpt=0;
	if(form.checked==true) {
		sel.style.display = 'block';
	} else {
		sel.style.display = 'none';
	}
	/*for(i=1;i<=NbCalques2;i++) {
		if(eval('document.getElementById("calque2'+i+'")')!=sel) eval('document.getElementById("calque2'+i+'")').style.display='none';
	}*/
	
	for(i=11;i<=14;i++) {
		if(eval('("suppl'+i+'")')) {
			('LogoSelect').innerHTML="(aucun)";
			if(eval('("suppl'+i+'")').checked==true) {
				if(i==14) {
					('LogoSelect').innerHTML="Slectionn";
				} else {
					cpt++;
				}
			}
		}
	}
	
	if(cpt==0) {
		('SupplSelect').innerHTML="(aucun)";
	} else {
		('SupplSelect').innerHTML="&times; "+cpt;
	}
	
	
}


function ow(t) {
	window.open('img.php?id='+t,'fp','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=600');
}

function piece(url) {
	window.open(url,'_blank','top=0,left=0,menubar=yes,scrollbars=yes,width=840,height=950,resizable=no');
}


function addslashes(texte) {
	texte = texte.replace(/\\/g,'%5C'); // ***
	texte = texte.replace(/\0/g,'\\0'); // ***
	texte = texte.replace(/(\r\n|\n|\r)/g,'<br>'); // *** chr(10) chr(13) CR LF
	texte = texte.replace(/"/g,'%22'); // 34 22 ***
	texte = texte.replace(/&/g,'%26'); // 38 26
	texte = texte.replace(/\'/g,'%27'); // 39 27 ***
	texte = texte.replace(/</g,'%3C'); // 60 3C
	texte = texte.replace(/>/g,'%3E'); // 62 3E
	texte = texte.replace(/\^/g,'%5E'); // 94 5E
	texte = texte.replace(//g,'%91'); // 145 91
	texte = texte.replace(//g,'%92'); // 146 92
	texte = texte.replace(//g,'%93'); // 147 93
	texte = texte.replace(//g,'%94'); // 148 94
	texte = texte.replace(//g,'%95'); // 149 95
	texte = texte.replace(/\+/g,'%2B'); // 43 2B
	texte = texte.replace(//g,'%96'); // 150 96
	texte = texte.replace(//g,'%97'); // 151 97
	texte = texte.replace(//g,'%98'); // 152 98
	texte = texte.replace(//g,'%99'); // 153 99
	texte = texte.replace(//g,'%9A'); // 154 9A
	texte = texte.replace(//g,'%9B'); // 155 9B
	texte = texte.replace(//g,'%9C'); // 156 9C
	texte = texte.replace(//g,'%9D'); // 157 9D
	texte = texte.replace(//g,'%9E'); // 158 9E
	texte = texte.replace(//g,'%9F'); // 159 9F
	//texte = texte.replace(/ /g,'%A0'); // 160 A0 => caractre "espace"
	texte = texte.replace(//g,'%A1'); // 161 A1
	texte = texte.replace(//g,'%A2'); // 162 A2
	texte = texte.replace(//g,'%A3'); // 163 A3
	texte = texte.replace(//g,'%A4'); // 164 A4
	texte = texte.replace(//g,'%A5'); // 165 A5
	texte = texte.replace(//g,'%80'); // 127 80
	texte = texte.replace(//g,'%A6'); // 166 A6
	texte = texte.replace(//g,'%A7'); // 167 A7
	texte = texte.replace(//g,'%A8'); // 168 A8
	texte = texte.replace(//g,'%A9'); // 169 A9
	texte = texte.replace(//g,'%AA'); // 170 AA
	texte = texte.replace(//g,'%AB'); // 171 AB
	texte = texte.replace(//g,'%AC'); // 172 AC
	texte = texte.replace(//g,'%AD'); // 173 AD
	texte = texte.replace(//g,'%AE'); // 174 AE
	texte = texte.replace(//g,'%AF'); // 175 AF
	texte = texte.replace(//g,'%B0'); // 176 B0
	texte = texte.replace(//g,'%B1'); // 177 B1
	texte = texte.replace(//g,'%B2'); // 178 B2
	texte = texte.replace(//g,'%B3'); // 179 B3
	texte = texte.replace(//g,'%B4'); // 180 B4
	texte = texte.replace(//g,'%B5'); // 181 B5
	texte = texte.replace(//g,'%B6'); // 182 B6
	texte = texte.replace(//g,'%B7'); // 183 B7
	texte = texte.replace(//g,'%B8'); // 184 B8
	texte = texte.replace(//g,'%B9'); // 185 B9
	texte = texte.replace(//g,'%BA'); // 186 BA
	texte = texte.replace(//g,'%BB'); // 187 BB
	texte = texte.replace(//g,'%BC'); // 188 BC
	texte = texte.replace(//g,'%BD'); // 189 BD
	texte = texte.replace(//g,'%BE'); // 190 BE
	texte = texte.replace(//g,'%BF'); // 191 BF
	texte = texte.replace(//g,'%C0'); // 192 C0
	texte = texte.replace(//g,'%C1'); // 193 C1
	texte = texte.replace(//g,'%C2'); // 194 C2
	texte = texte.replace(//g,'%C3'); // 195 C3
	texte = texte.replace(//g,'%C4'); // 196 C4
	texte = texte.replace(//g,'%C5'); // 197 C5
	texte = texte.replace(//g,'%C6'); // 198 C6
	texte = texte.replace(//g,'%C7'); // 199 C7
	texte = texte.replace(//g,'%C8'); // 200 C8
	texte = texte.replace(//g,'%C9'); // 201 C9
	texte = texte.replace(//g,'%CA'); // 202 CA
	texte = texte.replace(//g,'%CB'); // 203 CB
	texte = texte.replace(//g,'%CC'); // 204 CC
	texte = texte.replace(//g,'%CD'); // 205 CD
	texte = texte.replace(//g,'%CE'); // 206 CE
	texte = texte.replace(//g,'%CF'); // 207 CF
	texte = texte.replace(//g,'%D0'); // 208 D0
	texte = texte.replace(//g,'%D1'); // 209 D1
	texte = texte.replace(//g,'%D2'); // 210 D2
	texte = texte.replace(//g,'%D3'); // 211 D3
	texte = texte.replace(//g,'%D4'); // 212 D4
	texte = texte.replace(//g,'%D5'); // 213 D5
	texte = texte.replace(//g,'%D6'); // 214 D6
	texte = texte.replace(//g,'%D7'); // 215 D7
	texte = texte.replace(//g,'%D8'); // 216 D8
	texte = texte.replace(//g,'%D9'); // 217 D9
	texte = texte.replace(//g,'%DA'); // 218 DA
	texte = texte.replace(//g,'%DB'); // 219 DB
	texte = texte.replace(//g,'%DC'); // 220 DC
	texte = texte.replace(//g,'%DD'); // 221 DD
	texte = texte.replace(//g,'%DE'); // 222 DE
	texte = texte.replace(//g,'%DF'); // 223 DF
	texte = texte.replace(//g,'%E0'); // 224 E0
	texte = texte.replace(//g,'%E1'); // 225 E1
	texte = texte.replace(//g,'%E2'); // 226 E2
	texte = texte.replace(//g,'%E3'); // 227 E3
	texte = texte.replace(//g,'%E4'); // 228 E4
	texte = texte.replace(//g,'%E5'); // 229 E5
	texte = texte.replace(//g,'%E6'); // 230 E6
	texte = texte.replace(//g,'%E7'); // 231 E7
	texte = texte.replace(//g,'%E8'); // 232 E8
	texte = texte.replace(//g,'%E9'); // 233 E9
	texte = texte.replace(//g,'%EA'); // 234 EA
	texte = texte.replace(//g,'%EB'); // 235 EB
	texte = texte.replace(//g,'%EC'); // 236 EC
	texte = texte.replace(//g,'%ED'); // 237 ED
	texte = texte.replace(//g,'%EE'); // 238 EE
	texte = texte.replace(//g,'%EF'); // 239 EF
	texte = texte.replace(//g,'%F0'); // 240 F0
	texte = texte.replace(//g,'%F1'); // 241 F1
	texte = texte.replace(//g,'%F2'); // 242 F2
	texte = texte.replace(//g,'%F3'); // 243 F3
	texte = texte.replace(//g,'%F4'); // 244 F4
	texte = texte.replace(//g,'%F5'); // 245 F5
	texte = texte.replace(//g,'%F6'); // 246 F6
	texte = texte.replace(//g,'%F7'); // 247 F7
	texte = texte.replace(//g,'%F8'); // 248 F8
	texte = texte.replace(//g,'%F9'); // 249 F9
	texte = texte.replace(//g,'%FA'); // 250 FA
	texte = texte.replace(//g,'%FB'); // 251 FB
	texte = texte.replace(//g,'%FC'); // 252 FC
	texte = texte.replace(//g,'%FD'); // 253 FD
	texte = texte.replace(//g,'%FE'); // 254 FE
	texte = texte.replace(//g,'%FF'); // 255 FF
	return texte;
}



function majuscule(form) {
    form.value = form.value.toUpperCase();
}

function minuscule(form) {
    form.value = form.value.toLowerCase();
}

function capitalise(form) {
    chaine = new String(); 
    chaine = form.value;
    pos = chaine.search('-');
    if (pos == '-1') {
        form.value = chaine.substr(0,1).toUpperCase()+chaine.substr(1,chaine.length).toLowerCase();
    } else {
        form.value = chaine.substr(0,1).toUpperCase()+chaine.substr(1,pos-1).toLowerCase()+'-'+chaine.substr(pos + 1,1).toUpperCase()+chaine.substr(pos+2,chaine.length).toLowerCase();
    }
}

function telephone(form) {
    var a = form.value;
    var b = a.length;
    if (b == 2) { form.value = form.value + '-'; }
    if (b == 5) { form.value = form.value + '-'; }
    if (b == 8) { form.value = form.value + '-'; }
    if (b == 11){ form.value = form.value + '-'; }
}

function num() {
    if(event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;
    if(event.which < 48 || event.which > 57) return false;
}

function tel() {
    if(event.keyCode < 32 || event.keyCode > 57) event.returnValue = false;
    if(event.which < 32 || event.which > 57) return false;
}

function verif_mail() {
    mail = ('log').value;
    place = mail.indexOf("@",1);
    point = mail.indexOf(".",place+1);
	if ((place > -1)&&(mail.length >2)&&(point > 1)) { ajaxRequest('verifLog','id='+mail); } else { ('RtrVerifLog').innerHTML='L\'adresse Email n\'est pas valide.\n' }
}






function verifcontact() {
    raison = document.form.RaisonSociale.value;
	nom = document.form.Nom.value;
    prenom = document.form.Prenom.value;
    message = document.form.Message.value.length;
    mail = document.form.Email.value;
	objet = document.form.Objet.value;
    place = mail.indexOf("@",1);
    point = mail.indexOf(".",place+1);
    msg = '';
    if ((nom == "")||(nom == " "))       { msg += 'La raison sociale est obligatoire.\n' }
    if ((nom == "")||(nom == " "))       { msg += 'Le nom est obligatoire.\n' }
    if ((prenom == "")||(prenom == " ")) { msg += 'Le prnom est obligatoire.\n' }
    if ((mail == "")||(mail == " "))     { msg += 'L\'adresse Email est obligatoire.\n' } else { if ((place > -1)&&(mail.length >2)&&(point > 1)) { } else { msg += 'L\'adresse Email n\'est pas valide.\n' } }
	if ((objet == "")||(objet == " "))       { msg += 'L\'objet est obligatoire.\n' }
    if ((message <= 0))                  { msg += 'Vous n\'avez pas tap votre message.\n' }
    if (msg == '') { return true; } else { alert(msg);return false; }
}

function verif() {
    nom = document.form.Nom.value;
    prenom = document.form.Prenom.value;
    adresse = document.form.Adresse1.value;
    cp = document.form.CodePostal.value;
    ville = document.form.Ville.value;
    mail = document.form.Email.value;
    place = mail.indexOf("@",1);
    point = mail.indexOf(".",place+1);
	//mdp = document.form.mdp.value;
	//mdpl = document.form.mdp.value.length;
    cond = document.form.Conditions.checked;
    msg = '';
    if ((nom == "")||(nom == " "))       { msg += 'Le nom est obligatoire.\n' }
    if ((prenom == "")||(prenom == " ")) { msg += 'Le prnom est obligatoire.\n' }
    if ((adresse <= 0))                  { msg += 'L\'adresse postale est obligatoire.\n' }
    if ((cp == "")||(cp == " "))         { msg += 'Le code postal est obligatoire.\n' }
    if ((ville == "")||(ville == " "))   { msg += 'La ville est obligatoire.\n' }
    if ((mail == "")||(mail == " "))     { msg += 'L\'adresse Email est obligatoire.\n' } else { if ((place > -1)&&(mail.length >2)&&(point > 1)) { } else { msg += 'L\'adresse Email n\'est pas valide.\n' } }
    //if ((mdp == "")||(mdp == " ")||(mdpl<6))       { msg += 'Vous devez choisir un mot de passe de 6 caractres minimum.\n' }
    if (!cond) { msg += 'Vous devez accepter les conditions gnrales.' }
    if (msg == '') { return true; } else { alert(msg);return false; }
}


function password() {
	window.open('password.php','ap_pwd','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,,width=300,height=200,left='+((window.screen.width-300)/2)+',top='+((window.screen.height-200)/2)+',resizable=no');
}



function caract_autor() {
    if((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 65 || event.keyCode > 90) && (event.keyCode < 97 || event.keyCode > 122)) event.returnValue = false;
    if((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 65 || event.keyCode > 90) && (event.keyCode < 97 || event.keyCode > 122)) return false;
}




function verif_inscr() {
    log = ('log').value;
    place = log.indexOf("@",1);
    point = log.indexOf(".",place+1);
	pwd=('pwd').value;
	pwdl=('pwd').value.length;
	pwd2=('pwd2').value;
    civ1 = ('Civ1').checked;
    civ2 = ('Civ2').checked;
    civ3 = ('Civ3').checked;
    raison = ('RaisonSociale').value;
	tva = ('TVAintracom').value;
	nom = ('Nom').value;
    prenom = ('Prenom').value;
	telfixe = ('TelFixe').value;
	telmobile = ('TelMobile').value;	
    adresse = ('Adresse1').value;
    cp = ('CodePostal').value;
    ville = ('Ville').value;
	pays = ('CPays').value;
    cond = ('cgv').checked;
    msg = '';
    if ((log == "")||(log == " "))     { msg += 'L\'adresse Email est obligatoire.\n' } else { if ((place > -1)&&(log.length >2)&&(point > 1)) { } else { msg += 'L\'adresse Email n\'est pas valide.\n' } }
	if ((pwd == "")||(pwd == " ")||(pwdl<6))       { msg += 'Vous devez saisir un mot de passe de 6 caractres minimum.\n' }
	if ((pwd != pwd2) )      { msg += 'La confirmation du mot de passe n\'est pas correcte.\n' }
	if ((raison == "")||(raison == " "))       { msg += 'La raison sociale est obligatoire.\n' }
	if ((tva == "")||(tva == " "))       { msg += 'Le numro de TVA intracom est obligatoire.\nPour les collectivits, administrations et associations,\nremplissez le numro de TVA par \'0000\'.\n' }
	if ((!civ1)&&(!civ2)&&(!civ3)) { msg += 'La civilit est obligatoire.\n' }
    if ((nom == "")||(nom == " "))       { msg += 'Le nom est obligatoire.\n' }
    if ((prenom == "")||(prenom == " ")) { msg += 'Le prnom est obligatoire.\n' }
	if ((telfixe == "")&&(telmobile == "")) { msg += 'Au moins un numro de tlphone doit tre renseign.\n' }
    if ((adresse == "")||(adresse == " ")) { msg += 'L\'adresse postale est obligatoire.\n' }
    if ((cp == "")||(cp == " "))         { msg += 'Le code postal est obligatoire.\n' }
    if ((ville == "")||(ville == " "))   { msg += 'La ville est obligatoire.\n' }
	if ((pays == ""))   { msg += 'Le pays est obligatoire.\n' }
    if (!cond) { msg += 'Vous devez accepter les conditions gnrales de vente.' }
    if (msg == '') { return true; } else { alert(msg);return false; }
}

function verif_pwd() {
    log = document.form.log.value;
    msg = '';
    if ((log == "")||(log == " "))       { msg += 'Vous devez saisir votre adresse Email.\n' }
    if (msg == '') { return true; } else { alert(msg);return false; }
}

function verif_coord() {
    raison = document.form.RaisonSociale.value;
	nom = document.form.Nom.value;
    prenom = document.form.Prenom.value;
    adresse = document.form.Adresse1.value;
    cp = document.form.CodePostal.value;
    ville = document.form.Ville.value;
	pays = document.form.CPays.value;
    mail = document.form.Email.value;
    place = mail.indexOf("@",1);
    point = mail.indexOf(".",place+1);
	//log = document.form.log.value;
	pwd = document.form.pwd.value;
	//logl = document.form.log.value.length;
	pwdl = document.form.pwd.value.length;
    cond = document.form.cgv.checked;
    msg = '';
	if ((raison == "")||(raison == " "))       { msg += 'La raison sociale est obligatoire.\n' }
    if ((nom == "")||(nom == " "))       { msg += 'Le nom est obligatoire.\n' }
    if ((prenom == "")||(prenom == " ")) { msg += 'Le prnom est obligatoire.\n' }
    if ((adresse <= 0))                  { msg += 'L\'adresse postale est obligatoire.\n' }
    if ((cp == "")||(cp == " "))         { msg += 'Le code postal est obligatoire.\n' }
    if ((ville == "")||(ville == " "))   { msg += 'La ville est obligatoire.\n' }
	if ((pays == ""))   { msg += 'Le pays est obligatoire.\n' }
    if ((mail == "")||(mail == " "))     { msg += 'L\'adresse Email est obligatoire.\n' } else { if ((place > -1)&&(mail.length >2)&&(point > 1)) { } else { msg += 'L\'adresse Email n\'est pas valide.\n' } }
    //if ((log == "")||(log == " ")||(logl<6))       { msg += 'Vous devez saisir un pseudo de 6 caractres minimum.\n' }
    if ((pwd == "")||(pwd == " ")||(pwdl<6))       { msg += 'Vous devez saisir un mot de passe de 6 caractres minimum.\n' }
    if (!cond) { msg += 'Vous devez accepter les conditions gnrales.' }
    if (msg == '') { return true; } else { alert(msg);return false; }
}





function verif_connect() {
    log = ('log').value;
    pwd = ('pwd').value;
    msg = '';
    if ((log == "")||(log == " "))       { msg += 'Vous devez saisir votre adresse Email.\n' }
    if ((pwd == "")||(pwd == " "))       { msg += 'Vous devez saisir votre mot de passe.\n' }
    if (msg == '') { return true; } else { alert(msg);return false; }
}

function verif_coord_cmd() {
    civ11 = ('FCiv1').checked;
    civ12 = ('FCiv2').checked;
    civ13 = ('FCiv3').checked;
	raison1 = ('FRaisonSociale').value;
	tva=('TVAintracom').value;
    nom1 = ('FNom').value;
    prenom1 = ('FPrenom').value;
    adresse1 = ('FAdresse1').value;
    cp1 = ('FCodePostal').value;
    ville1 = ('FVille').value;
	pays1 = ('FCPays').value;
    civ21 = ('LCiv1').checked;
    civ22 = ('LCiv2').checked;
    civ23 = ('LCiv3').checked;
    raison2 = ('LRaisonSociale').value;
	nom2 = ('LNom').value;
    prenom2 = ('LPrenom').value;
    adresse2 = ('LAdresse1').value;
    cp2 = ('LCodePostal').value;
    ville2 = ('LVille').value;
	pays2 = ('LCPays').value;
	tel2 = ('LTelephone').value;
    mail2 = ('LEmail').value;
    place2 = mail2.indexOf("@",1);
    point2 = mail2.indexOf(".",place2+1);	
    cond = ('cgv').checked;
    msg = '';
    if ((raison1 == "")||(raison1 == " "))       { msg += 'La raison sociale en facturation est obligatoire.\n' }
	if ((tva == "")||(tva == " "))       { msg += 'Le numro de TVA intracom est obligatoire.\nPour les collectivits, administrations et associations,\nremplissez le numro de TVA par \'0000\'.\n' }
	if ((!civ11)&&(!civ12)&&(!civ13)) { msg += 'La civilit en facturation est obligatoire.\n' }
    if ((nom1 == "")||(nom1 == " "))       { msg += 'Le nom en facturation est obligatoire.\n' }
    if ((prenom1 == "")||(prenom1 == " ")) { msg += 'Le prnom en facturation est obligatoire.\n' }
    if ((adresse1 == "")||(adresse1 == " ")) { msg += 'L\'adresse postale en facturation est obligatoire.\n' }
    if ((cp1 == "")||(cp1 == " "))         { msg += 'Le code postal en facturation est obligatoire.\n' }
    if ((ville1 == "")||(ville1 == " "))   { msg += 'La ville en facturation est obligatoire.\n' }
	if ((pays1 == ""))   { msg += 'Le pays en facturation est obligatoire.\n' }
    if ((raison2 == "")||(raison2 == " "))       { msg += 'La raison sociale en livraison est obligatoire.\n' }
	if ((!civ21)&&(!civ22)&&(!civ23)) { msg += 'La civilit en livraison est obligatoire.\n' }
    if ((nom2 == "")||(nom2 == " "))       { msg += 'Le nom en livraison est obligatoire.\n' }
    if ((prenom2 == "")||(prenom2 == " ")) { msg += 'Le prnom en livraison est obligatoire.\n' }
    if ((adresse2 == "")||(adresse2 == " ")) { msg += 'L\'adresse postale en livraison est obligatoire.\n' }
    if ((cp2 == "")||(cp2 == " "))         { msg += 'Le code postal en livraison est obligatoire.\n' }
    if ((ville2 == "")||(ville2 == " "))   { msg += 'La ville en livraison est obligatoire.\n' }
	if ((pays2 == ""))   { msg += 'Le pays en livraison est obligatoire.\n' }
    if ((mail2 == "")||(mail2 == " "))     { msg += 'L\'adresse Email en livraison est obligatoire.\n' } else { if ((place2 > -1)&&(mail2.length >2)&&(point2 > 1)) { } else { msg += 'L\'adresse Email en livraison n\'est pas valide.\n' } }
    if ((tel2 == "")||(tel2 == " "))       { msg += 'Le tlphone en livraison est obligatoire.\n' }	
    if (!cond) { msg += 'Vous devez accepter les conditions gnrales de vente.' }
    if (msg == '') { return true; } else { alert(msg);return false; }
}

function verif_article_perso() {
	if(('avert').value==1) {
		alert('Le texte d\'un ou plusieurs article(s) personnalis(s) n\'a pas t dfini !');
		return false;
	} else {
		return true;
	}
}

function verif_article_custom() {
	if(('TxtPrincipal').value=="" && ('TxtAdresse1').value=="") {
		alert('Vous n\'avez pas saisi votre texte et\/ou vos coordonnes !');
		if(('calque13').style.display=="none") accordeon1('calque13');
		('TxtPrincipal').focus();
		return false;
	} else {
		return true;
	}
}
