/* 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_box(an, box)
{
  var cleft = 60;
  var ctop = 8;
  var obj = an;
  
  while(obj.offsetParent)
  {
    cleft += obj.offsetLeft;
    ctop += obj.offsetTop;
    obj = obj.offsetParent;
  }
  
  box.style.left = cleft + 'px';
  ctop += an.offsetHeight + 8;
  
  if(document.body.currentStyle && document.body.currentStyle['marginTop'])
  {
    ctop += parseInt(document.body.currentStyle['marginTop']);
  }
  
  box.style.top = ctop + 'px';
}

function show_hide_directionsBox(an, width, height)
{
  var href = an.lang;
  var boxdiv = document.getElementById(href);
  var borderStyle = "1px solid";
  var borderColor = "#9C1A1F";

  if(boxdiv != null)
  {
    if(boxdiv.style.display == 'none')
    {
//      an.innerHTML = "<font size='+0' color='#FF0000'><b>Close change category window</b></font>";
      move_box(an, boxdiv);
      boxdiv.style.display = 'block';
    }
   
   else
   {
//      an.innerHTML = "<font size='+1'>Change category</font>";
      boxdiv.style.display = 'none';
//     document.location.replace("ops_categories.php");
    }
     
    return false;
  }
  
  else
  {
//    an.innerHTML = "<font size='+0' color='#FF0000'><b>Close change category window</b></font>";
  }

  boxdiv = document.createElement('div');
  boxdiv.setAttribute('id', href);
  boxdiv.style.display = 'block';
  boxdiv.style.position = 'absolute';
  boxdiv.style.width = width + 'px';
  boxdiv.style.height = height + 'px';
  boxdiv.style.border = borderStyle;
  boxdiv.style.borderColor = borderColor;
  boxdiv.style.backgroundColor = "#ffffff";

  var contents = document.createElement('iframe');
  contents.scrolling = 'no';
  contents.frameBorder = '0';
  contents.style.width = width + 'px';
  contents.style.height = height + 'px';
  contents.src = href;

  boxdiv.appendChild(contents);
  document.body.appendChild(boxdiv);
  move_box(an, boxdiv);

  return false;
}

