/* JScript for base page */

/***********************************************************************************************
* Element highlighting code
*
* Set an element's onmouseover="highlightElementOn(this);" and
* onmouseout="highlightElementOff(this)" to enable mouse-over highlighting
*
***********************************************************************************************/

var highlightedBackgroundColor = "#99ccff";

function highlightElementOn(element)
{
	element.normalBackgroundColor = element.style.backgroundColor;
	element.style.backgroundColor = highlightedBackgroundColor;
}

function highlightElementOff(element)
{
	element.style.backgroundColor = element.normalBackgroundColor;
}



/**********************************************************************************************
* ShowHide code
*
**********************************************************************************************/

// toggle the display state of a ShowHide element
function showHide(sourceButton, id)
{
	var target = document.getElementById(id);
	sourceButton = sourceButton.childNodes[0];
	if(target.style.display == "none")
	{
		target.style.display = "";
		sourceButton.src = sourceButton.src.replace("1.gif", "0.gif");
	}
	else
	{
		target.style.display = "none";
		sourceButton.src = sourceButton.src.replace("0.gif", "1.gif");
	}
		
	target.parentNode.style.visibility = "hidden";
	target.parentNode.style.visibility = "visible";
	return false;
}

// show or hide all ShowHide elements in parent specified by id
function showHideAll(parentId, show)
{
     var parent = document.getElementById(parentId);
     showHideAllInElement(parent, show);
}

// show or hide all ShowHide elements in given element
function showHideAllInElement(parent, show)
{
	
	if(parent.nodeName == "IMG")
	{
		if(show==true)
			parent.src = parent.src.replace("show1.gif", "show0.gif");
		else
		    parent.src = parent.src.replace("show0.gif", "show1.gif");
	}
	
	if(parent.id != null && parent.id.substring(0, 7) == "RJETSH_")
		parent.style.display = (show==true) ? "" : "none";
	
	for(var i = 0; i < parent.childNodes.length; i++)
	{
		showHideAllInElement(parent.childNodes[i], show);
	}
}

function doNothing()
{
	return true;
}

var verticalScrollerSpeed = 1;

function verticalScroller(id)
{
	var content = document.getElementById(id);	
	
	if(content == null)
	{
		return;
	}
	var frame = content.parentNode;
	
	
	
	if(content.style.top == "")
		content.style.top = frame.style.height;
		
	
	var top = parseInt(content.style.top);
	
	if(top < -content.offsetHeight)
		top = parseInt(frame.style.height);
	else
		top -= verticalScrollerSpeed;
	
	content.style.top = top + "px";
		
	var verticalScrollerTimer = window.setTimeout("verticalScroller('" + id + "')", 60);	
	frame.onmouseover = function () {mouseOverScroller(verticalScrollerTimer);};
	content.onmouseover = function () {mouseOverScroller(verticalScrollerTimer);};
	frame.onmouseout = function () {mouseOutScroller(content.id);};
}

function mouseOverScroller(scrollerTimer)
{
		window.clearTimeout(scrollerTimer);
	
}

function mouseOutScroller(elementName)
{
	verticalScroller(elementName);
}
