var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

if (document.images) 
{
cnst1on = new Image(); cnst1on.src = "images/produits_on2.gif"; 
cnst1off = new Image(); cnst1off.src = "images/produits_off2.gif";
eng_cnst1on = new Image(); eng_cnst1on.src = "images/eng_produits_on.gif"; 
eng_cnst1off = new Image(); eng_cnst1off.src = "images/eng_produits_off.gif";
ger_cnst1on = new Image(); ger_cnst1on.src = "images/ger_produits_on.gif"; 
ger_cnst1off = new Image(); ger_cnst1off.src = "images/ger_produits_off.gif";
spa_cnst1on = new Image(); spa_cnst1on.src = "images/spa_produits_on.gif"; 
spa_cnst1off = new Image(); spa_cnst1off.src = "images/spa_produits_off.gif";

cnst2on = new Image(); cnst2on.src = "images/programmes_on2.gif";
cnst2off = new Image(); cnst2off.src = "images/programmes_off2.gif";
eng_cnst2on = new Image(); eng_cnst2on.src = "images/eng_programmes_on.gif";
eng_cnst2off = new Image(); eng_cnst2off.src = "images/eng_programmes_off.gif";
ger_cnst2on = new Image(); ger_cnst2on.src = "images/ger_programmes_on.gif";
ger_cnst2off = new Image(); ger_cnst2off.src = "images/ger_programmes_off.gif";
spa_cnst2on = new Image(); spa_cnst2on.src = "images/spa_programmes_on.gif";
spa_cnst2off = new Image(); spa_cnst2off.src = "images/spa_programmes_off.gif";

cnst3on = new Image(); cnst3on.src = "images/dietetique_on2.gif";
cnst3off = new Image(); cnst3off.src = "images/dietetique_off2.gif";
eng_cnst3on = new Image(); eng_cnst3on.src = "images/eng_dietetique_on.gif";
eng_cnst3off = new Image(); eng_cnst3off.src = "images/eng_dietetique_off.gif";
ger_cnst3on = new Image(); ger_cnst3on.src = "images/ger_dietetique_on.gif";
ger_cnst3off = new Image(); ger_cnst3off.src = "images/ger_dietetique_off.gif";
spa_cnst3on = new Image(); spa_cnst3on.src = "images/spa_dietetique_on.gif";
spa_cnst3off = new Image(); spa_cnst3off.src = "images/spa_dietetique_off.gif";

cnst4on = new Image(); cnst4on.src = "images/partenariat_on.gif";
cnst4off = new Image(); cnst4off.src = "images/partenariat_off.gif";

cnst5on = new Image(); cnst5on.src = "images/trouver_on2.gif";
cnst5off = new Image(); cnst5off.src = "images/trouver_off2.gif";
eng_cnst5on = new Image(); eng_cnst5on.src = "images/eng_trouver_on.gif";
eng_cnst5off = new Image(); eng_cnst5off.src = "images/eng_trouver_off.gif";
ger_cnst5on = new Image(); ger_cnst5on.src = "images/ger_trouver_on.gif";
ger_cnst5off = new Image(); ger_cnst5off.src = "images/ger_trouver_off.gif";
spa_cnst5on = new Image(); spa_cnst5on.src = "images/spa_trouver_on.gif";
spa_cnst5off = new Image(); spa_cnst5off.src = "images/spa_trouver_off.gif";

cnst6on = new Image(); cnst6on.src = "images/dietetique_on.gif";
cnst6off = new Image(); cnst6off.src = "images/dietetique_off.gif";

cnst7on = new Image(); cnst7on.src = "images/programme_on.gif";
cnst7off = new Image(); cnst7off.src = "images/programme_off.gif";

cnst8on = new Image(); cnst8on.src = "images/produit_on.gif";
cnst8off = new Image(); cnst8off.src = "images/produit_off.gif";

cnst9on = new Image(); cnst9on.src = "images/espace_on.gif";
cnst9off = new Image(); cnst9off.src = "images/espace_off.gif";

cnst10on = new Image(); cnst10on.src = "images/partenariat_on.gif";
cnst10off = new Image(); cnst10off.src = "images/partenariat_off.gif";

cnst11on = new Image(); cnst11on.src = "images/trouver_on.gif";
cnst11off = new Image(); cnst11off.src = "images/trouver_off.gif";

cnst12on = new Image(); cnst12on.src = "images/recrutement_on.gif";
cnst12off = new Image(); cnst12off.src = "images/recrutement_off.gif";

cnst13on = new Image(); cnst13on.src = "images/german_on.gif";
cnst13off = new Image(); cnst13off.src = "images/german_off.gif";

cnst14on = new Image(); cnst14on.src = "images/presse_on.gif";
cnst14off = new Image(); cnst14off.src = "images/presse_off.gif";

cnst15on = new Image(); cnst15on.src = "images/english_on.gif";
cnst15off = new Image(); cnst15off.src = "images/english_off.gif";

cnst16on = new Image(); cnst16on.src = "images/francais_on.gif";
cnst16off = new Image(); cnst16off.src = "images/francais_off.gif";
}

