(function($) {
		
    /**		
     *	Name: µPopup v1.8.9(jQuery.popup)
     *  (c) 2010, Sebestyén Zsolt
     *  License: Creative Commons License (http://creativecommons.org/licenses/by/3.0/)
     *  E-mail: info [at] zsottya [dot] hu
     **/	
	$.popup = function(element, config) {
		this.config = {};
		
		element.data('activePopup', false);
		
		/**		
		 *	Name: _getDimensions		 
		 *	@access private
		 *	@var [config] object		 
		 *	@return object 		 		  		 
		 **/		
		function _getDimensions(config) {
			var windowWidth = $(window).width(),
				windowHeight = $(window).height(),
				documentWidth = $(document).width(),
				documentHeight = $(document).height(),
				popupBoxWidth = $('#'+config.id).width(),
				popupBoxHeight = $('#'+config.id).height();
			
			return {
				'overlayWidth':  (windowWidth > documentWidth) ? windowWidth : documentWidth,
				'overlayHeight': (windowHeight > documentHeight) ? windowHeight : documentHeight,
				'popupWidth': 	 popupBoxWidth,
				'popupHeight': 	 popupBoxHeight
			}  
		}
		
		/**		
		 *	Name: _getHighestZIndexValue		 
		 *	@access private		 
		 *	@return number 		 		  		 
		 **/
		function _getHighestZIndexValue() {
			return Math.max.apply(null,$.map($('body > *'), function(e,n){
				if($(e).css('position')=='absolute' || $(e).css('position')=='static' || $(e).css('position')=='relative')
					return parseInt($(e).css('z-index'))||1 ;
		    	})
			);
		}
		
		/**		
		 *	Name: _getBoxItemsStyle		 
		 *	@access private		 
		 *	@return object 		 		  		 
		 **/
		function _getBoxItemsStyle(config) {
			var box = $('#' + config.id);
			
			var plus = (config.doubleBorder === true) ? parseInt(config.doubleBorderRadius,10) : 0;		 
		
			var h_height =   parseInt(box.find('.Popup_Title').css('height'), 10)
						   + parseInt(box.find('.Popup_Title').css('padding-top'), 10)
						   + parseInt(box.find('.Popup_Title').css('padding-bottom'), 10),
						   
				f_height =   parseInt(box.find('.Popup_Footer').css('height'), 10)
						   + parseInt(box.find('.Popup_Footer').css('padding-top'), 10)
						   + parseInt(box.find('.Popup_Footer').css('padding-bottom'), 10),
				
				b_height =   parseInt(box.find('.Popup_Content').css('padding-top'), 10)
						   + parseInt(box.find('.Popup_Content').css('padding-bottom'), 10),
								   
				c_height = parseInt(box.height(), 10),
				c_width  = parseInt(box.width(), 10);
				
				h_height = (!isNaN(h_height)) ? h_height : 0;
				f_height = (!isNaN(f_height)) ? f_height : 0;
				b_height = (!isNaN(b_height)) ? b_height : 0;
                
			return {
				'header_height': h_height,
				'footer_height': f_height,
				'box_height': 	 c_height,
				'box_width': 	 c_width,
				'body_height':   (c_height - f_height - h_height - b_height - (plus*2))
			}; 
		}
        
       /**		
		 *	Name: setContent
		 *	Description: a popup törzsének szövegét lehet módosítani (a html kód is engedélyezett)		 
		 *	@access public		 
		 *	@var [id] string
		 *	@var [newContent] string
		 *	@return object 		 		  		 
		 **/
		this.setContent = function(element, newContent) {
			var $this 	= element.data('popup'),
				config 	= $this.config,
				id 		= config.id,
				box		= $('#'+id);
				
			if ($this !== null && newContent!=undefined)
			{
				box.find('.Popup_Content').html(newContent);
			}
			return this;
		};
		
		/**		
		 *	Name: setTitle
		 *	Description: a popup fejlécének tartalmát lehet módosítani (a html kód is engedélyezett)		 
		 *	@access public		 
		 *	@var [id] string
		 *	@var [newContent] string
		 *	@return object 		 		  		 
		 **/		
		this.setTitle = function(element, newContent) {
			var $this 	= element.data('popup'),
				config 	= $this.config,
				id 		= config.id,
				box		= $('#'+id);
					
			if ($this !== null && newContent!=undefined && box.find('.Popup_Title').length > 0)
			{
				box.find('.Popup_Title').html(newContent);
			}
			return this;
		};
		
		/**		
		 *	Name: setFooter
		 *	Description: a popup láblécének tartalmát lehet módosítani (a html kód is engedélyezett)		 
		 *	@access public		 
		 *	@var [id] string
		 *	@var [newContent] string
		 *	@return object 		 		  		 
		 **/				
		this.setFooter = function(element, newContent) {
			var $this 	= element.data('popup'),
				config 	= $this.config,
				id 		= config.id,
				box		= $('#'+id);
			
			if ($this !== null && newContent!=undefined && box.find('.Popup_Footer').length > 0)
			{
				box.find('.Popup_Footer').html(newContent);
			}
			return this;
		};
		
		/**		
		 *	Name: resize
		 *	Description: a popup méretét lehet módosítani.		 		 
		 *	@access public		 
		 *	@var [obj] object
		 *	@var [id] string
		 *	@var [width] int
		 *	@var [height] int
		 *  @var [speed] int
		 *  @var [delay] int
		 *  @var [callback] function		 		 
		 *	@return object 		 		  		 
		 **/		
		this.resize = function(element, width, height, speed, delay) {
			var $this 	= element.data('popup'),
				config 	= $this.config,
				id 		= config.id,
				box		= $('#'+id);
			
			if ($this !== null  && width!=undefined && height!=undefined)
			{
				speed 	= (speed === undefined) ? 0 : speed;
				delay	= (delay === undefined) ? 0 : delay;
				width 	= parseInt(width, 10);
				height 	= parseInt(height, 10);
					
				width = (width <= parseInt(config.width, 10)) ? parseInt(config.width, 10) : width;
				height = (width <= parseInt(config.height, 10)) ? parseInt(config.height, 10) : height;
				
				box.find('.Popup_Title, .Popup_Content, .Popup_Footer, .Popup_Border')
				   .fadeOut(config.hideSpeed, function() {
				   					
						box.animate({ 	width: width, 
						 			height: height, 
									marginLeft:-(width/2), 
									marginTop:-(height/2) 
								}, 
								{queue:false, duration: speed, complete:  
								function() {
									var hcf_css = _getBoxItemsStyle(config);
									box.find('.Popup_Content').css('height', hcf_css.body_height);
									box.find('.Popup_Title, .Popup_Content, .Popup_Footer').fadeIn(config.showSpeed);
							   }});
				});
			}
			return this;
		};    
         
		/**		
		 *	Name: _fix_box_poz
		 *	Description: doboz helyzetét javítja megjelenítés után
		 *	@access private		 
		 *	@var [box] object
		 *	@return bool 		 		  		 
		 **/
        function _fix_box_poz(box, plus) 
        {
			var top_poz = box.offset().top,
				left_poz = box.offset().left;
				
			if (top_poz < 0)
			{ box.css('top', (config.height/2)+(plus*2)); }
		
			if (left_poz < 0)
			{ box.css('left', (config.width/2)+(plus*2)); }
			
			return false;
		}
        
        function _add_rounded_border(poz, size)
        {
        	var res = {},
        		prefix = '',
        		fixafter = '';
        		
        	if ($.browser.webkit === true)
        	{ prefix = '-webkit-'; fixafter = '-top-left-radius'; }
        	else if ($.browser.mozilla === true)
        	{ prefix = '-moz-'; fixafter = '-radius-topleft'; }
        	else
        	{ prefix = ''; fixafter = '-top-left-radius'; }
				
			/*switch(poz)
			{
				case 'top':
					res = {
						'-webkit-border-top-left-radius': config.borderRadius.toString(),
						'-webkit-border-top-right-radius': config.borderRadius.toString(),
						'-moz-border-radius-topleft': config.borderRadius.toString(),
						'-moz-border-radius-topright': config.borderRadius.toString(),
						'border-top-left-radius': config.borderRadius.toString(),
						'border-top-right-radius': config.borderRadius.toString(),
						'-khtml-border-radius-topleft': config.borderRadius.toString(),
						'-khtml-border-radius-topright': config.borderRadius.toString()						
					};
				break;
			}  */
		}
        
		/**		
		 *	Name: _create
		 *	Description: popup doboz és hátterének létrehozása		 
		 *	@access private		 
		 *	@var [element] object
		 *	@var [config] object
		 *	@return bool 		 		  		 
		 **/
		function _create(element, config, obj) 
		{   								
			if (config.oneBoxAllowed === true && element.data('activePopup') === true)
			{ return false; }
			
			element.data('activePopup', true);
			
			var dim = _getDimensions(config);   
							
			//BOXOK START
			if (config.overlay !== null && $('.Popup_Background').length === 0)
			{
				$('<div/>', {
					'class': 'Popup_Background',
					css: {
						width: 				dim.overlayWidth,
						height: 			dim.overlayHeight,
						backgroundColor:	config.overlay,
						opacity: 			config.overlayOpacity,
						zIndex:				(parseInt(config.zIndex, 10)===0) ? parseInt(_getHighestZIndexValue(), 10) + 1 : parseInt(config.zIndex, 10)
					}
				}).prependTo('body');
								
				$('.Popup_Background').fadeIn(config.showSpeed);
				
				$(window).bind('resize', function() {
					if ( $(window).height() != $('.Popup_Background').height() ||
						 $(window).width() != $('.Popup_Background').width() )
					{
						dim = _getDimensions(config); 
						$('.Popup_Background').css({ height: dim.overlayHeight, width: dim.overlayWidth });
					}
				});
			}
			
			
			//tartalom kinyerése
			if (config.useElementsContent === true)
			{
				if (element.is('input'))
				{ config.content = element.attr('value'); }
				else 
				{ config.content = element.html(); }
			}
			
			//tartalom beállítása 
			var Popup_Body;
			if (config.doubleBorder !== true)
			{
				Popup_Body = "<div class=\"Popup_Body\">"; 
			}
			else
			{
			    Popup_Body = "<div class=\"Popup_Window_Border\"><div class=\"Popup_Body\">";
			}		
				if (config.title != null && config.title.toString().length > 0) 
				{
					Popup_Body += '<div class="Popup_Title">'+config.title+'<span class="Popup_Close">'+config.closeButtonContent+'</span></div>';
				}
				
                Popup_Body += '<div class="Popup_Content">'+config.content+'</div>';
				
                if (config.footer != null && config.footer.toString().length > 0) 
				{
					Popup_Body += '<div class="Popup_Footer">'+config.footer+'</div>';
				}
			if (config.doubleBorder !== true)
			{
				Popup_Body += "</div>"; 
			}
			else
			{
			    Popup_Body += "</div></div>";
			}
			
			var plus = (config.doubleBorder === true) ? parseInt(config.doubleBorderRadius,10)*2 : 0;
					
			$('<div/>', {
				'class': 'Popup_Window',
				id:config.id,
				css: {
					width: 				(config.width+plus)+'px',
					height: 			(config.height+plus)+'px',
					zIndex:				(parseInt(config.zIndex, 10)===0) ? parseInt(_getHighestZIndexValue(), 10) + 2 : parseInt(config.zIndex, 10) + 2,
					marginLeft:			-(config.width/2)-(plus/2),
					marginTop:			-(config.height/2)-(plus/2)
				},
				html: Popup_Body
			}).prependTo('body');
			
			var box = $('#'+config.id),
				IE = $.browser.msie && parseInt($.browser.version, 10) < 9;
									
			if (config.doubleBorder === true)
			{
				box.find('.Popup_Window_Border').css({
					width: 				(config.width)+'px',
					height: 			(config.height)+'px',
					zIndex:				(parseInt(config.zIndex, 10)===0) ? parseInt(_getHighestZIndexValue(), 10) + 1 : parseInt(config.zIndex, 10),
					padding:			parseInt(config.doubleBorderRadius,10)
				});	
			} 
			
			//kerekített sarkak (próbáltam cross-browseresíteni)
			if (typeof config.borderRadius == 'string' && config.borderRadius.length >=3)
			{    
				box.css({
					'-webkit-border-radius': config.borderRadius.toString(),
					'-moz-border-radius': config.borderRadius.toString(),
					'border-radius': config.borderRadius.toString(),      					
					'-khtml-border-radius': config.borderRadius.toString()
				});
				
				if (IE)
				{  box.css('behavior', 'url(PIE.php)');  }
				
				if (config.doubleBorder === true)
				{      
					box.find('.Popup_Window_Border').css({
						'-webkit-border-radius': config.borderRadius.toString(),
						'-moz-border-radius': config.borderRadius.toString(),
						'-khtml-border-radius': config.borderRadius.toString(),
						'border-radius': config.borderRadius.toString()
					});
					
					if (IE)
					{  box.find('.Popup_Window_Border').css('behavior', 'url(PIE.php)');  }
				}
				
				if (box.find('.Popup_Title').length>0 && box.find('.Popup_Footer').length>0)
				{
					box.find('.Popup_Title').css({
						'-webkit-border-top-left-radius': config.borderRadius.toString(),
						'-webkit-border-top-right-radius': config.borderRadius.toString(),
						'-moz-border-radius-topleft': config.borderRadius.toString(),
						'-moz-border-radius-topright': config.borderRadius.toString(),
						'border-top-left-radius': config.borderRadius.toString(),
						'border-top-right-radius': config.borderRadius.toString(),
						'-khtml-border-radius-topleft': config.borderRadius.toString(),
						'-khtml-border-radius-topright': config.borderRadius.toString()						
					});
					box.find('.Popup_Footer').css({
						'-webkit-border-bottom-left-radius': config.borderRadius.toString(),
						'-webkit-border-bottom-right-radius': config.borderRadius.toString(),
						'-moz-border-radius-bottomleft': config.borderRadius.toString(),
						'-moz-border-radius-bottomright': config.borderRadius.toString(),
						'border-bottom-left-radius': config.borderRadius.toString(),
						'border-bottom-right-radius': config.borderRadius.toString(),
						'-khtml-border-radius-bottomleft': config.borderRadius.toString(),
						'-khtml-border-radius-bottomright': config.borderRadius.toString()
					});
				}
				else if (box.find('.Popup_Title').length>0 && box.find('.Popup_Footer').length==0)
				{
					box.find('.Popup_Title').css({
						'-webkit-border-top-left-radius': config.borderRadius.toString(),
						'-webkit-border-top-right-radius': config.borderRadius.toString(),
						'-moz-border-radius-topleft': config.borderRadius.toString(),
						'-moz-border-radius-topright': config.borderRadius.toString(),
						'border-top-left-radius': config.borderRadius.toString(),
						'border-top-right-radius': config.borderRadius.toString(),        						
						'-khtml-border-radius-topleft': config.borderRadius.toString(),
						'-khtml-border-radius-topright': config.borderRadius.toString()						
					});
					box.find('.Popup_Content').css({
						'-webkit-border-bottom-left-radius': config.borderRadius.toString(),
						'-webkit-border-bottom-right-radius': config.borderRadius.toString(),
						'-moz-border-radius-bottomleft': config.borderRadius.toString(),
						'-moz-border-radius-bottomright': config.borderRadius.toString(),
						'border-bottom-left-radius': config.borderRadius.toString(),
						'border-bottom-right-radius': config.borderRadius.toString(),    						
						'-khtml-border-radius-bottomleft': config.borderRadius.toString(),
						'-khtml-border-radius-bottomright': config.borderRadius.toString()						
					});
				}
				else if (box.find('.Popup_Title').length==0 && box.find('.Popup_Footer').length>0)
				{
					box.find('.Popup_Content').css({
						'-webkit-border-top-left-radius': config.borderRadius.toString(),
						'-webkit-border-top-right-radius': config.borderRadius.toString(),
						'-moz-border-radius-topleft': config.borderRadius.toString(),
						'-moz-border-radius-topright': config.borderRadius.toString(),
						'border-top-left-radius': config.borderRadius.toString(),
						'border-top-right-radius': config.borderRadius.toString(),
						'-khtml-border-radius-topleft': config.borderRadius.toString(),
						'-khtml-border-radius-topright': config.borderRadius.toString()						
					});
					box.find('.Popup_Footer').css({
						'-webkit-border-bottom-left-radius': config.borderRadius.toString(),
						'-webkit-border-bottom-right-radius': config.borderRadius.toString(),
						'-moz-border-radius-bottomleft': config.borderRadius.toString(),
						'-moz-border-radius-bottomright': config.borderRadius.toString(),
						'border-bottom-left-radius': config.borderRadius.toString(),
						'border-bottom-right-radius': config.borderRadius.toString(),    						
						'-khtml-border-radius-bottomleft': config.borderRadius.toString(),
						'-khtml-border-radius-bottomright': config.borderRadius.toString()						
					});
				}
				else
				{
				    box.find('.Popup_Content').css({
						'-webkit-border-radius': config.borderRadius.toString(),
						'-moz-border-radius': config.borderRadius.toString(),
						'border-radius': config.borderRadius.toString(),     
						'-khtml-border-radius': config.borderRadius.toString()
					});
				}
			}
			
			//doboz mögé árnyék
			if (typeof config.boxShadow == 'string' && config.boxShadow.length >=7)
			{
				box.css({
					'box-shadow': config.boxShadow.toString(),
					'-moz-box-shadow': config.boxShadow.toString(),
					'-webkit-box-shadow': config.boxShadow.toString()
				});
			}
			
			//draggable
			if (box.draggable)
			{
				if (box.find('.Popup_Title').length === 1)
				{
					box.draggable({ handle:'.Popup_Title' });
					box.find('.Popup_Title').css('cursor', 'move');
				}
				else
				{
				    box.draggable({ handle:'.Popup_Content' });
				}
			}
			
			//content rész magasságának beállítása
			var hcf_css = _getBoxItemsStyle(config);
			box.find('.Popup_Content').css('height', hcf_css.body_height);
			            
            //doboz megjelenítése
            //az opera kicsit buggy, ezért kell ez a kis hekk
            if ($.browser.opera)
            {
                box.css({ opacity:0.0, display:'block' });
                box.find('.Popup_Content, .Popup_Title, .Popup_Footer').css({ opacity:0.0 });
                
                hcf_css = _getBoxItemsStyle(config);
                box.find('.Popup_Content').css('height', hcf_css.body_height);
    			
    			if (config.showSpeed > 0)
    			{
	                box.delay(config.showSpeed).animate({opacity:1.0}, config.showSpeed, function() {
	                    box.find('.Popup_Content, .Popup_Title, .Popup_Footer').css({ opacity:1.0 });       
						_fix_box_poz(box, plus);
						 
	    				if (typeof config.onLoaded == 'function')
	    				{	        
	    					if ($('.Popup_Window').length > 1)
							{  $('.Popup_Window').each(function() { $(this).removeClass('Active_Popup'); }); }
							box.addClass('Active_Popup');
							
							config.onLoaded(box, config.id, obj, _getHighestZIndexValue()); 
	    				}
	    			});
    			}
    			else
    			{
					box.animate({opacity:1.0}, 0, function() {
	                    box.find('.Popup_Content, .Popup_Title, .Popup_Footer').css({ opacity:1.0 });
						_fix_box_poz(box, plus);
						        
	    				if (typeof config.onLoaded == 'function')
	    				{	 
							if ($('.Popup_Window').length > 1)
							{  $('.Popup_Window').each(function() { $(this).removeClass('Active_Popup'); }); }
							box.addClass('Active_Popup');
							       
	    					config.onLoaded(box, config.id, obj, _getHighestZIndexValue()); 
	    				}
	    			});
				}
            }	
            else
            {
            	if (config.showSpeed > 0)
            	{
	                box.delay(config.showSpeed).fadeIn(config.showSpeed, function() {
	                	_fix_box_poz(box, plus);
						
	    				if (typeof config.onLoaded == 'function')
	    				{ 
	    					if ($('.Popup_Window').length > 1)
							{  $('.Popup_Window').each(function() { $(this).removeClass('Active_Popup'); }); }
							box.addClass('Active_Popup');
							
	    				    hcf_css = _getBoxItemsStyle(config);
	                        box.find('.Popup_Content').css('height', hcf_css.body_height);	        
	    					config.onLoaded(box, config.id, obj, _getHighestZIndexValue()); 
	    				}
	    			});
				}   
				else
				{
					box.show(0, function() {
						_fix_box_poz(box, plus);
						
	    				if (typeof config.onLoaded == 'function')
	    				{
							if ($('.Popup_Window').length > 1)
							{  $('.Popup_Window').each(function() { $(this).removeClass('Active_Popup'); }); }
							box.addClass('Active_Popup');
							 
	    				    hcf_css = _getBoxItemsStyle(config);
	                        box.find('.Popup_Content').css('height', hcf_css.body_height);	        
	    					config.onLoaded(box, config.id, obj, _getHighestZIndexValue()); 
	    				}
	    			});
				}             
            }
			//BOXOK VÉGE
			
			
			//AKTÍV ABLAK JELÖLÉSE (  class[Active_Popup]  )
			box.bind('click dblclick', function() {
				if ($('.Popup_Window').length > 1)
				{
					$('.Popup_Window').each(function() {
						$(this).removeClass('Active_Popup');
					});
				}
				box.addClass('Active_Popup');
			});
			
			
			//Törlés
			if (config.destroyId != null)
			{ $(config.destroyId).bind('click', function() { _destroy(element, config, config.id, box); });  }
			
			//ESC kilépés
			$(document).keypress(function(e) {
				if ( config.closeOnEsc===true && (e.keyCode|e.charCode) === 27 && $('.Popup_Window').length > 0 )
				{
					_destroy(element);
				} 
			});
            
			//BG kattintásra kilép
			$('body *').bind('click', function(e) {
				var cls = $(e.target).attr('class');
				if ( config.closeOnOverlayClick === true && new RegExp('Popup_Background').test(cls) )
				{
					_destroy(element);
				}			
			});
			
			//kilépés gombra kattintva bezárom a popupot
			box.find('.Popup_Close').bind('click', function() {
				_destroy(element);
			});
            
            			
			return true;
		}  
		
		/**		
		 *	Name: _destroy
		 *	Description: popup törlése		 
		 *	@access private		 
		 *	@var [element] object
		 *	@var [config] object
		 *	@return bool 		 		  		 
		 **/
		function _destroy(element, cb) {
			var $this 	= element.data('popup'),
				config 	= $this.config,
				id 		= config.id,
				box		= $('#'+id);
						
			if (  $('.Popup_Window').length > 0  )
			{
				if (config.hideSpeed > 0)
				{
					box.fadeOut(config.hideSpeed, function() {
						if (  $('.Popup_Window').length-1 < 1  )
						{
							$(this).remove();
							$('.Popup_Background').fadeOut(config.hideSpeed, function() {
								$(this).remove();
							});	
						}
					});
				}
				else
				{
					box.remove();
					if (  $('.Popup_Window').length-1 < 1  )
					{
						$('.Popup_Background').remove();
					}
				}
			}
			else 
			{
				box.remove();
				$('.Popup_Background').remove();			
			}
									
			element.data('activePopup', false);
			//element.data('popup', $this);
			element.die(config.showEvent);
			
			if (typeof cb != 'function' && typeof config.onDestroy == 'function')
			{ config.onDestroy(box, config.id); }                             
			else if (typeof cb == 'function')
			{ cb(box, config.id); }
			
			return true;
		}		
		
		/**		
		 *	Name: destroy
		 *	Description: popup törlése		 
		 *	@access public		 
		 *	@var [element] object
		 *	@return object 		 		  		 
		 **/
		this.destroy = function(element, cb)
		{
			_destroy(element, cb);
			return this;
		};  		
				
		/**		
		 *	Name: init
		 *	Description: a script inicializálása		 
		 *	@access public		 
		 *	@var [element] object
		 *	@var [config] object		 
		 *	@return object 		 		  		 
		 **/
		this.init = function(element, config) 
		{
			this.config = $.extend({}, $.popup.defaultConfig, config);
			
			if (this.config.id === null)
			{ this.config.id = 'Popup_' + Math.round( ( Math.random() * 9999999999 ) + 1 ); }
			
			if (typeof this.config.onInit == 'function')
			{ this.config.onInit($('#'+this.config.id), this.config.id, this); }
			
			this.openerElement = element;
			
			element.data('popup', this);
								
			var config 	= this.config,
				obj		= this;
			switch(config.showEvent.toLowerCase())
			{
			 	default:
			 	case 'click':
			 		element.bind('click', function() 	 { _create(element, config, obj); });
			 	break;
			 	case 'mouseover':
			 		element.bind('mouseover', function() { _create(element, config, obj); });
			 	break;
			 	case 'mouseout':
			 		element.bind('mouseout', function()  { _create(element, config, obj); });
			 	break;
			 	case 'dblclick':
			 		element.bind('dblClick', function()  { _create(element, config, obj); });
			 	break;
			 	case 'domready':
			 		$(document).ready(function() 		 { _create(element, config, obj); });
			 	break;
			}
			
			return this;
		};
								
		/*
		 *  Inicializálás
		 **/		 				
		this.init(element, config);						
	};
	
	/**		
	 *	Name: jQuery.fn.popup		 
	 *	@access public		 
	 *	@var [config] object
	 *	@return object 		 		  		 
	 **/
	$.fn.popup = function(config) {
		return this.each(function() {
			(new $.popup($(this), config));
		});
	};
    	
	/**			 
	 * Popup alap beállításai		 
	 **/
	$.popup.defaultConfig = {
		showSpeed:			    200,
		hideSpeed:				200,
	  	width: 					400,
	  	height:					150,
	  	id:						null,
	  	oneBoxAllowed:			false,      //egyszerre csak egy popupot nyithatnak-e meg a megadott elemről?
	  	content:	 			'',
	  	useElementsContent:		false,		//a megadott elem értékét (input) vagy tartalmát (div, span...) használja fel tartalomként (a sima content ilyenkor nem lesz használva)
	  	onDestroy:				null,
		onInit:					null,
		onLoaded:				null,
		destroyId:				null,       //azoknak az elemeknek az azonosítója, amelyekre kattintva bezáródik a popup. PL: destroyId: '#bezarom, #ezisbezarja, .ezekmindbezarjak'
		title:					null,
		footer:					'',
		overlay:				null,       //elsötétülő háttér, ha null, akkor nincs ellenkező esetben az itt megadott színű lesz
		overlayOpacity:			0.5,
		showEvent:				'click',    //a megjelenítés milyen eseményre történjen. Alap: "click" azaz DOM betöltődése után az elemre kattintva jelenik meg az ablak. Lehetséges: domReady, click, mouseOver, mouseOut, dblClick			
		closeOnEsc:				true,
		closeOnOverlayClick: 	true,
		borderRadius:			null,
		boxShadow:				null,
		closeButtonContent:		'X',
		doubleBorder:			false,
		doubleBorderRadius:		10,
		zIndex:					1000
	};

/**
 * Aktív felugró ablak bezárása
 * @param: callback - ablak bezárásakor az "onDestroy" függvényt felül lehet írni ezzel!
 */ 
	$.fn.popup_destroy = function(callback) {
		return this.each(function() {
			var $this = $(this);
			
			if ($this.length > 0)
			{  
				var $popup = $this.data('popup');
				
				if ($popup === null || $popup == undefined)
				{ return false; }      
				
				$popup.destroy($this, callback);
			}
			else
			{ return false; }
			
			return this;  	
		});
	};

/**
 * Ablak tartalmának felülírása
 * @param: newContent - új tartalom
 */ 
	$.fn.popup_setContent = function(newContent) {
		return this.each(function() {
			var $this = $(this);
			
			if ($this.length > 0)
			{  
				var $popup = $this.data('popup');
				
				if ($popup === null || $popup == undefined)
				{ return false; }
				
				$popup.setContent($this, newContent);
			}
			else
			{ return false; }
			
			return this;  	
		});
	};

/**
 * Ablak címének felülírása
 * @param: newContent - új tartalom
 */ 
	$.fn.popup_setTitle = function(newContent) {
		return this.each(function() {
			var $this = $(this);
			
			if ($this.length > 0)
			{  
				var $popup = $this.data('popup');
				
				if ($popup === null || $popup == undefined)
				{ return false; }
				
				$popup.setTitle($this, newContent);
			}
			else
			{ return false; }
			
			return this;  	
		});
	};	

/**
 * Ablak láblécének felülírása
 * @param: newContent - új tartalom
 */ 
	$.fn.popup_setFooter = function(newContent) {
		return this.each(function() {
			var $this = $(this);
			
			if ($this.length > 0)
			{  
				var $popup = $this.data('popup');
				
				if ($popup === null || $popup == undefined)
				{ return false; }
				
				$popup.setFooter($this, newContent);
			}
			else
			{ return false; }
			
			return this;  	
		});
	};	

/**
 * Ablak átméretezése
 * @param: width - új szélesség
 * 		   height - új magasság
 * 		   speed - átméretezés sebessége
 * 		   delay - késleltetés
 */ 
	$.fn.popup_resize = function(width, height, speed, delay, callback) {
		return this.each(function() {
			var $this = $(this);
			
			if ($this.length > 0)
			{  
				var $popup = $this.data('popup');
				
				if ($popup === null || $popup == undefined)
				{ return false; }
			
				$popup.resize($this, width, height, speed, delay);
				
				/*if (typeof callback == 'function')
				{ callback($this, $popup); }*/
			}
			else
			{ return false; }
			
			return this;  	
		});
	};	
	
	

})(jQuery);
