function areCookiesEnabled() {
	// name, value, expires
	createCookie( 'test', 'none', '');
	// if readCookie succeeds, cookies are enabled, since the cookie was successfully created.
	if (readCookie('test')) {
		// erase the cookie since it was only a test
		eraseCookie('test');
			return true;
	} else {
		return false;
	}
}

function skipSplash(loc) {
    if(areCookiesEnabled()) {
        createCookie('skips', 'true', '360');
        window.location.href = loc;
    } else {
        alert("Cookies must be enabled in your browser for this to work");
    }
}

$(function() {
	var loc;

	$('#skip-splash').click(function(e) {
		loc = $(this).attr('href');
		e.preventDefault();
		skipSplash(loc);
	});
	
	if(areCookiesEnabled()) {
		if (readCookie('skips') ) {
			loc = $('#skip-splash').attr('href');
			window.location.href = (loc.length) ? loc : '';
		}
	}
});
