// Start functioning when DOM is ready
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function bui_close()
{
	location.href = 'http://www.multilingualcareers.eu';	
	//$.unblockUI({
	//	onUnblock: function() {
	//		$('.blockUI').remove();
	//	}
	//});
	return false;
}

$(document).ready( function()
{
	var beenhere = false; // readCookie('beenhere');
	
	if( ! beenhere )
	{
		createCookie('beenhere','1',1);
		
		// Open a splash page with BlockUI
		$.blockUI(
		{
			// The div to use as splasg
			message: $('#splash'),
			
			// Style for the splash
			// !! Let op !! Style attributen met een streepje 
			// worden camelcased. dus 'text-align' wordt dan
			// 'textAlign' (Hoofdletter A).
			css: {
				width: '300px',
				height: '200px',
				top: '20%',
				left: '40%',
				textAlign: 'center',
				border: '0px solid #000',
				cursor: 'default'
			},
			
			// Style for the overlay
			// Hier worden de style attributen ook camelcased !!
			overlayCSS: {
				backgroundColor: '#FFF',
				opacity: '0.6',
				cursor: 'default'
			},
			
			onUnblock: function()
			{
				alert('test');
			}
		});
		
		setTimeout('bui_close()', 12000);
		
		// unblockUI on click on the overlay (Live functioning)
		$('.blockOverlay').live( 'click', function() {
			bui_close();
		});
	}
});	

