(function($) {
	$.fn.Topbanner = function(options) {
		options = $.extend( {
			
			defaults: {
				log: false
			},
			core: {
				wrapper: $(this)
			}
			
		}, options );
		
		init();
		
		function init() {
			if (typeof(window["console"]) == "undefined") {
				options.defaults.log = false;
			}
			scale();
			
			$(window).bind( 'resize', function() {
				scale(); 
			});
			
			
		};
		
		function scale() {
			var _DocHeight = $(window).height();
			
			if ( _DocHeight ) {
				if ( options.defaults.log )
					console.info( 'Document height is ' + _DocHeight );
				
				var _Height = _DocHeight;
				
				var _Height = _Height - $('.Header').innerHeight();
				var _Height = _Height - $('.Blokken').innerHeight();
				var _Height = _Height - 90; //Helft van 1 item + padding-top + Header
				
				if ( options.defaults.log )
					console.info( 'Everything is subtracted and height is now: ' + _Height );
				
				if ( _Height > 360 ) {
					_Height = 360;
				} 
				
//				if ( !$('.Blokken').innerHeight() ) {
//					_Height = 300;
//				}
				
				if ( _Height < 200 ) {
					_Height = 200;
				}
				
				if ( options.defaults.log )
					console.info( 'Set item with classname "' + options.core.wrapper.attr( 'class' ) + '" on height ' + _Height );
				
				options.core.wrapper.css('height', _Height );
				
			} else {
				if ( options.defaults.log )
					console.info( 'Could not gain document height' );
			}
		};
				
	};
})(jQuery);
