var obj_color="";var Timer;function set_couleur(couleur){obj_color.value=couleur;if(couleur!=0){document.all['image_'+obj_color.name].style.backgroundColor='#'+couleur;document.all['image_'+obj_color.name].style.backgroundImage='url(image/transparent.gif)';}}
function editer_couleur(obj){obj_color=obj;change_page('xml_pop_couleur.php?couleur='+obj.value,'','1');}
function del(){return confirm("Etes vous sur de vouloir supprimer?");}
function vider(){return confirm("Etes vous sur de vouloir vider le contenu de la facture?");}
function del_art(){return confirm("Etes vous sur de vouloir supprimer un article");}
function del_contrat(){return confirm("Etes vous sur de vouloir supprimer un contrat");}
function arch(){return confirm("Etes vous sur de vouloir archiver");}
function enreg(){return confirm("Etes vous sur de vouloir enregistrer les modifications");}
function del_dossier(){return confirm("Ce dossier contient peut-être des e-mails. Confirmez la suppression");}
function del_compte(){return confirm("Vous allez perdre les messages ainsi que les dossiers associés à ce compte. Confirmez la suppression");}
function del_user(){return confirm("Vous allez perdre les taches,rendez-vous et contacts associés à cet utilisateur. Confirmez la suppression");}
function del_facture(type){if(type!=undefined)
type="de "+type;else
type="";return confirm("Etes vous sur de vouloir valider la facture "+type);}
function del_fact_ligne(){return confirm("Etes vous sur de vouloir supprimer la ligne de facture");}
function del_facture_art_offert(){return confirm("Etes vous sur de vouloir supprimer l'article offert de la facture");}
function del_liste_noire(){return confirm("Confirmez la libération de cette adresse email");}
function setPointer(theRow,theAction,theDefaultColor,thePointerColor,theMarkColor){var theCells=null;if((thePointerColor==''&&theMarkColor=='')||typeof(theRow.style)=='undefined'){return false;}
if(typeof(document.getElementsByTagName) !='undefined'){theCells=theRow.getElementsByTagName('td');}
else if(typeof(theRow.cells) !='undefined'){theCells=theRow.cells;}
else{return false;}
var rowCellsCnt=theCells.length;var domDetect=null;var currentColor=new String('');var newColor=null;if(typeof(window.opera)=='undefined'
&&typeof(theCells[0].getAttribute) !='undefined'){currentColor=theCells[0].getAttribute('bgcolor');domDetect=true;}
else{currentColor=theCells[0].style.backgroundColor;domDetect=false;}
if(currentColor==null) currentColor=new String('');if(currentColor==''||currentColor.toLowerCase()==theDefaultColor.toLowerCase()){if(theAction=='over'&&thePointerColor !=''){newColor=thePointerColor;}
else if(theAction=='click'&&theMarkColor !=''){newColor=theMarkColor;}}
else if(currentColor.toLowerCase()==thePointerColor.toLowerCase()){if(theAction=='out'){newColor=theDefaultColor;}
else if(theAction=='click'&&theMarkColor !=''){newColor=theMarkColor;}}
else if(currentColor.toLowerCase()==theMarkColor.toLowerCase()){if(theAction=='click'){newColor=(thePointerColor !='')
?thePointerColor
:theDefaultColor;}}
if(newColor){var c=null;if(domDetect){for(c=0;c<rowCellsCnt;c++){theCells[c].setAttribute('bgcolor',newColor,0);}}
else{for(c=0;c<rowCellsCnt;c++){theCells[c].style.backgroundColor=newColor;}}}
return true;}
function setOpacity(obj,opacity){opacity=(opacity==100)?99.999:opacity;obj.style.filter="alpha(opacity:"+opacity+")";obj.style.KHTMLOpacity=opacity/100;obj.style.MozOpacity=opacity/100;obj.style.opacity=opacity/100;}
function fadeIn(objId,start_opacity,end_opacity,full_screen,cache_select,no_fade){if(optimisation_performance=="1")no_fade=1;if(cache_select==1)cacher_select();if(document.getElementById){obj=document.getElementById(objId);if(full_screen==1){if(navigator.appName!="Microsoft Internet Explorer"){obj.style.height=document.body.clientHeight+"px";obj.style.width=document.body.clientWidth+"px";} else{obj.style.height=document.documentElement.scrollHeight+"px";obj.style.width=document.documentElement.scrollWidth+"px";}}
obj.style.display="block";if(no_fade!=1){if(start_opacity<=end_opacity){setOpacity(obj,start_opacity);start_opacity+=20;window.setTimeout("fadeIn('"+objId+"',"+start_opacity+","+end_opacity+")",5);}}
else{setOpacity(obj,end_opacity);}}}
function fadeOut(objId,start_opacity,end_opacity,aff_select,no_fade){if(objId==undefined||objId=='')objId="div_pop";if(optimisation_performance=="1")no_fade=1;if(document.getElementById){obj=document.getElementById(objId);if(no_fade!=1){if(start_opacity>=end_opacity){setOpacity(obj,start_opacity);start_opacity-=20;window.setTimeout("fadeOut('"+objId+"',"+start_opacity+","+end_opacity+","+aff_select+")",5);}}
else{start_opacity=0;end_opacity=0;}
if(start_opacity<=end_opacity){obj.style.display="none";if(aff_select==1)afficher_select();}}}
function cacher_select(){ss=window.document.getElementsByTagName("select");for(var i=0;i<ss.length;i++){ss[i].style.visibility='hidden';}
p=window.iframe_contenu;if(p!=undefined){ss2=window.iframe_contenu.document.getElementsByTagName("select");for(var i=0;i<ss2.length;i++){ss2[i].style.visibility='hidden';}}}
function afficher_select(){ss=window.document.getElementsByTagName("select");for(var i=0;i<ss.length;i++){ss[i].style.visibility='visible';}
p=window.iframe_contenu;if(p!=undefined){ss2=window.iframe_contenu.document.getElementsByTagName("select");for(var i=0;i<ss2.length;i++){ss2[i].style.visibility='visible';}}}
function loadNewDiv(url,id,no_style,no_fade,no_cacher_select){if(no_cacher_select=="undefined"){cacher_select();}
document.body.style.overflow='hidden';document.getElementById(id).innerHTML='<div align="center" style="padding:20px;"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="300" height="30"><param name="movie" value="images/loading.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><embed src="image/loading.swf" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="300" height="30"></embed></object></div>';var xhr_object=null;if(window.XMLHttpRequest) xhr_object=new XMLHttpRequest();else
if(window.ActiveXObject) xhr_object=new ActiveXObject("Microsoft.XMLHTTP");xhr_object.open("POST",url,true);xhr_object.onreadystatechange=function(){if(xhr_object.readyState==4){if(no_style==1){document.getElementById(id).className="";}
else{document.getElementById(id).className="div_popup";}
document.getElementById(id).innerHTML=xhr_object.responseText;}}
xhr_object.send(null);fadeIn("masque",0,60,1,1,no_fade);fadeIn(id,0,100,0,0,no_fade);}
function reduce_div(id,no_fade){fadeOut("masque",60,0,0,no_fade);fadeOut(id,100,0,1,no_fade);document.body.style.overflow='';}
function fermer_session(){loadNewDiv("fermer_session.php","div_pop_old",1);}
function affiche_popup(url,url_retour,no_fade,nom_div_popup,nom_iframe_popup,nom_iframe_contenu){if(url_retour==undefined)url_retour="";if(nom_div_popup==undefined||nom_div_popup=='')nom_div_popup="div_pop";if(nom_iframe_popup==undefined||nom_iframe_popup=='')nom_iframe_popup="iframe_popup";if(nom_iframe_contenu==undefined||nom_iframe_contenu=='')nom_iframe_contenu="iframe_contenu";if(no_fade==undefined)no_fade="";eval("document.getElementById(\"bouton_fermer_popup\").onclick=function(){fermer_popup('"+url_retour+"','"+no_fade+"','"+nom_div_popup+"','"+nom_iframe_popup+"','"+nom_iframe_contenu+"');};");if(no_fade==1){fadeIn("masque",60,60,1,1);fadeIn("div_pop",100,100,0,0);}
else{fadeIn("masque",0,60,1,1);fadeIn("div_pop",0,100,0,0);}
if(document.all)window.eval(nom_iframe_popup).set_lien_ajax(url);else document.getElementById(nom_iframe_popup).contentWindow.set_lien_ajax(url);}
function fermer_popup(url_retour,no_fade,nom_div_pop){if(nom_div_pop=='undefined'||nom_div_pop=='')nom_div_pop="div_pop";if(no_fade==1){fadeOut("masque",0,0,0);fadeOut(nom_div_pop,0,0,1);}
else{fadeOut("masque",60,0,0);fadeOut(nom_div_pop,100,0,1);}
if(url_retour!=""){if(document.getElementById("iframe_contenu")){document.getElementById("iframe_contenu").src=url_retour;}
else{document.location.href=url_retour;}}
window.iframe_popup.vider_page();}

