var client=file('php/chercheIdClient.php')
var zone_livraison=file('php/chercheLieuLivraison.php')
var cgv=file('php/chercheCgv.php')
var etoile="<span style=color:red;margin-left:2px;margin-right:2px;font-weight:bold;>*</span>"
var travail_old=''
var pub_old=''
var etoileRouge="<span style=font-familiy:Arial;color:red;> *</span>"
var interrogation="<span style=font-familiy:Arial;color:red;font-weight:bold> ? </span>"
var colonne_centre_old=''
var montant_livre=0
var montant_port=0
var body_old=0
var montant_total=0
var tab_showroom=new Array()
var	tab_sur_categorie = new Array()
/*tab_sur_categorie.push(Array('loisir',1))
tab_sur_categorie.push(Array('art',2))
tab_sur_categorie.push(Array('livre',4))
tab_sur_categorie.push(Array('papeterie',6))
tab_sur_categorie.push(Array('jeunesse',7))*/
tab_sur_categorie.push(Array('1-librairie',1))
tab_sur_categorie.push(Array('2-seconnecter',2))
tab_sur_categorie.push(Array('3-moncompte',3))
tab_sur_categorie.push(Array('4-affiliation',4))
titreDocument='Ep librairie en ligne'


function noaccent(chaine) {
	temp = chaine.replace(/[àâä]/gi,"a")
	temp = temp.replace(/[À]/gi,"a")
	temp = temp.replace(/[ÉÈÊ]/gi,"E")
	temp = temp.replace(/[éèêë]/gi,"e")
	temp = temp.replace(/[éèêë]/gi,"e")
	temp = temp.replace(/[îï]/gi,"i")
	temp = temp.replace(/[ôö]/gi,"o")
	temp = temp.replace(/[ùûü]/gi,"u")
	temp = temp.replace(/[ç]/gi,"c")
	temp = temp.replace(/[Ç]/gi,"C")
	return temp
}


function initGenre(){
	document.getElementById('espaceGenre').innerHTML=libelle_genre

}
function changeSurCategorie(valeur) {
	razChangeSurCategorie()
	var i=trouveIndex(tab_sur_categorie,valeur,0,0)
	document.getElementById(valeur).style.backgroundImage='url(icon/'+valeur+'-on.jpg)'
	if (valeur=='1-librairie') {
		location.replace('index.php')
	}
	else if (valeur=='2-seconnecter') {
		location.replace('monCompte.php')
	}
	else if (valeur=='3-moncompte') {
		location.replace('monCompte.php')
	}
//	else if (valeur=='4-affiliation' && (ip=='88.178.52.79' || ip=='86.75.170.140' || ip=='89.2.96.207') ) {
	else if (valeur=='4-affiliation'  ) {
		//else if (valeur=='4-affiliation' && ip=='88.178.52.79') {
		location.replace('affiliation.php')
	}	
}
function razChangeSurCategorie() {
	var n=tab_sur_categorie.length
	for (var i=0;i<n;i++) {
		document.getElementById(tab_sur_categorie[i][0]).style.backgroundImage='url(icon/'+tab_sur_categorie[i][0]+'-off.jpg)'
	}	
}
function initBandeau(){

/*	document.getElementById('ok').innerHTML="<a>"+messageDeroulant+"</a>"
	P = document.body.getElementsByTagName(tag);
	T = P.length;
	O[1] = new Olink(1);
	setTimeout("O[1].over();", 16);
	*/
	var libelle='<marquee width="100%" behavior="slide" loop="100">TEXTE DEFILANT</marquee>'
	document.getElementById('texteD').innerHTML=messageDeroulant
}

function remetAccent(valeur) {
	valeur=valeur.replace('ACUTE;','acute;')	
	valeur=valeur.replace('GRAVE;','grave;')	
	valeur=valeur.replace('CIRC;','circ;')	

	return valeur
	
}

function init(champ,valeur) {
	document.getElementById('colonne_gauche').style.opacity= 1
	document.getElementById('colonne_droite').style.opacity= 1
	document.getElementById('bandeau').style.opacity= 1
	document.getElementById('pied').style.opacity= 1

	if (idLivreDirect>0 && passageId==0 ) {
		passageId++
		if (eanDirect!='') {
		//affichePresentationLivre(idLivreDirect)	
			location.replace('http://eplibrairie.fr/'+eanDirect);
		}
		else {
			affichePresentationLivre(idLivreDirect)
			return
		}
	}

	var libelle=''
	var n=tab_livre_tout.length
	for (var i=0;i<n;i++) {
		if (verifAppartenance(champ,valeur,i)==1 || champ==0 || (champ=='R' && trouveIndex(tab_recherche,tab_livre_tout[i][0],0,0)!==false )  ){
			libelle+="<div class=case_livre>"
			if (tab_livre_tout[i][24]==0) {
				libelle+="<div class=accroche_livre style=background-image:url('icon/fond_"+tab_livre_tout[i][14]+".png') onclick=\"init(12,'"+tab_livre_tout[i][12]+"|')\" >"
			}
			else {
				libelle+="<div class=accroche_livre style=background-image:url('icon/fond_"+tab_livre_tout[i][14]+".png') onclick=\"init(8,'"+tab_livre_tout[i][8]+"|')\" >"
			}

			libelle+=remetAccent(decrea(tab_livre_tout[i][13]))
			libelle+="</div>"

			libelle+="<div class=cover style=background-image:url('cover/"+tab_livre_tout[i][22]+"'); onclick=affichePresentationLivre('"+tab_livre_tout[i][0]+"') title='Cliquer pour voir la couverture en haute définition'>"
			libelle+="</div>"
			libelle+="<div class=auteur onclick=\"init(6,'"+tab_livre_tout[i][6]+"|') \" title='Cliquer pour accéder aux livres de "+decrea(tab_livre_tout[i][7])+"'>"
			var u=tab_livre_tout[i][6].split(' - ')
			if (u.length>1) {
				libelle+=decrea(u[0])+'<span style=margin-left:10px>...</span>'
			}
			else {
				libelle+=decrea(tab_livre_tout[i][6])
			}
			libelle+="</div>"

			libelle+="<div class=genrePresentation  >"
			libelle+="<span onclick=init(8,'"+tab_livre_tout[i][8]+"|') style=cursor:pointer; title='Cliquer pour accéder au livre de "+decrea(tab_livre_tout[i][9])+"'>"+decrea(tab_livre_tout[i][9])+'</span>'
			libelle+="</div>"
			libelle+="<div class=genrePresentation  >"
			libelle+="<span onclick=init(10,'"+tab_livre_tout[i][10]+"|')  style=cursor:pointer; title='Cliquer pour accéder au livre de "+decrea(tab_livre_tout[i][11])+"'>"+decrea(tab_livre_tout[i][11])+'</span>'
			libelle+="</div>"

			libelle+="<div class=messageArgumentaire  >"
			libelle+=decrea(tab_livre_tout[i][16])
			libelle+="</div>"

			libelle+="<div class=prix_remise style=background-color:#"+tab_livre_tout[i][15]+";>"
			libelle+=tab_livre_tout[i][18].replace(".",",")+' €'
			libelle+="</div>"
			libelle+="<div class=prix_base >"

			if (tab_livre_tout[i][19]==1) {
				libelle+=" au lieu de <del>"+tab_livre_tout[i][17]+' €</del>'
			}
			libelle+="</div>"
			libelle+="<div class=prix_base style='width:110px;color:#"+tab_livre_tout[i][15]+";font-weight:bold;font-size:18px;' >"
			if (tab_livre_tout[i][19]==1) {
				libelle+=' 5% de remise'
			}
			libelle+="</div>"
			if (tab_livre_tout[i][37]=='0'){
				if (tab_livre_tout[i][25]=='' || tab_livre_tout[i][38]==1){
					libelle+="<div class=ajoutPanier  onclick=ajoutPanier("+tab_livre_tout[i][0]+")></div>"
				}
				else {
					libelle+="<div class=ajoutPanierInerte onclick=ajoutPanierInerte("+tab_livre_tout[i][0]+") >PARUTION : "+tab_livre_tout[i][25]+"</div>"
				}
			}
			else {
						libelle+="<div class=ajoutPanierInerte onclick=ajoutPanierInerte("+tab_livre_tout[i][0]+")>Indisponible</div>"
			}
			
			
			libelle+="<div class=c4_etendue >"
			libelle+=decrea(tab_livre_tout[i][21])+"<span style=font-weight:bold;color:blue;cursor:pointer;text-align:right; title='Cliquer pour accéder à la fiche complete de "+decrea(tab_livre_tout[i][2])+"'  onclick=affichePresentationLivre('"+tab_livre_tout[i][0]+"')> &laquo;suite&raquo; </span>"
		
			libelle+="</div>"
			libelle+="</div>"
		
	}
	document.getElementById('colonne_centre').innerHTML=libelle

	if (tab_panier.length>0) {
		affichePanierGauche()
	}
	if (pub_old!='') {
		document.getElementById('colonne_droite').innerHTML=pub_old
	}
}
}
function verifTabRecherche(id_livre) {


	//alert(id_livre+'  '+tab_recherche.indexOf(id_livre))
	return tab_recherche.indexOf(id_livre)
	
}

