function ajoutpanier(ref, qte)
{
	//alert ("Article ajouté à votre panier");
	new Ajax.Updater('panier','panier_bloc.php?action=ajout&ref='+ref+'&qte='+qte+'&time='+Math.random(),{method:'get'});
	//return false;
}
function affiche_panier() 
{ 
	if (navigator.appName=="Microsoft Internet Explorer") offsety = document.documentElement.scrollTop;
	else offsety = window.pageYOffset;
	//alert (document.body.scrollTop);
	//alert (screen.availHeight);
	document.getElementById('affiche_panier').style.top=offsety+300;
	document.getElementById('affiche_panier').style.left=(screen.availHeight / 2) + 30;
	document.getElementById("affiche_panier").style.display='block'; 
	document.getElementById("affiche_panier").style.display=''; 
	setTimeout("cache_panier()", 6000);
	
}
function cache_panier() { document.getElementById("affiche_panier").style.display='none'; }

function charge() { document.getElementById("charge").style.display='none'; }
function chargeon() { document.getElementById("charge").style.display=''; }

function ouvre (aWinName, aURL)
{
	var wOpen;
	var sOptions;

	sOptions = 'status=yes,menubar=no,scrollbars=yes,resizable=yes,toolbar=no';
	sOptions = sOptions + ',width=' + (screen.availWidth - 50).toString();
	sOptions = sOptions + ',height=' + (screen.availHeight - 100).toString();
	sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';
	
	wOpen = window.open( aURL, aWinName, sOptions );
	wOpen.focus();
	wOpen.moveTo( 0, 0 );
	wOpen.resizeTo( screen.availWidth, screen.availHeight );
	return wOpen;
	
	
	w = screen.width -180;
	h = screen.height -405;
}

function PopupCentrer(page,name,largeur,hauteur,options) {
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  Nouvfen = window.open(page,name,"top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
  Nouvfen.focus();
}

function datefr()
{
	var now, d = new Date();
    var s = "00";var jo="00";
 	jo = d.getDate();jo = '0' + jo;jo = (jo.substring(jo.length-2, jo.length));
 	mo = d.getMonth()+1;mo = '0' + mo;mo = (mo.substring(mo.length-2, mo.length));
 	ho = d.getHours();ho = '0' + ho;ho = (ho.substring(ho.length-2, ho.length));
 	mn = d.getMinutes();mn = '0' + mn;mn = (mn.substring(mn.length-2, mn.length));
 	now = jo + "/" +  mo + "/" + d.getYear()+ " " +  ho + ":" + mn;
	return (now);
}

function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
			return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
		}  
	return null;
	}
	
function SetCookie(Nom, Contenu) {
expdate = new Date ();
expdate.setTime (expdate.getTime() + (10 * 24 * 60 * 60 * 1000 * 365)); // 1 an  depuis maintenant
//Contenu = document.form.[Nom].value;
//alert (Nom + " " + Contenu);
document.cookie = Nom + "=" + Contenu + "; expires=" + expdate.toGMTString() ;
//LitCook();
//alert(GetCookie ('VAD_theme'));
}

function SetCookieOLD (name, value, expires) {  
	var expire = new Date();  
	expire.setHours (expire.getHours() + 1 + expires ); 
	//document.write ( "expires=" + expire.toGMTString() );
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expire.toGMTString()));
	}

function DeleteCookie (name) {  
	var exp = new Date();  
	//alert('efface');
	exp.setTime (exp.getTime() - 1);  
	var cval = GetCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
	}
	
function getCookieVal (offset) {  
	var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1)    
		endstr = document.cookie.length;  
	return unescape(document.cookie.substring(offset, endstr));
	}
		
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_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_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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}
// foldheader Rend visible / invisible la balise suivante
function cache()
{
	if(!document.all)	return
	if (event.srcElement.id=="foldheader") 
	{
		var srcIndex = event.srcElement.sourceIndex
		var nested = document.all[srcIndex+1]
		if (nested.style.display=="none") {
			nested.style.display=''
			document.cookie=event.srcElement.sourceIndex
			event.srcElement.style.listStyleImage="url(open.gif)"
		}
		else 							
		{
			nested.style.display="none"
			event.srcElement.style.listStyleImage="url(fold.gif)"
		}
	}
}