var categorie_initial=new Array();function charge_categorie(parent,niveau_categorie,type_categorie,nom_champ){var XHR_categorie=new XHRConnection();XHR_categorie.appendData('retour[niveau_categorie]',niveau_categorie);XHR_categorie.appendData('retour[type_categorie]',type_categorie);XHR_categorie.appendData('retour[nom_champ]',nom_champ);XHR_categorie.appendData('type',type_categorie);XHR_categorie.appendData('id',parent);XHR_categorie.sendAndLoad("../ajax/recherche.php","GET",affiche_categorie);}
function affiche_categorie(obj){s="";var tabResult=obj.responseXML.getElementsByTagName('resultat');var niveau_categorie=obj.responseXML.getElementsByTagName('niveau_categorie').item(0).getAttribute('value')*1;var type_categorie=obj.responseXML.getElementsByTagName('type_categorie').item(0).getAttribute('value');var nom_champ=obj.responseXML.getElementsByTagName('nom_champ').item(0).getAttribute('value');for(i=0;i<tabResult.length;i++){resultat=tabResult.item(i);if(categorie_initial[nom_champ][niveau_categorie]==resultat.getAttribute('id'))selected=" selected";else selected="";s+="<option value='"+resultat.getAttribute('id')+"'"+selected+">"+resultat.getAttribute('titre')+"</option>";}
if(niveau_categorie>0)slash="&nbsp;/ ";else slash="";if(s!="")s="<div style='float:left;'>"+slash+"<select name='"+nom_champ+"_"+niveau_categorie+"' id='"+nom_champ+"_"+niveau_categorie+"' class='liste-deroulante' onChange='change_categorie("+niveau_categorie+",\""+type_categorie+"\",\""+nom_champ+"\")'><option value=''></option>"+s+"</select></div><div id='refresh_"+nom_champ+"_"+(niveau_categorie+1)+"'></div>";document.getElementById('refresh_'+nom_champ+'_'+niveau_categorie).innerHTML=s;if(categorie_initial[nom_champ][niveau_categorie]!=undefined){categorie_initial[nom_champ][niveau_categorie]=undefined;change_categorie(niveau_categorie,type_categorie,nom_champ);}}
function change_categorie(niveau,type_categorie,nom_champ){id=document.getElementById(nom_champ+'_'+niveau).value;if(id==""){if(niveau>0)id=document.getElementById(nom_champ+'_'+(niveau-1)).value;else id="";document.getElementById(nom_champ).value=id;document.getElementById('refresh_'+nom_champ+'_'+(niveau+1)).innerHTML="";}
else{document.getElementById(nom_champ).value=id;charge_categorie(id,niveau+1,type_categorie,nom_champ);}}
function affichageElement(string_idElement,bool_OuiNon){if(bool_OuiNon){document.getElementById(string_idElement).style.display='';}else{document.getElementById(string_idElement).style.display='none';}}
function affichagecacheElement(string_idElement){if(document.getElementById(string_idElement).style.display=='none'){document.getElementById(string_idElement).style.display='';}else{document.getElementById(string_idElement).style.display='none';}}
var t_memorise_formulaire=new Array();function memorise_formulaire(nom_form,cible){if(nom_form!=""){if(cible==undefined)w=window;else eval("w=window."+cible+";");t_memorise_formulaire[nom_form]=new Array();nb=w.document[nom_form].length;for(i=0;i<nb;i++){name=w.document[nom_form].elements[i].name;if(w.document[nom_form].elements[i].type=='radio'&&w.document[nom_form].elements[i].checked==true){t_memorise_formulaire[nom_form][name]=w.document[nom_form].elements[i].value;}
if(w.document[nom_form].elements[i].type=='checkbox'&&w.document[nom_form].elements[i].checked==true){t_memorise_formulaire[nom_form][name]=w.document[nom_form].elements[i].value;}
if(w.document[nom_form].elements[i].type!='radio'&&w.document[nom_form].elements[i].type!='checkbox'){t_memorise_formulaire[nom_form][name]=w.document[nom_form].elements[i].value;}}}}
function compare_formulaire(nom_form,cible){if(nom_form!=""){if(cible==undefined)w=window;else eval("w=window."+cible+";");t=new Array();k=0;nb=w.document[nom_form].length;for(i=0;i<nb;i++){name=w.document[nom_form].elements[i].name;if(w.document[nom_form].elements[i].type=='radio'&&w.document[nom_form].elements[i].checked==true){t[k]=new Array();t[k]['name']=name;t[k]['value']=w.document[nom_form].elements[i].value;k++;}
if(w.document[nom_form].elements[i].type=='checkbox'&&w.document[nom_form].elements[i].checked==true){t[k]=new Array();t[k]['name']=name;t[k]['value']=w.document[nom_form].elements[i].value;k++;}
if(w.document[nom_form].elements[i].type!='radio'&&w.document[nom_form].elements[i].type!='checkbox'){t[k]=new Array();t[k]['name']=name;t[k]['value']=w.document[nom_form].elements[i].value;k++;}}
for(i=0;i<t.length;i++){if(t[i]['value']!=t_memorise_formulaire[nom_form][t[i]['name']])return false;}
return true;}
return true;}
function check_form(cible,message_erreur){if(cible==undefined||cible=="")w=window;else eval("w=window."+cible+";");bool=true;if(typeof w.get_champ_obligatoire=="function"){t=w.get_champ_obligatoire();for(i=0;i<t.length;i++){if(w.document.getElementById(t[i]["champ"])!=undefined&&w.document.getElementById(t[i]["label"])!=undefined){if(w.document.getElementById(t[i]["champ"]).value==""){w.document.getElementById(t[i]["label"]).style.color="#FF0000";bool=false;}
else{w.document.getElementById(t[i]["label"]).style.color="";}
w.document.getElementById(t[i]["champ"]).onchange=function(){w.check_form()};}}}
if(message_erreur==1&&!bool)alert("Tous les champs obligatoires ne sont pas remplis.");return bool;}