function affichePresentationLivre(valeur) {
	//alert(valeur)
	var uh=file("php/stat_livre.php?z="+valeur+'|||')

	travail_old=document.getElementById('colonne_centre').innerHTML	

	pub_old=document.getElementById('colonne_droite').innerHTML	
	var kx=trouveIndex(tab_livre_tout,valeur,0,0)
	document.title=titreDocument+' - '+decrea(tab_livre_tout[kx][2])
	var libelle=''
	libelle+="<div class=lignePanier style='height:18px;text-align:left;font-family:Arial;font-size:14px;color:blue;margin-left:10px ;'>"
	libelle+="<span onclick=;init(0,'0|') style=cursor:pointer;>"
	libelle+="Accueil "
	libelle+="</span>"
	libelle+="<span onclick=init(8,'"+tab_livre_tout[kx][8]+"|') style=cursor:pointer;>"
	libelle+="> "+decrea(tab_livre_tout[kx][9])+" "
	libelle+="</span>"
	libelle+="<span onclick=init(10,'"+tab_livre_tout[kx][10]+"|') style=cursor:pointer;>"
	libelle+="> "+decrea(tab_livre_tout[kx][11])+" "
	libelle+="</span>"
	libelle+="</div>"
	libelle+="<div class=lignePanier style=height:auto;text-align:center;;width:540px;margin-left:25px;>"
//	libelle+="<span style=height:auto;background-color:#A7077C;color:white;font-family:Times;font-size:22px;color:white;font-weight:bold;>"
	libelle+="<span style=height:auto;color:black;font-family:Times;font-size:22px;font-weight:bold;>"
	libelle+=decrea(tab_livre_tout[kx][2])
	libelle+="</span>"
	libelle+="</div>"
	libelle+="<div class=lignePanier style=height:auto;text-align:center;>"
	libelle+="<span style=width:auto;height:auto;font-family:Times;font-size:18px;font-weight:bold;>"
	libelle+=decrea(tab_livre_tout[kx][26])
	libelle+="</span>"
	libelle+="</div>"
	libelle+="<div class=lignePanier style=height:auto;text-align:left;margin-left:25px !important;>"
//	libelle+=decrea(tab_livre_tout[kx][16])
	libelle+="</div>"
	libelle+="<div class=lignePanier style=height:auto;text-align:left;margin-left:25px ;>"
	libelle+="<span style=width:auto;height:auto;font-family:Times;font-size:18px;font-weight:bold;color:#A7077C;'>"
	libelle+=decrea(tab_livre_tout[kx][16])
	libelle+="</span>"
	libelle+="</div>"

	libelle+="<div class=lignePanier style=height:auto;text-align:justify;margin-left:25px;width:540px;font-family:Arial;font-size:14px;font-weight:'';>"
	libelle+=decrea(tab_livre_tout[kx][27])
	libelle+="</div>"
	
	libelle+="<div class=lignePanier style=height:auto;text-align:left;margin-left:25px;margin-top:15px;>"
	libelle+="<span style=width:auto;height:auto;font-family:Times;font-size:18px;font-weight:bold;color:#A7077C;>"	
	var u=tab_livre_tout[kx][6].split(' - ')
	var n=u.length
	if (n==1) {
		libelle+="L'auteur"
	}
	else {
		libelle+="Les auteurs"
	}
	libelle+="</span>"
	libelle+="</div>"

	libelle+=decrea(tab_livre_tout[kx][35])
	libelle+="<div class=lignePanier style=height:auto;text-align:left;margin-top:15px;margin-left:25px !important;margin-left:0px;width:540px>"
	libelle+="<span style=width:auto;height:auto;font-family:Times;font-size:18px;font-weight:bold;color:#A7077C;>"
	libelle+="Lien affilié"
	libelle+="</span>"
	libelle+="</div>"	
	libelle+="<div class=lignePanier style=height:auto;text-align:left;margin-left:25px;width:540px;font-family:Arial;font-size:14px;font-weight:'';>"
	var zu=file('php/chercheCodeAffilie.php').split('|')
	if (zu[0].length>5) {
		libelle+="http://www.boutique-creapassions.com/?livre="+valeur+"&aff="+zu[0]+"&"
	}
	else {
		
		libelle+="Vous n'êtes pas afffilié cliquez <a href=affiliation.php style=\"width:40px;height:20px;color:blue;font-size:12px;border-bottom:1px solid blue;\">ici</a> pour le devenir"
	}
	libelle+="</div>"	



	libelle+="<div class=lignePanier style=height:auto;text-align:left;margin-top:15px;margin-left:25px !important;margin-left:0px;width:540px>"
	libelle+="<span style=width:auto;height:auto;font-family:Times;font-size:18px;font-weight:bold;color:#A7077C;>"
	libelle+="Fiche signalétique"
	libelle+="</span>"
	libelle+="</div>"	

	libelle+="<div class=lignePanier style=height:auto;text-align:left;margin-left:25px;width:540px;font-family:Arial;font-size:14px;font-weight:'';>"
	libelle+="Editeur&nbsp;:&nbsp;"+decrea(tab_livre_tout[kx][28])+"&nbsp;/ Collection&nbsp;:&nbsp;"+decrea(tab_livre_tout[kx][29])
	libelle+="</div>"	

	libelle+="<div class=lignePanier style=height:auto;text-align:left;margin-left:25px;width:540px;font-family:Arial;font-size:14px;font-weight:'';>"
	libelle+="Format&nbsp;:&nbsp;"+decrea(tab_livre_tout[kx][30])+"&nbsp;/ "
	libelle+=decrea(tab_livre_tout[kx][31])+"&nbsp;pages&nbsp;/ Nombre de visuels&nbsp;:&nbsp;"+tab_livre_tout[kx][32]
	libelle+="</div>"	

	libelle+="<div class=lignePanier style=height:auto;text-align:left;margin-left:25px;width:540px;font-family:Arial;font-size:14px;font-weight:'';>"
	libelle+="ISBN&nbsp;:&nbsp;"+decrea(tab_livre_tout[kx][33])
	libelle+="</div>"			
	libelle+="<div class=lignePanier style=height:auto;text-align:left;margin-left:25px;width:540px;font-family:Arial;font-size:14px;font-weight:'';>"
	libelle+="Date de parution&nbsp;:&nbsp;"+tab_livre_tout[kx][34]
	libelle+="</div>"			
	libelle+="<div class=lignePanier style=height:auto;text-align:left;margin-left:25px;width:540px;font-family:Arial;font-size:14px;font-weight:'';>"
	//libelle+="Prix&nbsp;:&nbsp;"+tab_livre_tout[kx][18].replace(".",",")+' € au lieu de '+tab_livre_tout[kx][17].replace(".",",")+' €'
	libelle+="Prix&nbsp;net&nbsp;:&nbsp;"+tab_livre_tout[kx][18].replace(".",",")+' € '
	libelle+="</div>"	


	document.getElementById('colonne_centre').innerHTML=libelle

	var u=tab_livre_tout[kx][22].split('.png')
	var image_hd=u[0]+'.jpg'
	libelle=''
	if (valeur==999) {
		libelle+="<div class=cover style=background-image:url('cover/"+tab_livre_tout[kx][22]+"'); onclick=showroom("+valeur+") title='Cliquer pour voir la couverture en haute définition'></div>"
	}
	else {
		libelle+="<div class=cover style=background-image:url('cover/"+tab_livre_tout[kx][22]+"'); onclick=window.open('cover_hd/"+image_hd+"','','width=600,height=600') title='Cliquer pour voir la couverture en haute définition'></div>"
	}
	
	
	if (tab_livre_tout[kx][37]==0){
		if (tab_livre_tout[kx][25]=='' ||  tab_livre_tout[kx][38]==1){
			libelle+="<div class=ajoutPanierAcheter  onclick=ajoutPanier("+tab_livre_tout[kx][0]+")></div>"
		}
		else {
			libelle+="<div class=ajoutPanierInerte style='text-align:center;' onclick=ajoutPanierInerte("+tab_livre_tout[kx][0]+") >PARUTION : "+tab_livre_tout[kx][25]+"</div>"
			libelle+="<div class=etrePrevenu  onclick=ajoutPanierInerte("+tab_livre_tout[kx][0]+") ></div>"
		}
	}
	else {
		libelle+="<div class=ajoutPanierAcheter  style='width:99px;margin-left:0px;margin-right:0px;background:url(icon/INDISPONIBLE.gif);' ></div>"
	}


	if (tab_livre_tout[kx][40]==1){
		if (tab_livre_tout[kx][37]==1 || !(tab_livre_tout[kx][25]=='' ||  tab_livre_tout[kx][38]==1)){		
			libelle+="<div id=bouton_feuilletage style=margin-left:5px; onclick=showroom("+valeur+")></div>"
		}
		else {
			libelle+="<div id=bouton_feuilletage onclick=showroom("+valeur+")></div>"
		}
	}
	else {
		if (tab_livre_tout[kx][37]==1 || !(tab_livre_tout[kx][25]=='' ||  tab_livre_tout[kx][38]==1)){		
			libelle+="<div id=bouton_feuilletage style=margin-left:5px; onclick=showroomAbsent()></div>"
		}
		else {
			libelle+="<div id=bouton_feuilletage onclick=showroomAbsent()></div>"
		}

	}
	
	libelle+="<div class=lignePanier style=height:auto>"
	libelle+="<div id=sommaire><div style='width:auto;height:20px;font-weight:bold;font-family:Arial;font-size:14px;font-weight:bold;text-align:center; !important;margin-left:15px ;margin-top:20px;'>Sommaire</div>"
	libelle+="<div id=bouton_descend onmouseover=descend() onmouseout=stop()></div>"
	libelle+="<div id=bouton_monte onmouseover=monte() onmouseout=stop()></div>"
	libelle+="<div id=box_sommaire ><div id=detail_sommaire ></div></div>"
	libelle+="</div>"
	libelle+="</div>"
	document.getElementById('colonne_droite').innerHTML=libelle

	som=propre(decrea(tab_livre_tout[kx][36]))

	
	document.getElementById('detail_sommaire').innerHTML=decreaHTML(som)

	document.getElementById('detail_sommaire').style.marginTop=0
}

function showroom(valeur) {
	//window.open('feuilletage.php?livre='+valeur,'width=1200,height=900')
	window.open('feuilletage.php?livre='+valeur)
	return
	
	if (ip=='88.178.52.79' || ip=='193.251.52.193' || '81.220.191.76') {
		showroom_nouveau(valeur)
		return
	}
	
	
	var u=file('php/chercheInfoShowroom.php?z='+valeur+'|').split('^')
	
	//alert(u)
	var ean=u[0]
	var v=u[1].split('|')
	tab_showroom=v

	colonne_centre_old=document.getElementById('colonne_centre').innerHTML
	//document.getElementById('main').style.opacity= 0.3
	document.getElementById('colonne_gauche').style.opacity= 0.2
	document.getElementById('colonne_droite').style.opacity= 0.2
	document.getElementById('bandeau').style.opacity= 0.2
	document.getElementById('pied').style.opacity= 0.2
	afficheShow(0,ean,v)
	
/*
	document.getElementById('colonne_centre').innerHTML="<img src='showroom/"+ean+"/"+ean+"-"+tab[r]+".png' style=opacity:1 style='height:540px;width:540px;margin-bottom:5px;' >"
//	document.getElementById('colonne_centre').innerHTML+="<div id=toto style='width:95%;height:40px;margin-top:5px;background-color:#dddddd;margin-left:auto;margin-right:auto;' >"
	document.getElementById('colonne_centre').innerHTML+="<div id=precedent style='width:25%;height:30px;float:left;position:relative;text-align:center;' >Précedent</div>"
	document.getElementById('colonne_centre').innerHTML+="<div id=precedent style='width:50%;height:30px;float:left;position:relative;text-align:center;cursor:pointer;' onclick=quitteShowroom() >Quitter</div>"
	document.getElementById('colonne_centre').innerHTML+="<div id=precedent style='width:25%;height:30px;float:left;position:relative;text-align:center;' >Suivant</div>"
//	document.getElementById('colonne_centre').innerHTML+="</div>"
*/
}
function afficheShow(page,ean,vais) {
	document.getElementById('colonne_centre').innerHTML="<img src='showroom/"+ean+"/"+ean+"-"+tab_showroom[parseInt(page)]+".png' style=opacity:1 style='height:540px;width:540px;margin-bottom:5px;' >"
	if (page>0 ) {
		document.getElementById('colonne_centre').innerHTML+="<div id=precedent style='width:40%;height:30px;cursor:pointer;margin-left:20px;float:left;position:relative;background:url(../icon/pageprecedente.gif) no-repeat center left;'cursor:pointer;' onclick= afficheShow('"+(parseInt(page)-1)+"','"+ean+"','"+tab_showroom+"')></div>"
	}
	else {
		document.getElementById('colonne_centre').innerHTML+="<div id=precedent style='width:40%;height:30px;float:left;position:relative;text-align:center;' )></div>"
	}
	
	document.getElementById('colonne_centre').innerHTML+="<div style='width:35%;height:30px;float:left;position:relative;text-align:center;cursor:pointer;background:url(../icon/revenir.gif) no-repeat center left;' onclick=quitteShowroom() ></div>"

	if (page<tab_showroom.length-2) {
		document.getElementById('colonne_centre').innerHTML+="<div id=suivant style='width:20%;height:30px;float:left;position:relative;text-align:center;cursor:pointer;background:url(../icon/pagesuivante.gif) no-repeat center center;' onclick= afficheShow('"+(parseInt(page)+1)+"','"+ean+"','"+tab_showroom+"')></div>"
	}
	else {
		document.getElementById('colonne_centre').innerHTML+="<div id=suivant style='width:25%;height:30px;float:left;position:relative;text-align:center;' onclick= ></div>"
	}

	
	
}
function showroom_nouveau(valeur) {
	body_old=document.body.innerHTML
	var libelle=''
	libelle+='<div id="center">'
	libelle+='	<div id="DHTMLBOOK">'
	libelle+='		<span class="page" onmousedown="return false;" ondblclick="TPL();" onclick="TPL();"><img class="img"></span>'
	libelle+='		<span class="page right" onmousedown="return false;" ondblclick="TPR();" onclick="TPR();"><img class="img"  style="left:-100%"></span>'
	libelle+='		<span class="page turn" onmousedown="return false;" ondblclick="TPL();" onclick="TPL();"><img class="img"  style="opacity:1;filter:alpha()"></span>'
	libelle+='		<span class="page turn right" onmousedown="return false;" ondblclick="TPR();" onclick="TPR();"><img class="img"  style="opacity:1;filter:alpha();left:-100%"></span>'
	libelle+='		<div id="TXTBOX"><input type=button value="Quitter le feuilletage" onclick=quitteShowroomNouveau()></div>'
	libelle+='		<span id="TXTBOX_G" onmousedown="return false;" ondblclick="TPL();" onclick="TPL();"></span>'
	libelle+='		<span id="TXTBOX_D" onmousedown="return false;" ondblclick="TPR();" onclick="TPR();"></span>'
	libelle+='	</div>'
	libelle+='</div>'
	libelle+='<div id="imgsrc" style="visibility:hidden;">'

	var u=file('php/chercheInfoShowroom2.php?z='+valeur+'|').split('^')
	var ean=u[0]

	var v=u[1].split('|')

	for (var i=0;i<(v.length)-1;i++ ) {
		var w=v[i].split('$')
		if (w[0]!='') {
			libelle+='<img alt="'+w[1]+'|'+w[2]+'" src="feuilletage/'+ean+'/'+w[0]+'">'+"\n"

		}
	}
	

	libelle+='</div>'

	document.body.innerHTML=libelle

  if (!document.styleSheets) return;
  var regles=new Array();
  if (document.styleSheets[0].cssRules) regles=document.styleSheets[0].cssRules
  else if (document.styleSheets[1].rules) regles = document.styleSheets[1].rules
  else return
  
  var z=''
  for (var i=0;i<regles[0].style.length;i++) {
	  z+= i+' = '+regles[0].style[i]+"\n";
  }
  
    for (i=0;i<3;i++) {
	//alert(i+' '+regles[i].style.)
}
  
	//alert(regles[0].style.textAlign)
	//regles[0].style.marginLeft=''
	//regles[0].style.marginRight=''
	//regles[0].style.textAlign=''
//	document.body.style.marginLeft=''
//	document.body.marginRight=''
	//alert(naviguateur)
	if (naviguateur!=0) {
		alert(naviguateur)
	//	document.body.style.textAlign=''
		regles[0].style.marginLeft=''
		regles[0].style.marginRight=''
		document.body.style.marginLeft=''
		document.body.marginRight=''
	}

	document.body.style.overflow='hidden'
	document.body.style.width=screen.width+'px'
	document.body.style.height=screen.height+'px' 
	document.body.style.background='white'

	
	var nI  = 0;
	var kI  = 0;
	var run = false;
	demarreDemo()
	
	
	
}


function quitteShowroomNouveau() {

	  if (!document.styleSheets) return;
  var regles=new Array();
  if (document.styleSheets[0].cssRules) regles=document.styleSheets[0].cssRules
  else if (document.styleSheets[0].rules) regles = document.styleSheets[0].rules
  else return

	document.body.innerHTML=body_old
	document.body.style.background="#ffffff"

  
	rdocument.body.style.marginLeft='auto'
	document.body.style.marginRight='auto'
	
	document.body.style.textAlign='center'

	document.body.style.background='#ffffff'
	document.body.style.width='996px'
	document.body.style.height='996px' 

}

function quitteShowroom(){
	document.getElementById('colonne_gauche').style.opacity= 1
	document.getElementById('colonne_droite').style.opacity= 1
	document.getElementById('bandeau').style.opacity= 1
	document.getElementById('pied').style.opacity= 1
	document.getElementById('colonne_centre').innerHTML=colonne_centre_old
	
}
function showroomAbsent() {
	alert('Pas de feuilletage disponible pour ce livre')
	
}
	
function retourIndex() {
	document.getElementById('colonne_centre').innerHTML=travail_old
	
}

function afficheCoverHd(image) {
alert(image)
	location.replace('cover_hd/'+image)
}
function Idescend() {
	setTimeout('descend()',100)	
}

