$(document).ready(function() {	

	// cookies!
	if ( $.cookie('oregonfreshstart_welcome') == 'true') {
		return;
	} else {
	
		// reset after 30 days
		$.cookie('oregonfreshstart_welcome','true',{ path: '/', expires: 30 } )
		
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();

		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		//$('#mask').fadeIn(1000);
		$('#mask').fadeTo(0,0);
		$('#mask').show();
		$('#mask').fadeTo(1000,0.5);	

		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
			  
		//Set the popup window to center
		$('#welcome').css('top',  winH/2-$('#welcome').height()/2);
		$('#welcome').css('left', winW/2-$('#welcome').width()/2);

		//transition effect
		$('#welcome').fadeIn(1000); 
	}

	//if close button is clicked
	$('#welcome .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('#welcome').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('#welcome').hide();
	});			
	
});
