// attention, pour chaque nom de gamme, il faut une variable et un champ dans le formulaire "texture" de la page 'frontoffice/templates/top.html' et 'frontoffice/templates/topUK.html'
tabTexture = new Array();
tabTexture["Excellence"] = "corps";
tabTexture["Prestige"] = "jupe";
tabTexture["Autres"] = "autre";
tabTexture["Coiffe/GPI"] = "coiffe";
tabTexture["Extra"] = "extra";

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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_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_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;
}

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_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
 
 // Change la couleur des lignes d'un tableau
 function setPointer(theRow, thePointerColor)
 {
  if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
   return false;
  }
  if (typeof(document.getElementsByTagName) != 'undefined') {
   var theCells = theRow.getElementsByTagName('td');
  }
  else if (typeof(theRow.cells) != 'undefined') {
   var theCells = theRow.cells;
  }
  else {
   return false;
  }
 
  var rowCellsCnt  = theCells.length;
  for (var c = 0; c < rowCellsCnt; c++) {
   theCells[c].style.backgroundColor = thePointerColor;
  }
 
  return true;
 }

 //recupération des info du navigateur
function getNavigateur()
{
	// Récupération des infos du navigateur
	var N=navigator.appName; var V=navigator.appVersion;
	var version="?"; var nom=N; var os="?"; var langue="?";
	if (N=="Microsoft Internet Explorer") 
	{
		langue=navigator.systemLanguage
		version=V.substring(V.indexOf("MSIE",0)+5,V.indexOf(";",V.indexOf("MSIE",0)));
		if (V.indexOf("Win",0)>0) 
		{
			if ( V.indexOf(";",V.indexOf("Win",0)) > 0 ) 
			{
				os=V.substring(V.indexOf("Win",0),V.indexOf(";",V.indexOf("Win",0)));
			} else 
			{
				os=V.substring(V.indexOf("Win",0),V.indexOf(")",V.indexOf("Win",0)));
			}
		}
		if (V.indexOf("Mac",0)>0) 
		{
			os="Macintosh";
			version=V.substring(V.indexOf("MSIE",0)+6,V.indexOf(" ",V.indexOf("MSIE",0)));
		}
	}
	if (N=="Netscape") 
	{
		langue=navigator.systemLanguage
		version=(V.substring(0,V.indexOf("(",0)));
		if (V.indexOf("Mac",0)>0) 
		{
			os="Macintosh";
		}
		if (V.indexOf("Linux",0)>0) 
		{
			os="Linux";
		}
		if (V.indexOf("Win",0)>0) 
		{
			os=V.substring(V.indexOf("Win",0),V.indexOf(";",V.indexOf("Win",0)));
		}
		if (version==5) 
		{
			version="6.0"
		}
	}
	return (nom+"#"+version.substr(0,3)+"#"+os+"#"+langue)
}

//gestion de l'ecrasement d'un fichier uploader
function confirmationEcrase(listefichier, formu, champPhoto)
{
	var champ = champPhoto.name;
	var lstFichier = listefichier.split("#");
	var champPhoto = champPhoto.value;
	var lspPhoto = champPhoto.split("\\");
	var taille = lspPhoto.length;
	
	photo = lspPhoto[taille -1];
	for (i=0; i<lstFichier.length; i++)
	{
		if (lstFichier[i] == photo)
		{
			rep = confirm('Voulez vous remplacer la photo : ' + photo + ' ?');
			if (rep == true)
			{
				document.forms[formu].elements['ecraseFichier'+champ].value="true";
			}
			else
			{
				document.forms[formu].elements['ecraseFichier'+champ].value="false";
			}
		}
	}
	return true;
}

// Confirmation de suppression de tbl_liquide
function confirmSupprTbl_liquide(idliquide)
{
	if (confirm("Etes-vous sûr de vouloir supprimer ce liquide ?"))
	{
		var test = getNavigateur();
		if (test.indexOf("Mac",0)>0)
		{
			document.write("<form name=\"confirmSupprTbl_liquide\" action=\"gestiontbl_liquide.php\" method=\"GET\"");
			document.write("<input type=\"hidden\" name=\"action\" value=\"delete\">");
			document.write("<input type=\"hidden\" name=\"idliquide\" value= \"" + idliquide + "\">");
			document.write("</form>");
			document.confirmSupprTbl_liquide.submit();
		}
		else
		{
			document.location.href = "gestiontbl_liquide.php?action=delete&idliquide="+idliquide;
		}
	}
	else
	{
		alert("Demande de suppression annulée !");
	}
}

