/* Pour afficher l'image d'un plat selectionne dans controlplat.jspf*/
function showimage(value) {
       var val = "http://www.revedemenus.com/resources/images/recette"+value+".jpg";
       var p = "color: blue";
       if (!document.images)
       return
       document.images["form1:controlplat:imageplat"].src=val;
       document.getElementById('form1.controlplat:listeoccasions').attributes["style"].value=p;
}

/* Pour apporter la fonction qui agrandie à une image */
function showbigpict(value) { 
        var p = "big('images/"+value+".JPG')";
        if (!document.links)
        return
        document.links.i.attributes["onmouseover"].value=p;
}

/* Pour faire clignoter du texte dans menus.jsp */
function white() {
        Nom = navigator.appName;
        ie = (Nom.indexOf("Explorer")>=0) ? 1:0
        if (ie) {
        document.getElementById('form1:selectmenu:outputText1').style.setAttribute('color', 'white');   
        } else { 
        document.getElementById('form1:selectmenu:outputText1').attributes["style"].value='color: white; font-size: 12px; font-weight: bold; left: 456px; top: 3px; position: absolute';
        }
}

function clignot() { 
        //alert('e');
        Nom = navigator.appName;
        ie = (Nom.indexOf("Explorer")>=0) ? 1:0
        if (ie) {
        document.getElementById('form1:selectmenu:outputText1').style.setAttribute('color', '#f30ec3');   
        } else {
        document.getElementById('form1:selectmenu:outputText1').attributes["style"].value='color: #f30ec3; font-size: 12px; font-weight: bold; left: 456px; top: 3px; position: absolute';
        }

    setTimeout('white()',2000);
        
}

/*Pour changer la taille de limage transparente du moteur ds pagelistedecourse*/
function changeheight() {
        //document.getElementById('form1:moteur:image1').attributes["height"].value=130;
document.images["form1:moteur:image1"].height="130";
}

//Pour changer ladresse action dans controlplat
function url() {
                url = ''+document.location;
//                i = url.indexOf('s=');
//                i = i +2;
                //alert('e');
//                newurl = url.substring(0,i) + nbpers;
                //newurl='http://www.yahoo.fr';
                //alert(url);
                //document.location=newurl;
                document.getElementById('controlplat:form1:url').value=url;
                //document.getElementById('form2:url').value=url;

                //pour tools send by email
                document.getElementById('urlsend').value=url;
}
function url2() {
                url = ''+document.location;
//                i = url.indexOf('s=');
//                i = i +2;
                //alert('e');
//                newurl = url.substring(0,i) + nbpers;
                //newurl='http://www.yahoo.fr';
                //alert(url);
                //document.location=newurl;
                //document.getElementById('controlplat:form1:url').value=url;
                //document.getElementById('form2:url').value=url;

                //pour tools send by email
                document.getElementById('urlsend').value=url;
}

//Pour changer le coderecette dans controlplat
function changerecipe(code) {
                //alert(code);
                //ds control plat;
                document.getElementById('controlplat:form1:coderecette').value=code;
                //document.getElementById('controlplat:form1:codemenu').value=null;
                //ds commentaires
                document.getElementById('form2:coderecette').value=code;
}

//Pour changer le codemenu dans controlplat
function changemenu(cod) {
                //alert('codemenu'+cod);
                document.getElementById('controlplat:form1:codemenu').value=cod;
                document.getElementById('form2:codemenu').value=cod;
}

//Pour changer le codemenu dans controlplat
function ressset(v) {
                if (document.getElementById(v).value.indexOf('-')==0) {
  document.getElementById(v).value='';
}
}

function printrecettes() {
                //alert('e');
                var listb = document.getElementById('controlplat:form1:listeplats');
                var count = listb.options.length;
                for (i = 0; i < count; i++) {
                    //alert(''+listb.options(i).value);
                    coderecette = listb.options[i].value;
                    url = 'http://www.revedemenus.com/recette/print-'+coderecette+'-0.jsp';
                    window.open(url);
                }


}

