/**
* Fullscreenr - lightweight full screen background jquery plugin
* By Jan Schneiders
* Version 1.0
* www.nanotux.com
**/
jQuery.noConflict();
(function($j){	
	$j.fn.fullscreenr = function(options) {
		$j(document).ready(function() { $j(options.bgID).fullscreenrResizer(options);	});
		$j(window).bind("resize", function() { $j(options.bgID).fullscreenrResizer(options); });		
		return this; 		
	};	
	$j.fn.fullscreenrResizer = function(options) {
		
		// Set bg size
		var ratio = options.height / options.width;
		
		// Get browser window size
		var browserwidth = $j(window).width();
		var browserheight = $j(window).height();
		
		// Scale the image
		if ((browserheight/browserwidth) > ratio){
			//viewport. weite < viewport. höhe
			$j(this).height(browserheight);
			$j(this).width(browserheight / ratio);
		} else {
			//viewport. weite > viewport. höhe
			$j(this).width(browserwidth);
			$j(this).height(browserwidth * ratio);
		}
		
		// Center the image
//		$j(this).css('left', (browserwidth - $j(this).width())/2);
//		$j(this).css('top', (browserheight - $j(this).height())/2);
		
		return this; 		
	};
})(jQuery);