function descend() {
		document.getElementById('detail_sommaire').style.marginTop=parseInt(document.getElementById('detail_sommaire').style.marginTop)-10
		a=setTimeout('descend()',100)	
}

function Imonte() {
	
	setTimeout('monte()',100)	
}
function propre(ch) {
	ch = ch.replace(/\t/g," ... ")
	return ch
}




function monte() {
	document.getElementById('detail_sommaire').style.marginTop=parseInt(document.getElementById('detail_sommaire').style.marginTop)+10
	a=setTimeout('monte()',100)
}

function stop() {

	clearTimeout(a)
}


function ajoutPanier(valeur) {
	var kx=trouveIndex(tab_livre_tout,valeur,0)
	if (kx!==false) {
		var quantite=1
		var titre=decrea(tab_livre_tout[kx][2])
		alert("Vous avez rajouté l'ouvrage "+String.fromCharCode(171)+titre+String.fromCharCode(187)+" dans votre panier")
		var ky=trouveIndex(tab_panier,valeur,0)
		if (ky!==false) {
			quantite+=tab_panier[ky][2]
			tab_panier.splice(ky,1)
		}
		tab_panier.unshift(Array(valeur,titre,quantite))
	}
	if (tab_panier.length>0) {
		affichePanierGauche()
	}
}

function ajoutPanierInerte(valeur) {
	var kx=trouveIndex(tab_livre_tout,valeur,0)
	if (kx!==false) {
		var titre=decrea(tab_livre_tout[kx][2])	
		if (mailAParaitre=='') {
			var mailAParaitreX=prompt("Merci d'indiquer votre adresse de courriel \nvous serez prévenu dès que \""+titre+"\" \nsera disponible à la vente sur le site" ,'')
		}
		else {
			
			var mailAParaitreX=prompt("Confirmez votre mail pour être automatiquement averti de la sortie de "+String.fromCharCode(171)+titre+String.fromCharCode(187),mailAParaitre)
		}
		if (mailAParaitreX!='') {
			var u=file('php/ajoutMailAParaitre.php?z='+valeur+'|'+escape(mailAParaitreX)+'|').split('|')
			if (u[0]=='X') {
				mailAParaitre=mailAParaitreX
			}
		}
	}
}


function inscriptionMailingListe() {
	var mailMailingListe=prompt("Inscrivez vous\nEntrez votre email pour recevrez notre astuce de scrap quotidienne.")
	if (mailMailingListe!='') {
		var u=file('php/ajoutMailMailingListe.php?z='+escape(mailMailingListe)+'|').split('|')
		if (u[0]=='X') {
			alert("Vous êtes déjà enregistré")	
		}
		else if (u[0]=='Y'){
			alert("Erreur dans l'email")	
		}
		else if (u[0]>0){
			alert("Vous êtes enregistré")	
		}
		else {
			alert('Probleme')	
		}
	}
	
}

function affichePanierGauche() {
	if (tab_panier.length>0) {
		document.getElementById('validationPanierGauche').title='Cliquez pour valider votre panier'
		document.getElementById('accesPanier').title='Cliquez pour valider votre panier'
		document.getElementById('panierSecondaire').title='Cliquez pour valider votre panier'
	}
	else {
		document.getElementById('validationPanierGauche').title="Votre panier est vide"
		document.getElementById('accesPanier').title="Votre panier est vide"
		document.getElementById('panierSecondaire').title="Votre panier est vide"
	}

	var libelle=''
	var zone=''
	var n=tab_panier.length
	for (var i=0;i<n;i++) {
		if (i%2==0) {
			var couleur='#EAEAEA'
		}
		else {
			var couleur='#CFCFCF'
		}
		libelle+="<div class=lignePanierGauche style=background-color:"+couleur+";>"
		libelle+="<div class=titrePanierGauche>"
		libelle+=decrea(tab_panier[i][1])
		libelle+="</div>"
		libelle+="<div class=qPanierGauche>"
		libelle+=tab_panier[i][2]
		libelle+="</div>"
		libelle+="<div class=poubellePanierGauche onclick=effaceLignePanier("+tab_panier[i][0]+") title='Cliquer pour supprimer "+decrea(tab_panier[i][1])+" du panier'>"
		libelle+="</div>"
		libelle+="</div>"
		zone+=tab_panier[i][0]+'|'+tab_panier[i][2]+'$'
	}

	var resultat=file('php/majPanier.php?z='+zone)
	document.getElementById('panierGauche').innerHTML=libelle
}

function initPanier() {
	document.title=titreDocument+' - Panier'
	var n=tab_panier.length
	client=file('php/chercheIdClient.php')
	var libelle=''
	var zone=''
	var prixTTC=0
	var prixTTCFin=0
	var pp=0
	frais_port_france=0
	libelle+="<div  style='position:relative;float:left;height:450px;width:100%;overflow:auto;'>"
		libelle+="<div class=lignePanier style='background:lightblue;width:100%;'>"
		libelle+="<div class=qPanier style='border-top:1px solid black;border-bottom:1px solid black;text-align:center;font-weight:bold;height:28px;'>"
		libelle+="Quantité</div>"
		libelle+="<div class=titrePanier style='border-top:1px solid black;border-bottom:1px solid black;text-align:center;font-weight:bold;height:28px'>"
		libelle+="Titre</div>"
		libelle+="<div class=pUPanier style='border-top:1px solid black;border-bottom:1px solid black;text-align:center;font-weight:bold;font-size:12px;height:28px'>"
		libelle+="Prix public unitaire</div>"
		libelle+="<div class=pUPanier style='border-top:1px solid black;border-bottom:1px solid black;text-align:center;font-weight:bold;font-size:12px;height:28px'>"
		libelle+="Prix net unitaire <span onmouseover=allumeNote(1)>(1)</span></div>"
		libelle+="<div class=pUPanier style='border-top:1px solid black;border-bottom:1px solid black;text-align:center;font-weight:bold;font-size:12px;height:28px'>"
		libelle+="Prix net</div>"

		libelle+="</div>"
		
		var quantite_cumul=0
	for (var i=0;i<n;i++) {
		if (i%2==0) {
			var couleur='#eeeeee'
		}
		else {
			var couleur='#dddddd'
		}
		var prix=0
		var kx=trouveIndex(tab_livre_tout,tab_panier[i][0],0)
		if (kx!==false) {
			quantite_cumul+=parseInt(tab_panier[i][2])
			p=parseInt(tab_livre_tout[kx][18]*100).toString()
			prix=p.substr(0,(p.length-2))+','+p.substr(p.length-2,2)
			prixTTC+=parseInt(tab_livre_tout[kx][18]*100*tab_panier[i][2])
			p=parseInt(tab_livre_tout[kx][18]*100*tab_panier[i][2]).toString()
			prix_total=p.substr(0,(p.length-2))+','+p.substr(p.length-2,2)
			prix_total_point=parseFloat(p.substr(0,(p.length-2))+'.'+p.substr(p.length-2,2))
			p=parseInt(tab_livre_tout[kx][17]*100).toString()
			prix_brut=p.substr(0,(p.length-2))+','+p.substr(p.length-2,2)
			montant_livre=prixTTC
		}
		


		libelle+="<div class=lignePanier style='background:"+couleur+";width:100%;'>"
		libelle+="<div class=qPanier >"
		libelle+="<select size=1  id='q_"+tab_panier[i][0]+"' onChange=recalculPrixUnitaire("+tab_panier[i][0]+") >"
		for (x=1;x<21;x++) {
			if (tab_panier[i][2]==x) {
				var selection='selected'
			}
			else {
				var selection=''
			}
			libelle+="<option value="+x+" "+selection+">"+x+"</option>"
		}
		libelle+="</select >"
		libelle+="</div>"
		libelle+="<div class=titrePanier>"
		libelle+=decrea(tab_panier[i][1])
		libelle+="</div>"
		libelle+="<div class=pUPanier>"
		libelle+=prix_brut
		libelle+="</div>"

		libelle+="<div class=pUPanier>"
		libelle+=prix
		libelle+="</div>"
		libelle+="<div class=pUPanier>"
		libelle+=prix_total
		libelle+="</div>"

		libelle+="<div class=poubellePanier onclick=effaceLignePanierGeneral("+tab_panier[i][0]+") title='Cliquer pour supprimer "+decrea(tab_panier[i][1])+" du panier'>"
		libelle+="</div>"
		libelle+="</div>"
		zone+=tab_panier[i][0]+'|'+tab_panier[i][2]+'$'
	}
	libelle+="<div class=lignePanier style='background:lightblue;width:100%;height:8px;'>"
	libelle+="<div class=qPanier style='border:none;border-top:1px solid black;height:8px;'>"
	libelle+="</div>"
	libelle+="<div class=titrePanier style='border:none;border-top:1px solid black;height:8px'>"
	libelle+="</div>"
	libelle+="<div class=pUPanier style='border:none;border-top:1px solid black;height:8px'>"
	libelle+="</div>"
	libelle+="<div class=pUPanier style='border:none;border-top:1px solid black;height:8px'>"
	libelle+="</div>"
	libelle+="<div class=pUPanier style='border:none;border-top:1px solid black;height:8px;padding:none;width:130px !important;width:70px;'>"
	libelle+="</div>"

	libelle+="</div>"

	for (var i=0;i<tab_frais_de_port_dom.length;i++) {
		if (prix_total_point > parseFloat(tab_frais_de_port_dom[i][0]) && prix_total_point <= parseFloat(tab_frais_de_port_dom[i][1]) ) {
			frais_port_dom=parseFloat(tab_frais_de_port_dom[i][2]*100)
			montant_port=frais_port_dom
		}
	}

	for (var i=0;i<tab_frais_de_port.length;i++) {
		if (prixTTC/100 > parseFloat(tab_frais_de_port[i][0]) && prixTTC/100 <= parseFloat(tab_frais_de_port[i][1]) ) {
			frais_port_france=parseFloat(tab_frais_de_port[i][2]*100)
			montant_port=frais_port_france
		}
	}



	if (zone_livraison==0) {
		libelle+="<div class=lignePanier style='height:20px;font-family:Arial;font-size:14px;background:pink;font-weight:bold;width:100%;padding-left:10px;text-align:center;'>"
		libelle+="Frais de port"
		libelle+="</div>"
		libelle+="<div class=lignePanier style='height:20px;font-family:Arial;font-size:14px;background:pink;font-weight:none;width:100%;padding-left:10px;text-align:center;'> "
		if (frais_port_france>0) {
			libelle+=frais_port_france.toString().substr(0,(frais_port_france.toString().length-2))+','+frais_port_france.toString().substr(frais_port_france.toString().length-2,2)
			libelle+=' euros pour la France métroplotitaine'
		}
		else {
			libelle+='gratuit pour la France métroplotitaine (à partir de '+limiteGratuitFrance+' euros)'
		}
		libelle+="</div>"
		libelle+="<div class=lignePanier style='height:20px;font-family:Arial;font-size:14px;background:pink;font-weight:none;width:100%;padding-left:10px;text-align:center;'> "

		if (frais_port_dom>0) {
			libelle+=frais_port_dom.toString().substr(0,(frais_port_dom.toString().length-2))+','+frais_port_dom.toString().substr(frais_port_dom.toString().length-2,2)
			libelle+=' euros pour les Dom Tom'
		}
		else {
			libelle+=' gratuit pour les Dom Tom (à partir de '+limiteGratuitDom+' euros)'
		}
		prixTTCFin=prixTTC
		montant_total=prixTTC
	}
	else {
		libelle+="<div class=lignePanier style='background:lightblue;font-weight:bold;width:100%;'>"
		libelle+='<div style=width:250px;margin-left:25px;text-align:left;position:relative;float:left;margin-right:25px;>Nombre d\'ouvrages : '
		libelle+=quantite_cumul
		libelle+='</div> '

		libelle+='<div style=width:500px;text-align:right;position:relative;float:left;margin-right:25px;>Total livre TTC <span style=font-size:12px; onmouseover=allumeNote(2)>(2)</span> : </div> '
		libelle+=prixTTC.toString().substr(0,(prixTTC.toString().length-2))+','+prixTTC.toString().substr(prixTTC.toString().length-2,2)
		libelle+="</div>"
		libelle+="<div class=lignePanier style='background:pink;font-weight:bold;width:100%;'>"
		libelle+='<div style=width:250px;margin-left:25px;text-align:left;position:relative;float:left;margin-right:25px;>&nbsp;</div> '
		libelle+='<div style=width:500px;text-align:right;position:relative;float:left;margin-right:25px;>Frais de port :</div> '
		if (zone_livraison==1) {
			if (frais_port_france>0) {
				//libelle+=frais_port_france
				libelle+=frais_port_france.toString().substr(0,(frais_port_france.toString().length-2))+','+frais_port_france.toString().substr(frais_port_france.toString().length-2,2)
			}
			else {
				libelle+='gratuit'
			}
			prixTTCFin=parseFloat(prixTTC)+parseFloat(frais_port_france)
			montant_total=prixTTCFin
			montant_port=frais_port_france
		}
		else {
			if (frais_port_dom>0) {
				//libelle+=frais_port_dom
				libelle+=frais_port_dom.toString().substr(0,(frais_port_dom.toString().length-2))+','+frais_port_dom.toString().substr(frais_port_dom.toString().length-2,2)
			}
			else {
				libelle+='gratuit'
			}
			prixTTCFin=parseFloat(prixTTC)+parseFloat(frais_port_dom)				
			montant_port=frais_port_dom
			montant_total=prixTTCFin
		}
	}		
	libelle+="</div>"	


	libelle+="<div class=lignePanier style='background:lightblue;font-weight:bold;width:100%;'>"
	libelle+='<div style=width:250px;margin-left:25px;text-align:left;position:relative;float:left;margin-right:25px;>&nbsp;</div> '
	
	libelle+='<div style=width:500px;text-align:right;position:relative;float:left;margin-right:25px;>Total net TTC : </div> '

	libelle+=prixTTCFin.toString().substr(0,(prixTTCFin.toString().length-2))+','+prixTTCFin.toString().substr(prixTTCFin.toString().length-2,2)
	libelle+="</div>"

	
	
	
	if (n==0) {
		libelle="<div class=lignePanier style='background:lightblue;font-weight:bold;width:100%;text-align:center;'>"
		libelle+='Votre panier est vide';
		libelle+='</div>'
	}
	else {
		if (cgv==1) {
			cgvChecked='checked'
		}
		else {
			cgvChecked=''
		}
		libelle+="<div class=lignePanier style='color:red;width:100%;text-align:center;font-size:14px;font-weight:bold;height:16px;'>"
		libelle+="Vous devez accepter les conditions générales de vente pour valider votre commande et passer à l'etape suivante."
		libelle+='</div>'
		libelle+="<div class=lignePanier style='width:100%;text-align:center;font-size:12px;margin-top:0px;color:black'>"
		libelle+="<input type=checkbox id=cgv_ok onChange=accepteCgv() "+cgvChecked+" style=color:black;>En cochant cette case, je reconnais avoir pris connaissance et j'accepte les <a href=\"tab_livre/cgv.htm\" target=\"_BLANK\" style=\"color:black;text-decoration:underline;font-family:Arial;font-size:14px;\">Conditions Générales de Vente</a>. "
		libelle+='</div>'

}
	libelle+="<div class=lignePanier style='color:red;width:100%;text-align:center;'>"
	libelle+='<input  type=button value="Poursuivre mes achats" onclick=location.href="index.php">'

	if (client>0 && n>0) {
		if (zone_livraison==0) {
			libelle+=" <input type=button value=\"Etape suivante : Livraison\" id=boutonLivraison onclick=location.replace(\"livraison.php\")>"
		}
		else {
			libelle+=" <input type=button value=\"Modification  livraison\" id=boutonLivraison onclick=location.href(\"livraison.php\") >"
		}
	}
	else if (n>0){
		libelle+="<input type=button value=\"Etape suivante : m'identifier\" onclick=accueilIdentification()>"

	}

	if (client>0 && zone_livraison>0) {
		//libelle+=" <a href=paiement.php style=text-decoration:none;><input type=button value=\"Etape suivante : Payer\" onclick=vaPaiement()></a>"
		libelle+=" <input type=button value=\"Etape suivante : Payer\" onclick=vaPaiement()>"
	}
	
	libelle+="</div>"
	libelle+="</div>"	
	libelle+="</div>"	
	libelle+="<div style=position:relative;float:left;height:auto;width:100%;font-family:Arial;font-size:12px;color:black;text-align:left;position:relative;float:left;>"
	libelle+="<div style=width:100%;text-align:left; id=note_1>"
	libelle+="(1) Vous bénéficiez d’une <span style=font-weight:bold>remise de 5%</span> sur tous les ouvrages de la librairie"
	libelle+="</div>"
	libelle+="<div style=width:100%;text-align:left; id=note_2>"
	libelle+="(2) Hors frais de port éventuels : gratuits pour toute commande inférieure à 10 euros adressée en France métropolitaine, et pour toute commande supérieure à 50 euros adressée dans les DOM-TOM. Les éventuels frais de port seront comptabilisés sur l’écran suivant."
	libelle+="</div>"	
	libelle+="<div style=width:100%;text-align:center;font-weight:bold;text-decoration:underline;margin-top:10px;margin-bottom:10px;>Rappel des conditions de gratuité des frais de port</div>"
	libelle+="<span style=font-style:italic;font-weight:bold;>France métropolitaine - </span> L’expédition s’effectuera par La Poste. Délais d'acheminement : généralement de 48h à 96h, garantis en 7 jours calendaires. Coût TTC: 3,00 euros pour toute commande de moins de 10 euros Frais de port gratuits pour toute commande à partir de 10 euros."
	libelle+="<br><span style=font-style:italic;font-weight:bold;>DOM/TOM - </span> Type d'envoi: Colissimo expert Délais d'acheminement: variables  Coût TTC: 14,50 euros pour toute commande de moins de 50 euros Frais de port gratuits pour toute commande à partir de 50 euros."
	libelle+="<br><span style=font-style:italic;font-weight:bold;>Reste du monde - </span> EP Services ne prend pas les commandes extérieures à la France métropolitaine et aux DOM-TOM. "
	libelle+="</div>"
	
	var resultat=file('php/majPanier.php?z='+zone)
	document.getElementById('panierCentral').innerHTML=libelle
}

