	
$(document).ready(function() {
	
	if(!document.getElementById('plugin39')) return;
	
	// Hide the plugin
	$('#plugin39').css('display','none');
	
	// Get the plugin text
	var plugHTML = $('#plugin39').html();
	
	// Create starting html to be inserted into the pgin div
	var startHTML = "<div id='splashscreen'>";
	startHTML += "<div id='buttonarea'>";
	startHTML += "<a id='closebutton' href='#'>Close [X]</a>";
	startHTML += "</div>";
	
	var endHTML = "</div>";
	
	$('#plugin39').html(startHTML + plugHTML + endHTML);
	
	// Close and do not navigate
	$('#closebutton').click(function(e) {
		closeSplash();
		e.preventDefault();
	});
	
	c_val = null;
	c_val = getCookie("bhsplash");
	
	if (c_val == null)
	{
		setCookie("bhsplash","1",15);
		$.fancybox({
			'href'				: '#splashscreen',
			'type'				: 'inline',
			'autoScale'			: false,
			'titleShow'			: false,
			'autoDimensions'	: false,
			'showCloseButton'	: false,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'overlayColor'		: '#000000',
			'opacity'			: true,
			'width'				: '817',
			'height'			: '600'
		});
	}
});


function getCookie(c_name)
{
	var i, x, y, ARRcookies = document.cookie.split(",");
	for (i=0; i<ARRcookies.length; i++)
	{
		x = ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
		y = ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
		x = x.replace(/^\s+|\s+$/g,"");
		if (x == c_name)
		{
			return unescape(y);
		}
		else
		{
			return null;
		}
	}
}

function setCookie(c_name,value,exdays)
{
	var exdate=new Date();
	
	exdate.setDate(exdate.getDate() + exdays);
	
	var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
	
	document.cookie=c_name + "=" + c_value;
}

function closeSplash()
{
	setCookie("bhsplash","1",15);
	
	$.fancybox.close();
	
}