function goMap24(){Map24.loadApi(["core_api","wrapper_api"],init_map);}
function goMap24_no_carte(){Map24.loadApi(["core_api","wrapper_api"],DoNothing);}
function init_map(){Map24.MapApplication.init({NodeName:"maparea"});}
function DoNothing(){Map24.MapApplication.Map=new Map24.Map();}
function get_lg_lt_map24(adresse,cp,ville,callback){if(Map24.trim(adresse+" "+cp+" "+ville)==""){return;}
var geocoder=new Map24.GeocoderServiceStub();if(callback==undefined)
callback=ResultGeocode;geocoder.geocode({SearchText:Map24.trim(adresse+" "+cp+" "+ville),MaxNoOfAlternatives:10,CallbackFunction:callback});}
function get_lg_lt_map24_world(adresse,cp,ville,dep,pays,callback){if(Map24.trim(adresse+" "+cp+" "+ville+" "+dep+" "+pays)==""){return;}
var geocoder=new Map24.GeocoderServiceStub();if(callback==undefined)
callback=ResultGeocode;geocoder.geocode({SearchText:Map24.trim(adresse+" "+cp+" "+ville),MaxNoOfAlternatives:10,CallbackFunction:callback});}
function ResultGeocodeAdresse(locs){alert(locs[0].getLongitude());alert(locs[0].getLatitude());}
function format_mel(champ){var _Mel=document.getElementById(champ);if(_Mel.value !=""){var usr="([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";var domain="([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";var regex="^"+usr+"\@"+domain+"$";var rgx=new RegExp(regex);var etat=rgx.exec(_Mel.value);if(!etat){alert('Veuillez saisir une adresse E-Mail de la forme:X@X.XX');document.getElementById(champ).focus();}
else{return 'valide';}}}
function alert_liste_creer_panier(){if(document.getElementById("titre_panier").options[document.getElementById("titre_panier").selectedIndex].value==""&&document.getElementById("maj_panier").checked==true){document.getElementById('erreur_vide').style.display='block';document.getElementById("pop_contenu").style.display="block";}
else if(document.getElementById("nom_panier").value==""&&document.getElementById("maj_panier").checked==false){document.getElementById('erreur_vide').style.display='block';document.getElementById("nom_panier").focus();}
else{document.getElementById("pop_contenu").style.display="none";document.getElementById("mess").style.display="block";}}
function alert_creer_panier(){if(document.getElementById("nom_panier").value==""){document.getElementById('erreur_vide').style.display='block';document.getElementById("nom_panier").focus();}
else{document.getElementById("pop_contenu").style.display="none";document.getElementById("mess").style.display="block";}}
function alert_mail_envoyer_vide(){var mail=document.getElementById("adresse_mel");if(mail.value !=""){var usr="([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";var domain="([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";var regex="^"+usr+"\@"+domain+"$";var rgx=new RegExp(regex);var etat=rgx.exec(mail.value);if(!etat){statut=0;}
else{statut=1;}}
if(mail.value==""){document.getElementById("mess_mail").style.display="none";document.getElementById("erreur_mail").style.display="block";mail.focus();}
else if(mail.value !=""&&statut==0){document.getElementById("mess_mail").style.display="none";document.getElementById("erreur_mail").style.display="block";mail.value='';mail.focus();}
else if(mail.value !=""&&statut==1){document.getElementById("pop_contenu").style.display="none";document.getElementById("mess").style.display="block";}}
function masquer_pop_message(){if(document.getElementById("boite_message_boite")){document.getElementById("boite_message_boite").style.display="none";}
if(document.getElementById("boite_message_fond")){document.getElementById("boite_message_fond").style.display="none";}
if(document.getElementById("boite_message")){document.getElementById("boite_message").style.display="none";}
document.getElementById("boite_message_fond").style.display="none";}
function format_tel(champ){var _Champ=document.getElementById(champ);var valeur=_Champ.value;return(valeur);}
function format_jour(jour,mois){var _Jour=document.getElementById(jour);var _Mois=document.getElementById(mois);if(_Jour.value>31){_Jour.value=31;}
if(_Jour.value.length==2){_Mois.focus();_Mois.select();_Mois.value='';}}
function format_mois(jour,mois,annee){var _Jour=document.getElementById(jour);var _Mois=document.getElementById(mois);var _Annee=document.getElementById(annee);if(_Mois.value>12){_Mois.value=12;}
if(_Jour.value==''){_Jour.value='01';}
if(_Mois.value.length==2){_Annee.focus();_Annee.select();_Annee.value='';}}

