/*Ouverture d'un sous menu du treemenu*/
function OpenMenuItem (dossier) {
var
  submenu = null;

if((navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 3 && navigator.userAgent.indexOf("Opera") == -1 && navigator.userAgent.indexOf("WebTV") == -1) || (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) >= 4)) {
  for(i = 0; i < parent.frames.length; i++) {
    if(parent.frames[i].name == "code" && parent.frames[i].MTMLoaded) {
      submenu = parent.frames[i].MTSearchItem (dossier);
        if (submenu == null) {alert ('null');} else {alert(submenu.items.length)}
    if (submenu != null) {
        parent.frames[i].MTMTrackExpand(submenu);
    }
      break;}}
    }
}

/* Creation de la barre de navigation */
function ShowNavig () {
var Position = 0;
var str = "";
var dossier = 0;
var strTmp;
var tpstr = new String (document.location);

 Position = tpstr.indexOf("dossier=");
 strTmp = tpstr.substring (Position+8,tpstr.length)
 Position = strTmp.indexOf("&");
 strTmp =strTmp.substring (0,Position);
 dossier = strTmp;

if((navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 3 && navigator.userAgent.indexOf("Opera") == -1 && navigator.userAgent.indexOf("WebTV") == -1) || (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) >= 4)) {
  for(i = 0; i < parent.frames.length; i++) {
    if(parent.frames[i].name == "code" && parent.frames[i].MTMLoaded) {
      parent.frames[i].MTMTrack = true;
      str = parent.frames[i].MTMakeUrlNav(dossier);
      break;
    }
  }
}
return (str);
}

// End of script hiding -->

/* - - - - - - - - - - - - - - - - - - - - - - -
 Fichier JavaScript
 Créé le mardi 2 mars 2004 16:20:58
 avec HAPedit 3.0.11.102
  - - - - - - - - - - - - - - - - - - - - - - - */
/* HE 18 Janvier 2005*/
function copy_clip(meintext){
 if (window.clipboardData) 
   {
   
   // the IE-manier
   window.clipboardData.setData("Text", meintext);
   
   // waarschijnlijk niet de beste manier om Moz/NS te detecteren;
   // het is mij echter onbekend vanaf welke versie dit precies werkt:
   }
   else if (window.netscape) 
   { 
   
   // dit is belangrijk maar staat nergens duidelijk vermeld:
   // you have to sign the code to enable this, or see notes below 
   netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
   
   // maak een interface naar het clipboard
   var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
   if (!clip) return;
   
   // maak een transferable
   var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
   if (!trans) return;
   
   // specificeer wat voor soort data we op willen halen; text in dit geval
   trans.addDataFlavor('text/unicode');
   
   // om de data uit de transferable te halen hebben we 2 nieuwe objecten nodig   om het in op te slaan
   var str = new Object();
   var len = new Object();
   
   var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
   
   var copytext=meintext;
   
   str.data=copytext;
   
   trans.setTransferData("text/unicode",str,copytext.length*2);
   
   var clipid=Components.interfaces.nsIClipboard;
   
   if (!clip) return false;
   
   clip.setData(trans,null,clipid.kGlobalClipboard);
   
   }
   alert("Le texte suivant est copié dans le presse-papier :\n\n" + meintext);
   return false;
}

function copier2clipBoard(Code)
{
   var textRange = document.body.createTextRange();
   textRange.moveToElementText(Code);
   textRange.execCommand("Copy");
}

function copystring2clipBoard(str)
{
   var st = new string(str);
      st.execCommand("Copy");
}

function isSite() {var result, st; result = false;
result = true;
  if (parent.location.href == self.location.href) {
    result = false;
    }
    return result;}

//<!-- ---------------------------------------------------- -->
//<!-- Fonctions utilisées par la Barre de navigation       -->
//<!-- ---------------------------------------------------- -->
//<!-- Copyright 2000 by Mike Hall                          -->
//<!-- Please see http://www.brainjar.com for terms of use. -->
//<!-- ---------------------------------------------------- -->
function Browser() {
  var ua, s, i;
  this.isIEPC    = false;  // Pocket Internet Explorer
  this.isIE    = false;  // Internet Explorer
  this.isNS    = false;  // Netscape
  this.version = null;
  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
  s = "Pocket";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.isIEPC = true;
    this.version = 4.0;
    return;
  }
}

var browser = new Browser();

// Global variable for tracking the currently active button.

var activeButton = null;

// Capture mouse clicks on the page so any active button can be
// deactivated.

if (browser.isIE)
  document.onmousedown = pageMousedown;
if (browser.isNS)
  document.addEventListener("mousedown", pageMousedown, true);