//-----------------------------------------------------------
//  Nom Document : GFBULLE.JS
//-----------------------------------------------------------
//-------------------------------------------------------------
//  Nom Document : GFBULLE.JS
//  Auteur       : G.Ferraz
//  Objet        : Info Bulle...
//  Création     : 01.12.2003
//-------------------------------------------------------------
//  Mise à Jour  : 29.05.2006
//  Objet        : Compatibilité IE6 et DOCTYPE
//  -----------------------------------------------------------
//  Mise à Jour  : 21.06.2006
//  Objet        : Prise en compte des <SELECT>
//  -----------------------------------------------------------
var DOM = (document.getElementById ? true : false);
var IE  = (document.all && !DOM ? true : false);
var NS4 = (document.layers ? true : false);
var NAV_OK   = ( DOM || IE );
var NETSCAPE = ( navigator.appName == "Netscape");
var EXPLORER = ( navigator.appName =='Microsoft Internet Explorer');
var OPERA    = ( window.opera ? true : false);
var Mouse_X;          // Position X en Cours de la Mouse
var Mouse_Y;          // Position Y en Cours de la Mouse
var TopIndex = 1;     // Z-Index interne
var Decal_X  = -10;   // Décalage X entre Pointeur Mouse et Bulle
var Decal_Y  = -10;   // Décalage Y entre Pointeur Mouse et Bulle
var bBulle= false;    // Flag Affichage de la Bulle

