//
 var idx_Parts = 0;
 var countPart = 0;
 var screenMod = 0; // 0 = Affichage info; 1 = Affichage achat
 var CallByClick = false;
//--------------------------------------------------------------------------------------------------------------------- Variables
 var oTitre = ""; //--- Titre.
 var oLocat = ""; //--- URL Page.
 var oWords = ""; //--- Keywords.
 var oInfos = ""; //--- Descriptif.
 var oProds = ""; //--- Référence.  
 var oNotes = ""; //--- Commentaires.
//
 var _partList = ""; //--- objet Liste des références disponibles
 var _monCaddy = "";
//var Actif = false
//var bonusPart = 50
//
//--------------------------------------------------------------------------------------------------------------------- Tableaux
//var oTitre= new Array();
//var oInfos= new Array();
//var lignes_Prix= new Array()
//
//--------------------------------------------------------------------------------------------------------------------- Fonctions
function loadFiche(oIndex, openMode){
 if ((izOver=!false)&&(izShow==false)){
  if(CallByClick == false){
   switch(openMode){
    case 0:// Affiche le cache; 
     indexFiche = oIndex;
     var urlFond = "_flash/scr_Label.swf";    
     var urlFiche = listArray[oIndex][6];
     if (urlFiche){
      _statusBar.className= "flash00";
      _statusBar.innerHTML= my_Text[0];
//--- Nettoyage
      while (_moveFrame.firstChild) {_moveFrame.removeChild(_moveFrame.firstChild);};
//--- Création & insertion calque Cache
      var new_Fly = document.createElement("DIV"); new_Fly.setAttribute("id", "fly_Cache");_moveFrame.insertBefore(new_Fly, _moveFrame.firstChild);
      put_SWF(urlFond, "fly_Cache", "fly_Cache", 1, fly_Larg, fly_Haut, -1);  
      var _flyCache = document.getElementById("fly_Cache"); _flyCache.className = 'frm_Popup';  
      with(_flyCache.style){top= 0; left= 0; width="100%"; height="100%"};
      showFlyer(0,0,500,300,0); //openMode=0;      
//--- Affichage & Positionneent de la fenêtre
     } else {_statusBar.innerHTML= my_Text[19]; } 
    break;
// 
    case 1:
     var urlPaper = "images/skin00/fonds/flyBG02.png";  
//--- Création & insertion calque fiche
     var new_Fly = document.createElement("DIV"); 
     new_Fly.setAttribute("id", "_flyFiche");
     _moveFrame.insertBefore(new_Fly, _moveFrame.firstChild);
     var _flyFiche = document.getElementById("_flyFiche"); _flyFiche.className = 'frm_Popup';
     with(_flyFiche.style){ top= 17; left=13; width="93%"; height="93%"; align="middle"};
//
     drawFiche(indexFiche, _flyFiche);   
//--- Création & insertion calque d'arrière plan 
     var new_Fly = document.createElement("DIV"); new_Fly.setAttribute("id", "fly_Paper");_moveFrame.insertBefore(new_Fly, _moveFrame.firstChild);
     var _flyPaper = document.getElementById("fly_Paper"); _flyPaper.className = 'frm_Popup';
     with(_flyPaper.style){ top= 0; left= 0; width= fly_Larg; height= fly_Haut};
     _flyPaper.innerHTML = '<img src='+urlPaper+' width="500" height="300">';
     izShow= true; setTimeout("hideFlyer(0)", 0);
     if(izClic != false){CallByClick = true};
   break;
  }}
 }
}
//
// ----------------------------------------------------------------------------------------------------------------------------------------
function drawFiche(oIndex, oTarget){
//---
 countPart= 0;
//---
oTarget.innerHTML=
 '<form name="mafiche" id="mafiche">'+
 '<TABLE id="tabCarte" class="tabloBody"  border="0" cellpadding="0" cellspacing="0" align="center" width="97%" height="95%">'+
//--- Création tableau cellule Titre & cellule bouton fermer:
 '<TR><TD height="10"><Table align="center" width="100%"><TR>'+// ligne titre et bouton window close
 '<TD width="15"></TD><TD id="zoTitre" align="left" vAlign="middle" class="ficheHead"></TD>'+
 '<TD width="10"></TD>'+
 '<TD id="zoFlash" align="left" vAlign="middle" class="flash02"></TD>'+
 '<TD id="zoWindo" align="right" vAlign="middle">'+
 //'<IMG src='+oImage[15]+' class="urlOver" alt='+my_Text[5]+' '+
 //'id="swCaddy" onclick="addPart('+oIndex+')"></td><td width="5">'+                   // Insertion bouton Panier
 '<IMG src='+oImage[0]+' class="urlOver" onclick="hideFlyer(1)" alt='+my_Text[1]+'></TD>'+// Insertion bouton Fermer
 '</TR></Table></TD></TR>'+
//--- Création ligne de séparation:
 '<TR><TD height="2" background='+oImage[4]+'></TD></TR><TR><TD height="5"></TD></TR>'+
//--- Création zône Description:
 '<TR><TD id="zoInfos" vAlign="top" height="140">Descriptif:<br><br><br></TD></TR>'+
//--- Création ligne de séparation:
 '<TR><TD height="1"></TD></TR>'+
//---  Création zône infos de commande (le tableau peut être caché):
 '<TR><TD vAlign="top" >'+
 '<TABLE id="zoCodes" class="tabloBody"  border="0" cellpadding="0" cellspacing="0" width="100%" align="center">'+
 '<TR><TD colspan="2" height="2" background='+oImage[4]+'></TD></TR>'+
 '<TR height="13">'+
 '<TD vAlign="middle" align="left">Références disponibles:</TD>'+ 
 '<TD vAlign="top" align="right" id="zoParts">-</TD>'+
 '</TR></TABLE>'+
 '</TD></TR>'+
//--- Création ligne de séparation:
 '<TR><TD height="2" background='+oImage[4]+'></TD></TR>'+
//---  Création zône infos de commentaires 
 '<TR><TD id="zoNotes" align="left" vAlign="top" height="50">Commentaires:<br></TD></TR>'+
//--- Création ligne de séparation:
 '<TR><TD height="2" background='+oImage[4]+'></TD></TR>'+
//---  Création zône achat (le tableau peut être caché):
 '<TR><TD vAlign="top" height="25">'+
 '<TABLE id="zoToBuy" class="tabloBody"  border="0" cellpadding="0" cellspacing="0" align="right"><TR>'+
  '<TD>'+
  '<TABLE class="tabloBody" border="0" cellpadding="0" cellspacing="0" height="100%"><TR>'+
  '<TD>'+
   '<TABLE class="tabloBody" border="0" cellpadding="0" cellspacing="0" height="100%"><TR>'+
    '<TD><INPUT type="text" id="zoQuanta" class="fiche_Qtt" maxLength="3" size="1" value='+countPart+' onkeyup="swSwitch(this,5,this.value)"></TD>'+
    '<TD><IMG src='+oImage[9]+' alt='+my_Text[10]+' class=urlOver id="minOne" '+
    'onmouseout="swSwitch(this,0,0)" onmouseup="swSwitch(this,2,0)" onmousedown="swSwitch(this,3,0)" onclick="swSwitch(this,4,-1)"></TD>'+
    '<TD><IMG src='+oImage[8]+' alt='+my_Text[9]+' class=urlOver id="addOne" '+
    'onmouseout="swSwitch(this,0,0)" onmouseup="swSwitch(this,2,0)" onmousedown="swSwitch(this,3,0)" onclick="swSwitch(this,4,+1)"></TD>'+    
   '</TR></TABLE>'+
  '</TD>'+
 '<td width="10"></td>'+ 
 '<TD align="right" noWrap>'+
 '<span id="goToBuy" class="url_Out" onclick=add2Buy(true)>'+my_Text[4]+'</span>&nbsp;</TD>'+ // texte ajouter au panier.
 '<td id="monCaddy" width="27" background='+oImage[15]+' align="right" '+ //  Image Caddy
 'onclick= "swImage(this,4,oPages[98],oFrame[6])"></td><td width="5"></td>'+
 '</TR></TABLE>'+
 '</TD>'+
'</TR></TABLE></form>';
//---
 writeFiche(oIndex, screenMod)
}
//
//--------------------------------------------------------------------------------------------------------------------- Ecriture données carte
function writeFiche(idxFiche, screenMod){// Affichage et mise à jour contenu des pages en fonction du menu et fichier annexes
//
 oFiche = dataFiche[idxFiche];
 oTitre = oFiche[1][1]; //--- Titre.
 oLocat = oFiche[2][1]; //--- URL Page.
 oWords = oFiche[3][1]; //--- Keywords.
 oInfos = oFiche[4][1]; //--- Descriptif.
 oProds = oFiche[5][1]; //--- Référence.  
 oNotes = oFiche[6][1]; //--- Commentaires.
 oParts = oProds.split("<br>"); //--- Référence.
// Préparation tableau des références
 var oCombo = '<select id="partSelect" onChange="on_Select('+idxFiche+', this.selectedIndex)">'+
              '<option selected value='+my_Text[2]+'>'+my_Text[3]+'</option></select>';//onChange="swSelect(this.value)"
//---  Ecriture barre d'état.
 _statusBar.className= "flash02"; 
 _statusBar.innerHTML= oTitre + ': ' + oWords;
//--- Ecriture zone Description, références, tarifs, commentaires.
 switch(screenMod){
  case 0: // Affichage mode infos sans bouton "Fermer"
   document.getElementById("zoTitre").innerHTML= oTitre//--- Affichage titre   
   document.getElementById("zoInfos").innerHTML= oInfos;
   document.getElementById("zoNotes").innerHTML= oNotes;
   document.getElementById("zoWindo").style.visibility = "hidden";
   document.getElementById("zoCodes").style.visibility = "hidden";
   document.getElementById("zoToBuy").style.visibility = "hidden";    
  break;
  case 1: // Affichage mode infos avec bouton "Fermer"
   document.getElementById("zoTitre").innerHTML= oTitre//--- Affichage titre    
   document.getElementById("zoInfos").innerHTML= oInfos;
   document.getElementById("zoNotes").innerHTML= oNotes;
   document.getElementById("zoCodes").style.visibility = "hidden";
   document.getElementById("zoToBuy").style.visibility = "hidden";    
  break;
  case 2:
   document.getElementById("zoTitre").innerHTML= oTitre//--- Affichage titre    
   document.getElementById("zoInfos").innerHTML= oInfos;
   document.getElementById("zoNotes").innerHTML= oNotes;
//--- Liste des références:
   document.getElementById("zoParts").innerHTML= oCombo;
   _partList = document.getElementById("partSelect"); 
   _zoQuanta = document.getElementById("zoQuanta");
   _monCaddy = document.getElementById("monCaddy");
//---   
  for(i=0; i<oParts.length; i++){
   var idx = i + 1;
   var textParts = oParts[i].split("|");
   var newOption = document.createElement("option" );
//
   newOption.setAttribute("value", oParts[i]);
   newOption.appendChild(document.createTextNode(idx + ". " + textParts[0]));
   _partList.insertBefore(newOption);
   }
  break; 
 }
}
//
//--------------------------------------------------------------------------------------------------------------------- 
function on_Select(idxFiche, idxLigne){
 _zoQuanta.value= 0;  
 idx_Parts = idxLigne;
//
 oFiche = dataFiche[idxFiche];
 oTitre = oFiche[1][1]; //--- Titre.
 oLocat = oFiche[2][1]; //--- URL Page.
 oWords = oFiche[3][1]; //--- Keywords.
 oInfos = oFiche[4][1]; //--- Descriptif.
 oProds = oFiche[5][1]; //--- Référence.  
 oNotes = oFiche[6][1]; //--- Commentaires. 
// 
 swPart = document.getElementById("partSelect").options(idxLigne).value; //oIndex;
 swLine = swPart.split("|"); 
//
  monPanier[0][0]= idxFiche;                              // Index Fiche
  monPanier[0][1]= idxLigne;                              // Index article
  monPanier[0][2]= oTitre + swLine[0];                    // Désignation
  monPanier[0][3]= swLine[1];                             // Réference dde commande
  monPanier[0][4]= Number(swLine[2].replace(reg_Alfa,""));// Prix //"0.00"
  monPanier[0][5]= 0;                                     // Quantité - est ajouté dans swSwitch();
 document.getElementById("zoFlash").innerHTML = swLine[0] + " / " + swLine[2] ;
}
//
//--------------------------------------------------------------------------------------------------------------------- 
function swSwitch(oObjet, oMode, oValue){// Action sur les boutons de la fiche.
// oLine: id de Ligne sélectionnée // 
 var imageRoot = skin_Theme +"icones/" + oObjet.id;
//
 switch(oMode){
 case 0: break;// 0=Out
 case 1: oObjet.className = "buyOver"; break;// 1=Over
 case 2: oObjet.src= imageRoot +"0.png"; break;// 2=Up
 case 3: oObjet.src= imageRoot +"3.png"; break;// 3=Down
//
 case 4:// 4 = onClick
  if(idx_Parts==0){alert(my_Text[6]); break;}// Aucune référence de sélectionnée...
  countPart= Number(_zoQuanta.value) + oValue;
  if(countPart<=0){
   Actif= false; countPart=0;
   _zoQuanta.value= countPart; monPanier[0][5]= countPart;    
   document.getElementById("goToBuy").className="url_Out";
  } else{
   Actif= true; add2Buy(false);
   _zoQuanta.value= countPart; monPanier[0][5]= countPart;
   document.getElementById("goToBuy").className="buyOver";
   }; break;
//
 case 5:// 5 = onChange
  if(idx_Parts==0){alert(my_Text[6]); break;}// Aucune référence de sélectionnée...
  countPart= Number(_zoQuanta.value);
  if(countPart<=0){
   Actif= false; countPart=0;
   _zoQuanta.value = countPart;
   monPanier[0][5] = countPart;    
   document.getElementById("goToBuy").className="url_Out";
  } else{
   Actif= true;
   add2Buy(false);
   _zoQuanta.value = countPart;
   monPanier[0][5] = countPart;    
   document.getElementById("goToBuy").className="buyOver";
   }; break;
 }
}
//
//--------------------------------------------------------------------------------------------------------------------- 
function swImage(oObjet,oMode,oPage,oWhere){//Actions sur les images de la fiche.
 switch(oMode){
 case 0: oObjet.className= "url_Out"; break;
 case 1: oObjet.className= "urlOver"; break;
 case 2: break;
 case 3: break;
 case 4: openPage(98,10,1); //(openMode) 
 break;
}}
//
//--------------------------------------------------------------------------------------------------------------------- 
function swSelect(oValue){// Actions sur les selecteurs de la fiche.
 oValue= Number(oValue);
 layTip.style.left= -500;
 var charScr, varTxt, varStr="0123456789.";
//--- Ecriture zône Prix:
 oResult= '<span class='+flash02+'>'+oTexte[6][0]+' :</span>';
 oResult=oResult.concat('<br>',lignes_Prix[oValue]); zoTarif.innerHTML= oResult
//--- Extraction données numériques.
 varTxt= zoPrix.innerHTML
 for (i=0; i< varTxt.length; i++){
  charScr= varTxt.charAt(i);
  ((charScr==",")?charScr=".":"")
  for (j=0;j< varStr.length; j++){
   //((charScr== varStr.charAt(j))? = oPrix.concat(charScr):'')
  }
 }
//--- Comparaison avec le panier.
 oSelect= refPart.options(oValue).innerText 
 idx= oPanier.length
 for(i=1; i<idx; i++){
 if(monPanier[i][3]== oSelect){
  layTip.style.top = top.screenHaut-170
  layTip.style.left= top.screenLarg/2-200
  layTip.innerHTML =
   ' Votre panier contient déjà: '+monPanier[i][5]+' fois cette référence, '+
   'les prochains ajouts seront totalisés avec votre commande actuelle...'
 }
}
zoQuanta.select()
}
//--------------------------------------------------------------------------------------------------------------------- Fin des porocédures