function changeImages() 
{
  if (document.images) 
  {
    for (var i=0; i<changeImages.arguments.length; i+=2) 
	{ 
      document.images[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src"); 
	}
  }
}

function openWindow(name, url, width, height)
{
	var wnd = window.open(url, name, "status=no,scrollbars=no,menubar=no,toolbar=no,height="+height+",width="+width);
	return wnd;
}

function trim(str)
{
   if (str == null) return str;
   return str.replace(/^\s+/,"").replace(/\s+$/,"");
}

function IsNumeric(str)
{
   var objRegExp = new RegExp("^\\d+$");
   return objRegExp.test(str);
}

function recalcPanier(form)
{
	if (checkPanier(form))
	{
		form.action = "panier.php?update=1";
		form.submit();
	}	
}

function int_recalcPanier(form)
{
	if (checkIntPanier(form))
	{
		form.action = "int_panier.php?update=1";
		form.submit();
	}	
}

function deleteProduitPanier(form, nameProduit)
{
	for (i = 0; i < form.elements.length; i++)
	{
		var element = form.elements[i];
		if (element.name == nameProduit)
		{
			element.value = 0;
			break;
		}
	}	
	form.action = "panier.php?update=1";
	form.submit();
}

function int_deleteProduitPanier(form, nameProduit)
{
	for (i = 0; i < form.elements.length; i++)
	{
		var element = form.elements[i];
		if (element.name == nameProduit)
		{
			element.value = 0;
			break;
		}
	}	
	form.action = "int_panier.php?update=1";
	form.submit();
}

function checkPanier(form)
{
	var PREFIXE_PRODUIT = "cap";
	for (i = 0; i < form.elements.length; i++)
	{
		var element = form.elements[i];
		if (element.name.substring(0,3) == PREFIXE_PRODUIT)
		{
			if (!IsNumeric(element.value))
			{
				alert("Quantité invalide ! Saisissez de nouveau la quantité voulue.");
				element.focus();
				return false;
			}
		}
	}
	return true;
}

function checkIntPanier(form)
{
	var PREFIXE_PRODUIT = "cap";
	for (i = 0; i < form.elements.length; i++)
	{
		var element = form.elements[i];
		if (element.name.substring(0,3) == PREFIXE_PRODUIT)
		{
			if (!IsNumeric(element.value))
			{
				alert("Invalid quantity format !");
				element.focus();
				return false;
			}
		}
	}
	return true;
}

function checkAddProduit(form)
{
	var PREFIXE_PRODUIT = "cap";
	var qte = 0;
	for (i = 0; i < form.elements.length; i++)
	{
		var element = form.elements[i];
		if (element.name.substring(0,3) == PREFIXE_PRODUIT)
		{
			if (!IsNumeric(element.value))
			{
				alert("Quantité invalide ! Saisissez de nouveau la quantité voulue.");
				element.focus();
				return false;
			}
			qte += element.value;
		}			
	}
	if (qte == 0)
	{
		alert("Quantités vides ! Saisissez au minimum une quantité pour ajouter ce produit à votre panier.");
		form.elements[0].focus();
		return false;
	}
	return true;
}

function checkIntAddProduit(form)
{
	var PREFIXE_PRODUIT = "cap";
	var qte = 0;
	for (i = 0; i < form.elements.length; i++)
	{
		var element = form.elements[i];
		if (element.name.substring(0,3) == PREFIXE_PRODUIT)
		{
			if (!IsNumeric(element.value))
			{
				alert("Invalid quantity format !");
				element.focus();
				return false;
			}
			qte += element.value;
		}			
	}
	if (qte == 0)
	{
		alert("No quantity entered ! Please precise the quantity of product you want to add to your basket.");
		form.elements[0].focus();
		return false;
	}
	return true;
}

function checkEmail(email) 
{
	var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
	var regex = new RegExp(emailReg);
	if (!regex.test(email.value))
	{
		alert("Adresse e-mail vide ou invalide ! Saisissez de nouveau votre e-mail.");
		email.focus();
		return false;
	}
	return true;
}

function checkIntEmail(email) 
{
	var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
	var regex = new RegExp(emailReg);
	if (!regex.test(email.value))
	{
		alert("The e-mail address you entered appears to be incorrect. Please fill in correctly the e-mail address.");
		email.focus();
		return false;
	}
	return true;
}

function checkInfoClient(form)
{
	if (trim(form.nom.value).length == 0)
	{
		alert("Nom obligatoire !");
		form.nom.focus();
		return false;
	}
	if (trim(form.prenom.value).length == 0)
	{
		alert("Prénom obligatoire !");
		form.prenom.focus();
		return false;
	}
	if (trim(form.adresse.value).length == 0)
	{
		alert("Adresse obligatoire !");
		form.adresse.focus();
		return false;
	}
	if (trim(form.cp.value).length == 0)
	{
		alert("Code postal obligatoire !");
		form.cp.focus();
		return false;
	}
	if (trim(form.ville.value).length == 0)
	{
		alert("Ville obligatoire !");
		form.ville.focus();
		return false;
	}
	if (trim(form.pays.value) == 0)
	{
		alert("Pays obligatoire !");
		form.pays.focus();
		return false;
	}	
	var bSport = false;
	for (var i=0; i<form.elements['sport'].length; i++)
	{
		if (form.elements['sport'][i].checked == true)
		{
			bSport = true;
			break;
		}
	}
	if (bSport == false)
	{
		alert("Sport principal pratiqué obligatoire !");
		return false;
	}	
	return true;
}

function checkIntInfoClient(form)
{
	if (trim(form.nom.value).length == 0)
	{
		alert("Please fill in name");
		form.nom.focus();
		return false;
	}
	if (trim(form.prenom.value).length == 0)
	{
		alert("Please fill in first name");
		form.prenom.focus();
		return false;
	}
	if (trim(form.adresse.value).length == 0)
	{
		alert("Please fill in address");
		form.adresse.focus();
		return false;
	}
	if (trim(form.cp.value).length == 0)
	{
		alert("Please fill in post code");
		form.cp.focus();
		return false;
	}
	if (trim(form.ville.value).length == 0)
	{
		alert("Please fill in town/city");
		form.ville.focus();
		return false;
	}
	if (trim(form.pays.value) == 0)
	{
		alert("Please fill in country");
		form.pays.focus();
		return false;
	}	
	var bSport = false;
	for (var i=0; i<form.elements['sport'].length; i++)
	{
		if (form.elements['sport'][i].checked == true)
		{
			bSport = true;
			break;
		}
	}
	if (bSport == false)
	{
		alert("Please select practiced sport");
		return false;
	}	
	return true;
}

function checkPassword(password)
{
	if (trim(password.value).length == 0)
	{
		alert("Champ obligatoire !");
		password.focus();
		return false;
	}
	if (trim(password.value).length < 4)
	{
		alert("Votre mot de passe doit avoir au moins 4 caractères !");
		password.focus();
		return false;
	}
	return true;
}

function checkIntPassword(password)
{
	if (trim(password.value).length == 0)
	{
		alert("Please fill in the required password.");
		password.focus();
		return false;
	}
	if (trim(password.value).length < 4)
	{
		alert("Your password must have at least 4 characters !");
		password.focus();
		return false;
	}
	return true;
}

function checkSaisiePassword(form)
{
	if (!checkPassword(form.password)) return false;
	if (!checkPassword(form.passwordbis)) return false;
	if (trim(form.passwordbis.value) != trim(form.password.value))
	{
		alert("Confirmation du mot de passe différente du mot de passe ! Saisissez de nouveau votre mot de passe et sa confirmation.");
		form.password.value = "";
		form.passwordbis.value = "";
		form.password.focus();
		return false;
	}
	return true;
}

function checkIntSaisiePassword(form)
{
	if (!checkIntPassword(form.password)) return false;
	if (!checkIntPassword(form.passwordbis)) return false;
	if (trim(form.passwordbis.value) != trim(form.password.value))
	{
		alert("Confirmation of your password is not equal to your filled in password ! Please fill in again your confirmation password.");
		form.password.value = "";
		form.passwordbis.value = "";
		form.password.focus();
		return false;
	}
	return true;
}

function checkQuestionReponse(form)
{
	if (trim(form.question.value).length == 0)
	{
		alert("Champ obligatoire !");
		form.question.focus();
		return false;
	}
	if (trim(form.reponse.value).length == 0)
	{
		alert("Champ obligatoire !");
		form.reponse.focus();
		return false;
	}
	return true;
}

function checkIntQuestionReponse(form)
{
	if (trim(form.question.value).length == 0)
	{
		alert("Please fill in question");
		form.question.focus();
		return false;
	}
	if (trim(form.reponse.value).length == 0)
	{
		alert("Please fill in answer");
		return false;
	}
	return true;
}

function checkSignIn(form)
{
	if (!checkEmail(form.email)) return false;
	if (!checkPassword(form.password)) return false;
	return true;
}

function checkIntSignIn(form)
{
	if (!checkIntEmail(form.email)) return false;
	if (!checkIntPassword(form.password)) return false;
	return true;
}

function checkModePaiement(form)
{
	if ((form.modepaiement[0].checked == false) && (form.modepaiement[1].checked == false))
	{
		alert("Précisez le mode de paiement souhaité !");
		return false;
	}	
	return true;
}

function checkCreateClient(form)
{
	if (!checkInfoClient(form)) return false;		
	if (!checkEmail(form.email)) return false;
	if (!checkSaisiePassword(form)) return false;
	if (!checkQuestionReponse(form)) return false;
	return true;
}

function checkIntCreateClient(form)
{
	if (!checkIntInfoClient(form)) return false;		
	if (!checkIntEmail(form.email)) return false;
	if (!checkIntSaisiePassword(form)) return false;
	if (!checkIntQuestionReponse(form)) return false;
	return true;
}

function checkUpdateClient(form)
{
	if (!checkInfoClient(form)) return false;		
	if (!checkQuestionReponse(form)) return false;
	return true;
}

function checkIntUpdateClient(form)
{
	if (!checkIntInfoClient(form)) return false;		
	if (!checkIntQuestionReponse(form)) return false;
	return true;
}

function checkUpdatePasswordClient(form)
{
	if (!checkPassword(form.oldpassword)) return false;
	if (!checkSaisiePassword(form)) return false;
	return true;
}

function checkIntUpdatePasswordClient(form)
{
	if (!checkIntPassword(form.oldpassword)) return false;
	if (!checkIntSaisiePassword(form)) return false;
	return true;
}

function checkJCMarathon(form)
{
	if ((form.sexe[0].checked == false) && (form.sexe[1].checked == false))
	{
		alert("Précisez si vous êtes un homme ou une femme !");
		return false;
	}	
	if ((form.jour.value == 0) || (form.mois.value == 0) || (form.annee.value == 0))
	{
		alert("Date de naissance obligatoire !");
		form.jour.focus();
		return false;
	}
	if (!checkInfoClient(form)) return false;		
	if (!checkEmail(form.email)) return false;
	if (form.reglement.checked != 1)
	{
		alert("Cliquez sur la case à cocher pour accepter le règlement du jeu concours !");
		form.reglement.focus();
		return false;
	}
	return true;
}

function checkOffreSpeciale(form)
{
	if ((form.choix1.checked == false) && (form.choix2.checked == false) && (form.choix3.checked == false))
	{
		alert("Vous devez choisir au moins une offre pour commander !");
		return false;
	}	
	if ((form.cadeau[0].checked == false) && (form.cadeau[1].checked == false) && (form.cadeau[2].checked == false))
	{
		alert("choisissez votre cadeau !");
		return false;
	}	
	return true;
}

function checkNewsletter(form) 
{
	if (!checkEmail(form.email)) return false;
	if (trim(form.nom.value).length == 0)
	{
		alert("Nom obligatoire !");
		form.nom.focus();
		return false;
	}
	if (trim(form.prenom.value).length == 0)
	{
		alert("Prénom obligatoire !");
		form.prenom.focus();
		return false;
	}
	var bSport = false;
	for (var i=0; i<form.elements['sport'].length; i++)
	{
		if (form.elements['sport'][i].checked == true)
		{
			bSport = true;
			break;
		}
	}
	if (bSport == false)
	{
		alert("Sport principal pratiqué obligatoire !");
		return false;
	}	
	return true;
}

function checkIntNewsletter(form) 
{
	if (!checkIntEmail(form.email)) return false;
	if (trim(form.nom.value).length == 0)
	{
		alert("Please fill in name");
		form.nom.focus();
		return false;
	}
	if (trim(form.prenom.value).length == 0)
	{
		alert("Please fill in first name");
		form.prenom.focus();
		return false;
	}
	var bSport = false;
	for (var i=0; i<form.elements['sport'].length; i++)
	{
		if (form.elements['sport'][i].checked == true)
		{
			bSport = true;
			break;
		}
	}
	if (bSport == false)
	{
		alert("Please select practiced sport");
		return false;
	}	
	return true;
}

function checkGeNewsletter(form) 
{
	if (trim(form.nom.value).length == 0)
	{
		alert("Nom obligatoire !");
		form.nom.focus();
		return false;
	}
	if (trim(form.prenom.value).length == 0)
	{
		alert("Prénom obligatoire !");
		form.prenom.focus();
		return false;
	}
	if (trim(form.nom1.value).length == 0)
	{
		alert("Nom de votre ami obligatoire !");
		form.nom1.focus();
		return false;
	}
	if (trim(form.prenom1.value).length == 0)
	{
		alert("Prénom de votre ami obligatoire !");
		form.prenom1.focus();
		return false;
	}
	if (!checkEmail(form.email1)) return false;
	return true;
}

function checkCode(form)
{
	if (trim(form.code.value).length == 0)
	{
		alert("Merci de saisir votre code promotionnel !");
		form.code.focus();
		return false;
	}
	return true;
}

function checkIntCode(form)
{
	if (trim(form.code.value).length == 0)
	{
		alert("Please enter a code !");
		form.code.focus();
		return false;
	}
	return true;
}

function randomNum(max) 
{
  var rNum=NaN
  while (isNaN(rNum)) 
  {
    rNum=Math.floor(Math.random()*(max))
  }
  return rNum;
}

function confirmation(msg)
{
	return confirm(msg);
}

function init() 
{
	if (document.all) 
	{
		var n=1;
		for(var j=1;j<=12;j++)
		{
			if (document.all['news'+j])
			{
				eval("document.all.news"+j+".style.display='none';");
			}
		}
		if (document.all.news1)
		{
			eval("document.all.news1.style.display='block';");		
		}
	}
	//rotateNewsImages();
	randomImage();
	rotateImage();
	swapNews(2, "#D0181F");
}

function rotateNewsImages() 
{
	for(var i=1;i<=5;i++) rotateNewsImg(i);
}

function rotateNewsImg(n) 
{
	var timeout = 15000;
	var timecst = 8000;
	var nbMaxImg = 29;
	var id = "ihome" + n;	
	var fct = "rotateNewsImg(" + n + ")";
	var num = randomNum(nbMaxImg+1);
	if (num == 0) num = 1;
	if (num > nbMaxImg) num = nbMaxImg;
	
	if (document.images[id].filters) 
	{
		document.images[id].style.filter="blendTrans(duration=5)";
		document.images[id].filters.blendTrans.Apply();
	}
	document.images[id].src = "images/bandeau/home" + num + ".gif";
	if (document.images[id].filters) document.images[id].filters.blendTrans.Play()


	var t = randomNum(timeout)+timecst;
	setTimeout(fct, t);
}


var tabPicNews = new Array();
tabPicNews[0] = 'news';
tabPicNews[1] = null;
tabPicNews[2] = null;
tabPicNews[3] = null;
tabPicNews[4] = null;
tabPicNews[5] = null;
tabPicNews[6] = null;
tabPicNews[7] = null;
tabPicNews[8] = null;
tabPicNews[9] = null;
tabPicNews[10] = null;
tabPicNews[11] = null;

var PicNews = new Array();
PicNews[0] = 'news';
PicNews[1] = '2news';
PicNews[2] = '3news';
PicNews[3] = '4news';
PicNews[4] = '5news';
PicNews[5] = '6news';
PicNews[6] = '7news';
PicNews[7] = '8news';
PicNews[8] = '9news';
PicNews[9] = '10news';
PicNews[10] = '11news';
PicNews[11] = '12news';

var j = 0;
var p = PicNews.length;

function randomImage()
{
	for (i = 1; i < tabPicNews.length; i++)
	{
		var contenu = null;
		var index = 0;
		do
		{
			do
			{
				index = randomNum(tabPicNews.length);
			} while (index == 0);				
			contenu = PicNews[index];
			if (contenu != null) PicNews[index] = null;		
		} while (contenu == null);
		tabPicNews[i] = contenu;
	}
}

function rotateImage() 
{
	var timecst = 6000;
	var fct = "rotateImage()";
	
	for (var i=1;i<=11;i++)
	{
		var id = "imgnews" + i;	
		var srcimg = tabPicNews[j] + i + ".jpg";	
		
		if (document.images[id])
		{
			if (document.images[id].filters) 
			{
				document.images[id].style.filter="blendTrans(duration=5)";
				document.images[id].filters.blendTrans.Apply();
			}
			document.images[id].src = "images/news/" + srcimg;
			if (document.images[id].filters) document.images[id].filters.blendTrans.Play()
		}
	}

	j = j + 1;
	if (j > (p-1)) j = 0;

	setTimeout(fct, timecst);
}

function initMenu(n)
{
	if (document.getElementById) 
	{
		for(var j=1;j<=n;j++)
		{
			var id = "menu" + j;
			var body = document.getElementById(id);
			if (body) body.style.display = "none";
		}
		var e = window.event;
		if (e) 
		{
			e.cancelBubble = true;
			if (e.stopPropagation) e.stopPropagation();
		}
	}
}

function swapMenu(n)
{
	if (document.getElementById) 
	{
		var id = "menu" + n;
		var body = document.getElementById(id);
		if (body)
		{
			if (body.style.display == "none")
			{
				body.style.display = "block";
			}
			else
			{
				body.style.display = "none";
			}
		}
		var e = window.event;
		if (e) 
		{
			e.cancelBubble = true;
			if (e.stopPropagation) e.stopPropagation();
		}
	}
}

var saveIndice = -1;
var saveCelColor = null;

function restoreColor(n, celcolor)
{
	if (document.all) 
	{
		eval("document.all.cnews"+n+".style.background='"+celcolor+"';");		
	} 
	else if (document.layers)
	{
		var ilayer = "inews" + n;
		var id = "cnewsl" + n;
		document.layers[ilayer].document.layers[id].bgColor = celcolor;		
	}
}

function swapNews(n, celcolor)
{
	if (saveIndice != -1) restoreColor(saveIndice, saveCelColor);
	saveIndice=n;
	saveCelColor = celcolor;
	if (document.all) 
	{
		eval("document.all.cnews"+n+".style.background='#000099';");		
		for(var j=1;j<=12;j++) 
		{
			if (document.all['news'+j]) eval("document.all.news"+j+".style.display='none';");
		}
		eval("document.all.news"+n+".style.display='block';");		
	}
	else if (document.layers)
	{
		var ilayer = "inews" + n;
		var id = "cnewsl" + n;
		document.layers[ilayer].document.layers[id].bgColor = "#000099";		
	}
}

function getposOffset(overlay, offsettype)
{
	var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
	var parentEl=overlay.offsetParent;
	while (parentEl!=null)
	{
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}

function overlay(curobj, subobjstr, opt_position)
{
	overlayclose('subcontent1');
	overlayclose('subcontent2');
	overlayclose('subcontent3');
	overlayclose('subcontent4');
	overlayclose('subcontent5');
	overlayclose('subcontent6');
	overlayclose('subcontent7');
	overlayclose('subcontent8');
	overlayclose('subcontent9');
	overlayclose('subcontent10');
	overlayclose('subcontent11');
	overlayclose('subcontent12');
	overlayclose('subcontent13');
	
	if (document.getElementById(subobjstr))
	{
		var subobj=document.getElementById(subobjstr);
		subobj.style.display=(subobj.style.display!="block")? "block" : "none";
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0);
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0);
		if (opt_position.indexOf("top") != -1) ypos -= subobj.offsetHeight;
		subobj.style.left=xpos+"px";
		subobj.style.top=ypos+"px";
		return false;
	}
	else
		return true;
}