function calculer_prix(){var XHR=new XHRConnection();XHR.appendData('demande_ajax',1);XHR.appendData('del',document.getElementById('del').value);XHR.appendData('info_del',document.getElementById('info_del').value);XHR.appendData('vider',document.getElementById('vider').value);if(document.getElementById('commentaire'))
XHR.appendData('commentaire',document.getElementById('commentaire').value);for(i=0;i<document.form_panier.length;i++){if(document.form_panier[i].id.indexOf('quantite')!=-1){var id=document.form_panier[i].id;if(document.getElementById(id))
XHR.appendData(document.form_panier[i].name,document.getElementById(id).value);}}
XHR.sendAndLoad("../ajax/ajax_panier.php","POST",refresh_panier);}
function refresh_panier(obj){document.getElementById('refresh_panier').innerHTML=obj.responseText;if(document.getElementById('refresh_panier_header')) lance_refresh_header_panier();}
function lance_refresh_header_panier(){var XHR=new XHRConnection();XHR.appendData('demande_ajax',1);XHR.sendAndLoad("../ajax/ajax_panier_header.php","POST",refresh_panier_header);}
function refresh_panier_header(obj){var text=obj.responseText;text=text.replace('--##--','&euro;');if(document.getElementById('refresh_panier_header'))
document.getElementById('refresh_panier_header').innerHTML=text;}
function lance_refresh_boite_panier(){var XHR=new XHRConnection();XHR.appendData('demande_ajax',1);XHR.appendData('id_menu',document.getElementById('id_menu_en_cours').value);XHR.sendAndLoad("../ajax/ajax_boite_panier.php","POST",refresh_boite_panier);}
function lance_refresh_boite_comparateur(){var XHR=new XHRConnection();XHR.appendData('demande_ajax',1);XHR.appendData('id_menu',document.getElementById('id_menu_en_cours').value);XHR.sendAndLoad("../ajax/ajax_boite_comparateur.php","POST",refresh_boite_comparateur);}
function lance_refresh_comparateur(){var XHR=new XHRConnection();XHR.appendData('demande_ajax',1);XHR.appendData('id_menu','comparateur');XHR.sendAndLoad("../ajax/ajax_comparateur.php","POST",refresh_comparateur);}
function refresh_boite_panier(obj){eval(obj.responseText);if(document.getElementById('refresh_panier_header')) lance_refresh_header_panier();}
function refresh_boite_comparateur(obj){eval(obj.responseText);}
function refresh_comparateur(obj){eval(obj.responseText);}
function remplir_boite(obj){if(obj.responseText=="34")
location.href="home.php";if(navigator.appName=="Microsoft Internet Explorer"){ScrollY=document.documentElement.scrollTop+document.body.scrollTop;ScrollX=document.documentElement.scrollLeft+document.body.scrollLeft;}
else{ScrollY=window.pageYOffset;ScrollX=window.pageXOffset;}
var View={width:(window.innerWidth?
window.innerWidth:(document.documentElement&&document.documentElement.clientWidth)?
document.documentElement.clientWidth:
document.body.clientWidth),
height:(window.innerHeight?
window.innerHeight:(document.documentElement&&document.documentElement.clientHeight)?
document.documentElement.clientHeight:
document.body.clientHeight)}
document.getElementById('boite_message_boite').innerHTML=obj.responseText;width_boite='300';height_boite='400';if(document.all){xleft=(window.document.body.clientWidth / 2)-(width_boite / 2)+'px';xlongueur=window.document.body.clientWidth+'px';xtop=((window.document.body.clientHeight+document.documentElement.scrollTop+document.body.scrollTop) / 2)-(height_boite / 2)+'px';}
else{xleft=(window.innerWidth / 2-width_boite / 2)+'px';xlongueur=window.innerWidth+'px';xtop=(window.innerHeight / 2-height_boite / 2)+'px';}
ylongueur=document.body.scrollHeight+'px';with(document.getElementById('boite_message_boite').style){left=xleft;top=(View.height / 2-(height_boite / 2)+ScrollY)+'px';display='';position='absolute';}
document.getElementById('boite_message_fond').style.display='block';document.getElementById('boite_message_fond').style.width=xlongueur;document.getElementById('boite_message_fond').style.height=ylongueur;if(document.all){document.getElementById('boite_message_fond').style.backgroundColor='#F2F7EE';}
lance_refresh_boite_panier();}
function ajout_panier(article_var,gabarit,article){var qte=1;if(document.getElementById('quantite_'+article_var+'_'+gabarit)){qte=document.getElementById('quantite_'+article_var+'_'+gabarit).value;}
var XHR=new XHRConnection();XHR.appendData("id_article",article);XHR.appendData("id_article_var",article_var);XHR.appendData("qte",qte);XHR.sendAndLoad("../ajax/ajout_panier.php","POST",remplir_boite);}
function creer_un_panier_boite(commande){var XHR=new XHRConnection();XHR.appendData("ajax","1");XHR.appendData("commande",commande);XHR.sendAndLoad("../ajax/creer_un_panier_boite.php","POST",remplir_boite);}
function show_div_panier(){var status=document.getElementById('maj_panier').checked;var div_paniers=document.getElementById('list_paniers');if(status)
div_paniers.style.display='none';else
div_paniers.style.display='block';}
function creer_un_favori_boite(article){var XHR=new XHRConnection();XHR.appendData("ajax","1");XHR.appendData("article",article);XHR.sendAndLoad("../ajax/creer_un_favori_boite.php","POST",remplir_boite);}
function envoyer_a_un_ami_panier_boite(id){var XHR=new XHRConnection();XHR.appendData("ajax","1");XHR.appendData("id_panier",id);XHR.sendAndLoad("../ajax/envoyer_a_un_ami_panier_boite.php","POST",remplir_boite);}
function envoyer_a_un_ami_favori_boite(id_article){var XHR=new XHRConnection();XHR.appendData("ajax","1");XHR.appendData("id_article",id_article);XHR.sendAndLoad("../ajax/envoyer_a_un_ami_favori_boite.php","POST",remplir_boite);}
function envoyer_a_un_ami_panier(id_panier,mail){var XHR=new XHRConnection();XHR.appendData("id_panier",id_panier);XHR.appendData("mail",mail);XHR.sendAndLoad("../ajax/envoyer_a_un_ami_panier.php","POST");}
function envoyer_a_un_ami_favori(id_article,mail){var XHR=new XHRConnection();XHR.appendData("id_article",id_article);XHR.appendData("mail",mail);XHR.sendAndLoad("../ajax/envoyer_a_un_ami_favori.php","POST");}
function creer_un_panier(id_commande,nom,titre_panier){var XHR=new XHRConnection();XHR.appendData("id_commande",id_commande);XHR.appendData("nom",nom);XHR.appendData("titre_panier",titre_panier);XHR.sendAndLoad("../ajax/creer_un_panier.php","POST",retour_creer_un_panier);}
function retour_creer_un_panier(obj){document.getElementById('mess').style.display='';document.getElementById('mess').innerHTML=obj.responseText;}
function ajouter_un_favori(article){var XHR=new XHRConnection();XHR.appendData("article",article);XHR.sendAndLoad("../ajax/ajouter_un_favori.php","POST");}
function supprimer_une_commande_boite(id_commande,num_commande,hash){var XHR=new XHRConnection();XHR.appendData("id_commande",id_commande);XHR.appendData("num_commande",num_commande);XHR.appendData('hash',hash);XHR.sendAndLoad("../ajax/supprimer_une_commande_boite.php","POST",remplir_boite);}
function get_nb_cheque(){var chaine;var chaine2;var element_nom;var qte_requise;var taille=document.forms['form_fidelite'].elements.length;var element=null;var i=0;while(i<taille){element=document.forms['form_fidelite'].elements[i];element_nom=element.name.replace("qte[","");if(element.name !=element_nom){var id_valeur=element.id;id_valeur=id_valeur.replace("qte[","");id_valeur=id_valeur.replace("]","");if(element.type=='text'){qte_requise=document.getElementById('qte['+id_valeur+']').value;chaine2+=id_valeur+"-"+qte_requise+",";chaine2=chaine2.replace("undefined","");chaine2=chaine2.replace(" ","");}}
i++;}
var XHR=new XHRConnection();XHR.appendData("chaine",chaine2);XHR.sendAndLoad("../ajax/ajax_fidelite.php","POST",recevoir_data_fidelite);}
function recevoir_data_fidelite(obj){var tab_points_restants=obj.responseText.split('_');var points_restants=tab_points_restants[1];var tab_nb_cheque=tab_points_restants[0].split(',');var nb_cheques=tab_nb_cheque[1];var tab1=tab_nb_cheque[0].split('-');taille=(tab1.length);for(var i=0;i<taille;i++){tab2=tab1[i].split('|');taille2=(tab1.length)-1;prevision=tab2[1];nb_points=tab2[0];nb_points=nb_points.replace(' ','');nb_points=nb_points.replace(' ','');nb_points=nb_points.replace(' ','');document.getElementById('qte['+nb_points+']').value=prevision;}
document.getElementById('nb_cheque').innerHTML=nb_cheques;document.getElementById('points_restants').innerHTML=points_restants;}
function supprimer_une_commande(id_commande,hash){var XHR=new XHRConnection();XHR.appendData('id_commande',id_commande);XHR.appendData('hash',hash);XHR.sendAndLoad('../ajax/supprimer_une_commande.php','POST');}
function envoyer_a_un_ami_boite(id_cheque,adr){var XHR=new XHRConnection();XHR.appendData("id_cheque",id_cheque);XHR.appendData("hash",adr);XHR.sendAndLoad("../ajax/envoyer_a_un_ami_boite.php","POST",remplir_boite);}
function envoyer_cheque_ami(id_cheque,adr){var adr=document.getElementById('adresse_mel').value;var msg=document.getElementById('message_favoris').value;var protection=document.getElementById('protection').value;var XHR=new XHRConnection();XHR.appendData('id_cheque',id_cheque);XHR.appendData('adr',adr);XHR.appendData('msg',msg);XHR.appendData('protection',protection);XHR.sendAndLoad('../ajax/envoyer_a_un_ami.php','POST');}
function verif_formulaire_envoyer_ami(id_article){var mail_ami=document.getElementById('mail_ami').value;var mon_mail=document.getElementById('mon_mail').value;var nom_ami=document.getElementById('nom_ami').value;var mon_nom=document.getElementById('mon_nom').value;var commentaire=document.getElementById('commentaire_ami').value;var XHR=new XHRConnection();XHR.appendData('id_article',id_article);XHR.appendData('mail_ami',mail_ami);XHR.appendData('mon_mail',mon_mail);XHR.appendData('nom_ami',nom_ami);XHR.appendData('mon_nom',mon_nom);XHR.appendData('commentaire',commentaire);XHR.sendAndLoad('../ajax/verif_formulaire_envoyer_ami.php','POST',retour_formulaire_envoyer_ami);}
function retour_formulaire_envoyer_ami(obj){var retour=obj.responseText;var tab=retour.split("---");var etat=tab[0];var erreur=tab[1];if(etat==1){document.getElementById('formulaire').style.display='none';document.getElementById('message').style.display='block';document.getElementById('mail_ami').value="";document.getElementById('mon_mail').value="";document.getElementById('nom_ami').value="";document.getElementById('mon_nom').value="";document.getElementById('commentaire_ami').value="";document.getElementById('commentaire_ami').innerHTML="";document.getElementById('message').innerHTML=erreur;}
else{document.getElementById('formulaire').style.display='block';document.getElementById('message').style.display='block';document.getElementById('message').innerHTML=erreur;}}
function verif_avis_internaute(id_article){if(document.getElementById('mail')){var mail=document.getElementById('mail').value;var id_client='';}
else{var mail='';var id_client=document.getElementById('id_client').value;}
var titre=document.getElementById('titre').value;var commentaire=document.getElementById('commentaire').value;var note=document.getElementById('note').value;var XHR=new XHRConnection();XHR.appendData('id_article',id_article);XHR.appendData('mail',mail);XHR.appendData('id_client',id_client);XHR.appendData('titre',titre);XHR.appendData('commentaire',commentaire);XHR.appendData('note',note);XHR.sendAndLoad('../ajax/verif_formulaire_avis_internaute.php','POST',retour_formulaire_avis_internaute);}
function retour_formulaire_avis_internaute(obj){var retour=obj.responseText;var tab=retour.split("---");var etat=tab[0];var erreur=tab[1];if(etat==1){document.getElementById('commentaire_ajout').style.display='none';document.getElementById('tab_message').style.display='';document.getElementById('message_avis').style.display='block';if(document.getElementById('mail'))
document.getElementById('mail').value="";document.getElementById('titre').value="";document.getElementById('note').value="";document.getElementById('commentaire').value="";document.getElementById('commentaire').innerHTML="";document.getElementById('message_avis').innerHTML=erreur;}
else{document.getElementById('commentaire_ajout').style.display='';document.getElementById('tab_message').style.display='';document.getElementById('message_avis').style.display='block';document.getElementById('message_avis').innerHTML=erreur;}}
function affichage_alternance(id){if(document.getElementById(id).style.display=='none'){document.getElementById(id).style.display='block';}
else{document.getElementById(id).style.display='none';}}
function nb_carac_champ(champ){var chaine=document.getElementById(champ).value;var longueur=chaine.length;return(longueur);}
function tronquer(max,nb_carac,champ_tronc,champ_nb_carac){var diff=max-nb_carac;if(diff<0){diff=0;}
document.getElementById(champ_nb_carac).innerHTML=diff;if(max<nb_carac){var texte=document.getElementById(champ_tronc).value;texte=texte.substring(0,max);document.getElementById(champ_tronc).value=texte;}}
function affiche(Colonne,tablo,idchkbx,nbcheckbox){var n=0;var j=0;for(i=1;i<=nbcheckbox;i++){if(document.getElementById('checkbox_'+i).checked==true){j++;}}
while(document.getElementById(tablo).rows[n]!=null){if(document.getElementById(tablo).rows[n].cells[Colonne].style.display==''){if(j>0){document.getElementById(tablo).rows[n].cells[Colonne].style.display='none';i=1;while(document.getElementById(tablo).rows[n].cells[i]!=null){document.getElementById(tablo).rows[n].cells[i].width=85/j+"%";i++;}
document.getElementById(tablo).rows[n].cells[Colonne].width='';}
else{document.getElementById('checkbox_'+idchkbx).checked=true;document.getElementById('alerte').className="erreur";document.getElementById('alerte').innerHTML="au moins un produit doit être sélectionné";}}
else{if(j<4){document.getElementById(tablo).rows[n].cells[Colonne].style.display='';i=1;while(document.getElementById(tablo).rows[n].cells[i]!=null){document.getElementById(tablo).rows[n].cells[i].width=85/j+"%";i++;}
document.getElementById('alerte').innerHTML="";if(j==3){document.getElementById('alerte').className="message";document.getElementById('alerte').innerHTML="vous avez atteint la limite d'affichage des produits<br>";}
else{document.getElementById('alerte').innerHTML="";}}
else{document.getElementById('alerte').className="erreur";document.getElementById('alerte').innerHTML="vous ne pouvez pas afficher plus de trois articles en même temps<br>";document.getElementById('checkbox_'+idchkbx).checked=false;break;}}
n++;}
return(nbcheckbox);}
function add_comparateur(id,num_bouton){if(document.getElementById('ajout_comparateur_'+num_bouton).value=='ajouter'){var XHR=new XHRConnection();XHR.appendData('id_variante',id);XHR.sendAndLoad("../ajax/ajout_comparateur.php","POST");document.getElementById('ajout_comparateur_'+num_bouton).value='enlever';}
else{var XHR=new XHRConnection();XHR.appendData('id_variante',id);XHR.sendAndLoad("../ajax/enlever_comparateur.php","POST");document.getElementById('ajout_comparateur_'+num_bouton).value='ajouter';}
lance_refresh_boite_comparateur();}
function ajout_comparateur(id,num_del){if(typeof(id)=="undefined"){id=document.getElementById("select_article").value;}
if(typeof(num_del)=="undefined"){var XHR=new XHRConnection();XHR.appendData('id_variante',id);XHR.sendAndLoad("../ajax/ajout_comparateur.php","POST");}
else{var XHR=new XHRConnection();XHR.appendData('id_variante',id);XHR.sendAndLoad("../ajax/enlever_comparateur.php","POST");}
lance_refresh_comparateur();lance_refresh_boite_comparateur();}
function format_annee(jour,mois,annee){var _Jour=document.getElementById(jour);var _Mois=document.getElementById(mois);var _Annee=document.getElementById(annee);encours=new Date();var annee_en_cours=encours.getYear();if(document.all){annee_en_cours_2=parseInt(annee_en_cours)-2000;}
else{annee_en_cours_2=parseInt(annee_en_cours)-100;annee_en_cours=parseInt(annee_en_cours)+1900;}
if(_Annee.value.length<2){_Annee.value=0+_Annee.value;}
if(_Annee.value<=parseInt(annee_en_cours_2)&&_Annee.value>=0&&_Annee.value !=''){_Annee.value='20'+_Annee.value;}
if(_Annee.value>parseInt(annee_en_cours_2)&&_Annee.value<100&&_Annee.value !=''){_Annee.value='19'+_Annee.value;}
if(_Annee.value>parseInt(annee_en_cours)&&_Annee.value !=''){_Annee.value=parseInt(annee_en_cours);}
if(_Annee.value<1900&&_Annee.value !=''){_Annee.value=1900;}
if(_Jour.value==''){_Jour.value='01';}
if(_Mois.value==''){_Mois.value='01';}}
var valeur=0;function deplacer_galerie_photo_h(sens,max){valeur=document.getElementById('galerie_interne').style.left;if(document.getElementById('galerie_interne').offsetWidth){taille_div=document.getElementById('galerie_externe').offsetWidth;}else{taille_div=document.getElementById('galerie_externe').style.pixelWidth;}
valeur=valeur.replace('px','');if(valeur==''){valeur=0;}
valeur=parseInt(valeur);if(sens=='p'){valeur=valeur-5;}else{valeur=valeur+5;}
if(valeur>0){valeur=0;}
if(max>taille_div){diff=parseInt(max)-parseInt(taille_div);}else{diff=0;}
if(valeur<-diff){valeur=-diff;}
document.getElementById('galerie_interne').style.left=valeur+'px';Timer=setTimeout('deplacer_galerie_photo_h(\''+sens+'\',\''+max+'\');',50);}
function deplacer_block_galerie_photo_h(sens,max,max_page){valeur=document.getElementById('galerie_interne').style.left;if(document.getElementById('galerie_interne').offsetWidth){taille_div=document.getElementById('galerie_externe').offsetWidth;}else{taille_div=document.getElementById('galerie_externe').style.pixelWidth;}
valeur=valeur.replace('px','');if(valeur==''){valeur=0;}
valeur=parseInt(valeur);if(sens=='p'){valeur=valeur-max_page;if(valeur<=-max)
valeur=valeur+max_page;}else{valeur=valeur+max_page;if(valeur>0)
valeur=0;}
document.getElementById('galerie_interne').style.left=valeur+'px';}
function deplacer_galerie_photo_v(sens,max){valeur=document.getElementById('galerie_interne').style.top;if(document.getElementById('galerie_interne').offsetWidth){taille_div=document.getElementById('galerie_externe').offsetHeight;}else{taille_div=document.getElementById('galerie_externe').style.pixelHeight;}
valeur=valeur.replace('px','');if(valeur==''){valeur=0;}
valeur=parseInt(valeur);if(sens=='p'){valeur=valeur-5;}else{valeur=valeur+5;}
if(valeur>0){valeur=0;}
if(max>taille_div){diff=parseInt(max)-parseInt(taille_div);}else{diff=0;}
if(valeur<-diff){valeur=-diff;}
document.getElementById('galerie_interne').style.top=valeur+'px';Timer=setTimeout('deplacer_galerie_photo_v(\''+sens+'\',\''+max+'\');',50);}
function deplacer_block_galerie_photo_v(sens,max,max_page){valeur=document.getElementById('galerie_interne').style.top;if(document.getElementById('galerie_interne').offsetWidth){taille_div=document.getElementById('galerie_externe').offsetHeight;}else{taille_div=document.getElementById('galerie_externe').style.pixelHeight;}
valeur=valeur.replace('px','');if(valeur==''){valeur=0;}
valeur=parseInt(valeur);if(sens=='p'){valeur=valeur-max_page;if(valeur<=-max)
valeur=valeur+max_page;}else{valeur=valeur+max_page;if(valeur>0)
valeur=0;}
document.getElementById('galerie_interne').style.top=valeur+'px';}
function get_nb_cheque(chaine){var chaine;var chaine2;var element_nom;var qte_requise;var taille=document.forms['form_fidelite'].elements.length;var element=null;var i=0;while(i<taille){element=document.forms['form_fidelite'].elements[i];element_nom=element.name.replace("qte[","");if(element.name !=element_nom){var id_valeur=element.id;id_valeur=id_valeur.replace("qte[","");id_valeur=id_valeur.replace("]","");if(element.type=='text'){qte_requise=document.getElementById('qte['+id_valeur+']').value;qte_requise=qte_requise.replace(' ','');chaine2+=id_valeur+"-"+qte_requise+",";chaine2=chaine2.replace("undefined","");}}
i++;}
var XHR=new XHRConnection();XHR.appendData("chaine",chaine2);XHR.sendAndLoad("../ajax/ajax_fidelite.php","POST",recevoir_data_fidelite);}
function show_div(id){document.getElementById(id).style.display='';}
function hide_div(id){document.getElementById(id).style.display='none';}
no_cache_div=true;function no_cache(type){no_cache_div=type;cache_div();}
function affichage_photo(url_photo,largeur_photo,hauteur_photo,largeur_div,hauteur_div){no_cache_cdiv=false;couleur_bordure="#000000";couleur_fond="#ffffff";taille_bordure=1;type_bordure="solid";document.getElementById("affiche_article").style.display="block";document.getElementById("affiche_article").style.width=hauteur_div+"px";document.getElementById("affiche_article").style.height=largeur_div+"px";document.getElementById("affiche_article").style.borderSize=taille_bordure+"px";document.getElementById("affiche_article").style.borderStyle=type_bordure;document.getElementById("affiche_article").style.borderColor=couleur_bordure;document.getElementById("affiche_article").style.backgroundColor=couleur_fond;document.getElementById("affiche_article").style.position="fixed";document.getElementById("affiche_article").style.top=0;document.getElementById("affiche_article").style.right=0;contenu_div="<table style=\"text-align:center;vertical-align:middle;height:"+hauteur_div+"px;\">";contenu_div+="<tr><td style=\"text-align:center;width:"+hauteur_div+"px;\">";contenu_div+="<img src=\""+url_photo+"\" width='"+largeur_photo+"' height='"+hauteur_photo+"'>";contenu_div+="</td></tr></table>";document.getElementById("affiche_article").innerHTML=contenu_div;}
function cacher_photo(){no_cache_cdiv=true;attente=window.setTimeout("cache_div()",500);}
function cache_div(){if(no_cache_div&&no_cache_cdiv){document.getElementById("affiche_article").style.display="none";}
window.clearTimeout(attente);}