function pageMousedown(event) {

  var el;

  // If there is no active menu, exit.

  if (!activeButton)
    return;

  // Find the element that was clicked on.

  if (browser.isIE)
    el = window.event.srcElement;
  if (browser.isNS)
    el = (event.target.className ? event.target : event.target.parentNode);

  // If the active button was clicked on, exit.

  if (el == activeButton)
    return;

  // If the element clicked on was not a menu button or item, close the
  // active menu.

  if (el.className != "menuButton"  && el.className != "menuItem" && el.className != "menuItemSep" && el.className != "menu")
    resetButton(activeButton);
}

function buttonClick(button, menuName) {

  // Blur focus from the link to remove that annoying outline.

  button.blur();

  // Associate the named menu to this button if not already done.

  if (!button.menu)
    button.menu = document.getElementById(menuName);

  // Reset the currently active button, if any.

  if (activeButton && activeButton != button)
    resetButton(activeButton);

  // Toggle the button's state.

  if (button.isDepressed)
    resetButton(button);
  else
    depressButton(button);

  return false;
}

function buttonMouseover(button, menuName) {

  // If any other button menu is active, deactivate it and activate this one.
  // Note: if this button has no menu, leave the active menu alone.

  if (activeButton && activeButton != button) {
    resetButton(activeButton);
    if (menuName)
      buttonClick(button, menuName);
  }
}

function depressButton(button) {

  var w, dw, x, y;

  // Change the button's style class to make it look like it's depressed.

  button.className = "menuButtonActive";

  // For IE, set an explicit width on the first menu item. This will
  // cause link hovers to work on all the menu's items even when the
  // cursor is not over the link's text.

  if (browser.isIE && !button.menu.firstChild.style.width) {
    w = button.menu.firstChild.offsetWidth;
    button.menu.firstChild.style.width = w + "px";
    dw = button.menu.firstChild.offsetWidth - w;
    w -= dw;
    button.menu.firstChild.style.width = w + "px";
  }

  // Position the associated drop down menu under the button and
  // show it. Note that the position must be adjusted according to
  // browser, styling and positioning.

  x = getPageOffsetLeft(button);
  y = getPageOffsetTop(button) + button.offsetHeight;
  if (browser.isIE) {
    x += 2;
    y += 2;
  }
  if (browser.isNS && browser.version < 6.1)
    y--;

  // Position and show the menu.

  button.menu.style.left = x + "px";
  button.menu.style.top  = y + "px";
  button.menu.style.visibility = "visible";

  // Set button state and let the world know which button is
  // active.

  button.isDepressed = true;
  activeButton = button;
}

function resetButton(button) {

  // Restore the button's style class.

  button.className = "menuButton";

  // Hide the button's menu.

  if (button.menu)
    button.menu.style.visibility = "hidden";

  // Set button state and clear active menu global.

  button.isDepressed = false;
  activeButton = null;
}

function getPageOffsetLeft(el) {

  // Return the true x coordinate of an element relative to the page.

  return el.offsetLeft + (el.offsetParent ? getPageOffsetLeft(el.offsetParent) : 0);
}

function getPageOffsetTop(el) {

  // Return the true y coordinate of an element relative to the page.

  return el.offsetTop + (el.offsetParent ? getPageOffsetTop(el.offsetParent) : 0);
}

//<!-- Fin Fonctions utilisées par la Barre de navigation       -->


/**  Affichage menu
 * This array is used to remember mark status of rows in browse mode
 */
var marked_row = new Array;

var timeoutglobalvar;
function setdisplay (objet, statut) {
  if (objet.style.display != statut) objet.style.display = statut;
}

function cleandisplay(id){
  var e=document.getElementById(id);
  if (e){
    var ie=false;

    var appVer = navigator.appVersion.toLowerCase();
    var iePos = appVer.indexOf('msie');
    if (iePos !=-1) {
      var is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
      var is_major = parseInt(is_minor);
    }
    if (navigator.appName.substring(0,9) == "Microsoft")
    { // Check if IE version is 6 or older
      if (is_major <= 6) {
        ie=true;
      }
    }

    setdisplay(e,'block');

    if (ie){
      var selx=0; var sely=0; var selp;
      if(e.offsetParent){
        selp=e;
        while(selp.offsetParent){
          selp=selp.offsetParent;
          selx+=selp.offsetLeft;
          sely+=selp.offsetTop;
        }
      }
      selx+=e.offsetLeft;
      sely+=e.offsetTop;
      selw=e.offsetWidth;
      selh=e.offsetHeight;
      hideSelect(selx,sely,selw,selh);
    }
  }
}

