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 blink(){
	var a = MM_findObj("blinkid");
	if (a != null)
	{
		if (a.style.visibility == "visible")
			a.style.visibility = "hidden";
		else
			a.style.visibility = "visible";
	}
	else
	{
		return;
	}
/*	if(document.all){
		if(document.all("blinkid").style.visibility == "visible"){
			document.all("blinkid").style.visibility = "hidden";
		}else{
			document.all("blinkid").style.visibility = "visible";
		}
	}else if(document.getElementById){
		if(document.getElementById("blinkid").style.visibility == "visible"){
			document.getElementById("blinkid").style.visibility = "hidden";
		}else{
			document.getElementById("blinkid").style.visibility = "visible";
		}
	}else{
		return;
	}*/
	setTimeout(blink, 800);
}

/*function OpenPopUp_PlanFax(Url){
	window.open(Url,'pizzahut','width=670,height=450,toolbar=0,directories=0,menubar=0,scrollbars=1,status=0,resizable=0');
}
function OpenImmeubleEnFete(Url){
	window.open(Url,'pizzahut','width=1000,height=450,toolbar=0,directories=0,menubar=0,scrollbars=1,status=0,resizable=0');
}
function OpenPopUp(Url, Nom, Opt){
	window.open(Url, Nom, Opt);
}
function rollover_tjs(nom,src) {
	document.images[nom].src=src;
}

window.onload = blink;
function testform_inscription(){
		var submit_ok=1;
		if (document.inscription.nom.value == ''){alert("La saisie du nom est obligatoire");submit_ok=0;}
		if (document.inscription.prenom.value == '' && submit_ok==1){alert("La saisie du prnom est obligatoire");submit_ok=0;}
		if (document.inscription.email.value == '' && submit_ok==1){alert("La saisie de l'e-mail est obligatoire");submit_ok=0;}
		if (mail_validator(document.inscription.email.value) == "0" && submit_ok==1){alert("L'e-mail saisi n'est pas conforme");submit_ok=0;}
		if (document.inscription.identifiant.value == '' && submit_ok==1){alert("La saisie de l'identifiant est obligatoire");submit_ok=0;}
		if (document.inscription.motpasse1.value == '' && submit_ok==1){alert("La saisie du mot de passe est obligatoire");submit_ok=0;}
		if (document.inscription.motpasse2.value == '' && submit_ok==1){alert("La confirmation du mot de passe est obligatoire");submit_ok=0;}
		if (document.inscription.motpasse1.value != document.inscription.motpasse2.value && submit_ok==1){alert("La confirmation du mot de passe n'est pas correcte");submit_ok=0;}
		if (submit_ok==1){
			document.inscription.submit();}
	}
	function mail_validator(str) {
		if (window.RegExp) {
			var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
			var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
			var reg1 = new RegExp(reg1str);
			var reg2 = new RegExp(reg2str);
			if (!reg1.test(str) && reg2.test(str)) return "1";
			return "0";
		} else {
			if(str.indexOf("@") >= 0) return "1";
			return "0";
		}
	}
	
	function verif_mail() {
ok=true;
if(document.form.usr_password.value!=document.form.usr_password2.value) {ok=false;alert('Vrifiez votre mot de passe');}
if ((document.form.usr_login.value.length>0)||(document.form.usr_password.value.length>0)){
	if ((document.form.usr_login.value.length==0)||(document.form.usr_password.value.length==0)){
		ok=false;alert("Veuillez remplir le login et le mot de passe");
	}
}
if ((document.form.usr_nom.value.length==0)||(document.form.usr_prenom.value.length==0) || (document.form.usr_email.value.length==0)) {ok=false;alert("Veuillez remplir tous les champs obligatoires");};
if (mail_validator(document.form.usr_email.value) == "0" && ok==true){alert("L'e-mail saisi n'est pas conforme");ok=false;}
if (ok==true) {document.form.submit()};
}

function test_ing() {
		if (document.search_engine.ingredient.value==""){
			alert("Vous devez saisir un ingrdient !");
			return false;
		}else{
			return true;
		}
	}
	
	function isEmail(s)
{
	if (s.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
            return true ;
        else
            return false ;
    
}







/*
 * FlashObject embed
 * by Geoff Stearns (geoff@deconcept.com, http://www.deconcept.com/)
 *
 * v1.1.0 - 03-31-2005
 *
 * writes the embed code for a flash movie, includes plugin detection
 *
 * Usage:
 *
 *	myFlash = new FlashObject("path/to/swf.swf", "swfid", "width", "height", flashversion, "backgroundcolor");
 *	myFlash.write("objId");
 *
 * for best practices, see:
 *  http://blog.deconcept.com/2005/03/31/proper-flash-embedding-flashobject-best-practices/
 *
 */

