//
// DESCRIPTION : Sets the opacity of an element.
// INPUTS :
//    1) obj - the name of the element
//    2) opacity - the desired opacity of the element
//
function setOpacity(obj_id, opacity) {
	//
	// Get the object.
	//
	obj = document.getElementById(obj_id);
	//
	// Set opacity to 99.999 if it is 100.
	//
	if (opacity == 100)
	{
		opacity = 99.999;	
	}
	//
	// Set the opacity for different browsers.
	//
	obj.style.filter = "alpha(opacity:"+opacity+")";  // IE/Win
	obj.style.KHTMLOpacity = opacity / 100;           // Safari<1.2, Konqueror
	obj.style.MozOpacity = opacity / 100;             // Older Mozilla and Firefox
	obj.style.opacity = opacity / 100;                // Safari 1.2, newer Firefox and Mozilla, CSS3
}


//
// DESCRIPTION : Fade an element in.
// INPUTS :
//    1) obj - the name of the element
//    2) opacity - the desired opacity of the element
//
function fadeIn(obj_id, opacity) {
	//
	// Get the object.
	//
	obj = document.getElementById(obj);
	//
	// Set the opacity of the object.  Set a timer to iteratively
	// call this function with a reduced opacity.
	//
	if (opacity <= 100) {
		setOpacity(obj_id, opacity);
		opacity += 10;
		window.setTimeout("fadeIn('"+obj_id+"',"+opacity+")", 100);
	}
}


//
// DESCRIPTION : Fade an element out.
// INPUTS :
//    1) obj - the name of the element
//    2) opacity - the desired opacity of the element
//
function fadeOut(obj_id, opacity) {
	//
	// Get the object.
	//
	obj = document.getElementById(obj);
	//
	// Set the opacity of the object.  Set a timer to iteratively
	// call this function with a reduced opacity.
	//
	if (opacity > 0) {
		setOpacity(obj_id, opacity);
		opacity -= 10;
		window.setTimeout("fadeOut('"+obj_id+"',"+opacity+")", 100);
	}
}
