

function getCookie (nom) {
  var arg = nom + "=";
  var alen = arg.length;
  var i = 0;
  
  
  while (i < document.cookie.length) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg) {
      var endstr = document.cookie.indexOf (";", j);
      if (endstr == -1) endstr = document.cookie.length;
      return unescape(document.cookie.substring(j, endstr));
    }
    i = document.cookie.indexOf(" ", i) + 1; 
    if (i == 0) break; 
  }
  return null;
}




var testDemo;

link = document.location.href;
lmax = link.length;
testmag = link.substring(0, link.lastIndexOf('demo')+4);
testmagMerca = link.substring(0, link.lastIndexOf('mercanet2')+9);
//alert (testmag);


if (testmag == 'http://127.0.0.1/Site%20Avh/magasin_demo' || testmag == 'http://www.avh.asso.fr/magasin_demo' || testmagMerca == 'http://www.avh.asso.fr/cgi-bin/mercanet2') {
  compteur = getCookie('AVH');
  //alert (testmag);
}else{
  compteur = null;
}


document.write('<style type=\"text/css\">');

if (compteur != null) { 
  doc = compteur.split(':');
  tailleTexte = doc[1];
  colorTexte = "#" + doc[2];
  colorFond = "#" + doc[3];
  //alert(tailleTexte + ' * ' + colorTexte + ' * ' + colorFond);

  
	document.write('	html, body, font, table, tr, td, thead { background: ' + colorFond + ';	color: ' + colorTexte + '; font-family: Arial, Verdana; font-size: ' + tailleTexte + 'px; }');
	document.write('	body { margin-left:10px; }');
	//document.write('	#logoAVH { display:none; }');
	document.write('  img { margin:auto; }');

	document.write('	input, textarea, select { background: ' + colorFond + '; color: ' + colorTexte + '; font-size: ' + tailleTexte + 'px; border: 2px solid ' + colorTexte + '}');
	//document.write('	h1, h2, h3, h4, h5, h6, p, font, .textItalic, .small, .smallsmall, div ul, div li, span, tr, td, ul { font-size: ' + tailleTexte + 'px; }');

  document.write('	h1, h2 { font-size: ' + tailleTexte + 'px; border-left: 10px solid ' + colorTexte + '; border-bottom: 2px solid ' + colorTexte + '; padding:5px 5px 8px 10px; text-align:left; margin-top:50px; }');
  document.write('	h3, h4 { font-size: ' + tailleTexte + 'px; }');

	document.write('	table, tr, td, th { border:none; }');
	document.write('  .caddieMagTable td { border: 1px solid ' + colorTexte + '; padding:15px; }');
	document.write('  .effectBT { background-image:; background-color:' + colorFond + '; }');
  document.write('  .commandeMagchamp, .livraisonMagchamp { width: 230px; height: 25px; text-align:right; padding-right:10px; color:' + colorTexte + '; font-weight: bolder; }');

  /*nb = document.location.href.split('/');
  LENnb = nb.length;
  nameFile = nb[LENnb-1];
  modeNUM = new RegExp("^[0-9]+");
  if (modeNUM.test([nameFile])==false) { document.write('  img, hr { display:none; }');  }*/

  document.write('  .MagasinPanierCadre { width:' + (350+(eval(tailleTexte)*10)) + 'px; margin-bottom:0px; border: 2px solid ' + colorTexte + '; }');
  //document.write('  .MagasinAccesContenu { float: left; clear: both; text-align: left;  height: 27px; border:0; padding: 0; margin:0; }');
	document.write('  .codeEtatPanier h1 { width:' + (280+eval(tailleTexte)*10) + 'px; color:' + colorTexte + '; font-size:' + tailleTexte + 'px; font-weight: bold; margin:0px; }');
	document.write('  .codeEtatProduit { color:' + colorTexte + '; font-size:' + tailleTexte + 'px; padding-left: 65px; font-weight: bold; }');
	document.write('  .codeEtatTotal { color:' + colorTexte + '; font-size:' + tailleTexte + 'px; padding-left: 109px; font-weight: bold; }');

  document.write('  .MagasinAjout { width:' + (350+(eval(tailleTexte)*10)) + 'px; margin-top: 30px; border: 2px solid ' + colorTexte + '; }');
	document.write('  .codeCommande h1 {  width:' + (280+eval(tailleTexte)*10) + 'px; color=' + colorTexte + '; font-size:' + tailleTexte + 'px; font-weight: bold; margin:0px; }');
	document.write('  .codeReference { color=' + colorTexte + '; font-size:' + tailleTexte + 'px; font-weight: bold; padding-left: 100px; }');
  document.write('  .codeQuantite { color=' + colorTexte + '; font-size:' + tailleTexte + 'px; font-weight: bold; padding-left: 100px; }');
  document.write('  .codeAjoutBT { margin-top:10px; padding-left: 100px; }');
  document.write('  .codeErreur { padding-left: 100px; }');


	document.write('	a { font-size: ' + tailleTexte + 'px; color: ' + colorTexte + '; font-weight: bolder;  text-decoration: underline; }');
	document.write('	a:hover { text-decoration: none; }');

	document.write('	.zoneTest {  border: 2px solid ' + colorTexte + ' }');
	document.write('	.alertSommeMin { padding-bottom: 15px; width:100%; text-align: center; color:' + colorTexte + '; font-weight:bolder; }');


	document.write('	BODY {');
	document.write('		scrollbar-face-color:' + colorTexte + ';');				/* la couleur principale (face) */
	document.write('		scrollbar-arrow-color:' + colorFond + ';');				/* la couleur des fleches */
	document.write('		scrollbar-track-color:' + colorFond + ';');				/* la couleur de fond (entre le curseur et la fleche) */
	document.write('		scrollbar-highlight-color:' + colorFond + ';');			/* la couleur claire (haut+gauche) */
	document.write('		scrollbar-3dlight-color:' + colorFond + ';');				/* la couleur claire 2 (haut+gauche) */
	document.write('		scrollbar-shadow-color:' + colorFond + ';');				/* la couleur foncee (bas+droite) */
	document.write('	}');
}else{

  document.write('	html, body, font, table, tr, td, thead { font-family: Arial, Verdana; }');
  document.write('	body { margin-left:10px; }');

	//document.write('	h1 { font-size: 18px; }');
	document.write('  .caddieMagTable thead { color:#FFF; padding:2px; }');
	document.write('  .effectBT { background-image: url(\'images/form_button.gif\'); background-color: #F5F5F5; font-weight: bolder; }');
	document.write('  .commandeMagchamp, .livraisonMagchamp { width: 230px; height: 25px; text-align:right; padding-right:10px; background-color:#0000A0; color:#FFF; font-weight: bolder; }');
	document.write('  .signalErreur { width: 180px; height: 25px; text-align:right; padding-right:10px; background-color:#0000A0; color:#FFF; }');

  document.write('  .MagasinPanierCadre { float: left; font-family: Verdana; width:100%; height: 147px; margin-top:5px; margin-bottom:50px; }'); 
	document.write('  .MagasinPanier { float: left; font-size: 14px; width:100%; height: 115px; border:0px solid red; background-image:url(\'http://www.avh.asso.fr/magasin/produits/images/fondEtat.jpg\'); background-position: top left; background-repeat: no-repeat; }');
	document.write('  .codeEtatPanier h1 { color:#0B4499; font-size:15px; font-weight: bold; margin:0px; margin-top:20px; padding-left: 120px; }');
	document.write('  .codeEtatProduit { color:#000; font-size:13px; padding-left: 65px; font-weight: bold; }');
	document.write('  .codeEtatTotal { color:#000; font-size:13px; padding-left: 109px; font-weight: bold; }');
	document.write('  .MagasinAccesContenu { float: left; clear: both; text-align: left; width: 450px; height: 27px; background-image:url(\'http://www.avh.asso.fr/magasin/produits/images/fondErreur.jpg\'); background-position: top left; background-repeat: no-repeat; border:0; padding: 0; margin:0; }');
	document.write('  .MagasinAccesContenu a { color:#FFF; font-size: 12px; font-weight: bolder; }');

	document.write('  .MagasinAjout { float:left; font-family: Verdana; margin-top:10px; margin-bottom: 20px; font-size:14px; width:100%; height: 139px; padding-top:20px; background-image:url(\'http://www.avh.asso.fr/magasin/produits/images/fondPanier.jpg\'); background-position: top left; background-repeat: no-repeat; }');
	document.write('  .codeCommande { float:left; clear:both; color:#0B4499; font-size:15px; font-weight: bold; margin:0px; }');
	document.write('  .codeCommande h1 { color:#0B4499; font-size:15px; font-weight: bold; margin:0px; padding-left: 190px; }');
	document.write('  .codeReference { float:left; clear:both; color:#FFF; font-size:14px; font-weight: bold; padding-left: 210px; }');
  document.write('  .codeQuantite { float:left; clear:both; color:#FFF; font-size:14px; font-weight: bold; padding-left: 220px; }');
  document.write('  .codeAjoutBT { float:left; clear:both; margin-top:10px; padding-left: 210px; }');
  document.write('  .codeErreur { float: left; clear:both; padding-left: 120px; }');
  document.write('  .codeErreur a { font-size:12px; font-weight:bolder; }');
  
  document.write('  .codeNoVente { float: left; width: 500px; padding: 20 0 0 180; text-align: left; }');
  document.write('  .codeNoVenteInfo { COLOR=#0B4499; font-size:15px; font-weight: bold; }');
  document.write('  .codeNoVenteInfo2 { color:#FFF; width: 270px; font-size: 13px; font-weight: bold; }');
  
  document.write('	.alertSommeMin { padding-bottom: 15px; width:100%; text-align: center; color:#FF0000; font-weight:bolder; }');



  /* ANCIEN PANIER
  document.write('.MagasinPanier { float: left; font-family: Verdana; font-size: 14px; width:100%; height: 115px; margin-bottom:50px; background-image:url("http://www.avh.asso.fr/magasin/produits/images/fondEtat.jpg"); background-position: top left; background-repeat: no-repeat; }');
  document.write('.MagasinAccesContenu { float: left; clear: both; text-align: left; width: 450px; height: 27px; background-image:url("http://www.avh.asso.fr/magasin/produits/images/fondErreur.jpg"); background-position: top left; background-repeat: no-repeat; border:0; padding: 0; margin:0; }');
  document.write('.MagasinAccesContenu2 { float: left; clear: both; text-align:right; width: 450px; height: 27px; background-image:url("http://www.avh.asso.fr/magasin/produits/images/fondErreur.jpg"); background-position: top right; background-repeat: no-repeat; border:0; padding: 0; margin:0; }');
  document.write('.MagasinAjout { float:left; font-family: Verdana; margin-bottom: 20px; font-size:14px; width:100%; height: 139px; background-image:url("http://www.avh.asso.fr/magasin/produits/images/fondPanier.jpg"); background-position: top left; background-repeat: no-repeat; }');
  */

	/* NOUVEAU PANIER
  document.write('	h1 { font-size: 18px;}');
	document.write('  .caddieMagTable thead { color:#FFF; padding:2px; }');
	document.write('  .effectBT { background-image: url(\'images/form_button.gif\'); background-color: #F5F5F5; font-weight: bolder; }');
	document.write('  .commandeMagchamp { width: 230px; height: 25px; text-align:right; padding-right:10px; background-color:#0000A0; color:#FFF; font-weight: bolder; }');
	document.write('  .signalErreur { width: 180px; height: 25px; text-align:right; padding-right:10px; background-color:#0000A0; color:#FFF; }');

	document.write('  .MagasinPanier { float: left; font-family: Verdana; width:100%; height: 140px; padding-top:12px; margin-bottom:50px; background-image:url(\'images/panier.jpg\'); background-position: top left; background-repeat: no-repeat; }');
	document.write('  .codeEtatPanier h1 { color:#FFF; font-size:15px; font-weight: bold; margin:0px; padding-left: 40px; }');
	document.write('  .codeEtatProduit { color:#FFF; font-size:13px; padding-left: 40px; font-weight: bold; }');
	document.write('  .codeEtatTotal { color:#FFF; font-size:13px; padding-left: 85px; font-weight: bold; }');
	document.write('  .MagasinAccesContenu { float: left; clear: both; text-align: left; width: 300px; height: 20px; border:0px; padding: 0; margin:0; padding-top:5px; padding-left:5px; }');
	document.write('  .MagasinAccesContenu a { color:#000; font-size: 12px; }');

	document.write('  .MagasinAjout { float:left; font-family: Verdana; margin-bottom: 20px; width:100%; height: 140px; padding-top:12px; background-image:url(\'images/panier.jpg\'); background-position: top left; background-repeat: no-repeat; }');
	document.write('  .codeCommande { float:left; clear:both; color:#FFF; font-size:15px; font-weight: bold; margin:0px; }');
	document.write('  .codeCommande h1 { color:#FFF; font-size:15px; font-weight: bold; margin:0px; padding-left: 35px; }');
	document.write('  .codeReference { float:left; clear:both; color:#FFF; font-size:13px; font-weight: bold; padding-left: 100px; padding-top:10px; }');
  document.write('  .codeQuantite { float:left; clear:both; color:#FFF; font-size:13px; font-weight: bold; padding-left: 110px; }');
  document.write('  .codeAjoutBT { float:left; clear:both; margin-top:10px; padding-left: 100px; padding-top:10px; }');
  document.write('  .codeErreur { float: left; clear:both; margin-top:30px; padding-left: 85px; }');
	document.write('  .codeErreur a { color:#000; font-size: 12px; }');
  
  document.write('  .codeNoVente { float: left; width: 500px; padding: 20 0 0 180; text-align: left; }');
  document.write('  .codeNoVenteInfo { COLOR=#0B4499; font-size:15px; font-weight: bold; }');
  document.write('  .codeNoVenteInfo2 { color:#FFF; width: 270px; font-size: 13px; font-weight: bold; }');
  */
}
document.write('</style>');