function vaPaiement() {
		if (document.getElementById('cgv_ok').checked!==true) {
			alert('Pour accéder au paiement il vous faut accepter les CGV')
			return
		}
		else {
			var resultat=file('php/ecritSessionPaiement.php?z='+montant_livre+'|'+montant_port+'|'+montant_total+'|')
			location.replace('paiement.php')
		}
		
	
}

function allumeNote(valeur) {
	if (!document.getElementById('note_1')) {
		return
	}
	if (valeur==0 ) {
		document.getElementById('note_1').style.backgroundColor	='white'
		document.getElementById('note_2').style.backgroundColor	='white'		
	}
	else {

		document.getElementById('note_'+valeur).style.backgroundColor	='#AAAAAA'
	}
}


function initLivraison() {
	document.title=titreDocument+' - Lieu de livraison'
	var resultat=file('php/chercheInfoLivraison.php')
	var u=resultat.split('|||')
	//alert(u)

	if (u[1]=='') {
		alert('Veuillez vous reconnectez')
		location.replace('panier.php')
	}
	else {
		var libelle=''
		libelle+="<div class=lignePanier style='color:red;width:100%;text-align:center;font-size:16px;font-weight:bold;height:16px;'>Vérifiez votre adresse de livraison et corrigez s'il y a lieu</div>"
		libelle+="<div class=ligne style=margin-top:25px;>"
		libelle+="<div class=libelle >Nom</div>"
		libelle+="<div class=donnee><input type=text id=nom value=\""+u[1]+"\"></div>"
		libelle+="</div>"
		libelle+="<div class=ligne style=margin-top:5px;>"
		libelle+="<div class=libelle >Prénom</div>"
		libelle+="<div class=donnee><input type=text id=prenom value=\""+u[2]+"\"></div>"
		libelle+="</div>"
		libelle+="<div class=ligne style=margin-top:5px;>"
		libelle+="<div class=libelle >Adresse</div>"
		libelle+="<div class=donnee><input type=text id=adresse1 value=\""+u[3]+"\"></div>"
		libelle+="</div>"
		libelle+="<div class=ligne style=margin-top:5px;>"
		libelle+="<div class=libelle >Rés Bat App</div>"
		libelle+="<div class=donnee><input type=text id=adresse2 value=\""+u[4]+"\"></div>"
		libelle+="</div>"
		libelle+="<div class=ligne style=margin-top:5px;>"
		libelle+="<div class=libelle ></div>"
		libelle+="<div class=donnee><input type=text id=adresse3 value=\""+u[5]+"\"></div>"
		libelle+="</div>"
		libelle+="<div class=ligne style=margin-top:5px;>"
		libelle+="<div class=libelle >Code postal</div>"
		libelle+="<div class=donnee><input type=text id=cp value=\""+u[6]+"\"></div>"
		libelle+="</div>"
		libelle+="<div class=ligne style=margin-top:5px;>"
		libelle+="<div class=libelle >Ville</div>"
		libelle+="<div class=donnee><input type=text id=ville value=\""+u[7]+"\"></div>"
		libelle+="</div>"
		libelle+="<div class=ligne style=margin-top:5px;>"
		libelle+="<div class=libelle >Consignes pour le livreur</div>"
		libelle+="<div class=donnee style=margin-top:15px;><input style=width:800px; type=text id=info value=\""+u[8]+"\"></div>"
		libelle+="</div>"
		libelle+="<div class=ligne style=text-align:center;margin-top:25px;><input type=button value='Annuler' style=background:red;color:white; onclick=location.replace(\"panier.php\")> <input type=button value='Valider' style=background:green;color:white; onclick=enregistreAdresseLivraison()></div>"
		libelle+=u[9];
		document.getElementById('panierCentral').innerHTML=libelle
	}
}

function enregistreAdresseLivraison() {
	var zone=''
	zone+=document.getElementById('nom').value+'|||'
	zone+=document.getElementById('prenom').value+'|||'
	zone+=document.getElementById('adresse1').value+'|||'
	zone+=document.getElementById('adresse2').value+'|||'
	zone+=document.getElementById('adresse3').value+'|||'
	zone+=document.getElementById('cp').value+'|||'
	zone+=document.getElementById('ville').value+'|||'
	zone+=document.getElementById('info').value+'|||'
	var resultat=file('php/modifAdresseLivraison.php?z='+zone)
	var u=resultat.split('|')
	if (u[1]=='M' ) {
		if (parseInt(document.getElementById('cp').value.substring(0,2)) <96 ) {
			zone_livraison='1'	
		}
		else {
			zone_livraison='0'	
		}
		location.replace('panier.php')
	}
}

function initPaiement() {
	document.title=titreDocument+' - Choix du paiement'
	var libelle=''
	libelle+="<div class=lignePanier style='color:red;width:500px;text-align:center;font-size:16px;font-weight:bold;height:16px;'>Choisissez votre mode de paiement</div>"
	libelle+="<div class=ligne style=margin-top:5px;width:500px;>"
	libelle+="<div class=libelle style=width:250px;>Chèque</div>"
	libelle+="<div class=donnee style=width:50px;><input type=radio name=paie id=cheque style=width:50px;></div>"
	libelle+="</div>"
	libelle+="<div class=ligne style=margin-top:5px;width:500px;>"
	libelle+="<div class=libelle style=width:250px;>Carte bancaire</div>"
	libelle+="<div class=donnee style=width:50px;><input type=radio name=paie id=cb checked style=width:50px;></div>"
	libelle+="</div>"
	libelle+="<div class=ligne style=text-align:center;margin-top:25px;width:500px;><input type=button value='Annuler' style=background:red;color:white; onclick=location.replace('index.php')> <input type=button value='Payer' style=background:green;color:white; onclick=enregistreFacture()></div>"
	document.getElementById('colonne_centre').innerHTML=libelle
	
}

function initAffiliation() {
	var u=file('php/chercheCodeAffiliation.php').split('|')

	var affilie=u[1]
	document.title=titreDocument+' - Affiliation'
	var libelle=''
	if (u[0]=='O') {
		libelle+="<div class=ligne style=margin-top:5px;width:500px;>"
		libelle+="<div class=libelle style=width:250px;>Code affilié</div>"
		libelle+="<div class=donnee style=width:50px;>"+affilie+"</div>"
		libelle+="</div>"
	}
	else {
		libelle+="<div class=ligne style=margin-top:5px;width:500px;color:red;>"
		libelle+="Vous n'avez pas de compte affilié"
		libelle+="</div>"
	}
		libelle+="<div class=ligne style='font-family:times new roman, times, serif;font-weight:bold;margin-top:50px;width:600px;text-align:left;height:350px;'>"
		libelle+="L'affiliation en 5 points :"
		libelle+="<ol> <li>En devenant affili&eacute;, vous devenez partenaire de la boutique Créapassions.com et vous obtenez une r&eacute;mun&eacute;ration.</li><br>"
		libelle+="<li>Vous recommandez la boutique dans votre blog ou votre site et &agrave; chaque fois qu'un achat est r&eacute;alis&eacute; sur votre recommandation, vous accumulez des bons d'achat. Vous pouvez aussi recommander un achat dans notre boutique sur votre r&eacute;seau social ou dans vos courriels et en retirer les m&ecirc;mes b&eacute;n&eacute;fices.</li><br>"
		libelle+="<li>Un euro command&eacute; = 10 centimes de bon d'achat, soit une commission de 10% du montant des achats r&eacute;alis&eacute;s par vos pr&eacute;conisations. Les bons d'achat peuvent &ecirc;tre convertis en ouvrages de la boutique Creapassions.com. Votre espace priv&eacute; dans le site de la boutique vous permet de suivre le d&eacute;compte de vos bons d'achat.</li><br>"
		libelle+="<li>Pour recommander la boutique, vous devez disposer d'un compte, mais pas obligatoirement avoir pass&eacute; une commande.</li><br>"
		libelle+="<li>Il vous suffit de suivre les &eacute;tapes suivantes, d&rsquo;accepter en ligne les termes du contrat et vous devenez imm&eacute;diatement affili&eacute;.</li></ol>"
		libelle+="</div>"		

		libelle+="<div class=ligne style=text-align:center;margin-top:25px;width:500px;>"
		libelle+="<input type=button value='Retour boutique' style=background:red;color:white; onclick=location.replace('index.php')> "
		
		if (u[0]=='O') {
			libelle+="<input type=button value=\"les liens\" onclick=afficheLien() style=background:blue;color:white;> "
			libelle+="<input type=button value=\"Décompte\" onclick=afficheDecompte() style=background:green;color:white;>"
		}
		else {
			libelle+="<input type=button value=\"Je veux créer un compte d'affilié\" onclick=creeAffilie() style=background:blue;color:white;>"
		}
		libelle+="</div>"
	

	document.getElementById('colonne_centre').innerHTML=libelle
	
}

