var posx = posy = targ = "";	// coordinates and event target

var hoverBoxId = "hoverBox";	// id of the box that gets displayed



// onload function written by Simon Willison - http://simon.incutio.com

// use this function instead of window.onload - usage addLoadEvent(functionName)

function addLoadEvent(func) {

  var oldonload = window.onload;

  if (typeof window.onload != 'function') {

    window.onload = func;

  } else {

    window.onload = function() {

      oldonload();

      func();

    }

  }

}

// end addLoadEvent()

/*----------------------*/



// activates the box

function hoverBox(e, linkage)

{

	/*if(timerID)

	   {

		  clearTimeout(timerID);

		  timerID  = 0;

	   }*/

	getXCoords(e);

	getYCoords(e);

	eventTarget(e);

	rel=linkage.getAttribute("rel").toString();;

	var moreBox = document.getElementById(rel);



	//fadeIn(id, 0,20);

	if(moreBox.style.display != "block") {

		showElement(rel);

	}

	moreBox.style.top = (posy - 10) + "px";

	moreBox.style.left = (posx + 10) +"px";

}

/*----------------------*/



// hides an element

function hideElement(id)

{

	document.getElementById(id).style.display = "none";

}

/*----------------------*/



// displays the element

function showElement(id)

{

	document.getElementById(id).style.display = "block";

}

/*----------------------*/



// gets the mouse X coords

function getXCoords(e)

{

	posx = 0;

	if(!e)

	var e = window.event;

	if(e.pageX)

		posx = e.pageX;

	else if (e.clientX)

		posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;

	return posx;

}

/*----------------------*/



// gets the mouse X coords

function getYCoords(e)

{

	posy = 0;

	if(!e)

		var e = window.event;

	if(e.pageY)

		posy = e.pageY;

	else if (e.clientY)

		posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;

	return posy;

}

/*----------------------*/



// gets event target so we know which link is being moused over

function eventTarget(e)

{

	if (!e)

		var e = window.event;

	if (e.target)

		targ = e.target;

	else if(e.srcElement)

		targ = e.srcElement;

	if (targ.nodeType == 3) // defeat Safari bug

		targ = targ.parentNode;

	return targ;	

}

/*----------------------*/