var FlashObject = function(swf, id, w, h, ver, c) {
	this.swf = swf;
	this.id = id;
	this.width = w;
	this.height = h;
	this.version = ver;
	this.align = "middle";

	this.params = new Object();
	this.variables = new Object();

	this.redirect = "";
	this.sq = document.location.search.split("?")[1] || "";
	this.bypassTxt = "<p>Already have Macromedia Flash Player? <a href='?detectflash=false&"+ this.sq +"'>Click here if you have Flash Player "+ this.version +" installed</a>.</p>";
	
	if (c) this.color = this.addParam('bgcolor', c);
	this.addParam('quality', 'high'); // default to high
	this.doDetect = getQueryParamValue('detectflash');
}

var FOP = FlashObject.prototype;

FOP.addParam = function(name, value) { this.params[name] = value; }

FOP.getParams = function() { return this.params; }

FOP.getParam = function(name) { return this.params[name]; }

FOP.addVariable = function(name, value) { this.variables[name] = value; }

FOP.getVariable = function(name) { return this.variables[name]; }

FOP.getVariables = function() { return this.variables; }

FOP.getParamTags = function() {
    var paramTags = "";
    for (var param in this.getParams()) {
        paramTags += '<param name="' + param + '" value="' + this.getParam(param) + '" />';
    }
    return (paramTags == "") ? false:paramTags;
}

FOP.getHTML = function() {
    var flashHTML = "";
    if (navigator.plugins && navigator.mimeTypes.length) { // netscape plugin architecture
        flashHTML += '<embed type="application/x-shockwave-flash" src="' + this.swf + '" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '"';
        for (var param in this.getParams()) {
            flashHTML += ' ' + param + '="' + this.getParam(param) + '"';
        }
        if (this.getVariablePairs()) {
            flashHTML += ' flashVars="' + this.getVariablePairs() + '"';
        }
        flashHTML += '></embed>';
    } else { // PC IE
        flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '">';
        flashHTML += '<param name="movie" value="' + this.swf + '" />';
        if (this.getParamTags()) {
            flashHTML += this.getParamTags();
        }
        if (this.getVariablePairs() != null) {
            flashHTML += '<param name="flashVars" value="' + this.getVariablePairs() + '" />';
        }
        flashHTML += '</object>';
    }
    return flashHTML;	
}

FOP.getVariablePairs = function() {
    var variablePairs = new Array();
    for (var name in this.getVariables()) { 
    	variablePairs.push(name + "=" + escape(this.getVariable(name))); 
    }
    return (variablePairs.length > 0) ? variablePairs.join("&"):false;
}

FOP.write = function(elementId) {
	if(detectFlash(this.version) || this.doDetect=='false') {
		if (elementId) {
			document.getElementById(elementId).innerHTML = this.getHTML();
		} else {
			document.write(this.getHTML());
		}
	} else {
		if (this.redirect != "") {
			document.location.replace(this.redirect);
		} else if (this.altTxt) {
			if (elementId) {
				document.getElementById(elementId).innerHTML = this.altTxt +""+ this.bypassTxt;
			} else {
				document.write(this.altTxt +""+ this.bypassTxt);
			}
		}
	}		
}