function creeAffilie() {
	var libelle=""
	libelle+="<div class=ligne style='font-family:times new roman, times, serif;font-weight:bold;text-align:center;margin-top:25px;width:500px;text-align:left;height:50px;'>"
	libelle+="Voici votre contrat personnalisé d'affilié, en l'acceptant vous serez  affilié. Nous vous communiquerons ensuite les liens à insérer pour  activer vos rétrocessions sur les achats effectués."
		libelle+="</div>"		
			libelle+="<div class=ligne style=text-align:center;margin-top:25px;width:500px;text-align:CENTER;height:50px;>"
	libelle+="<a href='contrat_affiliation/contrat_2.pdf' target='_blank'><img src='icon/dl-iconePDF.gif'></a>"
	libelle+="</div>"		
	libelle+="<div class=ligne style='font-family:times new roman, times, serif;font-weight:bold;text-align:left;margin-top:25px;width:500px;margin-top:50px;'>"
	libelle+="J'accepte les conditions <input type=checkbox id=ok_affiliation> "
	libelle+="</div>"		
	libelle+="<div class=ligne style=text-align:left;margin-top:25px;width:500px;margin-top:50px;>"
	libelle+="<input type=button value='Retour boutique' style=background:red;color:white; onclick=location.replace('index.php')> "
	libelle+="<input type=button value=\"Créer mon compte\" style=background:blue;color:white; onclick=accepteAffilie()> "

	libelle+="</div>"		
	document.getElementById('colonne_centre').innerHTML=libelle
}


function accepteAffilie() {
	if (document.getElementById('ok_affiliation').checked===true) {
		var u=file('php/creeCodeAffiliation.php').split('|')
		var affilie=u[0]
		var nouveau=u[1]
		var libelle=''
		libelle+="<div class=ligne style='font-family:times new roman, times, serif;text-align:center;margin-top:25px;width:500px;text-align:left>"
		if (nouveau=='N') {
			libelle+="Bravo, vous êtes désormais affilié à la boutique Creapassions.com."
		}
		else if (nouveau=='A') {
			libelle+="Bravo, vous êtes déjà affilié à la boutique Creapassions.com."
		}
		libelle+="</div>"		
		libelle+="<div class=ligne style='font-family:times new roman, times, serif;font-weight:bold,text-align:left;margin-top:25px;width:600px;text-align:left;height:250px;'>"
		libelle+="<ul style= height:200px; >Vous pouvez utiliser deux types de liens :"
		libelle+="<li>Sur la boutique directement, sans pointer sur un ouvrage précis, voici le lien :<br> <span style=color:blue; >http://www.boutique-creapassions.com/index.php?aff="+affilie+"&</span></li><br>"
		libelle+="<li>sur un ouvrage spécifique : sélectionnez-le dans la liste, en cliquant sur la couverture vous obtenez le lien direct vers l'ouvrage, il vous suffit de le copier.</li><br>"
		libelle+="</ul>"		
		libelle+="</div>"	
		libelle+="<div class=ligne style=text-align:left;margin-top:25px;width:500px;margin-top:150px;>"
		libelle+="<input type=button value='Retour boutique' style=background:red;color:white; onclick=location.replace('index.php')> "
		libelle+="<input type=button value=\"les liens\" onclick=afficheLien() style=background:blue;color:white;>"
		libelle+="</div>"		
		document.getElementById('colonne_centre').innerHTML=libelle
	}
	else {
		alert("Vous N'avez pas accepté les conditions")
	}
}


function afficheLien() {
	var libelle=''
	libelle+="<div class=ligne style=text-align:left;margin-top:5px;width:500px;height:100px;margin-bottom:15px;cursor:default;>"
	libelle+="Sélectionner le lien dans la case à côté du titre et utilisez-le dans vos revois vers la boutique. Pour trouver plus rapidement un titre, utilisez le moteur de recherche de votre navigateur.<br>Vous pouver également obtenir la liste de tous les liens dans un fichier texte en cliquant <a href=\"fic_lien.php\"  target=\"_BLANK\" style=\"color:blue;font-size:14px;border-bottom:1px solid blue;width:40px;height:20px;\">ici</a><br>Chacun de ces liens est disponible dans la fiche livre"
	//libelle+="Sélectionner le lien dans la case à côté du titre et utilisez-le dans vos revois vers la boutique. Pour trouver plus rapidement un titre, utilisez le moteur de recherche de votre navigateur.<br>Vous pouver également obtenir la liste de tous les liens dans un fichier texte en cliquant <a>ici</a><br>Chacun de ces liens est disponible dans la fiche livre"
	libelle+="</div>"		
	libelle+="<div class=ligne style=text-align:center;margin-top:5px;width:500px;margin-bottoù:15px;>"
	libelle+="<input type=button value='Retour boutique' style=background:red;color:white; onclick=location.replace('index.php')> "
	libelle+="<input type=button value='Retour affiliation' style=background:blue;color:white; onclick=location.replace('affiliation.php')> "
	libelle+="</div>"		
	var u=file("../php/transfertListeLivreAffiliation.php")
	//alert(u)
	document.getElementById('colonne_centre').innerHTML=libelle+u+libelle
	
	
}

function afficheDecompte() {
	alert('Fonction bientot en service')
	return
	var u=file("../php/transfertListeVenteAffiliation.php")
	alert(u)
}

function afficheRudy() {
	alert("(ESAT : Etablissement et Service d’Aide par le Travail)\nUne solution logistique pour le colisage et la gestion de vos flux et stockages.\nTél : 04-79-32-28-75\nMail : direction@cat73.com")
}


function enregistreFacture() {
	if (document.getElementById('cheque').checked===true) {
		var cible = 'cheque.php'
	}
	else {
		var cible = 'call_request.php'
	}
	window.location.href = cible
}

function accepteCgv() {
	if (document.getElementById('cgv_ok').checked===true ){
		cgv=1
	}
	else {
		cgv=0
	}
	file('php/modif_cgv.php?z='+cgv)
}



function initCheque() {
	document.title=titreDocument+' - Paiement par chèque'
	var libelle=''
	var libelle_bouton=''
		var libelle_suite=''
	libelle+="<div class=lignePanier style='font-family:Arial;color:red;width:900px;text-align:center;font-size:16px;font-weight:bold;height:16px;text-align:center;'>Vous avez choisi un paiement par chèque</div>"
	libelle+="<div class=ligne style=margin-top:15px;margin-left:25px;width:500px;>"
	libelle+="La règlement de <span id=totalCommande style=font-weight:bold;></span> euros est à envoyer à :"
	libelle+="</div>"
	libelle+="<div class=lignePanier style='width:500px;text-align:left;font-size:16px;margin-left:100px;height:20px;'>VITRAC & SON FRANCE</div>"
//	libelle+="<div class=lignePanier style='width:500px;text-align:left;font-size:16px;margin-left:100px;height:20px;'>Service diffusion</div>"
	libelle+="<div class=lignePanier style='width:500px;text-align:left;font-size:16px;margin-left:100px;height:20px;'>BP 70048</div>"
	libelle+="<div class=lignePanier style='width:500px;text-align:left;font-size:16px;margin-left:100px;height:20px;'>33007 Bordeaux cedex</div>"

	libelle_bouton+="<div class=ligne style=margin-top:15px;margin-left:25px;width:700px;>"
	libelle_bouton+="<span style='font-family:Arial;border-bottom: 1px solid black;font-decoration:underline;'>Notez derrière le chèque</span> le numéro qui va s'afficher après la validation de la commande."
	libelle_bouton+="</div>"
	libelle_bouton+="<div class=ligne style=text-align:center;margin-top:25px;><a href=panier.php style=text-decoration:none;margin-right:25px;><input type=button value='Annuler' style=background:red;color:white; onclick=location.replace('index.php')></a> <input type=button value='Accepter la commande' style=background:green;color:white; onclick=valideFacture(2)></div>"
	libelle_bouton+="</div>"
	libelle_suite+="<div class=lignePanier style='font-family:Arial;color:blue;width:100%;text-align:center;font-size:16px;font-weight:bold;height:16px;'>"

	libelle_suite+="<div class=lignePanier style='font-family:Arial;color:blue;width:100%;text-align:center;font-size:16px;font-weight:bold;height:16px;'>"
	libelle_suite+="NB : La commande ne sera expédiée qu’après réception et traitement du chèque."
	libelle_suite+="</div>"
	document.getElementById('panierCentral').innerHTML=libelle+libelle_bouton+libelle_suite
	var resultat=file('php/chercheSessionMontantTotal.php')
	montant_total=resultat
	document.getElementById('totalCommande').innerHTML=montant_total
}


function initCB() {
	document.title=titreDocument+' - Paiement par carte bancaire'
	var resultat=file('php/chercheSessionMontantTotal.php')
	montant_total=resultat


	
	var libelle=''

		libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:22px;font-weight:bold;height:50px;text-align:center;'>"
		libelle+="Paiement S&eacute;curis&eacute; - La Banque Postale"
		libelle+="</div>"
		libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:16px;font-weight:bold;height:100px;text-align:left;'>"
		libelle+=message
		libelle+="</div>"
		libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:16px;font-weight:bold;height:25px;text-align:center;'>"
		libelle+="L’expédition s’effectuera :"
		libelle+="</div>"
		if (zone_livraison==1) {
			libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:14px;height:16px;text-align:left;margin-left:40px;'>"
			libelle+="Par les services de La Poste"
			libelle+="</div>"
			libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:14px;height:30px;text-align:left;margin-left:40px;'>"
			libelle+="Délais d'acheminement : généralement de 48h à 96h, garantis en 7 jours calendaires."
			libelle+="</div>"
			libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:16px;height:25px;text-align:center;font-weight:bold;'>"

			libelle+="Coût TTC : "+ montant_total
			libelle+="</div>"
			libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:14px;height:16px;text-align:left;margin-left:40px;'>"

			libelle+="3 euros pour toute commande de moins de 10 euros."
			libelle+="</div>"
			libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:14px;height:16px;text-align:left;margin-left:40px;'>"

			libelle+="<u><b>Frais de port gratuits</b></u> pour toute commande à partir de 10 euros"
			libelle+="</div>"


		}
		else if (zone_livraison==2) {
			libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:14px;height:16px;text-align:left;margin-left:40px;'>"
			libelle+="Par les services de La Poste"
			libelle+="</div>"
			libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:14px;height:30px;text-align:left;margin-left:40px;'>"
			libelle+="Délais d'acheminement : variable et non garanti, expédition le jour ouvré suivant la commande sauf réassort."
			libelle+="</div>"
			libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:16px;height:25px;text-align:center;font-weight:bold;'>"

			libelle+="Coût TTC : "
			libelle+="</div>"
			libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:14px;height:16px;text-align:left;margin-left:40px;'>"

			libelle+="14,50 euros pour toute commande de moins de 50 euros."
			libelle+="</div>"
			libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:14px;height:16px;text-align:left;margin-left:40px;'>"

			libelle+="<u><b>Frais de port gratuits</b></u> pour toute commande à partir de 50 euros"
			libelle+="</div>"



		}
		
		
		
		libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:16px;height:25px;text-align:center;margin-top:40px;'>"
		libelle+="<input type=button value='Revenir à la boutique' onclick=retourIndex()>"
		libelle+="</div>"
		
		
	


	document.getElementById('panierCentral').innerHTML=libelle
}









function valideFacture(valeur) {
	var libelle_bouton=''
	var libelle=''
	var resultat=file('php/valideFacture.php?z='+valeur+'|')
	document.getElementById('panierCentral').innerHTML=resultat
	var u=resultat.split('|')
	if (u[1]=='C' && u[2]>0) {
		libelle+="<div class=lignePanier style='color:red;width:700px;text-align:center;font-size:16px;font-weight:bold;height:16px;'>Vous avez choisi un paiement par chèque</div>"
		libelle+="<div class=ligne style=margin-top:15px;margin-left:25px;width:700px;>"
		libelle+="La règlement de <span id=totalCommande style=font-weight:bold;>"+montant_total+"</span> euros est à envoyer à :"
		libelle+="</div>"
	libelle+="<div class=lignePanier style='width:700px;text-align:left;font-size:16px;margin-left:100px;height:20px;'>VITRAC & SON FRANCE</div>"

	libelle+="<div class=lignePanier style='width:700px;text-align:left;font-size:16px;margin-left:100px;height:20px;'>BP 70048</div>"
	libelle+="<div class=lignePanier style='width:700px;text-align:left;font-size:16px;margin-left:100px;height:20px;'>33007 Bordeaux cedex</div>"
		libelle_bouton+="<div class=ligne style=margin-top:15px;margin-left:25px;width:700px;>"
		libelle_bouton+="Notez derrière le chèque : <span style=font-weight:bold;color:red;font-size:16px;background:#EAEAEA;>Commande n°"+u[2]+"</span>"
		libelle_bouton+="</div>"
	}
	else {
		libelle+='il y a eu un probleme'

	}
	var libelle_fin=''
	libelle_fin+="<div class=lignePanier style='color:red;width:700px;text-align:center;font-size:16px;height:25px;margin-top:30px'>"
	libelle_fin+="<input type=button value='Retourner à la boutique en ligne' onclick=retourIndex()>"
	libelle_fin+="</div>"
	
	document.getElementById('panierCentral').innerHTML=libelle+libelle_bouton+libelle_fin
	

}

function retourIndex() {
	location.replace('index.php')	
	
}

