/** age verification functions and variables */
var cookieName = 'col_crest.age_verification';

function checkCookie() {
	return $.cookie(cookieName);
}

function passValidation(checked) {
	if (checked != false) {
		// They checked the box; the cookie is set for 30 days
		$.cookie(cookieName,true,{expires: 30,path: '/'});
	} else {
	$.cookie(cookieName,true,{path: '/'});
	}
	
	// get rid of the modal and they're on their way:
	$.closeDOMWindow();
	
	/* for the homepage only: */
	flashMovie = document.getElementById("flash_content_home");
	if (flashMovie) {	
		flashMovie.enableInteractivity();
	}
	
	// or, force a reload of the page to enable Flash (if necessary)
	// location.reload(true);
	
}

function displayVerification() {
	$.openDOMWindow({ 
			borderSize: 0,
			overlayColor: '#333',
			overlayOpacity:'80',
			draggable: 0,
			modal: 1,
			width: 450,
			height: 387,
			loader:1,
			loaderImagePath:'/img/verify/spinner.gif', 
			loaderHeight:16, 
			loaderWidth:17, 
			windowSource:'iframe',
			windowPadding:0,
			windowSourceURL: '/homepage/verification/' 
		});
}

$(document).ready(function(){
	
	// if there is no cookie put up the age verification modal
	if(!checkCookie(cookieName)) {
		displayVerification();
	}

});
