(function($) {
	$.fn.liquid_bg = function(callerSettings){
		
		var settings;
		settings = $.extend({
    		bg_image_path: '',
			bg_image_ratio: ''
    	},callerSettings||{});
		
		$(document.body).prepend('<div id="BGContainer"><img src="' + settings.bg_image_path + '" /></div>');
		
		$bgcontainer = $('#BGContainer');
		$bgcontainer.css({'top':'0px', 'left':'0px', 'z-index':'-1000', 'display':'none'});
		$bgcontainer.fadeIn(3500);
				
		if($.browser.msie) {
			$bgcontainer.css({'position':'absolute'});
		} else {
			$bgcontainer.css({'position':'fixed'});
		};
		
		function BGResize(){
			$windowwidth = $(window).width();
			$windowheight = $(window).height();
			
			$bgcontainer.width($windowwidth).height($windowheight);
			
			if ($windowwidth / $windowheight > settings.bg_image_ratio) {
				$bgcontainer.find('img').width($windowwidth);
				
			} else {
				$bgcontainer.find('img').height($windowheight);
			};
		};
		
		BGResize();
		
		$(window).bind('resize', function(){
			BGResize();
		});
	
	} // ends fn.liquid_bg
})(jQuery);