function accueilIdentificationOld() {
	var libelle=''
	libelle+="<div class=lignePanier style=height:50px;width:100%;margin-top:25px;>"
	libelle+="Vous avez 3 possibilités :"

	libelle+="</div>"

	libelle+="<div class=lignePanier style=height:50px;width:100%;>"
	libelle+="1) Vous n’avez jamais passé commande, vous devez "
//	libelle+='<a href=creationCompte.php style=text-decoration:none><input  type=button value="Vous enregistrer"></a>'
	libelle+='<input  type=button value="Vous enregistrer" onclick=location.replace("creationCompte.php")>'
	libelle+="</div>"

	libelle+="<div class=lignePanier style=width:100%;height:70px;>"
	libelle+="2) Vous avez déjà passé commande sur notre site et avez conservé votre identifiant et votre mot de passe, <br>vous pouvez <input type=button value=\"Accéder à votre compte\" onclick=allumeEcranLogin()>"
	libelle+="</div>"
	libelle+="</div>"
	libelle+="<div class=lignePanier style=width:100%>"
	libelle+="3) <input type=button value='Retourner à la boutique' onclick=location.replace('index.php')>"


	libelle+="</div>"
	
	
	libelle+="<div class=lignePanier id=ecranLogin style=margin-top:50px;visibility:hidden>"
	libelle+="<div class=lignePanier style=width:100%;><div class=libelle style=width:250px;color:black;font-weight:none;>Identifiant</div><div class=donnee style=width:350px;><input type=text size=15 id=identifiant></div></div>"
	libelle+="<div class=lignePanier style=width:100%;><div class=libelle style=width:250px;;color:black;font-weight:none;>Mot de passe</div><div class=donnee style=width:350px;><input type=text size=15 id=mot_de_passe></div></div>"	
	libelle+="<div class=lignePanier style=text-align:center;><input type=button value='Valider'onclick=valideIdentification() ></div>"
	libelle+="</div>"
	/*	libelle+='<a href=index.php style=text-decoration:none><input  type=button value="Revenir a la boutique"</a>'
	libelle+="<input type=button value='Retour au panier' onclick=initPanier()>"
	libelle+="<div class=lignePanier>Vous avez déjà un compte</div>"
	libelle+="<div class=lignePanier>Identifiant  <input type=text size=15 id=identifiant></div>"
	libelle+="<div class=lignePanier>Mot de passe <input type=text size=15 id=mot_de_passe></div>"
	libelle+="<div class=lignePanier><input type=button value='Validez'onclick=valideIdentification() ></div>"
	libelle+='<a href=recupPwd.php target=_BLANK>Mot de passe oublié ?</a>'
	libelle+="<div class=lignePanier>Vous etes nouveau client</div>"
	libelle+="<div class=lignePanier>"
	libelle+='<a href=creationCompte.php style=text-decoration:none><input  type=button value="Créer mon compte"></a>'
	libelle+="</div>"
*/
	document.getElementById('panierCentral').innerHTML=libelle
}


function accueilIdentification() {
	var libelle=''
	libelle+="<div class=lignePanier style='height:auto;width:95%;margin-top:15px;border:2px solid black;background:lightblue;margin-left:2%;'>"
	libelle+="Si vous êtes déjà utilisateur d'<b>EPlibrairie</b> en ligne, saisissez vos coordonnées pour poursuivre la commande. Si vous n’êtes pas enregistré, saisissez les informations demandées afin de créer un compte <b>EPlibrairie</b> en ligne."
	libelle+="</div>"
	
	libelle+="<div class=lignePanier style='height:20px;width:47%;margin-left:2%;margin-top:25px;text-align:center;font-family:Times;font-weight:bold;font-size:20px;'>"
	libelle+="Si vous êtes déjà enregistré"	
	libelle+="</div>"	
	libelle+="<div class=lignePanier style='height:20px;width:47%;margin-left:2%;margin-top:25px;text-align:center;font-family:Times;font-weight:bold;font-size:20px;'>"
	libelle+="Si vous n'êtes pas enregistré"	
	libelle+="</div>"	
	
	libelle+="<div class=lignePanier style='height:200px;width:47%;background:#E0EEEE;margin-left:2%;margin-top:25px;'>"

	libelle+="<div class=lignePanier style='height:20px;width:85%;;margin-left:5%;margin-top:5px;'>"
	libelle+="Votre login ou votre adresse email"	
	libelle+="</div>"		
	libelle+="<div class=lignePanier style='height:20px;width:85%;;margin-left:5%;margin-top:5px;'>"
	libelle+="<input type=text style=width:83%; id=identifiant>"	
	libelle+="</div>"		
	libelle+="<div class=lignePanier style='height:20px;width:85%;;margin-left:5%;margin-top:15px;'>"
	libelle+="Votre mot de passe"	
	libelle+="</div>"		
	libelle+="<div class=lignePanier style='height:20px;width:85%;;margin-left:5%;margin-top:5px;'>"
	libelle+="<input type=text style=width:83%; id=mot_de_passe>"	
	libelle+="</div>"		
	libelle+="<div class=lignePanier style='height:20px;width:85%;margin-top:25px;text-align:center'>"
	libelle+="<input type=button value='Continuer' style='width:100px;;cursor:pointer' onclick=valideIdentification() >"	
	libelle+="</div>"		
	libelle+="<div class=lignePanier style='height:20px;width:85%;;margin-left:5%;margin-top:15px;'>"
	
	libelle+="<span style='font-family:Arial;color:blue;font-size:12px;border-bottom:1px blue solid;cursor:pointer' onclick=retrouveIdentifiant()>Vous avez oublié vos identifiants</span>"	
	libelle+="</div>"		
	
	
	
	libelle+="</div>"	


	libelle+="<div class=lignePanier style='height:200px;width:47%;background:#E0EEEE;margin-left:2%;margin-top:25px;'>"
	libelle+="<div class=lignePanier style='height:auto;width:85%;;margin-left:5%;margin-top:5px;'>"
	libelle+="Cliquer sur &#171;M'inscrire&#187; pour poursuivre votre inscription"	
	libelle+="</div>"		
	libelle+="<div class=lignePanier style='height:20px;width:85%;margin-top:40px;text-align:center'>"
	libelle+="<input type=button value=\"M'inscrire\" style='width:100px;;cursor:pointer' onclick=onclick=location.replace(\"creationCompte.php\") >"	
	libelle+="</div>"		
	
	libelle+="</div>"	
	
	libelle+="<div class=lignePanier style='height:auto;width:95%;margin-top:35px;margin-left:2%;text-align:center;'>"
	libelle+="<input type=button value=\" Retourner à la boutique\" onclick=location.replace(\"index.php\")>"
	libelle+="</div>"
	

	document.getElementById('panierCentral').innerHTML=libelle
}




function initMonCompte(valeur) {
	var libelle=''
	libelle+="<div class=lignePanier style='height:auto;width:95%;margin-top:15px;border:2px solid black;background:lightblue;margin-left:2%;'>"
	libelle+="Si vous êtes déjà utilisateur d'<b>EPlibrairie</b> en ligne, saisissez vos coordonnées pour poursuivre la commande. Si vous n’êtes pas enregistré, saisissez les informations demandées afin de créer un compte <b>EPlibrairie</b> en ligne."
	libelle+="</div>"
	
	libelle+="<div class=lignePanier style='height:20px;width:47%;margin-left:2%;margin-top:25px;text-align:center;font-family:Times;font-weight:bold;font-size:20px;'>"
	libelle+="Si vous êtes déjà enregistré"	
	libelle+="</div>"	
	libelle+="<div class=lignePanier style='height:20px;width:47%;margin-left:2%;margin-top:25px;text-align:center;font-family:Times;font-weight:bold;font-size:20px;'>"
	libelle+="Si vous n'êtes pas enregistré"	
	libelle+="</div>"	
	
	libelle+="<div class=lignePanier style='height:200px;width:47%;background:#E0EEEE;margin-left:2%;margin-top:25px;'>"

	libelle+="<div class=lignePanier style='height:20px;width:85%;;margin-left:5%;margin-top:5px;'>"
	libelle+="Votre login ou votre adresse email"	
	libelle+="</div>"		
	libelle+="<div class=lignePanier style='height:20px;width:85%;;margin-left:5%;margin-top:5px;'>"
	libelle+="<input type=text style=width:83%; id=identifiant>"	
	libelle+="</div>"		
	libelle+="<div class=lignePanier style='height:20px;width:85%;;margin-left:5%;margin-top:15px;'>"
	libelle+="Votre mot de passe"	
	libelle+="</div>"		
	libelle+="<div class=lignePanier style='height:20px;width:85%;;margin-left:5%;margin-top:5px;'>"
	libelle+="<input type=text style=width:83%; id=mot_de_passe>"	
	libelle+="</div>"		
	libelle+="<div class=lignePanier style='height:20px;width:85%;margin-top:25px;text-align:center'>"
	libelle+="<input type=button value='Continuer' style='width:100px;;cursor:pointer' onclick=valideIdentificationCompte() >"	
	libelle+="</div>"		
	libelle+="<div class=lignePanier style='height:20px;width:85%;;margin-left:5%;margin-top:15px;'>"
	
	libelle+="<span style='font-family:Arial;color:blue;font-size:12px;border-bottom:1px blue solid;cursor:pointer' onclick=retrouveIdentifiant()>Vous avez oublié vos identifiants</span>"	
	libelle+="</div>"		
	
	
	
	libelle+="</div>"	


	libelle+="<div class=lignePanier style='height:200px;width:47%;background:#E0EEEE;margin-left:2%;margin-top:25px;'>"
	libelle+="<div class=lignePanier style='height:auto;width:85%;;margin-left:5%;margin-top:5px;'>"
	libelle+="Cliquer sur &#171;M'inscrire&#187; pour poursuivre votre inscription"	
	libelle+="</div>"		
	libelle+="<div class=lignePanier style='height:20px;width:85%;margin-top:40px;text-align:center'>"
	libelle+="<input type=button value=\"M'inscrire\" style='width:100px;;cursor:pointer' onclick=onclick=location.replace(\"creationCompte.php\") >"	
	libelle+="</div>"		
	
	libelle+="</div>"	
	
	libelle+="<div class=lignePanier style='cursor:pointer;height:auto;width:95%;margin-top:35px;margin-left:2%;text-align:center;'>"
	libelle+="<input type=button value=\" Retourner à la boutique\" onclick=location.replace(\"index.php\")>"
	libelle+="</div>"
	

	document.getElementById('panierCentral').innerHTML=libelle
}







function retrouveIdentifiant() {
	if ( zone=prompt("Entrez votre mail et vous recevrez vos identifiants dans quelques instants.",'') ){
			var u=file( 'php/envoiPwd.php?z=' + zone+'|').split('|')
			if (u[1]!='X' ) {
				alert("Vos identifiants viennent de vous être envoyés")	
			}
			else {
				alert("Votre email est inconnu ")	
			}
			
	}
	
	
}


function allumeEcranLogin() {
	document.getElementById('ecranLogin').style.visibility='visible'
	document.getElementById('identifiant').focus()
}

function valideIdentification() {

	var zone=document.getElementById('identifiant').value+'|^|'+document.getElementById('mot_de_passe').value+'|^|'

	var u=file('php/verifLogin.php?z='+escape(zone)).split('|');

	if (u[0]=='A') {
		location.replace(u[1])
	}
	else {
		client=u[0]
		mailAParaitre=u[1]
		if (client>0) {
			location.replace('livraison.php')
		}
		else {
			alert('Mauvais login')
		}
	}
}

function valideIdentificationCompte(valeur) {
	var zone=document.getElementById('identifiant').value+'|^|'+document.getElementById('mot_de_passe').value+'|^|'
	var u=file('php/verifLogin.php?z='+escape(zone)).split('|');
	client=u[0]
	mailAParaitre=u[1]
	if (client>0 && retour_aff && retour_aff==1) {
		location.replace('affiliation.php')
	}
	else if (client>0 ) {
		afficheCompte(client)
	}
	
	else {
		alert('Mauvais login')
	}
}

function afficheCompte(id_client) {
	var u=file('php/chercheInfoLivraison.php').split('|||')
	libelle=u[9]+u[10];
	libelle+="<div class=ligne style=text-align:center;margin-top:25px;><input type=button value='Retour boutique' style=background:lightblue;color:back; onclick=location.replace(\"index.php\")></div>"
	
	
	document.getElementById('panierCentral').innerHTML=libelle

	
}

function accueilLivraison() {
	var libelle=''
	libelle+='<a href=index.php style=text-decoration:none><input  type=button value="Revenir a la boutique"</a>'
	libelle+="<input type=button value='Retour au panier' onclick=initPanier()>"
	document.getElementById('panierCentral').innerHTML=libelle
}



function recalculPrixUnitaire(valeur) {
	var quantite=document.getElementById('q_'+valeur).value
	var kx=trouveIndex(tab_panier,valeur,0)
	if (kx!==false) {
		tab_panier.splice(kx,1,Array(valeur,tab_panier[kx][1],quantite))
	}
	var resultat=file('php/maj2Panier.php?z='+valeur+'|'+quantite)
	initPanier()
}


function effaceLignePanier(valeur) {
	var kx=trouveIndex(tab_panier,valeur,0)
	if (kx!==false) {
		var titre=decrea(tab_panier[kx][1])
		if (confirm('Etes vous de supprimer de '+titre+' de votre panier ?') ) {
			tab_panier.splice(kx,1)
			affichePanierGauche()
		}
	}
}

function effaceLignePanierGeneral(valeur) {
	var kx=trouveIndex(tab_panier,valeur,0)
	if (kx!==false) {
		var titre=decrea(tab_panier[kx][1])
		if (confirm('Etes vous de supprimer de '+titre+' de votre panier ?') ) {
			tab_panier.splice(kx,1)
			initPanier()
		}
	}
}

