var ie=document.all?1:0;
var ns6=document.getElementById&&!document.all?1:0;
var ns4=document.layers?1:0;

function sub(){

     if (check()) {
        document.forms[0].action_form.value="valider";
        document.forms[0].submit();
       }
 }

function touche_ie(){ //pour Explorer
 if (event.keyCode == "13") sub();
 }

function touche(e){ //pour Netscape
   if (e.which == "13") sub();
 }

function valid_key() {
   if (ie) {
         touche_ie();
        } else {
                touche(e);
     }
 }

document.onKeyPress = touche; // pour Netscape

function gere_fond() {

//opera Netscape 6 Netscape 4x Mozilla 
if (window.innerWidth || window.innerHeight){ 
docwidth = window.innerWidth; 
docheight = window.innerHeight; 
} 
//IE Mozilla 
if (document.body.clientWidth || document.body.clientHeight){ 
docwidth = eval(document.body.clientWidth); 
docheight = eval(document.body.clientHeight); 
} 
posleft = docwidth - 520;
postop = docheight - 126;
document.write ("<STYLE> body {background: url('./images/logo_fond"+screen.width+".jpg') no-repeat fixed "+ posleft +"px "+postop+"px;}</STYLE>");
}

function modifierContenu(id,idUser,code,url_retour)
{
  // detection du navigateur
  var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
  if( (navigator.userAgent.indexOf('Mac')>=0) ||
      (navigator.userAgent.indexOf('Windows CE')>=0) ||
      (navigator.userAgent.indexOf('Opera')>=0) )win_ie_ver = 0;
  // acc�s � l'�diteur
  //if(win_ie_ver>=5.5)
    ouvrirPopup('saisieNews.php4?id='+id+'&idUser='+idUser+'&code='+code+'&url_retour='+url_retour, 300, 400);
  //else
  //  alert("Votre navigateur ne supporte pas le DHTML !\nVeuillez installer Internet Explorer au minimum dans sa version 5.5.\n");
}

function loadSite()
{
  if( $('header2') )
  {
    $$('#header a').each(function(el) {
      el.onclick = function()
      {
        $$('#header li').each(function(el) {
          el.removeClassName('current');
        });
        el.up('li').addClassName('current');
        $$('#body div.onglet').each(function(el) {
          el.hide();
        });
        $(el.readAttribute('rel').toLowerCase()).show();
        return false;
      }
    });
  }
}

function reset(frm)
{
  Form.reset($(frm));
}


if( typeof(Event.observe) == "function" ) Event.observe( window, "load", loadSite, true ) ;
