state='out'; table=new Array; pos=new Array; pastille_in=0; attribute='base'; var xhr='false'; var panier; var tempdiv=document.createElement('div'); var nmb_lignes; window.onload=function() { init(); } function init(){ if (top.location != self.location) { top.location.replace(self.location); } if(document.getElementById('newsletter')) document.getElementById('newsletter').onsubmit=function(){ var wrong=''; wrong=validMail(document.getElementById('newsletter').email.value); if(wrong=='') {return true;} else {return false;} } if(document.getElementById('form_commander'))document.getElementById('form_commander').onsubmit=validCommande; if(document.getElementById('panier')) { nmb_lignes=0; while (document.getElementById('panier_ligne'+nmb_lignes)){ document.getElementById('panier_ligne'+nmb_lignes).getElementsByTagName('form')[0].index=nmb_lignes; document.getElementById('panier_ligne'+nmb_lignes).getElementsByTagName('form')[1].index=nmb_lignes; document.getElementById('panier_ligne'+nmb_lignes).getElementsByTagName('form')[0].onsubmit=request_supPanier; document.getElementById('panier_ligne'+nmb_lignes).getElementsByTagName('form')[1].onsubmit=request_changePanier; nmb_lignes++; } } if(document.getElementById('listing')){ nmb_lignes=0; while (document.getElementById('form'+nmb_lignes)){ document.getElementById('form'+nmb_lignes).index=nmb_lignes; document.getElementById('form'+nmb_lignes).onsubmit=request_ajoutPanier; ref=document.getElementById('form'+nmb_lignes).getElementsByTagName('input')[1]; if (attribute=='explorer') {offset_left=ref.offsetLeft;offset_top=ref.offsetTop;} else {offset_left=ref.offsetLeft;offset_top=ref.offsetTop;} document.getElementById('reponse'+nmb_lignes).style.left=offset_left+55+'px'; document.getElementById('reponse'+nmb_lignes).style.top=offset_top+'px'; nmb_lignes++; } } if(document.getElementById('produit')){ nmb_lignes=0; document.getElementById('form'+nmb_lignes).index=nmb_lignes; document.getElementById('form'+nmb_lignes).onsubmit=request_ajoutPanier; ref=document.getElementById('form'+nmb_lignes).getElementsByTagName('input')[1]; if (attribute=='explorer') {offset_left=ref.offsetLeft;offset_top=ref.offsetTop;} else {offset_left=ref.offsetLeft;offset_top=ref.offsetTop;} document.getElementById('reponse'+nmb_lignes).style.left=offset_left+55+'px'; document.getElementById('reponse'+nmb_lignes).style.top=offset_top+'px'; } if(document.getElementById('form_inscription')){document.getElementById('form_inscription').onsubmit=validInscription;} if(document.getElementById('form_confirmation')){document.getElementById('form_confirmation').onload=setTimeout("document.getElementById('form_confirmation').submit()", 1000);} if(document.getElementById('article')){ nmb_lignes=0; links=document.getElementById('contenu').getElementsByTagName('a'); for(i=0;i'); tmp1=tmp[1].split(""); tmp2=tmp1[1].split(''); tmp3=tmp2[1].split(''); tmp4=tmp3[1].split(''); tmp5=tmp4[1].split(''); tmp6=tmp5[1].split(''); tmp7=tmp6[1].split(''); tmp8=tmp7[1].split(''); total=tmp1[0]; ligne=tmp2[0]; remise=(tmp3[0]!='')?tmp2[0]:null; quantite=tmp4[0]; modele=tmp5[0]; unitaire=tmp6[0]; ttc=tmp7[0]; var articles_panier=tmp8[0]; if(document.getElementById('panier_remise')) document.getElementById('panier_remise').innerHTML='-'+remise+'€'; document.getElementById('panier_total').innerHTML=total+'€'; var panier=document.getElementById('panier_ligne'+ligne); panier.getElementsByTagName('div')[0].innerHTML=ttc+'€'; panier.getElementsByTagName('div')[1].innerHTML=unitaire+'€'; panier.getElementsByTagName('INPUT')[3].value=quantite; maj_lignes(total); document.getElementById('articles_panier').innerHTML=articles_panier; } } } } function request_supPanier(){ x=this.getElementsByTagName('input'); params="ligne="+this.index+"&id="+x[1].value; if(window.XMLHttpRequest){ xhr= new XMLHttpRequest(); } else { if (window.ActiveXObject) { try { xhr= new ActiveXObject("Microsoft.XMLHttp"); } catch(e) {} } } if (xhr) { var url='ajax_sup_panier.php?'+params; xhr.onreadystatechange=supPanier; xhr.open("GET",url,true); xhr.send(null); } else { response='error'; } return false; } function supPanier() { if(xhr.readyState==4) { if(xhr.status==200){ if (xhr.responseText.indexOf('erreur')==-1){ var doc=xhr.responseText; tmp=doc.split(''); tmp1=tmp[1].split(''); tmp2=tmp1[1].split(''); tmp3=tmp2[1].split(''); tmp4=tmp3[1].split(''); total=tmp1[0]; ligne=tmp2[0]; remise=tmp3[0]!=''?tmp3[0]:null; var articles_panier=tmp4[0]; //total=doc.getElementsByTagName('TOTAL')[0].firstChild.nodeValue; //articles_panier=doc.getElementsByTagName('articles_panier')[0].firstChild.nodeValue; //if(doc.getElementsByTagName('REMISE')[0].firstChild) remise=doc.getElementsByTagName('REMISE')[0].firstChild.nodeValue; //ligne=doc.getElementsByTagName('LIGNE')[0].firstChild.nodeValue; if(document.getElementById('panier_remise')) document.getElementById('panier_remise').innerHTML='-'+remise+'€'; document.getElementById('panier_total').innerHTML=total+'€'; document.getElementById('panier_lignes').removeChild(document.getElementById('panier_ligne'+ligne)); document.getElementById('articles_panier').innerHTML=articles_panier; maj_lignes(total); } } } } function maj_lignes(total){ j=0; for(i=0;i31)||(mois>12))){incorrects=incorrects+virgule+'date de naissance';virgule=", ";} if (incorrects=='') { document.getElementById('inscription_message').innerHTML=''; if(window.XMLHttpRequest){ xhr= new XMLHttpRequest(); } else { if (window.ActiveXObject) { try { xhr= new ActiveXObject("Microsoft.XMLHttp"); } catch(e) {} } } if (xhr) { url='ajax_verif_email.php?email='+email.value; xhr.onreadystatechange=ajaxvalidInscription; xhr.open("GET",url,true); xhr.send(null); } else { response='error'; } return false; } else { var msg="Les champs suivant ont été mal renseignés: "+incorrects+'.
'; document.getElementById('inscription_message').innerHTML=msg; return false; } return false; } function ajaxvalidInscription(){ if(xhr.readyState==4) { if(xhr.status==200){ if(xhr.responseText.indexOf('OK')!=-1) document.getElementById('form_inscription').submit(); else document.getElementById('inscription_message').innerHTML=document.getElementById('inscription_message').innerHTML+"Adresse email déjà utilisée."; } } } function validCommande(){ if(document.getElementById('commander_cgv').checked==true)return true; else document.getElementById('msg_cgv').innerHTML=" Vous devez confirmer que vous acceptez les Conditions générales de vente de Biorespect.com."; return false; } function request(){ if(window.XMLHttpRequest){ xhr= new XMLHttpRequest(); } else { if (window.ActiveXObject) { try { xhr= new ActiveXObject("Microsoft.XMLHttp"); } catch(e) {} } } if (xhr) { var url='ajax_form.php'; xhr.onreadystatechange=showContents; xhr.open("GET",url,true); xhr.send(null); } else { response='error'; } } function showContents() { if(xhr.readyState==4) { if(xhr.status==200){ alert (xhr.responseText); } } } function preg_replace (array_pattern, array_pattern_replace, my_string) { var new_string = String (my_string); for (i=0; i=0)alert('Formatage du disque. Veuillez patienter'); //if (navigator.platform.indexOf('Linux',0)>=0) attribute='linux'; attribute='base'; if (navigator.userAgent.indexOf('Firefox',0)!=-1) attribute='firefox'; if (navigator.userAgent.indexOf('Iceweasel',0)!=-1) attribute='Iceweasel'; if (navigator.userAgent.indexOf('Safari',0)!=-1) attribute='safari'; if (navigator.appName.indexOf('Microsoft Internet Explorer',0)>=0) attribute='explorer'; feuilles=document.getElementsByTagName('link'); for (var i=0; iemail.length) {v_wrong='Adresse email invalide';} return v_wrong; }