// Confirmation de suppression de tbl_gamme
function confirmSupprTbl_gamme(idgamme)
{
	if (confirm("Etes-vous sûr de vouloir supprimer cette gamme ?"))
	{
		var test = getNavigateur();
		if (test.indexOf("Mac",0)>0)
		{
			document.write("<form name=\"confirmSupprTbl_gamme\" action=\"gestiontbl_gamme.php\" method=\"GET\"");
			document.write("<input type=\"hidden\" name=\"action\" value=\"delete\">");
			document.write("<input type=\"hidden\" name=\"idgamme\" value= \"" + idgamme + "\">");
			document.write("</form>");
			document.confirmSupprTbl_gamme.submit();
		}
		else
		{
			document.location.href = "gestiontbl_gamme.php?action=delete&idgamme="+idgamme;
		}
	}
	else
	{
		alert("Demande de suppression annulée !");
	}
}

// Confirmation de suppression de tbl_bouteille
function confirmSupprTbl_bouteille(idbout)
{
	if (confirm("Etes-vous sûr de vouloir supprimer cette bouteille?"))
	{
		var test = getNavigateur();
		if (test.indexOf("Mac",0)>0)
		{
			document.write("<form name=\"confirmSupprTbl_bouteille\" action=\"gestiontbl_bouteille.php\" method=\"GET\"");
			document.write("<input type=\"hidden\" name=\"action\" value=\"delete\">");
			document.write("<input type=\"hidden\" name=\"idbout\" value= \"" + idbout + "\">");
			document.write("</form>");
			document.confirmSupprTbl_bouteille.submit();
		}
		else
		{
			document.location.href = "gestiontbl_bouteille.php?action=delete&idbout="+idbout;
		}
	}
	else
	{
		alert("Demande de suppression annulée !");
	}
}

// Confirmation de suppression de tbl_bouchon
function confirmSupprTbl_bouchon(idbouch)
{
	if (confirm("Etes-vous sûr de vouloir supprimer ce bouchon ?"))
	{
		var test = getNavigateur();
		if (test.indexOf("Mac",0)>0)
		{
			document.write("<form name=\"confirmSupprTbl_bouchon\" action=\"gestiontbl_bouchon.php\" method=\"GET\"");
			document.write("<input type=\"hidden\" name=\"action\" value=\"delete\">");
			document.write("<input type=\"hidden\" name=\"idbouch\" value= \"" + idbouch + "\">");
			document.write("</form>");
			document.confirmSupprTbl_bouchon.submit();
		}
		else
		{
			document.location.href = "gestiontbl_bouchon.php?action=delete&idbouch="+idbouch;
		}
	}
	else
	{
		alert("Demande de suppression annulée !");
	}
}

function confirmSupprBase(file)
// Confirmation de suppression d'un fichier de base de donnée
{
	if (confirm("Etes-vous sûr de vouloir supprimer ce fichier ?"))
	{
		var test = getNavigateur();
		if (test.indexOf("Mac",0)>0)
		{
			document.write("<form name=\"confirmSupprBase\" action=\"gestionsauvegarde.php\" method=\"GET\"");
			document.write("<input type=\"hidden\" name=\"action\" value=\"delete\">");
			document.write("<input type=\"hidden\" name=\"file\" value= \"" + file + "\">");
			document.write("</form>");
			document.confirmSupprBase.submit();
		}
		else
		{
			document.location.href = "gestionsauvegarde.php?action=delete&file="+file;
		}
	}
	else
	{
		alert("Demande de suppression annulée !");
	}
}