/* AUTEUR: ASSOCIATION VALENTIN HAUY */
/* DATE DE CREATION: 29/11/00 */



function BoutonDroit (evt) {
  if (document.all) {
		alert("Bouton droit désactivé!");
    return false;
  }
  else if (document.getElementById) {
    if (evt.button == 3) {
      evt.preventDefault();
		  alert("Bouton désactivé!");
      return false;
    }
  }
  return true;
}
/*
if (navigator.userAgent.toLowerCase().indexOf('msie 5') != -1) {document.oncontextmenu = BoutonDroit;}

if (!document.all && document.getElementById) {document.onmouseup = BoutonDroit;}
*/





function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;

}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}


// fonction ScrollMessage


var msg = "                                                  ............:::::: Association Valentin Haüy, pour le bien des aveugles et des malvoyants ::::::............                                                  "
var delay =100
var timerId
var maxCount = 0
var currCount = 1

function scrollMsg() {
 if (maxCount == 0) {
  maxCount = 20 * msg.length
 }
 window.status = msg
 currCount++
 msg = msg.substring (1, msg.length) + msg.substring (0, 1)

 if (currCount >= maxCount) {
  timerId = 0         

  window.status = ""  
  return              
 } else {
  timerId = setTimeout("scrollMsg()", delay)
 }
}