/* ---- detection functions ---- */
function getFlashVersion() {
	var flashversion = 0;
	if (navigator.plugins && navigator.mimeTypes.length) {
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			var y = x.description;
   			flashversion = y.charAt(y.indexOf('.')-1);
		}
	} else {
		result = false;
	    for(var i = 15; i >= 3 && result != true; i--){
   			execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
   			flashversion = i;
   		}
	}
	return flashversion;
}

function detectFlash(ver) {	return (getFlashVersion() >= ver) ? true:false; }

// get value of query string param
function getQueryParamValue(param) {
	var q = document.location.search || document.location.href.split("#")[1];
	if (q) {
		var detectIndex = q.indexOf(param +"=");
		var endIndex = (q.indexOf("&", detectIndex) > -1) ? q.indexOf("&", detectIndex) : q.length;
		if (q.length > 1 && detectIndex > -1) {
			return q.substring(q.indexOf("=", detectIndex)+1, endIndex);
		} else {
			return "";
		}
	}
}

/* add Array.push if needed */
if(Array.prototype.push == null){
	Array.prototype.push = function(item) { this[this.length] = item; return this.length; }
}

/********************************************************************************************************************/
// START ROLLOVER
/********************************************************************************************************************/
// JavaScript Document

<!--

var W3CDOM = (document.createElement && document.getElementsByTagName);

var mouseOvers = new Array();
var mouseOuts = new Array();

function init()
{
	if (!W3CDOM) return;
	/*var nav = document.getElementById('container');
	var imgs = document.getElementsByTagName('input');*/
	var imgs = document.getElementsByTagName('img');
	//alert (imgs.length);
	for (var i=0; i<imgs.length; i++)
	{
		if (imgs[i].src.indexOf('.gif') != -1) // On cible seulement les lments input de type image avec une extension de type .gif
		{			
			// Get image name
			//alert ( (imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).substring(0,(imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).lastIndexOf('.')) );
			tmp=(imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).substring(0,(imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).lastIndexOf('.'));
			
			if ( tmp.indexOf('_') != -1) /* search all img have "_" */
			{
				if (tmp.substring(tmp.lastIndexOf('_')+1) == "n" )
					{
						//alert ( (imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).substring(0,(imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).lastIndexOf('.')) );
						imgs[i].onmouseover = mouseGoesOver;
						imgs[i].onmouseout = mouseGoesOut;
						mouseOuts[i] = new Image();
						mouseOuts[i].src = imgs[i].src;
						mouseOvers[i] = new Image();	
						
						/*	
						if (imgs[i].src.lastIndexOf('_') != -1) { mouseOvers[i].src = imgs[i].src.substring(0,imgs[i].src.lastIndexOf('_')) + "_over" + suffix;}
						else { mouseOvers[i].src = imgs[i].src.substring(0,imgs[i].src.lastIndexOf('.')) + "_over" + suffix;}
						*/
						var suffix = imgs[i].src.substring(imgs[i].src.lastIndexOf('.'));
						if (imgs[i].src.lastIndexOf('.') != -1) { mouseOvers[i].src = imgs[i].src.substring(0,imgs[i].src.lastIndexOf('_')) + "_o" + suffix;}
						imgs[i].number = i;
					}
			}
		}
	} //end for
} //end init

function initreset()
{
	if (!W3CDOM) return;
	var imgs = document.getElementsByTagName('img');
	for (var i=0; i<imgs.length; i++)
	{
		if (imgs[i].src.indexOf('.gif') != -1) // On cible seulement les lments input de type image avec une extension de type .gif
		{			
			tmp=(imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).substring(0,(imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).lastIndexOf('.'));
			
			if ( tmp.indexOf('_') != -1) /* search all img have "_" */
			{
				if (tmp.substring(tmp.lastIndexOf('_')+1) == "o" )
				{
					//alert ( (imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).substring(0,(imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1)).lastIndexOf('.')) );
					var suffix = imgs[i].src.substring(imgs[i].src.lastIndexOf('.'));
					var tmpimg= new Image();
						tmpimg.src=imgs[i].src.substring(0,imgs[i].src.lastIndexOf('_')) + "_n.gif";
					imgs[i].src=tmpimg.src;
				}
			}
		}
	} //end for
} //end initreset

