// this function determines whether the event is the equivalent of the microsoft
// mouseleave or mouseenter events.
// http://dynamic-tools.net/toolbox/isMouseLeaveOrEnter/
function isMouseLeaveOrEnter(e, handler)
{		
	if (e.type != 'mouseout' && e.type != 'mouseover') return false;
	var reltg = e.relatedTarget ? e.relatedTarget :
	e.type == 'mouseout' ? e.toElement : e.fromElement;
	while (reltg && reltg != handler) reltg = reltg.parentNode;
	return (reltg != handler);
}

function expand(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);

  td.className = "menuNormal";  
  td.style.position = "relative";
  d.style.position = "absolute";
  d.style.top = "17px";
  d.style.left = "0px";
//d.style.width = "125px";
  d.style.display = "none";
  fade(d, true);
}

function collapse(s)
{
  var td = s;
  var d = td.getElementsByTagName("div").item(0);
  d = td.getElementsByTagName("div").item(0);

  td.className = "menuNormal";
  fade(d,false);
 }
 
 function hover(el, color)
 {
  el.style.color = "#000000";
 }

 function stopHover(el, color)
 {
   el.style.color = color;
 }

function colorThis(el, color)
{
	el.style.color = color;
}

///////////////////////////////////////////////////////////////////////
//     This fade library was designed by Erik Arvidsson for WebFX    //
//                                                                   //
//     For more info and examples see: http://webfx.eae.net          //
//     or contact Erik at http://webfx.eae.net/contact.html#erik     //
//                                                                   //
//     Feel free to use this code as lomg as this disclaimer is      //
//     intact.                                                       //
///////////////////////////////////////////////////////////////////////


var fadeSteps = 4;				// Number of steps to loop
var fademsec = 25;				// The time between each step (note that most computer have problem
								// handling to small values due to hardware limitations)


var fadeArray = new Array();	// Needed to keep track of wich elements are animating

//////////////////  fade  ////////////////////////////////////////////////////////////
//                                                                                  //
//   parameter: fadeIn                                                              //
// description: A boolean value. If true the element fades in, otherwise fades out  //
//              The steps and msec are optional. If not provided the default        //
//              values are used                                                     //
//                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////

function fade(el, fadeIn, steps, msec) {

	if (steps == null) steps = fadeSteps;
	if (msec == null) msec = fademsec;
	
	if (el.fadeIndex == null)
		el.fadeIndex = fadeArray.length;
	fadeArray[el.fadeIndex] = el;
	
	if (el.fadeStepNumber == null) 
	{
		if (el.style.display == "none")
			el.fadeStepNumber = 0;
		else
			el.fadeStepNumber = steps;
		if (fadeIn)
		{
			el.style.filter = "Alpha(Opacity=0) Shadow(Color=#000000, Direction=135, Strength=5)";
			el.style.display = "inline";
		}
		else
		{
			el.style.filter = "Alpha(Opacity=100) Shadow(Color=#000000, Direction=135, Strength=5)";
			el.style.display = "inline";
		}
	}
			
	window.setTimeout("repeatFade(" + fadeIn + "," + el.fadeIndex + "," + steps + "," + msec + ")", msec);
}

//////////////////////////////////////////////////////////////////////////////////////
//  Used to iterate the fading

function repeatFade(fadeIn, index, steps, msec) {	
	el = fadeArray[index];
	
	c = el.fadeStepNumber;
	if (el.fadeTimer != null)
		window.clearTimeout(el.fadeTimer);
	if ((c == 0) && (!fadeIn)) {			//Done fading out!
		el.style.display = "none";		// If the platform doesn't support filter it will hide anyway
		return;
	}
	else if ((c==steps) && (fadeIn)) {	//Done fading in!
		el.style.filter = "Shadow(Color=#000000, Direction=135, Strength=5)";
		return;
	}
	else {
		(fadeIn) ? 	c++ : c--;
		el.style.display = "inline";
		el.style.filter = "Alpha(Opacity=" + 100*c/steps + ") Shadow(Color=#000000, Direction=135, Strength=" + (c+1) + ")";

		el.fadeStepNumber = c;
		el.fadeTimer = window.setTimeout("repeatFade(" + fadeIn + "," + index + "," + steps + "," + msec + ")", msec);
	}
}

window.status = "";