var re_int=/^[0-9]+$/;
var http=false;var iEncour=false;function get_dom_object(object)
{if(document.getElementById){return document.getElementById(object);}else if(document.all){return document.all[object];}}
function createRequestObject(){var request_o;var browser=navigator.appName;if(browser=="Microsoft Internet Explorer"){request_o=new ActiveXObject("Microsoft.XMLHTTP");}else{request_o=new XMLHttpRequest();}
return request_o;}
function get_dom_object(object)
{if(document.getElementById){return document.getElementById(object);}else if(document.all){return document.all[object];}}
function bandeau_init(){get_dom_object('id_bandeau').style.overflowX="hidden";get_dom_object('id_bandeau').style.overflowY="hidden";get_dom_object('id_bandeau').firstChild.style.marginLeft=get_dom_object('id_bandeau').style.width;position_bandeau=parseInt(get_dom_object('id_bandeau').style.width);bandeau();}
function bandeau(){if(parseInt(position_bandeau)<=parseInt(get_dom_object('id_bandeau').firstChild.firstChild.offsetWidth*-1)){get_dom_object('id_bandeau').firstChild.style.marginLeft=get_dom_object('id_bandeau').style.width;position_bandeau=parseInt(get_dom_object('id_bandeau').style.width);}
get_dom_object('id_bandeau').firstChild.style.marginLeft=position_bandeau+"px";position_bandeau=(position_bandeau-2);setTimeout("bandeau()",20);}
function voire_image(source,larg,haut) { if(source) { get_dom_object('img_photo').src=source; get_dom_object('img_photo').width=larg; get_dom_object('img_photo').height=haut; } }
function valider_inscription(formulaire) {re_num=/^[\-]?[0-9\.]+$/;re_em=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;re_mp=/^([a-zA-Z0-9]{6,})$/;re_dt=/^([1-9]|0[1-9]|[12][0-9]|3[01])([1-9]|0[1-9]|1[012])(19[0-9][0-9]|20[0-9][0-9])$/;if(formulaire.em.value.length==0){document.body.style.cursor="auto";alert('Email : Obligatoire');formulaire.em.focus();return false;}
if(formulaire.em.value.length>0&&!re_em.test(formulaire.em.value)){document.body.style.cursor="auto";alert('Email : Invalide');formulaire.em.focus();return false;}
if(formulaire.mp.value.length==0){document.body.style.cursor="auto";alert('Mot de passe : Obligatoire');formulaire.mp.focus();return false;}
if(formulaire.nm.value.length==0){document.body.style.cursor="auto";alert('Nom : Obligatoire');formulaire.nm.focus();return false;}
if(formulaire.tl.value.length==0){document.body.style.cursor="auto";alert('Téléphone : Obligatoire');formulaire.tl.focus();return false;}
if(formulaire.ad_ln4.value.length==0){document.body.style.cursor="auto";alert('Adresse : Obligatoire');formulaire.ad_ln4.focus();return false;}
if(formulaire.cp.value.length==0){document.body.style.cursor="auto";alert('Code postal : Obligatoire');formulaire.cp.focus();return false;}
if(formulaire.vl.value.length==0){document.body.style.cursor="auto";alert('Ville : Obligatoire');formulaire.vl.focus();return false;}
if(formulaire.py[formulaire.py.selectedIndex].value.length==0){document.body.style.cursor="auto";alert('Pays : Obligatoire');formulaire.py.focus();return false;}
if(formulaire.dt_naissance.value.length>0&&!re_dt.test(formulaire.dt_naissance.value)){document.body.style.cursor="auto";alert('Date naissance : Invalide');formulaire.dt_naissance.focus();return false;}
if(!formulaire.dp_cgv.checked) { alert('CGV : Obligatoire'); return false;}
return true;}
function valider_identification(formulaire) {re_em=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;re_mp=/^([a-zA-Z0-9]{6,})$/;
if(formulaire.em.value.length==0){document.body.style.cursor="auto";alert('Email : Obligatoire');formulaire.em.focus();return false;}
if(formulaire.em.value.length>0&&!re_em.test(formulaire.em.value)){document.body.style.cursor="auto";alert('Email : Invalide');formulaire.em.focus();return false;}
if(formulaire.mp.value.length==0){document.body.style.cursor="auto";alert('Mot de passe : Obligatoire');formulaire.mp.focus();return false;}
return true;}
function valider_mdp_oublie(formulaire) {re_em=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(formulaire.em.value.length==0){document.body.style.cursor="auto";alert('Email : Obligatoire');formulaire.em.focus();return false;}
if(formulaire.em.value.length>0&&!re_em.test(formulaire.em.value)){document.body.style.cursor="auto";alert('Email : Invalide');formulaire.em.focus();return false;}
return true;}
function valider_mdp_change(formulaire) {
if(formulaire.mp.value.length==0){document.body.style.cursor="auto";alert('Mot de passe : Obligatoire');formulaire.mp.focus();return false;}
if(formulaire.mp_verif.value.length==0){document.body.style.cursor="auto";alert('Verification Mot de passe : Obligatoire');formulaire.mp_verif.focus();return false;}
if(formulaire.mp_verif.value!=formulaire.mp.value) { document.body.style.cursor="auto";alert('Mot de passe et Vérification Mot de passe Différents');formulaire.mp_verif.focus();return false; }
return true;}
function valider_contact(formulaire) {
formulaire.Nom.value=formulaire.Nom.value.replace(/^\s+/g,'').replace(/\s+$/g,'');formulaire.Email.value=formulaire.Email.value.replace(/^\s+/g,'').replace(/\s+$/g,'');re_em=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if(formulaire.Nom.value.length==0){alert('Nom : Obligatoire');formulaire.Nom.focus();return false;}
if(formulaire.Email.value.length==0){alert('Email : Obligatoire');formulaire.Email.focus();return false;}
if(!re_em.test(formulaire.Email.value)){alert('Email : Invalide');formulaire.Email.focus();return false;}
if(formulaire.Message.value.length==0){alert('Votre message : Obligatoire');formulaire.Message.focus();return false;}
return true;}
function valider_modif_compte(formulaire) {
re_dt=/^([1-9]|0[1-9]|[12][0-9]|3[01])([1-9]|0[1-9]|1[012])(19[0-9][0-9]|20[0-9][0-9])$/;
if(formulaire.nm.value.length==0){document.body.style.cursor="auto";alert('Nom : Obligatoire');formulaire.nm.focus();return false;}
if(formulaire.tl.value.length==0){document.body.style.cursor="auto";alert('Téléphone : Obligatoire');formulaire.tl.focus();return false;}
if(formulaire.ad_ln4.value.length==0){document.body.style.cursor="auto";alert('Adresse : Obligatoire');formulaire.ad_ln4.focus();return false;}
if(formulaire.cp.value.length==0){document.body.style.cursor="auto";alert('Code postal : Obligatoire');formulaire.cp.focus();return false;}
if(formulaire.vl.value.length==0){document.body.style.cursor="auto";alert('Ville : Obligatoire');formulaire.vl.focus();return false;}
if(formulaire.py[formulaire.py.selectedIndex].value.length==0){document.body.style.cursor="auto";alert('Pays : Obligatoire');formulaire.py.focus();return false;}
if(formulaire.dt_naissance.value.length>0&&!re_dt.test(formulaire.dt_naissance.value)){document.body.style.cursor="auto";alert('Date naissance : Invalide');formulaire.dt_naissance.focus();return false;}
return true;}
function valider_livraison(formulaire) {
if(formulaire.liv_nm.value.length==0){document.body.style.cursor="auto";alert('Nom : Obligatoire');formulaire.liv_nm.focus();return false;}
if(formulaire.liv_ad_ln4.value.length==0){document.body.style.cursor="auto";alert('Adresse : Obligatoire');formulaire.liv_ad_ln4.focus();return false;}
if(formulaire.liv_cp.value.length==0){document.body.style.cursor="auto";alert('Code postal : Obligatoire');formulaire.liv_cp.focus();return false;}
if(formulaire.liv_vl.value.length==0){document.body.style.cursor="auto";alert('Ville : Obligatoire');formulaire.liv_vl.focus();return false;}
if(formulaire.liv_py[formulaire.liv_py.selectedIndex].value.length==0){document.body.style.cursor="auto";alert('Pays : Obligatoire');formulaire.liv_py.focus();return false;}
return true;}
function toggle_commande(div)
{if(get_dom_object(div).style.display=='none'){try{get_dom_object(div).style.display='table-row';}catch(err){get_dom_object(div).style.display='inline';}}else{get_dom_object(div).style.display='none';}}
function toggle_display(div)
{if(get_dom_object(div).style.display=='none'){try{get_dom_object(div).style.display='table-row';}catch(err){get_dom_object(div).style.display='inline';}}else{get_dom_object(div).style.display='none';}}
function ajouter_aux_favoris(nm,dns){if(navigator.appName!='Microsoft Internet Explorer')
{window.sidebar.addPanel(nm,"http://"+dns,"");}else{window.external.AddFavorite("http://"+dns,nm);}}
function recommander_site(d,a,dns){d.href="m"+"a"+"i"+"l"+"t"+"o"+":?cc="+a+"&subject="+encodeURIComponent('Voila un site interessant !')+"&body="+encodeURIComponent('Je te recommande le site http://'+dns+".\n");}
function valid_change_page(f,max,byselect)
{if(byselect){numero_page=f.options[f.selectedIndex].value;}else{numero_page=f.num_page.value;}
if(!re_int.test(numero_page)){alert('Page Invalide');return false;}
if(numero_page<0||numero_page>max){alert('Page Invalide (hors limite)');return false;}
str=location.href;re=/\-page_[0-9]+\./;if(re.test(str)){str=str.replace(re,'-page_'+numero_page+'.');}else{re=/\.html/g;str=str.replace(re,'-page_'+numero_page+'.html');}
location.href=str;return false;}
function valid_paiement_paypal(f) { document.body.style.cursor='wait'; iEncour=false; date=new Date(); url_ajax="paiement.html?imageCde_x=1&ty_paie=paypal&d="+date.getTime(); var http=createRequestObject(); if(!iEncour){iEncour=true;http.open("GET",url_ajax,false);http.onreadystatechange=function parse_test(){if(http.readyState==4){if(http.status==200){http='';iEncour=false;}else{alert("There was a problem with the request.");iEncour=false;http='';}}else{}};http.send(null);}return true;}

