$(document).ready(function() {

	// check cookies

var COOKIE_NAME = "splash";
		
    if(jQuery.cookie(COOKIE_NAME))
    {
	
	var spHits =  jQuery.cookie(COOKIE_NAME);
	spHits = parseInt(spHits);
	
		if(spHits < 3)
		{
			spHits++;
			jQuery.cookie(COOKIE_NAME, spHits, { path: '/'});
		}else
		{   
			jQuery.cookie(COOKIE_NAME, null, { path: '/'});
		}
	
    } else
	{
	  if(!jQuery.cookie("splash"))
	  {
	    do_overlay();	
	  }
	  jQuery.cookie(COOKIE_NAME, '1', { expires: 30 });
	  return false;
	
	}


});


function do_overlay() {

  // select the overlay element - and "make it an overlay"
  $(".overlay").overlay({

	// custom top position
	//top: 272,

	// some expose tweaks
	expose: {

		// you might also consider a "transparent" color for the mask
		color: '#fdbb30',

		// load mask a little faster
		loadSpeed: 200,

		// highly transparent
		opacity: 0.5
	},

	// disable this for modal dialog-type of overlays
	closeOnClick: false,


	// we want to use the programming API
	api: true

  // load it immediately after the construction
  }).load();

}

function close_overlay() { 
        $(".overlay").overlay().close(); 
}