function cleanhide(id){
  var e=document.getElementById(id);
  if (e){
    var ie=false;

    var appVer = navigator.appVersion.toLowerCase();
    var iePos = appVer.indexOf('msie');
    if (iePos !=-1) {
      var is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
      var is_major = parseInt(is_minor);
    }
    if (navigator.appName.substring(0,9) == "Microsoft")
    { // Check if IE version is 6 or older
      if (is_major <= 6) {
        ie=true;
      }
    }

    if (ie){
      var selx=0; var sely=0; var selp;
      if(e.offsetParent){
        selp=e;
        while(selp.offsetParent){
          selp=selp.offsetParent;
          selx+=selp.offsetLeft;
          sely+=selp.offsetTop;
        }
      }
      selx+=e.offsetLeft;
      sely+=e.offsetTop;
      selw=e.offsetWidth;
      selh=e.offsetHeight;
      showSelect(selx,sely,selw,selh);
    }
    setdisplay(e,'none');

  }
}


function hidemenu(){
  var ie=false;

  var appVer = navigator.appVersion.toLowerCase();
  var iePos = appVer.indexOf('msie');
  if (iePos !=-1) {
    var is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
    var is_major = parseInt(is_minor);
  }
  if (navigator.appName.substring(0,9) == "Microsoft")
  { // Check if IE version is 6 or older
    if (is_major <= 6) {
      ie=true;
    }
  }

  for (var i = 1; i<=10; i++) {
    var e=document.getElementById('smenu'+i);
    if (e) {
      if (ie){
        var selx=0; var sely=0; var selp;
        if(e.offsetParent){
          selp=e;
          while(selp.offsetParent){
            selp=selp.offsetParent;
            selx+=selp.offsetLeft;
            sely+=selp.offsetTop;
          }
        }
        selx+=e.offsetLeft;
        sely+=e.offsetTop;
        selw=e.offsetWidth;
        selh=e.offsetHeight;
        showSelect(selx,sely,selw,selh);
      }
      setdisplay(e,'none');
    }
  }  
}

function montre(id) {
  var d = document.getElementById(id);

  var ie=false;

  var appVer = navigator.appVersion.toLowerCase();
  var iePos = appVer.indexOf('msie');
  if (iePos !=-1) {
    var is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
    var is_major = parseInt(is_minor);
  }
  if (navigator.appName.substring(0,9) == "Microsoft")
  { // Check if IE version is 6 or older
    if (is_major <= 6) {
      ie=true;
    }
  }

  for (var i = 1; i<=10; i++) {
    var e=document.getElementById('smenu'+i);
    if (e) {
      setdisplay(e,'block');
      if (ie){
        var selx=0; var sely=0; var selp;
        if(e.offsetParent){
          selp=e;
          while(selp.offsetParent){
            selp=selp.offsetParent;
            selx+=selp.offsetLeft;
            sely+=selp.offsetTop;
          }
        }
        selx+=e.offsetLeft;
        sely+=e.offsetTop;
        selw=e.offsetWidth;
        selh=e.offsetHeight;
        showSelect(selx,sely,selw,selh);
      }
      setdisplay(e,'none');
    }
  }
  if (d) {
    setdisplay(d,'block'); 
    clearTimeout(timeoutglobalvar);
    timeoutglobalvar=setTimeout(function(){setdisplay(d, 'none')},5000);

    if (ie){
      var selx=0; var sely=0; var selp;
      if(d.offsetParent){
        selp=d;
        while(selp.offsetParent){
          selp=selp.offsetParent;
          selx+=selp.offsetLeft;
          sely+=selp.offsetTop;
        }
      }
      selx+=d.offsetLeft;
      sely+=d.offsetTop;
      selw=d.offsetWidth;
      selh=d.offsetHeight;
      hideSelect(selx,sely,selw,selh);
    }
  }
}

function showSelect(x,y,w,h){
  var selx,sely,selw,selh,i;
  var sel=document.getElementsByTagName("SELECT");
  for(i=0;i<sel.length;i++){
    selx=0; sely=0; var selp;
    if(sel[i].offsetParent){
      selp=sel[i];
      while(selp.offsetParent){
        selp=selp.offsetParent;
        selx+=selp.offsetLeft;
        sely+=selp.offsetTop;
      }
    }
    selx+=sel[i].offsetLeft;
    sely+=sel[i].offsetTop;
    selw=sel[i].offsetWidth;
    selh=sel[i].offsetHeight;
    if(selx+selw>x && selx<x+w && sely+selh>y && sely<y+h)
      sel[i].style.visibility="visible";
  }
}

