/* includes code created by Juxtaprose - http://www.juxtaprose.com
(c) 2006. Licensed for use under
Creative Commons Attribution-NonCommercial-ShareAlike 2.0
http://creativecommons.org/licenses/by-nc-sa/2.0/
Please preserve this notice as a means of attribution. Thanks!
*/

/* obviously, this only works if there is JavaScript,
so the enter page markup is all encapsulated here
because the enter page feature should not appear unless
Javascript works
*/

show = false;

//only show the enter page once per session, track with a cookie
//if cookies don't work, don't show
if (readCookie('enter')==null) {
	createCookie('enter',1);
	if (readCookie('enter')==1) show=true;
}

//for debug only
// show = false;
// show = true;
//end debug only

if (show)
{
	document.write('<div id="enter" onclick="enter()">&nbsp;</div>'); 
	//entrance image is defined in CSS as a background-image

	document.write('<style type="text/css">#frontplane, #backplane {visibility: hidden;}</style>');
	//hide the non-entrance portions of the home page
}

function enter()
{
	e = document.getElementById('enter');
	b = document.getElementById('backplane');
	b.style.opacity = 0.0; 
	b.style.visibility = 'visible';	
	f = document.getElementById('frontplane');
	f.style.opacity = 0.0; 
	f.style.visibility = 'visible';
	try {
		Effect.Fade('enter');
		Effect.Appear('backplane');	
		Effect.Appear('frontplane');
	} catch (ec) {
		e.style.visibility = 'hidden';		
	}
}	

function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
