(function($) {
	$.fn.panel2 = function(settings) {
		var config = {
			'close':'<div class="box_close" style="position:absolute;right:0px;top:0px;cursor:pointer;">Bezár</div>'
		};
		
		if (settings) $.extend(config, settings);

		this.each(function() {
 			
 			var item = $(this);
 			this.timer = null; 	
 			
 					
			 		
  		if (config.close)
  		{  			
		    var x = item.prepend(config.close);
		    var closeItem = item.children().first();
		    
			closeItem.click(function(){
			    item.fadeOut(200);
			    // item.hide();
			    $.cookie('popupbox0','1',{ path: '/', expires: 1 });
			});
			
			closeItem.hide();
			
			item.hover(function(){
				closeItem.fadeIn(200);
			}, function(){
				closeItem.fadeOut(200);
			});
		}
			
		item.hide();	
		item.css("left", ($(window).width() - item.width()) / 2 + $(window).scrollLeft() + "px");
		if ($.cookie('popupbox0') != '1')
		{
		    item.fadeIn('1500');	
		}
     });
 
     return this;
 
   };
 
 })(jQuery);
 