function hideSelect(x,y,w,h){
  var selx,sely,selw,selh,i;
  var sel=document.getElementsByTagName("SELECT");
  for(i=0;i<sel.length;i++){
    selx=0; sely=0; var selp;
    if(sel[i].offsetParent){
      selp=sel[i];
      while(selp.offsetParent){
        selp=selp.offsetParent;
        selx+=selp.offsetLeft;
        sely+=selp.offsetTop;
      }
    }
    selx+=sel[i].offsetLeft;
    sely+=sel[i].offsetTop;
    selw=sel[i].offsetWidth;
    selh=sel[i].offsetHeight;
    if(selx+selw>x && selx<x+w && sely+selh>y && sely<y+h)
      sel[i].style.visibility="hidden";
  }
}

function jumpTo(URL_List){ var URL = URL_List.options[URL_List.selectedIndex].value;  window.location.href = URL; }


browserName=navigator.appName;
browserVer=parseInt(navigator.appVersion);
if ((browserName=="Netscape" && browserVer>=3) || (browserName=="Microsoft Internet Explorer" && browserVer>=4)) version="n3";
else version="n2"; 

function historyback() { history.back(); }

function historyforward() { history.forward(); }


function fillidfield(Type,Id){
  window.opener.document.forms["helpdeskform"].elements["computer"].value = Id;
  window.opener.document.forms["helpdeskform"].elements["device_type"].value = Type;
  window.close();
}

/**
 * marks all rows and selects its first checkbox inside the given element
 * the given element is usaly a table or a div containing the table or tables
 * From phpMyAdmin
 *
 * @param    container    DOM element
 */
function markAllRows( container_id ) {
  var rows = document.getElementById(container_id).getElementsByTagName('tr');
  var unique_id;
  var checkbox;

  for ( var i = 0; i < rows.length; i++ ) {

    checkboxes = rows[i].getElementsByTagName( 'input' );

    for ( var j = 0; j < checkboxes.length; j++ ) {
      checkbox=checkboxes[j];
      if ( checkbox && checkbox.type == 'checkbox' ) {
        unique_id = checkbox.name + checkbox.value;
        if ( checkbox.disabled == false ) {
          checkbox.checked = true;
          if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] ) {
            rows[i].className += ' marked';
            marked_row[unique_id] = true;
          }
        }
      }
    }
  }

  return true;
}


/**
 * marks all rows and selects its first checkbox inside the given element
 * the given element is usaly a table or a div containing the table or tables
 * From phpMyAdmin 
 *
 * @param    container    DOM element
 */
function unMarkAllRows( container_id ) {
  var rows = document.getElementById(container_id).getElementsByTagName('tr');
  var unique_id;
  var checkbox;

  for ( var i = 0; i < rows.length; i++ ) {
    checkboxes = rows[i].getElementsByTagName( 'input' );

    for ( var j = 0; j < checkboxes.length; j++ ) {
      checkbox=checkboxes[j];
      if ( checkbox && checkbox.type == 'checkbox' ) {
        unique_id = checkbox.name + checkbox.value;
        checkbox.checked = false;
        rows[i].className = rows[i].className.replace(' marked', '');
        marked_row[unique_id] = false;
      }
    }
  }
  return true;
}

function confirmAction(text,where){
  if (confirm(text)) {
    window.location = where;
  }
}

/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
* http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm
***********************************************/


var ie4=document.all;
var ns6=document.getElementById&&!document.all;
var menuwidth=400; /* RC 03/10/07 : ne change rien à la largeur menu dropmenu ? */
var disappeardelay=250;
var hidemenu_onclick="yes";


function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

/* RC 03/10/07 : en dur pour changer la largeur menu dropmenu ? */
menuwidth=200

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

function InitDropMenu() {if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>') ;
if (hidemenu_onclick=="yes")
document.onclick=hidemenu;

}
function GetMenuText (){
var s;

s ='<table border="0" cellspacing="0" cellpadding="0">';
s=s+'<tr><td><img src="/templates/images/r1_c1.jpg" height="13" width="9"></td>';
s=s+'<td><img src="/templates/images/r1_c2.jpg" width="100%" height="13"></td>';
s=s+'<td><img src="/templates/images/r1_c3.jpg" height="13" width="14"></td></tr>';
s=s+'<tr><td background="/templates/images/r2_c1.jpg">&nbsp;</td>';
s=s+'<td bgcolor="#FFFFFF">';
s=s+'<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>';
s=s+'</td>';
s=s+'<td  background="/templates/images/r2_c3.jpg">&nbsp;</td></tr>';
s=s+'<tr><td><img src="/templates/images/r3_c1.jpg" height="13" width="9"></td>';
s=s+'<td><img src="/templates/images/r3_c2.jpg" width="100%" height="13"></td>';
s=s+'<td><img src="/templates/images/r3_c3.jpg" height="13" width="14"></td></tr>';
s=s+'</table>';
return s;
}



