// this file is only included on the homepage. It redirects users to the Flash intro once.

var the_date = new Date();
the_date.setTime(the_date.getTime() + (365*24*60*60*1000));
var exp_date = '; expires=' + the_date.toGMTString();

function setCookie(name, value, expires, path, domain)
	{
	if ( value != 'empty' )
		{
		var setPath =(path) ? '; path=' + path : '; path=/';	
		var setDomain = (domain) ? '; domain=' + domain : '';
		if (expires == 'no')
			{
			document.cookie = name + '=' + escape(value) +'#' + exp_date +setDomain + setPath +  ';' ;
			}
		else
			{
			document.cookie = name + '=' + escape(value) +'#' +setDomain + setPath +  ';' ;
			}
		}
	else
		{
		alert('You are trying to set the value of the cookie to "empty".\nThis is not a good idea, as you will not be able to find out whether the cookie exists or not.');
		}
	}
	
function getCookie(name)
	{
	var theCookie = document.cookie;
	var whichCookie = name + '=';
	var rightCookie = theCookie.indexOf(whichCookie);
	if (rightCookie != -1)
		{
		var startCookie = rightCookie + whichCookie.length;
		var endCookie = theCookie.indexOf('#',startCookie);
		if (endCookie == -1)
			{
			endCookie = theCookie.length;
			}
		var theValue= unescape(theCookie.substring(startCookie, endCookie));
		return theValue;
		}
	else
		{
		var theValue ='empty';
		return theValue;
		}
	}

function doredirect(URL) {
	setCookie('cookieTest','true','yes');
	if( flash && ( flashVersion > 4 ) && ( getCookie('flash') == 'empty' ) && ( getCookie('cookieTest') == 'true' ) ) {
		setCookie('flash','true','yes');
		window.location = URL;
	}
}

// rob bamber added the following code to get this to work