//-- Pour Test mode Cadre
var ZObjet = new RECT();   // Zone pour MouseMove
var ZBulle = new RECT();
var bCadre = false;        // Flag Affichage du Cadre
var bInit  = false;
var Fenetre = new RECT();
//=========================
// Définition pour le Cadre
//=========================
function RECT(){
  this.Left   =0;
  this.Top    =0;
  this.Right  =0;
  this.Bottom =0;
  this.InitRECT   =RECT_Set; 
  this.PtInRECT   =RECT_PtIn; 
}
//-------------------------------------------
function RECT_Set( left_, top_, larg_, haut_){
  with( this){
    Left   = ( left_ ? left_ : -1);
    Top    = ( top_  ? top_  : -1);
    Right  = Left + ( larg_ ? (larg_ -1): 0);
    Bottom = Top  + ( haut_ ? (haut_ -1): 0);
  }
}
//-------------------------
function RECT_PtIn( x_, y_){
  with( this){
    return(( x_ > Left) && ( x_ < Right) && ( y_ > Top ) && ( y_ < Bottom));
    if( x_ < Left || x_ > Right)  return( false);
    if( y_ < Top  || y_ > Bottom) return( false);
    return( true);
  }
}
//---------------------
function GetObjet(div_){
  if( DOM) return document.getElementById(div_);
  if( IE)  return document.all[div_];
  return( null);
}
//-----------------------------
function ObjWrite( div_, html_){
  var Obj;
  Obj = GetObjet( div_);
  if( Obj) with( Obj){
    if( !NS4){
      innerHTML = html_;
    }
    else{
      document.open();
      document.write( html_);
      document.close();
    }
  }
}
//-----------------------
function Get_DimFenetre(){
  var L_Doc;
  var H_Doc;
  var DocRef;
  
  with( Fenetre){
    if( window.innerWidth){
      with( window){
        Left   = pageXOffset;
        Top    = pageYOffset;
        Right  = innerWidth;
        Bottom = innerHeight;

        if( NETSCAPE){
          L_Doc = document.body.offsetWidth;
          H_Doc = document.body.offsetHeight;
        }
        else{
          L_Doc = document.body.clientWidth;
          H_Doc = document.body.clientHeight;
        }
        if( Right  > L_Doc) Right  = L_Doc;
        if( Bottom > H_Doc) Bottom = H_Doc;
      }
    }
    else{ // Cas Explorer à part
      if( document.documentElement && document.documentElement.clientWidth)
        DocRef = document.documentElement;
      else
        DocRef = document.body;

      with( DocRef){
        Left   = scrollLeft;
        Top    = scrollTop;
        Right  = clientWidth;
        Bottom = clientHeight;
      }
    }
    //-- limite Maxi Fenêtre Affichage
    Right  += Left;
    Bottom += Top;
  }
}
//------------------------------------
function ObjShowAll( div_, x_, y_, z_){
  var B_Obj = GetObjet( div_);
  var F_Obj = GetObjet( 'F' +div_);
  var MaxX, MaxY;
  var Haut, Larg;
  var SavY = y_;

  if( B_Obj){
    //-- Récup. dimension du DIV
    if( NETSCAPE){
      Larg = B_Obj.offsetWidth;
      Haut = B_Obj.offsetHeight;
    }
    else{
      Larg = B_Obj.scrollWidth;
      Haut = B_Obj.scrollHeight;
    }
    with( Fenetre){
      //-- Réajuste dimension fenêtre
      MaxX = Right  - Larg;
      MaxY = Bottom - Haut;

      //-- Application Bornage
      if( x_ > MaxX) x_ = MaxX;
      if( x_ < Left) x_ = Left;
      if( y_ > MaxY) y_ = MaxY;
      if( y_ < Top)  y_ = Top;
    }
    //-- si en bas On réajuste
    //-- pour que la bulle ne prenne pas le focus
    if( y_== MaxY){
      var DeltaY = MaxY -SavY;
      y_ = MaxY - DeltaY -Haut -2*Decal_Y;
    }
    //-- On place la Bulle
    if( EXPLORER){ //-- Ajout pour SELECT sous IE
      with(F_Obj.style){
        left       = x_ +"px";
        top        = y_ +"px";
        zIndex     = z_-1;
        visibility = "visible";
      }
    }
    with(B_Obj.style){
      left       = x_ +"px";
      top        = y_ +"px";
      zIndex     = z_;
      visibility = "visible";
    }
    //-- Affectation Zone du Rectangle
    ZBulle.InitRECT( x_, y_, Larg, Haut);
  }
}
//---------------------
function Init_Bulle(){
  var Obj;
  var i, k;
  var bW3C = ( window.addEventListener ? true : false);

  //-- Pour les SELECT on supprime l'événement hérité
  Obj = document.getElementsByTagName('SELECT');
  for( i=0; i < Obj.length; i++){
    if( Obj[i].size == 1){
      for( k=0; k < Obj[i].options.length; k++){
        if( bW3C)
           Obj[i].options[k].addEventListener('mousemove', BulleHide, false);
        else
           Obj[i].options[k].attachEvent( 'onmousemove',    BulleHide);
      }
    }
    if( bW3C){
      Obj[i].addEventListener('scroll',    BulleHide, false);
      Obj[i].addEventListener('mousedown', BulleHide, false);
    }
    else{
      Obj[i].attachEvent( 'onscroll',    BulleHide);
      Obj[i].attachEvent( 'onmousedown', BulleHide);
    }
  }
  bInit=true;
}
//------------------------
// mode Cadre Indépendant
//------------------------
function CadreWrite( txt_){
  var Html;
  var B_Obj = GetObjet( 'Bulle');
  var F_Obj = GetObjet( 'FBulle');
  if( !bInit) Init_Bulle();
  if( B_Obj){
    //-- Récup dimension d'affichage
    Get_DimFenetre();
    Decal_X = -10;  // Decalage dans de la Bulle
    Decal_Y = -10;
    Html  = "<TABLE BORDER='1' BORDERCOLOR='#808080' CELLSPACING=0 CELLPADDING=2 BGCOLOR='#A0A0A0'>";
    Html += "<TR><TD class='Bulle' NOWRAP ALIGN='LEFT'>";
    Html += txt_;
    Html += "</TD></TR></TABLE>";
    B_Obj.innerHTML = Html;

    if( EXPLORER){ //-- Ajout pour SELECT sous IE
      with(F_Obj.style){
        height = B_Obj.offsetHeight;
        width  = B_Obj.offsetWidth;
        left   = B_Obj.offsetLeft;
        top    = B_Obj.offsetTop;
      }
    }
    //-- On affiche le résultat
    ObjShowAll('Bulle', Mouse_X +Decal_X, Mouse_Y +Decal_Y, 1000);
    bCadre= true;
    return( true);
  }
  return(false);
}
//------------------------
// mode Bulle Indépendant
//------------------------
function BulleWrite( txt_){
  // vérifie si le parametre info_bulle est à 1 pour l'affichage sinon ne pas traiter !
  //if (1==1) return false; 
	
  var B_Obj = GetObjet( 'Bulle');
  var F_Obj = GetObjet( 'FBulle');
  var Html;
  if( !bInit) Init_Bulle();
  if( B_Obj){
    //-- Récup dimension d'affichage
    Get_DimFenetre();
    Decal_X = 5;  // Decalage hors de la Bulle
    Decal_Y = 13;
    Html  = "<TABLE BORDER=0 CELLSPACING=0><TR><TD BGCOLOR='#0000c0'>";
    Html += "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=4 WIDTH='100%' BGCOLOR='#FFFFE8'>";
    Html += "<TR><TD class='Bulle' NOWRAP ALIGN='LEFT'>";
    Html += txt_;
    Html += "</TD></TR></TABLE></TD></TR></TABLE>";
    B_Obj.innerHTML = Html;

    if( EXPLORER){ //-- Ajout pour SELECT sous IE
      with(F_Obj.style){
        height = B_Obj.offsetHeight;
        width  = B_Obj.offsetWidth;
        left   = B_Obj.offsetLeft;
        top    = B_Obj.offsetTop;
      }
    }
    //-----------------------------------------//
    // IMPORTANT on n'affiche pas la Bulle     //
    // l'événement MouseOver va avec MouseMove //
    //-----------------------------------------//
	bBulle= true;
  var DocRef;
  var Obj = null;
  var bRect= true;

  if( NETSCAPE){
    Mouse_X = e.pageX;
    Mouse_Y = e.pageY;
    Obj     = e.target;
    //-- Spécifique FireFox
    if( Obj.boxObject){
      with( Obj){
        //-- La Zone de prise en compte
        ZObjet.InitRECT( boxObject.x, boxObject.y, boxObject.width, boxObject.height);
      }
      //-- Barre de défilement et autre sous FireFox
      Obj = e.originalTarget;
      if( Obj)
        if( Obj.prefix =="xul"){
          BulleHide();
          return( true);
        }
      //-- Test pour SELECT sous FireFox
      bRect = ZObjet.PtInRECT( Mouse_X, Mouse_Y);
    }
  }//-- Endif NETSCAPE
  else{
    if( document.documentElement && document.documentElement.clientWidth)
      DocRef = document.documentElement;
    else
      DocRef = document.body;

    Mouse_X = event.clientX+DocRef.scrollLeft;
    Mouse_Y = event.clientY+DocRef.scrollTop;
  }

  if( bBulle)
    if( bRect)
      ObjShowAll('Bulle', Mouse_X +Decal_X, Mouse_Y +Decal_Y, 1000);

  if( bCadre)// on ne move pas on test juste si dans Rect
    if( !ZBulle.PtInRECT( Mouse_X, Mouse_Y))
      BulleHide();
    return( true);
  }
 return(false);
}
//------------------
function BulleHide(){
  var B_Obj = GetObjet( 'Bulle');
  var F_Obj = GetObjet( 'FBulle');

  if( EXPLORER){ //-- Ajout pour SELECT sous IE
    F_Obj.style.height = 0 +"px";
  }
  with(B_Obj){
    innerHTML        = "&nbsp;"
    style.left       = -1000+"px";
    style.top        = -1000 +"px";
    style.zIndex     = 0;
    style.visibility = "hidden";
  }
  //-- Pose les Flags
  bCadre = false;
  bBulle = false;
  return(true);
}
//------------------------------------
function WhereMouse(e){
  var DocRef;
  var Obj = null;
  var bRect= true;

  if( NETSCAPE){
    Mouse_X = e.pageX;
    Mouse_Y = e.pageY;
    Obj     = e.target;
    //-- Spécifique FireFox
    if( Obj.boxObject){
      with( Obj){
        //-- La Zone de prise en compte
        ZObjet.InitRECT( boxObject.x, boxObject.y, boxObject.width, boxObject.height);
      }
      //-- Barre de défilement et autre sous FireFox
      Obj = e.originalTarget;
      if( Obj)
        if( Obj.prefix =="xul"){
          BulleHide();
          return( true);
        }
      //-- Test pour SELECT sous FireFox
      bRect = ZObjet.PtInRECT( Mouse_X, Mouse_Y);
    }
  }//-- Endif NETSCAPE
  else{
    if( document.documentElement && document.documentElement.clientWidth)
      DocRef = document.documentElement;
    else
      DocRef = document.body;

    Mouse_X = event.clientX+DocRef.scrollLeft;
    Mouse_Y = event.clientY+DocRef.scrollTop;
  }

  if( bBulle)
    if( bRect)
      ObjShowAll('Bulle', Mouse_X +Decal_X, Mouse_Y +Decal_Y, 1000);

  if( bCadre)// on ne move pas on test juste si dans Rect
    if( !ZBulle.PtInRECT( Mouse_X, Mouse_Y))
      BulleHide();

  return( false);
}
//== INITIALISATION ==================================
//document.onmousemove = WhereMouse;		

//-- Création STYLE Bulle et DIV----------------------			
var Html;
  //-- On met du style pour la bulle
  Html  = '<STYLE TYPE="text/css">';
  Html += '.Bulle{cursor:default;color:#000000;font-size:13px;font-family:Verdana;}';
  Html += '</STYLE>';
  document.write( Html);
  //-- Création du DIV Bulle
  Html ='<div id="Bulle" style="position:absolute; left:auto; top:auto; width:auto; height:auto; z-index:0; visibility:hidden"></div>';
  if( EXPLORER) //-- Ajout pour SELECT sous IE
    Html +='<iframe id="FBulle" style="position:absolute;visibility:hidden;border:0px;" frameborder="0" scrolling="no" src="/vide.htm">&nbsp;</iframe>';
  document.write( Html);
//-- EOF ------------------------------------------------------

