(function($) {
	$.fn.spalshScreen = function(path, time) {
		if (document.cookie !== 'splash=false') {
			show(this, path);
			setTimeout(function() {
				$('#splashScreen').fadeOut(2000);
			}, time * 1000);
			document.cookie = 'splash=false';
		}
		return this;
	};

	function show(body, path) {
		var div = $('<div>');
		var img = $('<img>');
		img.attr('src', path);
		div.append(img);
		div.attr('id', 'splashScreen');
		div.css({
			'width': '100%',
			'height': '100%',
			'position': 'absolute',
			'top': '0',
			'left': '0',
			'background-color': '#000',
			'z-index': '9999'
		});
		body.append(div);
		img.load(function(){
			img.css({
				'width': $(window).width(),
				'margin-top': '-' + (img.height()) + 'px',
				'position': 'relative',
				'top': '50%'
			});
		});
	}
})(jQuery);
