
//==============================================================================
// Show/Hide the spoilers
//==============================================================================
function ToggleSpoiler ( value )
{
	var isvisible = ( document.getElementById ( value ).style.visibility == 'visible' );
	document.getElementById ( value ).style.visibility = ( isvisible ? 'hidden' : 'visible' );
	document.getElementById ( value ).style.display = ( isvisible ? 'none' : 'block' );
}


//==============================================================================
// Show or hide a box
//==============================================================================
function ShowBox ( id )
{
	var popup = document.getElementById ( id );
	popup.style.visibility = 'visible';
	popup.style.display = 'block';
}
function HideBox ( id )
{
	var popup = document.getElementById ( id );
	popup.style.visibility = 'hidden';
	popup.style.display = 'none';
}


//==============================================================================
// Show a post popup
//==============================================================================
function ShowPopup ( event , id )
{
	var popup = document.getElementById ( 'post_' + id );
	popup.style.visibility = 'visible';
	popup.style.display = 'block';
	MovePopup ( event , id );
}
	

//==============================================================================
// Move a post popup
//==============================================================================
function MovePopup( event , id )
{
	var popup = document.getElementById ( 'post_' + id );
	var x = 0;
	var y = 0;
	if ( event.pageX )
	{
		x = ( event.pageX + 20 );
		y = ( event.pageY + 20 );
	}
	else
	{
		x = ( event.clientX + document.documentElement.scrollLeft + 20 );
		y = ( event.clientY + document.documentElement.scrollTop + 20 );
	}
	
	if ( x >= ( window.document.body.clientWidth - 550 ) )
	{
		x = window.document.body.clientWidth - 550;
	}
	
	popup.style.left = x + 'px';
	popup.style.top = y + 'px';
}


//==============================================================================
// Hide a post popup
//==============================================================================
function HidePopup( id )
{
	var popup = document.getElementById ( 'post_' + id );
	popup.style.visibility = 'hidden';
	popup.style.display = 'none';
}
