// A self-executing anonymous function,
// standard technique for developing jQuery plugins.

(function($){
	
	$.fn.splashScreen = function(settings){
		
		var promoIMG = this;

		var splashScreen = $('<div>',{
			id	: 'splashScreen',
			css:{
				//backgroundImage		: 'url('+promoIMG.attr('rel')+')',
				//backgroundPosition	: 'center '+promoIMG.offset().top+'px',
				height				: $(document).height()
			}
		});

		var xpos= ($(document).width()/2)-400;
		splashScreen.html("<img src='"+promoIMG.attr('rel')+"' alt='' style='left: "+xpos+"px;'/>")
		
		$('body').append(splashScreen);
		
		splashScreen.click(
			function(){
				var poff = promoIMG.offset();
				
				//splashScreen.fadeOut('slow');
				$("img",splashScreen).animate({
					width: promoIMG.width()+'px',
					height: promoIMG.height()+'px',
					top: poff.top+'px',
					left: poff.left+'px'
				},2000);
				splashScreen.animate({
					opacity: 0
					}, 2000,
					function() {
						$(this).remove();
					});

				return this;
		});
	}
})(jQuery);
