
function toggleDiv( id, flagit )
{
	if( flagit == '1' ) {
		AssignPosition( document.getElementById(id) );
		if( document.layers ) {
			document.layers[''+id+''].visibility = 'show';
		} else if( document.all ) {
			document.all[''+id+''].style.visibility = 'visible';
		} else if( document.getElementById ) {
			document.getElementById(''+id+'').style.visibility = 'visible';
		}
	} else if( flagit == '0' ) {
		if( document.layers ) {
			document.layers[''+id+''].visibility = 'hide';
		} else if( document.all ) {
			document.all[''+id+''].style.visibility = 'hidden';
		} else if( document.getElementById ) {
			document.getElementById(''+id+'').style.visibility = 'hidden';
		}
	}
}


var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition( e )
{
	cX = e.pageX;
	cY = e.pageY;
}

function UpdateCursorPositionDocAll( e )
{
	cX = event.clientX;
	cY = event.clientY;
}

if( document.all ) {
	document.onmousemove = UpdateCursorPositionDocAll;
} else {
	document.onmousemove = UpdateCursorPosition;
}


function AssignPosition( d )
{
	if( self.pageYOffset ) {
		rX = self.pageXOffset;
		rY = self.pageYOffset;
	} else if( document.documentElement && document.documentElement.scrollTop ) {
		rX = document.documentElement.scrollLeft;
		rY = document.documentElement.scrollTop;
	} else if( document.body ) {
		rX = document.body.scrollLeft;
		rY = document.body.scrollTop;
	}
	if( document.all ) {
		cX += rX;
		cY += rY;
	}
	//d.style.left = (cX+100) + 'px';
	d.style.left = ((document.documentElement.scrollWidth / 2) - 133) + "px";
	d.style.top = (cY-120) + 'px';
}

function HideContent( d )
{
	if(d.length < 1) { return; }
	//clearTimeout( fadeOutEvent );
	//fadeOutLoop( d, 100 );
	document.getElementById(d).style.display = "none";
}

function ShowContent( d )
{
	if( d.length < 1 ) {
		return;
	}
	var dd = document.getElementById( d );
	AssignPosition( dd );
	dd.style.display = 'block';
	clearTimeout( fadeInEvent );
	fadeInLoop( d, 0 );
}


var fadeInEvent;
var fadeOutEvent;


function fadeInLoop( divID, val )
{
	obj = document.getElementById( divID );

	obj.style.opacity = (val / 100);
	obj.style.MozOpacity = (val / 100);
	obj.style.KhtmlOpacity = (val / 100);
	obj.style.filter = "alpha(opacity=" + val + ")";


	val += 10;
	if( val <= 100 ) {
		fadeInEvent = setTimeout( "fadeInLoop('" + divID + "', " + val + ")", 0 );
	}
}

function fadeOutLoop( divID, val )
{
	obj = document.getElementById( divID );

	//obj.style.opacity = (val / 100);
	//obj.style.MozOpacity = (val / 100);
	//obj.style.KhtmlOpacity = (val / 100);
	//obj.style.filter = "alpha(opacity=" + val + ")";

	obj.style.opacity = 0.0;
	obj.style.MozOpacity = 0.0;
	obj.style.KhtmlOpacity = 0.0;
	obj.style.filter = "alpha(opacity=0)";


	val -= 5;
	if( val >= 0 ) {
		fadeOutEvent = setTimeout( "fadeOutLoop('" + divID + "', " + val + ")", 0 );
	} else {
		obj.style.display = 'none';
	}
}


