
/* ============================================================================== */

function show_active_buttons(id) {
  document.getElementById(id+"-cancel-button").style.backgroundImage="url(/portail/images/cancel-button-active-ico16x16.png)";
  document.getElementById(id+"-minus-button").style.backgroundImage="url(/portail/images/minus-button-active-ico16x16.png)";
  document.getElementById(id+"-plus-button").style.backgroundImage="url(/portail/images/plus-button-active-ico16x16.png)";
}

function show_inactive_buttons(id) {
  document.getElementById(id+"-cancel-button").style.backgroundImage="url(/portail/images/cancel-button-inactive-ico16x16.png)";
  document.getElementById(id+"-minus-button").style.backgroundImage="url(/portail/images/minus-button-inactive-ico16x16.png)";
  document.getElementById(id+"-plus-button").style.backgroundImage="url(/portail/images/plus-button-inactive-ico16x16.png)";
}


/* ============================================================================== */

function restore_box_content(id) {
  var status = getCookie(id);
  if( status ) {
    document.getElementById(id).style.display=status;
  }
}

function show_box_content(id) {
  document.getElementById(id).style.display="block";
  var expires = new Date;
  expires.setSeconds(expires.getSeconds()+15768000);
  setCookie(id,"block", expires);
}

function hide_box_content(id) {
  document.getElementById(id).style.display="none";
  var expires = new Date;
  expires.setSeconds(expires.getSeconds()+15768000);
  setCookie(id,"none", expires);
}


/* ============================================================================== */

function zoom (id) {
  var elt = document.getElementById(id);

  if (elt) {
    var windowWidth = getWindowSize() ['width'];
    elt.style.visibility = "hidden";
    elt.style.display    = "";
    //var top  = Ymouse-20- getWindowScroll() ['scrollY'];
    //var left = Xmouse-(elt.clientWidth-25);
    var top  = Ymouse-elt.clientHeight+25- getWindowScroll() ['scrollY'];
    var left = Xmouse-25;
    if( left+elt.clientWidth > windowWidth ) {
      left = left - (left+elt.clientWidth - windowWidth) - 35;
    }
    if( left < 0 ) { left = 0; }

    elt.style.top        = top+"px";
    elt.style.left       = left+"px";
    elt.style.visibility = "";
  }
}

function unzoom (id) {
  var elt = document.getElementById(id);
  if (elt) {
    elt.style.display = "none";
  }
}


/* ============================================================================== */

function expand_collapse_tr (id, button) {
  var elt = document.getElementById(id);
  if (elt) {
    if(elt.style.display == "none") {
      if(button) { button.src = "/portail/images/crossexpanded-button.png"; }
      elt.style.visibility = "hidden";
      elt.style.display    = "";
      elt.style.visibility = "";
    } else {
      if(button) { button.src = "/portail/images/crosscollapsed-button.png"; }
      elt.style.display = "none";
    }
  }

  if (window.parent.resizeIframe) {
      window.parent.resizeIframe('iframe');
  }
}