function verifAppartenance(champ,valeur,rangee){
	var u=valeur.split('|')
	var n=u.length	
	for (var i=0;i<n;i++) {
		if (champ!=39) {
			if (tab_livre_tout[rangee][champ]==u[i]) {
				return 1
			}
			else {
				return 0
			}
		}
		else {
			if (tab_livre_tout[rangee][champ].indexOf(u[i])>-1) {
				return 1
			}
			else {
				return 0
			}
		}
		
	}
	return 0
}

function deleteRecherche() {
	if (document.getElementById('texteRecherche').value=='Recherche') {
		document.getElementById('texteRecherche').value=''
	}
}

function declencheRecherche() {
	tab_recherche.length=0
	if (document.getElementById('texteRecherche').value!='') {
		texte=document.getElementById('texteRecherche').value
		var u=file('php/fonctionRecherche.php?z='+decrea(texte)+'|').split('|')
		var n=u.length - 1
		for (var i=0;i<n;i++) {
			tab_recherche[tab_recherche.length]=Array(u[i] ,'')
		}
	}
	init('R','')
}

function initRecupPwd() {
	document.title="Recupération de mot de passe"
	var libelle_bas=''
	libelle_bas +="<div class=ligne style=width:700px;text-align:center;margin-top:30px;margin-left:200px;> "
	libelle_bas +="<div class=libelle >Email</div>"
	libelle_bas +="<div class=donnee style=width:400px;><input type=text id=email size=90 style=width:400px;></div>"
	libelle_bas +="</div>"
	libelle_bas +="<div class=ligne style=width:500px;text-align:center;margin-top:30px;margin-left:200px;>"

	libelle_bas +="<input type=button value='Validez' style=background:green;color:white; onclick=recupPwd()>"
	libelle_bas +="</div>"
	document.getElementById('panierCentral').innerHTML=libelle_bas
	document.getElementById('email').focus()
}

function recupPwd() {
	var zone=document.getElementById('email').value  + '|'
	var resultat=file( 'php/envoiPwd.php?z=' + zone)
	var u=resultat.split('|')
	if (u[1]=='X') {
		alert("Erreur d'email")
	}
	else {
		var libelle="<div class=ligne style=width:700px;text-align:center;margin-top:30px;margin-left:100px;font-size:16px;font-weight:bold;> " 
		libelle+="Vous recevrez vos identifiants dans quelques secondes"
		libelle+="</div>"
		document.getElementById('panierCentral').innerHTML=libelle
	}


}

function initCreationCompte() {
	
	document.title=titreDocument+" - Création d'un compte"
	var libelle_bas=''
	libelle_bas +="<div class=ligne style=color:black;text-align:center;margin-bottom:25px;>"
	libelle_bas +="Les champs marqués d'une etoile rouge (<span style=font-family:Arial;color:red;>*</span>) sont obligatoires"
	libelle_bas +="</div>"
	libelle_bas +="<div class=ligne>"
	libelle_bas +="<div class=libelle >Nom</div>"
	libelle_bas +="<div class=donnee style=width:370px;><input type=text id=nom size=25 >"+etoileRouge+"</div>"
	libelle_bas +="<div class=libelle style=width:60px;>Prénom</div>"
	libelle_bas +="<div class=donnee style=width:300px;><input type=text id=prenom size=25></div>"
	libelle_bas +="</div>"



	libelle_bas +="<div class=ligne>"
	libelle_bas +="<div class=libelle>Société</div>"
	libelle_bas +="<div class=donnee><input type=text id=societe size=60></div>"
	libelle_bas +="</div>"


	libelle_bas +="<div class=ligne>"
	libelle_bas +="<div class=libelle>Email</div>"
	libelle_bas +="<div class=donnee style=width:600px;><input type=text id=email size=60 >"+etoileRouge+"</div>"
	libelle_bas +="</div>"
	
	libelle_bas +="<div class=ligne>"
	libelle_bas +="<div class=libelle>Téléphone</div>"
	libelle_bas +="<div class=donnee><input type=text id=telephone size=25 > </div>"
	libelle_bas +="</div>"
	libelle_bas +="<div style=width:50%;position:relative;float:left;>"
	libelle_bas +="<div class=ligne style=text-align:center;font-weight:bold;>Adresse de facturation</div>"
	libelle_bas +="<div class=ligne style=font-size:12px;font-weight:normal;text-align:center;margin-top:-10px;>(La facture sera envoy&eacute;e par mail apr&egrave;s acceptation du paiement en ligne)</div>"
	libelle_bas +="<div class=ligne >"
	libelle_bas +="<div class=libelle>Adresse</div>"

	libelle_bas +="<div class=donnee style=width:370px;><input type=text id=adresse1 size=25>"+etoileRouge+"</div>"
	libelle_bas +="</div>"

	libelle_bas +="<div class=ligne>"
	libelle_bas +="<div class=libelle>Rés Bat App</div>"
	libelle_bas +="<div class=donnee style=width:300px;><input type=text id=adresse2 size=25></div>"
	libelle_bas +="</div>"
	libelle_bas +="<div class=ligne>"
	libelle_bas +="<div class=libelle></div>"
	libelle_bas +="<div class=donnee style=width:300px;><input type=text id=adresse3 size=25></div>"
	libelle_bas +="</div>"



	libelle_bas +="<div class=ligne>"
	libelle_bas +="<div class=libelle>Code postal</div>"
	libelle_bas +="<div class=donnee style=width:310px;><input type=text id=cp size=4 style=width:100px;>"+etoileRouge+"</div>"
	libelle_bas +="</div>"

	libelle_bas +="<div class=ligne>"
	libelle_bas +="<div class=libelle>Ville</div>"
	libelle_bas +="<div class=donnee style=width:370px;><input type=text id=ville size=10 >"+etoileRouge+"</div>"
	libelle_bas +="</div>"
	libelle_bas +="<div class=ligne>"
	libelle_bas +="<div class=libelle>Pays</div>"
	libelle_bas +="<div class=donnee style=width:340px;><select id=pays size=1 ><option value=0>Votre choix</option><option value=1>France métropolitaine (département 1 à 95) </option><option value=2>Dom Tom (déparement 97)</option></select>"+etoileRouge+"<span style=color:blue;font-family:Arial;font-size:12px;> 1 </span></div>"
	libelle_bas +="</div>"



	libelle_bas +="</div>"
	libelle_bas +="<div style=width:50%;position:relative;float:left;>"
	libelle_bas +="<div class=ligne style=text-align:center;font-weight:bold;>Adresse de livraison</div>"
	libelle_bas +="<div class=ligne style=font-size:12px;text-align:center;margin-top:-10px;>(Si diff&eacute;rente de l'adresse de facturation)</div>"
	libelle_bas +="<div class=ligne >"
	libelle_bas +="<div class=libelle>Adresse</div>"
	libelle_bas +="<div class=donnee style=width:300px;><input type=text id=adresse1_livraison size=25></div>"
	libelle_bas +="</div>"

	libelle_bas +="<div class=ligne>"
	libelle_bas +="<div class=libelle>Rés Bat App</div>"
	libelle_bas +="<div class=donnee style=width:300px;><input type=text id=adresse2_livraison size=25></div>"
	libelle_bas +="</div>"
	libelle_bas +="<div class=ligne>"
	libelle_bas +="<div class=libelle></div>"
	libelle_bas +="<div class=donnee style=width:300px;><input type=text id=adresse3_livraison size=25></div>"
	libelle_bas +="</div>"

	libelle_bas +="<div class=ligne>"
	libelle_bas +="<div class=libelle>Code postal</div>"
	libelle_bas +="<div class=donnee style=width:300px;><input type=text id=cp_livraison size=4 onChange=recalculFraisPort()> </div>"
	libelle_bas +="</div>"

	libelle_bas +="<div class=ligne>"
	libelle_bas +="<div class=libelle>Ville</div>"
	libelle_bas +="<div class=donnee style=width:300px;><input type=text id=ville_livraison size=22></div>"
	libelle_bas +="</div>"

	libelle_bas +="<div class=ligne>"
	libelle_bas +="<div class=libelle>Pays</div>"
	libelle_bas +="<div class=donnee style=width:300px;><select id=pays_livraison size=1 onchange=recalculFraisPort() ><option value=0>Votre choix</option><option value=1>France métropolitaine</option><option value=2>Dom Tom</option></select></div>"
	libelle_bas +="</div>"
	libelle_bas +="</div>"
	libelle_bas +="<div class=ligne style=text-align:center;margin-top:15px;background:#dddddd;><div class=libelle style=width:250px;>Choisissez un identifiant</div><div class=donnee style=width:500px;><input type=text size=25 id=login></div></div>"
	libelle_bas +="<div class=ligne style=text-align:center;margin-top:0px;background:#dddddd;><div class=libelle style=width:250px;>Choisissez un mot de passe</div><div class=donnee style=width:500px;><input type=password size=25 id=pwd></div></div>"
	libelle_bas +="<div class=ligne style=text-align:center;margin-top:0px;background:#dddddd;><div class=libelle style=width:250px;>Vérification du mot de passe</div><div class=donnee style=width:500px;><input type=password size=25 id=pwd2></div></div>"
if (ip=='88.178.52.79') {
	libelle_bas +="<div class=ligne style=text-align:center;margin-top:5px;><div class=libelle style=width:250px;>Affiliation "+interrogation+"</div><div class=donnee style=width:100px;><input style=width:10px; type=checkbox  ></div></div>"
	
}
	libelle_bas +="<div class=ligne style=text-align:center;margin-top:15px;><input type=button value='Annuler' style=background:red;color:white; onclick=location.replace(\"panier.php\")><input type=button value='Valider' style=background:green;color:white; onclick=enregistreClient()></div>"
	libelle_bas +="<div class=ligne style=text-align:left;margin-top:15px;><span style=color:blue;font-family:Arial;font-size:12px;>(1)</span> Nous n’assurons les livraisons que dans tous les départements de France métropolitaine et dans les DOM-TOM. Pour les autres pays, veuillez consulter des librairies en ligne livrant localement.</div>"


	document.getElementById('panierCentral').innerHTML=libelle_bas
	document.getElementById('nom').focus()
}

function enregistreClient() {
	var erreur=''
	var libelle_info=''
	if (document.getElementById('pays').value==0) {
		erreur+="Choisir un pays \n"
	}
	if (document.getElementById('nom').value.length<3) {
		erreur+="Il manque le nom \n"
	}
	if (document.getElementById('adresse1').value.length<3) {
		erreur+="Il manque l'adresse \n"
	}

	if (!verifCp(document.getElementById('cp').value))  {
		erreur+="Il manque le code postal \n"
	}

	if (document.getElementById('ville').value.length<3) {
		erreur+="Il manque la ville \n"
	}
	if (document.getElementById('adresse1').value==0) {
		erreur+="Il manque une adresse valide\n"
	}
	if (!verifEmail(document.getElementById('email').value)) {
		erreur+="Il manque un email valide\n"
	}
	if (document.getElementById('pwd').value!=document.getElementById('pwd2').value || document.getElementById('pwd').value.length<5) {
		erreur+="Choisissez un mot de passe plus long (5 caractéres au minimum)\n et tapez le 2 fois identiquement pour vérification"
	}
	if (document.getElementById('login').value.length<5) {
		erreur+="Choisissez un login plus long (5 caractéres au minimum)\n"
	}


	if (erreur!='') {
		alert(erreur)
		return
	}
	var zone=''
	zone+=noaccent(document.getElementById('nom').value)+'|||'
	zone+=noaccent(document.getElementById('prenom').value)+'|||'
	zone+=noaccent(document.getElementById('societe').value)+'|||'
	zone+=document.getElementById('email').value+'|||'
	zone+=document.getElementById('telephone').value+'|||'
	zone+=noaccent(document.getElementById('adresse1').value)+'|||'
	zone+=noaccent(document.getElementById('adresse2').value)+'|||'
	zone+=noaccent(document.getElementById('adresse3').value)+'|||'
	zone+=document.getElementById('cp').value+'|||'
	zone+=noaccent(document.getElementById('ville').value)+'|||'
	zone+=noaccent(document.getElementById('pays').value)+'|||'
	if (document.getElementById('ville_livraison').value!='' && document.getElementById('cp').value!='') {
		zone+=noaccent(document.getElementById('adresse1_livraison').value)+'|||'
		zone+=noaccent(document.getElementById('adresse2_livraison').value)+'|||'
		zone+=noaccent(document.getElementById('adresse3_livraison').value)+'|||'
		zone+=document.getElementById('cp_livraison').value+'|||'
		zone+=noaccent(document.getElementById('ville_livraison').value)+'|||'
		zone+=noaccent(document.getElementById('pays_livraison').value)+'|||'
	}
	else {
		zone+=noaccent(document.getElementById('adresse1').value)+'|||'
		zone+=noaccent(document.getElementById('adresse2').value)+'|||'
		zone+=noaccent(document.getElementById('adresse3').value)+'|||'
		zone+=document.getElementById('cp').value+'|||'
		zone+=noaccent(document.getElementById('ville').value)+'|||'
		zone+=noaccent(document.getElementById('pays').value)+'|||'
	}
	zone+=document.getElementById('login').value+'|||'
	zone+=document.getElementById('pwd').value+'|||'

	var resultat=file("php/modif_client.php?z="+escape(zone))
	var u=resultat.split('|')
	if (u[1]=='X') {
		alert('Ce login est déjà utilisé')
		document.getElementById('login').value=''
		document.getElementById('login').focus()
	}
	else if (u[1]=='E') {
		if (confirm("Ce mail a déjà un compte\nVoulez vous recevoir les identifiants ?") ) {
			var zone=document.getElementById('email').value  + '|'
			var resultat=file( 'php/envoiPwd.php?z=' + zone)
			var u=resultat.split('|')
			if (u[1]=='X') {
				alert("Erreur d'email")
			}
			else {
				var libelle=''
				libelle+="<div class=ligne style=width:700px;text-align:center;margin-top:30px;margin-left:100px;font-size:16px;font-weight:bold;> " 
				libelle+="Vous recevrez vos identifiants dans quelques secondes"
				libelle+="</div>"
				libelle+="<div class=ligne style=width:700px;text-align:left;margin-top:30px;font-size:16px;font-weight:bold;> " 
				libelle+="<a href=panier.php style=text-decoration:none;><input type=button value='Revenir à ma commande'></a>"
				libelle+="</div>"

				document.getElementById('panierCentral').innerHTML=libelle
			}
		}

	}

		
	

	else if (u[1]=='C' && u[2]>0) {
	//	if (confirm("Voulez vous vous connecter avec vos nouveaux identifiants?") ) {
		if (1==1 ) {
			var zone=document.getElementById('login').value+'|^|'+document.getElementById('pwd').value
			var resultat=file('php/verifLogin.php?z='+escape(zone))
			client=resultat
			if ( retour_aff && retour_aff==1) {
				location.replace('affiliation.php')
			}
			else {
				location.replace('livraison.php')
			}
		}
	}
	else if (u[1]=='M' && u[2]==1) {
		alert('Votre fiche a été mofifié')
		location.replace('livraison.php')
		
	}
	
}