var fsub=false;
var mobj;
var osrc="";
/*
function mouseGoesOver(fsub, mEvent) {
	if (checkIt("msie") != 0) { // use in IE
		if (fsub==true) {
			mobj.src=osrc;
			fsub=false;
		} else {
			this.src = mouseOvers[this.number].src;
		}
		osrc=event.srcElement.src;
		mobj=event.srcElement;
	}
	else {	// use in firefox
		if (fsub==true) {
			mobj.src=osrc;
			fsub=false;
		} else if (fsub=='')  {
			osrc=mEvent.target.src;
			mobj=mEvent.target;
		} else {
			this.src = mouseOvers[this.number].src;
		}
	}
}
*/
function mouseGoesOver() {
	tmp=(this.src.substring(this.src.lastIndexOf('/') + 1)).substring(0,(this.src.substring(this.src.lastIndexOf('/') + 1)).lastIndexOf('.'));
	if (tmp.substring(tmp.lastIndexOf('_')+1) != "s" ){
			this.src = mouseOvers[this.number].src;
	}
}

function mouseGoesOut() {
	tmp=(this.src.substring(this.src.lastIndexOf('/') + 1)).substring(0,(this.src.substring(this.src.lastIndexOf('/') + 1)).lastIndexOf('.'));
	if (tmp.substring(tmp.lastIndexOf('_')+1) != "s" ){
		this.src = mouseOuts[this.number].src;
	}
}

//-->

<!--
var detect = navigator.userAgent.toLowerCase();
var OS,browser,total,thestring;
var version = 0;

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}
/********************************************************************************************************************/
// END ROLLOVER
/********************************************************************************************************************/
function getElementsByBaseTagClass(base, tag, className) { 
    var classPat = new RegExp('\\b'+className+'\\b'); 
    var nodes = base.getElementsByTagName(tag); 
    var matching = []; 
    for (var i = 0; i < nodes.length; i++) { 
        if (classPat.test(nodes[i].className)) { 
            matching.push(nodes[i]); 
        } 
    } 
	return matching; 
}

function popCont (id, curlink) {
	//alert (curlink.length);
	if (curlink.length==1) {
		alert ("the length = 1");	
	} else {
		for (i=0; i < curlink.length; i++) {
			if (i!=id) {				
				curlink[i].style.display="none";
			}
		}
		curlink[id].style.display="block";
	}
}

function hightlight2 (id, curlink) {
//	alert (curlink.length);
selectstate=["images/bgd3_li_o.gif"];

	if (curlink.length==1) {
		alert ("the length = 1");	
	} else {
		for (i=0; i < curlink.length; i++) {
			if (i!=id) {
				curlink[i].style.backgroundImage="";
				curlink[i].style.width="";
			}
		}
		curlink[id].style.background="url("+selectstate[0]+")";
	}
}

/*MODIFIED BY SUTRIXMEDIA*/

//window.onload = slideFAQ();

function slideFAQ(divID) {
	divObj = $(divID);
	if (divObj != document.toggleElement) {
		new Effect.toggle(document.toggleElement,'blind');
	}
	new Effect.toggle(divObj,'blind');
}

function hightlightQuest(id, num) {
	if (document.highlightedId&&document.highlightedId!=id) {
		hightlightContent(document.highlightedId, document.highlightedNum);
	}
	if (document.highlightedId!=id) {
		document.highlightedId = id;
		document.highlightedNum = num;
	} else {
		document.highlightedId = null;
		document.highlightedNum = null;
	}
	hightlightContent(id, num);
}
/*END MODIFIED BY SUTRIXMEDIA*/

function hightlightContent(id, num) {
	nCls = id.style;
	if (!num) {	
		if (nCls.color=="#ae0001" || nCls.color=="") {
			nCls.background="url(images/bgd_smalllist_active.gif) no-repeat";
			nCls.color = "#000000";
		} else{
			nCls.backgroundImage="";
			nCls.width = "375px";
			nCls.color="";
		}
	} else if (num==2) {
		if (nCls.color=="#ae0001" || nCls.color=="" ) {			
			nCls.background="url(images/bgd_bottomlist_ro.gif) no-repeat";
			nCls.color = "#000000";
		} else {
			nCls.backgroundImage="";
			nCls.color = "";
		}
	}
}