function overlayclose(subobj)
{
	if (document.getElementById(subobj)) 
		document.getElementById(subobj).style.display="none";
}

function overlayopen(subobj)
{
	overlayclose('txtnav1');
	overlayclose('txtnav2');
	overlayclose('txtnav3');
	overlayclose('txtnav4');
	if (document.getElementById(subobj))
	{
		document.getElementById(subobj).style.display="block";
	}		
}

function overlayopen2(subobj)
{
	overlayclose('txtnav1');
	overlayclose('txtnav2');
	overlayclose('txtnav3');
	if (document.getElementById(subobj))
	{
		document.getElementById(subobj).style.display="block";
	}
	return false;
}

function activenav(subobj)
{
	inactivenav('nav1');
	inactivenav('nav2');
	inactivenav('nav3');
	inactivenav('nav4');
	if (document.getElementById(subobj))
	{
		document.getElementById(subobj).style.backgroundColor = "#666666";
		document.getElementById(subobj).className="active";
	}		
}

function inactivenav(subobj)
{
	if (document.getElementById(subobj))
	{
		document.getElementById(subobj).className="";
		document.getElementById(subobj).style.backgroundColor = "#aaaaaa";
	}
}

function changeCellColor(objCell, color)
{
	if (objCell && objCell.className != "active")
		objCell.style.backgroundColor = color;
}

function updateInfoPanier(nbProduit)
{
	info_panier = '';
	if (nbProduit == 0) info_panier = 'Panier&nbsp;vide';
	if (nbProduit == 1) info_panier = '&nbsp;'+nbProduit+'&nbsp;article';
	if (nbProduit > 1) info_panier = '&nbsp;'+nbProduit+'&nbsp;articles';	
	
	if (document.getElementById)
	{
		document.getElementById("nbarticle").innerHTML = info_panier;
	}
	else if (document.all) 
	{
		document.all["nbarticle"].innerHTML = info_panier;
	}
}

function gethot(objid) {
  var myobj = document.getElementById(objid);
  if (myobj) {
    myobj.style.backgroundColor = "#e0e0e0"; // #e2e0d7
  }
}

function gocold(objid) {
  var myobj = document.getElementById(objid);
  if (myobj) {
    myobj.style.backgroundColor = "#f0f0f0";
  }
}
