/**
* Tomas Dabašinskas
* 2009-11-11
*/
jQuery(document).ready(function($) {
	showAdultAlert();
});

/**
* Shows adult alert
*/
function showAdultAlert() {
	// Variables:
	COOKIE = 'adult';				// Cookie name for storing the state of the warning
	
	// Hide the message:
	$('#adultWarning').css('display', 'none');
	// If there's no cookie:
	if ($.cookie(COOKIE) != 1) {
		// Show the alert:
		$.blockUI({
			message:	$('#adultWarning'),
			css: {
				width: '60%',
				left: '20%',
				top: '20%'
			},
			overlayCSS: { 
		        backgroundColor: '#000', 
		        opacity: 0.5 
			}			
		});
		// User decided to accept the terms:
		$('#adultWarningAccept').click(function() {
			// Save the cookie:
			$.cookie(COOKIE, 1, {
				path: '/',
				expires: 200
			});
			// Unblock the screen:
			$.unblockUI();
		});
	}	
}