function hightlightNutritionQuest(id, num) {
	if (document.highlightedId&&document.highlightedId!=id) {
		hightlight(document.highlightedId, document.highlightedNum);
	}
	if (document.highlightedId!=id) {
		document.highlightedId = id;
		document.highlightedNum = num;
	} else {
		document.highlightedId = null;
		document.highlightedNum = null;
	}
	hightlight(id, num);
}


function hightlight (id, num) {
	if (!num) {
		if (id.style.fontWeight=="normal" || id.style.fontWeight=="" ) {
			id.style.backgroundImage="";
			id.style.color="#0039ab";
			id.style.fontWeight="normal";
		} else{
			id.style.backgroundImage="";
			id.style.color="";
			id.style.fontWeight="normal";
		}
	} else if (num==2) {
		if (id.style.fontWeight=="normal" || id.style.fontWeight=="" ) {	
			id.style.backgroundImage="";
			id.style.color="#0039ab";
			id.style.fontWeight="normal";	
		} else {
			id.style.backgroundImage="";
			id.style.color="";
			id.style.fontWeight="normal";	
		}
	}
}

function hightlightTab (id) {
overstate=["images/btn1_menu_o.gif",
			"images/btn2_menu_o.gif",
			"images/btn3_menu_o.gif",				 
			"images/btn4_menu_o.gif" ];
	
	for (i=1; i<=4; i++) {
		var curTab=document.getElementById("tab"+i);		
		if (i!=id) {
			curTab.style.backgroundImage="";
		} else {
			var curTab=document.getElementById("tab"+id);			
			curTab.style.background="url("+overstate[id-1]+")";
		}
	}
}

function hightlightTab1 (id) {
overstate=["images/btn5_menu_o.gif",
			"images/btn6_menu_o.gif",
			"images/btn7_menu_o.gif",				 
			"images/btn8_menu_o.gif" ];
	
	for (i=1; i<=4; i++) {
		var curTab=document.getElementById("tab"+i);		
		if (i!=id) {
			curTab.style.backgroundImage="";
		} else {
			var curTab=document.getElementById("tab"+id);			
			curTab.style.background="url("+overstate[id-1]+")";
		}
	}
}

function hightlightTab2 (id) {
overstate=["images/nutrition/btn1_menu_o.gif",
			"images/nutrition/btn2_menu_o.gif",
			"images/nutrition/btn3_menu_o.gif",				 
			"images/nutrition/btn4_menu_o.gif" ];
	
	for (i=1; i<=4; i++) {
		var curTab=document.getElementById("tab"+i);		
		if (i!=id) {
			curTab.style.backgroundImage="";
		} else {
			var curTab=document.getElementById("tab"+id);			
			curTab.style.background="url("+overstate[id-1]+")";
		}
	}
}


function hightlightSubTab(id, curlink) {	
//alert (curlink.length);
	if (curlink.length==1) {
		alert ("the length = 1");	
	} else {
		for (i=0; i < curlink.length; i++) {
			if (i!=id) curlink[i].style.background="";
		}
			curlink[id].style.background="#ff7a00";
	}
}
/*
function showhideMenu(id, curlink) {	
//alert (curlink.length);
	if (curlink.length==1) {
		alert ("the length = 1");	
	} else {
		for (i=0; i < curlink.length; i++) {
			if (i!=id) curlink[i].style.display="none";
		}
			curlink[id].style.display="block";
	}
}
*/
function showlegend (id) {
	for (i=1; i<=4; i++) {
		var curTab=document.getElementById("legend"+i);		
		if (i!=id) {
			curTab.style.display="none";
		} else {
			var curTab=document.getElementById("legend"+id);			
			curTab.style.display="block";
		}
	}
}