function confirmSupprTbl_type(idtype)
// Confirmation de suppression de tbl_type
{
	if (confirm("Etes-vous sûr de vouloir supprimer ce type ?"))
	{
		var test = getNavigateur();
		if (test.indexOf("Mac",0)>0)
		{
			document.write("<form name=\"confirmSupprTbl_type\" action=\"gestiontbl_type.php\" method=\"GET\"");
			document.write("<input type=\"hidden\" name=\"action\" value=\"delete\">");
			document.write("<input type=\"hidden\" name=\"idtype\" value= \"" + idtype + "\">");
			document.write("</form>");
			document.confirmSupprTbl_type.submit();
		}
		else
		{
			document.location.href = "gestiontbl_type.php?action=delete&idtype="+idtype;
		}
	}
	else
	{
		alert("Demande de suppression annulée !");
	}
}

function confirmSupprTbl_contact(ctc_id)
// Confirmation de suppression de tbl_contact
{
	if (confirm("Etes-vous sûr de vouloir supprimer ce tbl_contact ?"))
	{
		var test = getNavigateur();
		if (test.indexOf("Mac",0)>0)
		{
			document.write("<form name=\"confirmSupprTbl_contact\" action=\"gestiontbl_contact.php\" method=\"GET\"");
			document.write("<input type=\"hidden\" name=\"action\" value=\"delete\">");
			document.write("<input type=\"hidden\" name=\"ctc_id\" value= \"" + ctc_id + "\">");
			document.write("</form>");
			document.confirmSupprTbl_contact.submit();
		}
		else
		{
			document.location.href = "gestiontbl_contact.php?action=delete&ctc_id="+ctc_id;
		}
	}
	else
	{
		alert("Demande de suppression annulée !");
	}
}

function confirmSupprTbl_famille(idfamille)
// Confirmation de suppression de tbl_famille
{
	if (confirm("Etes-vous sûr de vouloir supprimer cette famille ?"))
	{
		var test = getNavigateur();
		if (test.indexOf("Mac",0)>0)
		{
			document.write("<form name=\"confirmSupprTbl_famille\" action=\"gestiontbl_famille.php\" method=\"GET\"");
			document.write("<input type=\"hidden\" name=\"action\" value=\"delete\">");
			document.write("<input type=\"hidden\" name=\"idfamille\" value= \"" + idfamille + "\">");
			document.write("</form>");
			document.confirmSupprTbl_famille.submit();
		}
		else
		{
			document.location.href = "gestiontbl_famille.php?action=delete&idfamille="+idfamille;
		}
	}
	else
	{
		alert("Demande de suppression annulée !");
	}
}

function confirmSupprTbl_fiche_produit(idficheproduit)
// Confirmation de suppression de tbl_fiche_produit
{
	if (confirm("Etes-vous sûr de vouloir supprimer cette fiche_produit ?"))
	{
		var test = getNavigateur();
		if (test.indexOf("Mac",0)>0)
		{
			document.write("<form name=\"confirmSupprTbl_fiche_produit\" action=\"gestiontbl_fiche_produit.php\" method=\"GET\"");
			document.write("<input type=\"hidden\" name=\"action\" value=\"delete\">");
			document.write("<input type=\"hidden\" name=\"idficheproduit\" value= \"" + idficheproduit + "\">");
			document.write("</form>");
			document.confirmSupprTbl_fiche_produit.submit();
		}
		else
		{
			document.location.href = "gestiontbl_fiche_produit.php?action=delete&idficheproduit="+idficheproduit;
		}
	}
	else
	{
		alert("Demande de suppression annulée !");
	}
}

function confirmSupprTbl_news(idnews)
// Confirmation de suppression de tbl_news
{
	if (confirm("Etes-vous sûr de vouloir supprimer cette news ?"))
	{
		var test = getNavigateur();
		if (test.indexOf("Mac",0)>0)
		{
			document.write("<form name=\"confirmSupprTbl_news\" action=\"gestiontbl_news.php\" method=\"GET\"");
			document.write("<input type=\"hidden\" name=\"action\" value=\"delete\">");
			document.write("<input type=\"hidden\" name=\"idnews\" value= \"" + idnews + "\">");
			document.write("</form>");
			document.confirmSupprTbl_news.submit();
		}
		else
		{
			document.location.href = "gestiontbl_news.php?action=delete&idnews="+idnews;
		}
	}
	else
	{
		alert("Demande de suppression annulée !");
	}
}

