/**
 * @param name
 * @param value
 * @param days
 */
function setCookie(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=/";
}

/**
 * @param name
 * @return value
 */
function getCookie(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;
}

/**
 * @param name
 */
function deleteCookie(name)
{
	setCookie(name, "", -1);
}

/**
 * 
 */
function splash()
{
	if (getCookie("splash") == null) {
		document.getElementById("splashModal").style.display = "block";
		document.getElementById("splashModal").style.height = document.getElementsByTagName("BODY")[0].clientHeight+"px";
		var flashvars = {};
		var params = {};
		params.allowscriptaccess = "always";
		var attributes = {};
		swfobject.embedSWF("intro.swf", "splashFlash", "930", "470", "8.0.0", "expressInstall.swf", flashvars, params, attributes);
		setCookie("splash", true, 1);
		//document.getElementById("splashModal").addEventListener("click", closeSplash, true);
		addEvent( document.getElementById("splashModal"), "click", closeSplash );
	}
	window.scroll(0,0);
}

function addEvent( obj, type, fn )
{
	if (obj.addEventListener) {
		obj.addEventListener( type, fn, false );
	} else if (obj.attachEvent) {
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}

/**
 * 
 */
function closeSplash()
{
	document.getElementById("splashModal").style.display = "none";
}