/*
	Name of library:		functions_objects_showandhide.js
	Version:				0.1
	Created on:				2005/07/06
	Created by:				Jth
	Last modified on:		xx
	Last modified by:		xx

	This script depends on:
		functions_objects_get.js
*/

/*	show/hide functions (visibility set) v0.2
	It switches the visibility style property of objects based on their id.
	Example for mouse events:
		the pop (the element which will pop; the one which will be shown and/or hidden) will have an id like
			id="elementID_x"
		the trigger (link for example) should have the events
			onMouseOver="triggerShow ('elementID_x')"
			onMouseOut="triggerHide ('elementID_x')"
		the pop should also have these events
			onMouseOver="popKeep ('elementID_x')"
			onMouseOut="popLeave ('elementID_x')"	*/
	var pop_Timeouts = new Object ();
	var pop_Timeouts_Set = ",";
	function triggerShow (popID, f_popsClose)
	{
		eval ('if (pop_Timeouts.' + popID + ' != "") clearTimeout (pop_Timeouts.' + popID + ')');
		getObjectStyles(popID).visibility = 'visible';
		if (f_popsClose) popsClose (popID);
	}
	function triggerHide (popID, theTimeout)
	{
		if (!(theTimeout)) theTimeout = 300;
		eval ('pop_Timeouts.' + popID + ' = setTimeout (\'getObjectStyles("' + popID + '").visibility = "hidden"\', ' + theTimeout + ')');
		if (pop_Timeouts_Set.indexOf (popID) == -1) pop_Timeouts_Set += popID + ",";
	}
	function popKeep (popID)
	{
		triggerShow (popID);
	}
	function popLeave (popID, theTimeout)
	{
		if (!(theTimeout)) theTimeout = 300;
		triggerHide (popID, theTimeout);
	}
	function popsClose (popID_Leave, theTimeout)
	{
		if (!(popID_Leave)) popID_Leave = "";
		if (!(theTimeout)) theTimeout = 1;
		temp_array = pop_Timeouts_Set.split (",");
		for (i=1;i<temp_array.length-1;i++)
		{
			if (temp_array[i] != popID_Leave) triggerHide (temp_array[i], theTimeout);
		}
	}
/*	end of show/hide functions (visibility set)	*/