// POPUP1
// set the popup window width and height

var windowW=280 // wide
var windowH=398 // high

// set the screen position where the popup should appear


// set this to true if the popup should close
// upon leaving the launching page; else, false

var autoclose = true

// ============================


s = "width="+windowW+",height="+windowH;
var beIE = document.all?true:false

function openFL(urlPop,title,windowX,windowY){
  if (beIE){
    NFW = window.open("","popFL","fullscreen,"+s)     
    NFW.blur()
    window.focus()       
    NFW.resizeTo(windowW,windowH)
    NFW.moveTo(windowX,windowY)
    var frameString=""+
"<html>"+
"<head>"+
"<title>"+title+"</title>"+
"</head>"+
"<frameset rows='*,0' framespacing=0 border=0 frameborder=0>"+
"<frame name='top' src='"+urlPop+"' scrolling=auto>"+
"<frame name='bottom' src='about:blank' scrolling='no'>"+
"</frameset>"+
"</html>"
    NFW.document.open();
    NFW.document.write(frameString)
    NFW.document.close()
  } else {
    NFW=window.open(urlPop,"popFrameless","scrollbars,"+s)
    NFW.blur()
    window.focus() 
    NFW.resizeTo(windowW,windowH)
    NFW.moveTo(windowX,windowY)
  }   
  NFW.focus()   
  if (autoclose){
    window.onunload = function(){NFW.close()}
  }
}




