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_findObj(n, d) { //v4.0
  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 && document.getElementById)
    x=document.getElementById(n);
  return x;
}

function hideLayer(arg){
  if ((obj=MM_findObj(arg))!=null) {
      obj.style.visibility='hidden';
  }
}
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) {
    if ((obj=MM_findObj(args[i]))!=null) {
      p=args[i];

      v=args[i+2];
      if (obj.style) {
        obj=obj.style;
        v=(v=='show')?'visible':(v='hide')?'hidden':v;
      }
      obj.visibility=v;
      if (v=='visible') {
        window.setTimeout('hideLayer(\''+p+'\');',25000);
      }
    }
  }
}

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_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_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 Supprime(formulaire,texte){
   if (confirm('Etes-vous sūr de vouloir supprimer '+texte)){
      formulaire.submit();
   }
}
function CheckFieldNotEmpty(field,fieldName){
   if (field.value=="") {
       alert('Vous devez remplir le champ ['+fieldName+']');
       return false;
   }
   return true;
}
function Flip(obj){
  if(navigator.appName.substring(0,3) == "Net")
        document.captureEvents(Event.MOUSEMOVE);
  oDiv=document.getElementById(obj);
  if (oDiv.filters[0]!=null) oDiv.filters[0].Apply();
  if (oDiv.style.visibility=='hidden'){
    x= (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
    y= (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
    oDiv.style.left= x+5;
    oDiv.style.top = y+5;
    oDiv.style.visibility='visible';
  }
  else {
    oDiv.style.visibility='hidden';
  }
  if (oDiv.filters[0]!=null) oDiv.filters[0].Play();
}
function Show(obj){
  oDiv=document.getElementById(obj);
  if (oDiv.filters[0]!=null) oDiv.filters[0].Apply();
  x= (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
  y= (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
  oDiv.style.left= x+5;
  oDiv.style.top = y+5;
  oDiv.style.visibility='visible';
  if (oDiv.filters[0]!=null) oDiv.filters[0].Play();
}
function Hide(obj){
  oDiv=document.getElementById(obj);
  oDiv.style.visibility='hidden';
}
function css()
{
  if(navigator.appName=="Netscape" && navigator.appVersion.substring(0,1)==4)
    document.write("<link REL=\"StyleSheet\" HREF=\"styleNetscape.css\" TYPE=\"text/css\" MEDIA=\"screen\">");
  else
    document.write("<link REL=\"StyleSheet\" HREF=\"style.css\" TYPE=\"text/css\" MEDIA=\"screen\">");

}
css();
function OWGeneric(a,b,c,d)
{
  window.open('index.php?pageAlias=generic_ow&a_scod='+a,'nom','toolbar=no,menubar=no,scrollbars='+ d +',width=' + b +',height=' + c);
}

/* Display or hide menu item. The CSS id of paremnt menu items are identified 
   with idBase and an index (menu1,menu2...). For sub menus, an s is appended
   (smenu1,smenu2...)
   idBase  : basename for menu and submenu ids in CSS 
   id      : id of the item to display 
   nbParents: number of parent menu items */
function ShowHide_MenuItem(idbase,id,nbParents) {
  // Get the document for the selected sub menu
  var d = document.getElementById('s'+idbase+id);

  var isDisplayed = false ;
  if (d && d.style.display == "block") {
    isDisplayed = true;
  }
  // Hide all the submenus
  for (var i = 0; i<nbParents; i++) {
        var curr_smenu_id = 's'+idbase+i ;
        if (document.getElementById(curr_smenu_id)) {
          document.getElementById(curr_smenu_id).style.display='none';
          // Reset the color
          document.getElementById(idbase+i).style.color="#446c8d";
        }
  }
  // Only display an item if not already displayed
  if (d && !isDisplayed) {
        d.style.display='block';
        // Set the color of the parent item
        document.getElementById(idbase+id).style.color="#fcd7ab";
  }
}

