/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: JTricks.com :: http://www.jtricks.com/ */

function move_bax(an, bax) {
  var cleft = 0;
  var ctop = 0;
  var obj = an;
  while (obj.offsetParent) {
    cleft += obj.offsetLeft;
    ctop += obj.offsetTop;
    obj = obj.offsetParent;
  }
  bax.style.left = cleft + 'px';
  ctop += an.offsetHeight + 100;
  if (document.body.currentStyle &&
    document.body.currentStyle['marginTop']) {
    ctop += parseInt(
      document.body.currentStyle['marginTop']);
  }
  bax.style.top = ctop + 'px';
}

function show_hide_bax(an, width, height, borderStyle) {
  var href = an.href;
  var baxdiv = document.getElementById(href);

  if (baxdiv != null) {
    if (baxdiv.style.display=='none') {
      move_bax(an, baxdiv);
      baxdiv.style.display='block';
    } else
      baxdiv.style.display='none';
    return false;
  }

  baxdiv = document.createElement('div');
  baxdiv.setAttribute('id', href);
  baxdiv.style.display = 'block';
  baxdiv.style.position = 'absolute';
  baxdiv.style.width = width + 'px';
  baxdiv.style.height = height + 'px';
  baxdiv.style.border = borderStyle;
  baxdiv.style.backgroundColor = '#fff';

  var contents = document.createElement('iframe');
  contents.scrolling = 'no';
  contents.frameBorder = '0';
  contents.style.width = width + 'px';
  contents.style.height = height + 'px';
  contents.src = href;

  baxdiv.appendChild(contents);
  document.body.appendChild(baxdiv);
  move_bax(an, baxdiv);

  return false;
}