// POPUP
// set the popup window width and height

var windowW=280 // wide
var windowH=398 // high

// set the screen position where the popup should appear

//var windowX = 260 // from left
//var windowY = 100 // from top
var windowX = (screen.width/2)-(windowW/2);
var windowY = (screen.height/2)-(windowH/2);


// set this to true if the popup should close
// upon leaving the launching page; else, false

var autoclose = true

// ============================


s = "width="+windowW+",height="+windowH;
var beIE = document.all?true:false

function openFrameless(urlPop,title){
  if (beIE){
    NFW = window.open("","popFrameless","fullscreen,"+s)     
    NFW.blur()
    window.focus()       
    NFW.resizeTo(windowW,windowH)
    NFW.moveTo(windowX,windowY)
    var frameString=""+
"<html>"+
"<head>"+
"<title>"+title+"</title>"+
"</head>"+
"<frameset rows='*,0' framespacing=0 border=0 frameborder=0>"+
"<frame name='top' src='"+urlPop+"' scrolling=auto>"+
"<frame name='bottom' src='about:blank' scrolling='no'>"+
"</frameset>"+
"</html>"
    NFW.document.open();
    NFW.document.write(frameString)
    NFW.document.close()
  } else {
    NFW=window.open(urlPop,"popFrameless","scrollbars,"+s)
    NFW.blur()
    window.focus() 
    NFW.resizeTo(windowW,windowH)
    NFW.moveTo(windowX,windowY)
  }   
  NFW.focus()   
  if (autoclose){
    window.onunload = function(){NFW.close()}
  }
}




//-->



//Generic Drag Script- © Dynamic Drive (www.dynamicdrive.com)
//For full source code and terms of usage,
//visit http://www.dynamicdrive.com

var ie=document.all
var ns6=document.getElementById&&!document.all

var dragapproved=false
var z,x,y

function move(e){
if (dragapproved){
z.style.left=ns6? temp1+e.clientX-x: temp1+event.clientX-x
z.style.top=ns6? temp2+e.clientY-y : temp2+event.clientY-y
return false
}
}

function drags(e){
if (!ie&&!ns6)
return
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "HTML" : "BODY"

while (firedobj.tagName!=topelement&&firedobj.className!="drag"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.className=="drag"){
dragapproved=true
z=firedobj
temp1=parseInt(z.style.left+0)
temp2=parseInt(z.style.top+0)
x=ns6? e.clientX: event.clientX
y=ns6? e.clientY: event.clientY
document.onmousemove=move
return false
}
}
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")
//-->

