	// generate a vars object from the current querystring
	var v = new Vars(getHash(window)+'&'+getSearch(window));

	// when agecheck is set, redirect to main
	if (getCookie('AgeIsValid') == 'True')
	{
		document.location.href = 'main.html#' + v.toString();
	}

	var blnPopupBlocked	= true;
	var mainwnd;
	var isIEMac = (document.all && !window.print);

	self.moveTo(0,0);
	self.resizeTo(screen.availWidth,screen.availHeight);

	function scaleFlashMovie()
	{	
		var browserHeight = document.body.clientHeight;
		var browserWidth = document.body.clientWidth;
		
		if(!document.all)
		{
			browserHeight = document.clientHeight;
			browserWidth = document.clientWidth;
		}
	
		if(browserHeight == undefined){
		  browserHeight = document.body.clientHeight;
		  browserWidth = document.body.clientWidth;
		}
	
		//var theHeight = browserHeight - 30;
		var theHeight = browserHeight;
		var theWidth = (theHeight * 1014) / 690;
		
		if(browserWidth < theWidth)
		{
			//theWidth = browserWidth - 20;
			theWidth = browserWidth;
			theHeight = (theWidth * 690) / 1014;
		}
	
		if(theHeight > 690)
			theHeight = 690;
		if(theWidth > 1014)
			theWidth = 1014;
	
		MM_findObj("flashAgeCheck").style.height = theHeight;
		MM_findObj("flashAgeCheck").style.width = theWidth;
		
		if(!isIEMac)
		{
			MM_showHideLayers("flashAgeCheck", "", "show");
		}
	}
	
	function setTheEvents()
	{
		if(window.attachEvent)
			window.attachEvent("onresize", scaleFlashMovie);
		else
			window.onresize = scaleFlashMovie;
	}

	function setAgeCheck(value)
	{
		setCookie("AgeIsValid", (value ? "True" : "False"));
	} 

	function unblockPopup()
	{	
		blnPopupBlocked	= false;
	}
	
	function checkPopup()
	{
		MM_findObj('flashAgeCheck').SetVariable( "PopupsBlocked", blnPopupBlocked);
	}

	function setPopupTimer()
	{
		window.setTimeout('checkPopup()', 1500);
	}

	function initApp()
	{
		if (hasCookies())
		{
			MM_findObj("flashcheck").style.display = "block";

			// no expressinstall for now!
			var fo = new FlashObject("swf/agecheck.swf", "flashAgeCheck", "100%", "100%", "7.0.19", "#ffffff", false);
			fo.addParam("menu", "false");
			fo.addParam("quality", "high");
			fo.addParam("scale", "showall");
			fo.addParam("allowScriptAccess", "always");
			fo.write("flashcontent");
		
			if(!isIEMac)
			{
				MM_showHideLayers("flashAgeCheck", "", "hide");
			}

			scaleFlashMovie(); 
			setTheEvents();
		}
		else
		{
			MM_findObj("cookiecheck").style.display = "block";
		}
	}