function confirmSupprTbl_accueil(acc_id)
// Confirmation de suppression de tbl_accueil
{
	if (confirm("Etes-vous sûr de vouloir supprimer ce tbl_accueil ?"))
	{
		var test = getNavigateur();
		if (test.indexOf("Mac",0)>0)
		{
			document.write("<form name=\"confirmSupprTbl_accueil\" action=\"gestiontbl_accueil.php\" method=\"GET\"");
			document.write("<input type=\"hidden\" name=\"action\" value=\"delete\">");
			document.write("<input type=\"hidden\" name=\"acc_id\" value= \"" + acc_id + "\">");
			document.write("</form>");
			document.confirmSupprTbl_accueil.submit();
		}
		else
		{
			document.location.href = "gestiontbl_accueil.php?action=delete&acc_id="+acc_id;
		}
	}
	else
	{
		alert("Demande de suppression annulée !");
	}
}

function confirmSupprTbl_diaporamaPages(iddiaporamaPages,idpage)
// Confirmation de suppression de tbl_fiche_produit
{
	if (confirm("Etes-vous sûr de vouloir supprimer cette diapo ?"))
	{
		var test = getNavigateur();
		if (test.indexOf("Mac",0)>0)
		{
			document.write("<form name=\"confirmSupprTbl_diaporamaPages\" action=\"gestiontbl_diaporamaPages.php\" method=\"GET\"");
			document.write("<input type=\"hidden\" name=\"action\" value=\"delete\">");
			document.write("<input type=\"hidden\" name=\"iddiaporamaPages\" value= \"" + iddiaporamaPages + "\">");
			document.write("<input type=\"hidden\" name=\"idpage\" value= \"" + idpage + "\">");
			document.write("</form>");
			document.confirmSupprTbl_diaporamaPages.submit();
		}
		else
		{
			document.location.href = "gestiontbl_diaporamaPages.php?action=delete&iddiaporamaPages="+iddiaporamaPages+"&idpage="+idpage;
		}
	}
	else
	{
		alert("Demande de suppression annulée !");
	}
}


function mouseOver() {
   // pour IE affiche ou masque l'élément <ul> (le 1er) contenu dans l'objet "obj"
	this.className='on';
	if (document.all) {	   
       UL = this.getElementsByTagName('ul');
       if (UL.length > 0) {
           sousMenu = UL[0].style;
           if (sousMenu.display == 'none' || sousMenu.display == '') {
               sousMenu.display = 'block';
           }
       }
   }
}

function mouseOut() {
   // pour IE affiche ou masque l'élément <ul> (le 1er) contenu dans l'objet "obj"
	this.className='';
	if (document.all) {
       
       UL = this.getElementsByTagName('ul');
       if (UL.length > 0) {
           sousMenu = UL[0].style;
           if (sousMenu.display && sousMenu.display != 'none') {
               sousMenu.display = 'none';
           }
       }
   }
}

function setHover(id) {
   // affecte une fonction (hover) à tous les éléments <li> de la page
   obj = document.getElementById(id);
   if (obj)
   {
	   LI = obj.getElementsByTagName('li');
	   nLI = LI.length;
	   for (i=0; i < nLI; i++) {

		   LI[i].onmouseover = mouseOver;
		   LI[i].onmouseout = mouseOut;
	   }
   }
}
function loadingBehaviour(){
	setHover("navig");
	setHover("menu");		
}
if (document.all) window.attachEvent("onload", loadingBehaviour);


/*function setMenu(element){
	
		element.hover(
		function(){ 
			var uls = jQuery('> ul', this);
			uls.show();
			jQuery(this).addClass('hover');
		}, 
		function(){ 
			var uls = jQuery('> ul', this);
			uls.hide();
			jQuery(this).removeClass('hover');
		}
	);
}

jQuery(document).ready(function(){
	


	setMenu(jQuery('.menu li'));
		
	var uls = jQuery('> ul', '.menu li');
	uls.hide();
	
});
*/