function tabs() {
                url = ''+document.location;
                if (url.indexOf('recette')!=-1) {
                    document.getElementById('tabs').className="tabs1";
                } else if (url.indexOf('menu')!=-1) {
                    document.getElementById('tabs').className="tabs2";
                }

}

function hauteurcore() {
                alert('h'+document.body.offsetHeight);
                document.getElementById('core').height=window.innerHeight;
                
}

function validerformcp() {
                if (document.getElementById('controlplat:form1:codemenu').value==1 && document.getElementById('controlplat:form1:coderecette').value==1) {
                  document.getElementById('plats').innerHTML="Merci de selectionner une recette ou un menu, <br/> une date puis de cliquer sur Ajouter";
                  return false;
                }

}


function cre_cook(nom,contenu,jours) {
      var expireDate = new Date();
      expireDate.setTime(expireDate.getTime() + jours*24*3600*1000);
      document.cookie = nom + "=" + escape(contenu)
         + ";expires=" + expireDate.toGMTString();
      }

function lit_cook(nom) {
      var deb,fin
      deb = document.cookie.indexOf(nom + "=")
      if (deb >= 0) {
         deb += nom.length + 1
         fin = document.cookie.indexOf(";",deb)
         if (fin < 0) fin = document.cookie.length
         return unescape(document.cookie.substring(deb,fin))
         }
      return ""
      }

function news() {
      
	c=lit_cook("newsdial");
	if(c=="") { 
		cre_cook("newsdial", "1", "365");
				
	//} else  if(c=="1") {
        //        cre_cook("newsdial", "2", "365");

        } else if(c=="1") { 
		cre_cook("newsdial", "2", "365");
		ouvreBoite();
	}	
}

function ouvreBoite()
{
  document.getElementById("monPrompt").style.display = "block";
  document.getElementById("idFond").style.display = "block";
}
 
function fermeBoite()
{
  document.getElementById("monPrompt").style.display = "none";
  document.getElementById("idFond").style.display = "none";
}
 
/**************************************************************************/
/** Actions realisees par l utilisateur si clic sur Ok ou Annuler *********/
function clicOk()
{
  fermeBoite();
 
  /** Autres actions a realiser si clic sur Ok **/
  /** ... **/
}
 
 
function clicAnnuler()
{
  fermeBoite();
 
  /** Autres actions a realiser si clic sur annuler **/
  /** ... **/
}

function IEFixedElementPos()
        {
          // IE 7 en mode standard
          if (window.ActiveXObject && window.XMLHttpRequest && window.external && document.compatMode=="CSS1Compat") 
          {
             return ("fixed");
          }
          return ("absolute");
        }
         
        function IEFixedElementTop(defaultTop)
        {
          // IE 7 en mode standard
          if (window.ActiveXObject && window.XMLHttpRequest && window.external && document.compatMode=="CSS1Compat") 
          {
             return (defaultTop.toString() + "px;")
          }
          return ((document.body.scrollTop+defaultTop) + "px");
        }
 
        function IEFixedElementLeft(defaultLeft) 
        {
          // IE 7 en mode standard
          if (window.ActiveXObject && window.XMLHttpRequest && window.external && document.compatMode=="CSS1Compat") 
          {
             return (defaultLeft.toString() + "px;")
          }
          return ((document.body.scrollLeft+defaultLeft) + "px");
        }
 
        function IE100Width() 
        {
            //IE 7  en mode standard
            if (window.ActiveXObject && window.XMLHttpRequest && window.external && document.compatMode=="CSS1Compat")
            {
                return "100%";
            }
            return (document.body.offsetWidth-21) + "px";
        }
 
	function IE100Height() 
        {
            //IE 7  en mode standard
            if (window.ActiveXObject && window.XMLHttpRequest && window.external && document.compatMode=="CSS1Compat")
            {
                return "100%";
            }
            return (document.body.offsetHeight-21) + "px";
        }
