/* Create and postition menu -  Anders Blockmar 11/2004 */

//Extra code to find position:
function findPos(myid){
  var el,temp,x,y;

  x = 0;
  y = 0;

  el=document.getElementById(myid)
  if(!el){ return [2000,2000]; } //If we can't find the object then bail...

  if(el.offsetParent){
    temp = el
    while(temp.offsetParent){ //Looping parent elements to get the offset of them as well
      temp=temp.offsetParent; 
      x+=temp.offsetLeft
      y+=temp.offsetTop;
    }
  }
  x+=el.offsetLeft
  y+=el.offsetTop

  //Returning the x and y as an array
  return [x,y]
}

/* go to url */
function urlGoto(url)
{
  document.location = url;
}

/* turn back on an off */
function itemOn(obj)
{
  /*
  obj.style.backgroundColor="#CCCCCC";
  obj.style.borderColor="#666666";
  */

  obj.className="mhover";
  obj.style.borderColor="#666666"; /* IE crap */
}


function itemOff(obj)
{
  /*
  obj.style.backgroundColor="transparent";
  obj.style.borderColor="#EAEBE9";
  */
  obj.className="";
  obj.style.borderColor="#EAEBE9"; /* IE crap */
}

/* DHTML Menus by Anders Blockmar 04/2005 */

abMenu.hideTimer = [];
abMenu.currentMenu = null;

// constructor
function abMenu(id,left,top)
{
	/* check browser and set up vars */
	if( document.getElementById )
	{
	  this.id = id;
	  this.menu = document.getElementById(id + 'Container');
      this.load();
	}
}

abMenu.prototype.load  = function()
{
	this.menu.onmouseover = new Function("abMenu.menuShow('" + this.id + "')")
    this.menu.onmouseout = new Function("abMenu.menuHide('" + this.id + "')")
}

abMenu.menuShow  = function(id)
{
	if( abMenu.currentMenu ){ abMenu.menuHide2(abMenu.currentMenu); }

	var me = document.getElementById(id + 'Container');
	
	if(this.hideTimer[id]){ clearTimeout(this.hideTimer[id]); }
        //if( me != null ){ me.style.visibility = 'visible'; }
        if( me != null ){ me.style.display = 'block'; }
	abMenu.currentMenu = id;
}

abMenu.menuHide = function(id)
{
	if(this.hideTimer[id]){ clearTimeout(this.hideTimer[id]); }
	this.hideTimer[id]=setTimeout("abMenu.menuHide2('" + id + "')",200);
}

abMenu.menuHide2 = function(id)
{
  var me = document.getElementById(id + 'Container');
  //if( me != null ){ me.style.visibility = 'hidden'; }
  if( me != null ){ me.style.display = 'none'; }
}

abMenu.menuCloseCurrent = function()
{
	if( abMenu.currentMenu ){ abMenu.menuHide2(abMenu.currentMenu); }
	abMenu.currentMenu = null;
}