function initCallAutoResponse() {
	document.title=titreDocument
		var libelle=''
		libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:22px;font-weight:bold;height:70px;text-align:center;'>"
		libelle+="Paiement S&eacute;curis&eacute; - La Banque Postale"
		libelle+="</div>"
		libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:16px;font-weight:bold;height:25px;text-align:left;'>"
		libelle+="<div class=libelle style=width:300px;>"
		libelle+="Date de la transaction"
		libelle+="</div>"
		libelle+="<div class=donnee style=width:400px;>"
		libelle+=dateTransaction
		libelle+="</div>"
		libelle+="</div>"

		libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:16px;font-weight:bold;height:25px;text-align:left;'>"
		libelle+="<div class=libelle style=width:300px;>"
		libelle+="Identifiant commerçant"
		libelle+="</div>"
		libelle+="<div class=donnee style=width:400px;>"
		libelle+="035131491900033"
		libelle+="</div>"
		libelle+="</div>"

		libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:16px;font-weight:bold;height:25px;text-align:left;'>"
		libelle+="<div class=libelle style=width:300px;>"
		libelle+="R&eacute;f&eacute;rence de la transaction"
		libelle+="</div>"
		libelle+="<div class=donnee style=width:400px;>"
		libelle+=transactionId
		libelle+="</div>"
		libelle+="</div>"

		libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:16px;font-weight:bold;height:25px;text-align:left;'>"
		libelle+="<div class=libelle style=width:300px;>"
		libelle+="Montant de la transaction"
		libelle+="</div>"
		libelle+="<div class=donnee style=width:400px;>"
		libelle+=montantTransaction
		libelle+="</div>"
		libelle+="</div>"

		libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:16px;font-weight:bold;height:25px;text-align:left;'>"
		libelle+="<div class=libelle style=width:300px;>"
		libelle+="Numéro de carte "
		libelle+="</div>"
		libelle+="<div class=donnee style=width:400px;>"
		libelle+=numCarte
		libelle+="</div>"
		libelle+="</div>"

		libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:16px;font-weight:bold;height:25px;text-align:left;'>"
		libelle+="<div class=libelle style=width:300px;>"
		libelle+="Autorisation"
		libelle+="</div>"
		libelle+="<div class=donnee style=width:400px;>"
		libelle+=autorisationCarte
		libelle+="</div>"
		libelle+="</div>"

		libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:16px;font-weight:bold;height:25px;text-align:left;'>"
		libelle+="<div class=libelle style=width:300px;>"
		libelle+="Certificat de la transaction"
		libelle+="</div>"
		libelle+="<div class=donnee style=width:400px;>"
		libelle+=certificat
		libelle+="</div>"
		libelle+="</div>"

		libelle+="<div class=lignePanier style='font-family:Arial;color:black;width:900px;text-align:center;font-size:16px;font-weight:bold;height:25px;text-align:center;'>"
		libelle+="<input type=button value='Revenir à la boutique' onclick=retourIndex()>"
		libelle+="</div>"


		



/*
	print("<br>Identifiant commerçant <font color=blue>  035131491900033</font>");
  	print("<br>R&eacute;f&eacute;rence de la transaction  <font color=blue>$transaction_id</font>");
  	print("<br>Montant de la transaction <font color=blue>$montant €</font>");
  	print("<br>Num&eacute;ro de la carte <font color=blue>$numero_carte   06/09</font>");
  	print("<br>Autorisation <font color=blue>$authorisation_id</font>");
  	print("<br>Certificat de la transaction <font color=blue>$payment_certificate</font>");
	print("<br></h3>");
	print("<hr>");
	print("<hr>");
	print("<h4><center<input type=button value='Retour à la boutique en ligne.' onclick=location.replace('index.php')></center></h4> ");
*/
	
	document.getElementById('panierCentral').innerHTML=libelle
	
}

function verifCp(valeur) {
	var reg_rangement = /^[0-9]{5}$/
	if (reg_rangement.exec(valeur)==null) {
		return null
	}
	else {
		return true
	}
}
function verifEmail(valeur) {
	if(!valeur.match(new RegExp(/^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$/))) {
		return null
	}
	else {
		return true
	}
}

function verifTel(valeur) {
	valeur=valeur.replace(/\D/g,'')
	if (valeur.length==10) {
	document.getElementById('telephone').value=valeur
		return true
	}
	else {
		return false
	}
}









function file(fichier) {
     if(window.XMLHttpRequest) // FIREFOX
          xhr_object = new XMLHttpRequest();
     else if(window.ActiveXObject) // IE
          xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
     else
          return(false);
     xhr_object.open("GET", fichier, false);
     xhr_object.send(null);
     if(xhr_object.readyState == 4) return(xhr_object.responseText);
     else return(false);
}
function GetCookie(name) {
        if (document.cookie) { 
                  index = document.cookie.indexOf( name);
                  if ( index != -1) {
                           nDeb = (document.cookie.indexOf( "=", index) + 1);
                           nFin = document.cookie.indexOf( ";", index);
                           if (nFin == -1) {nFin = document.cookie.length;}
                           return unescape(document.cookie.substring(nDeb, nFin));
                  }
         }
         return null;
}

function trouveIndex(gros_array,id,champ) {
	var j=gros_array.length;
	for (var i = 0; i < j; i++) {
		if (gros_array[i][parseInt(champ)]==id) {
			return i;
		}
	}
	return false
}



function formater(nombre, taille) {
  if (isNaN(nombre)) return "";
  var chaine = nombre.toString();
  while (chaine.length < taille) chaine = "0" + chaine;
  return chaine;
}

function date2fr(valeur) {
	var u=valeur.split('-')
	return u[2]+'-'+u[1]+'-'+u[0]
}


function crea(nom) {
	var z=''

 	a =nom.split('\n')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'^retour^'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}

	nom=z
	z=''
	a =nom.split('\+')
	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'^plus^'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}

 	nom=z
	z=''
 	a =nom.split('\"')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'^guillemet^'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
 	nom=z
	z=''
 	a =nom.split('\'')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'^apostrophe^'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
	
	nom=z
	z=''
 	a =nom.split('\`')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'^apostrophe^'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}

	nom=z
	z=''
 	a =nom.split('\€')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'^euros^'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}

	return z




	


}

function decrea(nom) {
	var z=''
	a =nom.split('^plus^')
	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'\+'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
	nom=z
	z=''
 	a =nom.split('^apostrophe^')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+"\'"+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}

	nom=z
	z=''
 	a =nom.split('^eperluette^')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+"&"+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}


	nom=z
	z=''
 	a =nom.split('%u0153')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+"oe"+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}


 	nom=z
	z=''
 	a =nom.split('^guillemet^')
 	mbx=a.length

	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+"\""+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
 	nom=z
	z=''
 	a =nom.split('^euros^')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'€'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
 	nom=z
	z=''
 	a =nom.split('^...^')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'...'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}

 	nom=z
	z=''
 	a =nom.split('^retour^')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'\n'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
	return z
}

function tri(table,champ) {
	table_inter = new Array;
	table_inter_fin = new Array;
	n=table.length;
	m=table[0].length;

	for (i=0;i<n;i++) {
		table_inter2 = new Array;
		table_inter2.push(table[i][parseInt(champ)])
		for (j=0;j<m;j++) {
			table_inter2.push(table[i][j])

		}
		table_inter.push(table_inter2)
	}
	table_inter=table_inter.sort()

	n=table_inter.length;
	m=table_inter[0].length;

	for (i=0;i<n;i++) {
		table_inter2 = new Array;
		
		for (j=1;j<m;j++) {
			table_inter2.push(table_inter[i][j])

		}
		table_inter_fin.push(table_inter2)
	}
return table_inter_fin;	
}


function decrea2(nom) {
	var z=''
	a =nom.split('^plus^')
	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'\+'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
	nom=z
	z=''
 	a =nom.split('^apostrophe^')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+"\'"+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}

	nom=z
	z=''
 	a =nom.split('%u0153')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+"oe"+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}


 	nom=z
	z=''
 	a =nom.split('^guillemet^')
 	mbx=a.length

	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+"\""+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
 	nom=z
	z=''
 	a =nom.split('^euros^')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'€'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
 	nom=z
	z=''
 	a =nom.split('^...^')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'...'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
	nom=z
	z=''
 	a =nom.split('- ')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}


 	nom=z
	z=''
 	a =nom.split('^retour^')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			//z=z+'</li><li>'+a[imx]
			z=z+'<br>'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
	return z
}

function decreaHTML(nom) {
	var z=''
	a =nom.split('^plus^')
	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'\+'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
	nom=z
	z=''
 	a =nom.split('^apostrophe^')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+"\'"+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}



	nom=z
	z=''
 	a =nom.split('%u0153')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+"oe"+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}


 	nom=z
	z=''
 	a =nom.split('^guillemet^')
 	mbx=a.length

	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+"\""+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
 	nom=z
	z=''
 	a =nom.split('^euros^')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'€'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
 	nom=z
	z=''
 	a =nom.split('^...^')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'...'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
	nom=z
	z=''
 	a =nom.split('- ')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}


 	nom=z
	z=''
 	a =nom.split('^retour^')
 	mbx=a.length
	for (imx=0;imx<mbx;imx++) {
		if (imx>0) {
			z=z+'<br>'+a[imx]
		}
		else {
			z=z+a[imx]
		}
	}
	return z
}





Array.prototype.recherche = function(valeur) {
  var debut = 0;
  var fin = this.length - 1;
  if (this[fin] == valeur) return fin;
  var milieu = 0;
  while (true) {
     milieu = Math.floor((debut + fin ) / 2);
     if (this[milieu] == valeur) return milieu;
     else if (fin - debut <= 1) return -1;
     else {
        if (this[milieu] > valeur) fin = milieu;
        else debut = milieu;
     }
  }
  return -1;
}

Array.prototype.suppression = function(valeur) {
  if (this.length) {
     var indice = this.recherche(valeur);
     if (indice != -1) this.splice(indice, 1);
  }
}

function compare_num(a, b) {
 return a - b;
}
function triNum(table,champ) {
	table_inter = new Array;
	table_inter_fin = new Array;
	n=table.length;
	m=table[0].length;

	for (i=0;i<n;i++) {
		table_inter2 = new Array;
		table_inter2.push(table[i][parseInt(champ)])
		for (j=0;j<m;j++) {
			table_inter2.push(table[i][j])

		}
		table_inter.push(table_inter2)
	}
	table_inter=table_inter.sort(compare_num)

	n=table_inter.length;
	m=table_inter[0].length;

	for (i=0;i<n;i++) {
		table_inter2 = new Array;
		
		for (j=1;j<m;j++) {
			table_inter2.push(table_inter[i][j])

		}
		table_inter_fin.push(table_inter2)
	}
return table_inter_fin;	
}
var O = [];
var P,T;
/////////////////////////////////////////////////////////////////////////////////
var car = "-------------------- 0123456789abcdefghijklmnopqrstuvwxyz";
var tag = "a";
/////////////////////////////////////////////////////////////////////////////////
var L = car.length;

function Olink(o){
	this.o = o;
	this.txt = P[o].innerHTML;
	P[o].innerHTML = "";
	this.obj = P[o];
	this.len = this.txt.length;
	this.txa = "";
	this.txo = "";
	this.run = false;
	this.stop = false;
	this.cp = [];
	P[o].onmouseover=new Function("O["+o+"].over();return false;");
	P[o].onmousedown=new Function("O["+o+"].stop=true;setTimeout('P["+o+"].innerHTML=O["+o+"].txt;O["+o+"].stop=false;',1000);return false;");
	this.display = function(){
		with(this){
			if(!stop){
				run = false;
				for(i=0;i<len;i++){
					c = txa.charAt(i);
					d = txt.charAt(i);
					if(c != d){
						cp[i]++;
						run = true;
						c = car.charAt(cp[i]);
						if(cp[i] >= L) c=d;
						txa = txa.substring(0,i)+c+txa.substring(i+1,999);
					}
				}
				obj.childNodes[0].nodeValue = txa;
				if(run) setTimeout("O["+o+"].display()", 60);
			} else {
				run = false;
				txa = txt;
			}
		}
	}
	this.over = function(){
		with(this){
			txa="";
			for(i=0;i<len;i++){
				cp[i] = Math.round(Math.random()*20);
				txa += car.charAt(cp[i]);
			}
			obj.innerHTML = txa;
			if(!run) display();
		}
	}
}



