
var COOKIE_NAME2 = 'saga_download';
var COOKIE_NAME3 = 'saga_download_email';
var options = { path: '/', expires: 100000 };	  


function setAccess(sEmailAddress)
{
//	$.cookiesec(COOKIE_NAME, 'granted', options);

	

	$.cookie(COOKIE_NAME2, 'granted', options);
	$.cookie(COOKIE_NAME3, sEmailAddress, options);

	window.location = 'downloads.html';
}

function isUserLoggedOn()
{
	
	if($.cookie(COOKIE_NAME2) == 'granted')
	{
		$('#spEnglishSecurity').html('<strong>You are signed in as:</strong><br />' + $.cookie(COOKIE_NAME3));
		$('#spSwedishSecurity').html('<strong>Valkomnande rygg:</strong><br />' + $.cookie(COOKIE_NAME3));
		$('#tblLogonForm').hide('fast');
		$('#dvRegister').hide('fast');
	}
}

function checkSecurity2()
{

	if($.cookie(COOKIE_NAME2) == 'granted')
	{
		window.location = 'downloads.html';
		return true;
	}
	else
	{
		alert('Please register to view my downloads');
		return false;	
	}
}


function checkSecurity()
{

	if($.cookie(COOKIE_NAME2) == 'granted')
	{
		return true;
	}
	else
	{
		alert('You need to register before you can view this page.');
		window.location = 'new-index.html';
		return true;	
	}
}