jQuery(function() {
		var box = new multiBox('mb', {}); 
		
		jQuery('.popup_wrapper').each(function(i, item) {
			headline = jQuery(item).find('.link').text();
			text = jQuery(item).find('.popup').html();
			
			jQuery('<span />').addClass('popup_opener').attr({ title : 'Popup: ' + headline }).html(headline + '<span class="hidden">' + text + '</span>').appendTo('#menu .subnavi').click(function() {
				text = jQuery(this).find('.hidden').html();
				
				jQuery('#overlay').remove();
					jQuery('<div />').attr({ id: 'overlay' }).appendTo('body');
				jQuery('#popup').remove();
					jQuery('<div />').attr({ id: 'popup' }).appendTo('body');
					
					
				jQuery('<div />').addClass('content').html('<div class="scroll">' + text + '</div>').appendTo('#popup');
				jQuery('<div />').addClass('close_wrapper').prependTo('#popup .content');				
				jQuery('<span />').addClass('close').html('Fenster schlie&szlig;en').prependTo('#popup .content .close_wrapper').click(function() {
				
					jQuery('#popup').fadeOut('fast');
					
					jQuery('#overlay').animate({
						opacity: 0
					}, 200, function() {
						jQuery('#overlay').remove();
						jQuery('#popup').remove();
					});
				
				});
				
				
				jQuery('#popup').fadeIn('fast');
				
				jQuery('#overlay').css({
					height: jQuery(document).height(),
					width: jQuery(document).width(),	
					opacity: 0				
				}).show().animate({
					opacity: 0.3
				}, 
				200, function() {
				
				}).click(function() {
					// Remove Popup
					
					jQuery('#popup').fadeOut('fast');
					
					jQuery('#overlay').animate({
						opacity: 0
					}, 200, function() {
						jQuery(this).remove();
						jQuery('#popup').remove();
					});
				});
				
			});
			
		});
		
		
	});
