
jQuery.noConflict();
var activeNavElement;
var tabApi;
var slideApi;

(function ($){
	
	
	/*-------------------------------------------------------------------- 
	 * JQuery Plugin: "EqualHeights"
	 * by:	Scott Jehl, Todd Parker, Maggie Costello Wachs (http://www.filamentgroup.com)
	 *
	 * Copyright (c) 2008 Filament Group
	 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
	 *
	 * Description: Compares the heights or widths of the top-level children of a provided element 
	 		and sets their min-height to the tallest height (or width to widest width). Sets in em units 
	 		by default if pxToEm() method is available.
	 * Dependencies: jQuery library, pxToEm method	(article: 
			http://www.filamentgroup.com/lab/retaining_scalable_interfaces_with_pixel_to_em_conversion/)							  
	 * Usage Example: $(element).equalHeights();
	  		Optional: to set min-height in px, pass a true argument: $(element).equalHeights(true);
	 * Version: 2.0, 08.01.2008
	--------------------------------------------------------------------*/

	$.fn.equalHeights = function(px) {
		$(this).each(function(){
			var currentTallest = 0;
			$(this).children().each(function(i){
				if ($(this).height() > currentTallest) { currentTallest = $(this).height(); }
			});
			if (!px || !Number.prototype.pxToEm) currentTallest = currentTallest.pxToEm(); //use ems unless px is specified
			// for ie6, set height since min-height isn't supported
			if ($.browser.msie && $.browser.version == 6.0) { $(this).children().css({'height': currentTallest}); }
			$(this).children().css({'min-height': currentTallest}); 
		});
		return this;
	};
	
	
	
$(document).ready(function() {	

	function getAjaxData(theUrl, $tip) {
	    //$tip.html('<img src="fileadmin/img/loading.gif" />');
	    $tip.html('loading ...');
	    $.ajax({
	        url:theUrl,
	        success: function(response) {
	            $tip.html(response);
	        }
	    });
	}	
	
	$("a[rel='lightbox']").colorbox({		
		iframe:true,
		opacity: 0.4,
		innerWidth:644,
		innerHeight:'10%',
		initialHeight: '10%',		
		current: "",
		next: "",
		arrowKey: false,
		onComplete: function (){
			$("#cboxNext").hide();
			$("#cboxPrevious").hide();
		}
		
			
	}
		
	);
	$("a[rel='lightbox']").each(function(){
			if ($(this).hasClass('popup-noprint')){
				$(this).attr('href',$(this).attr('href')+'?type=556');
			}
			else{
				$(this).attr('href',$(this).attr('href')+'?type=555');
			}		
	});
	
	 activeNavElement =  $("#main-navigation .lev1 li.actifsub, #main-navigation .lev1 li.curifsub");	 
	 var tempActive;
	 var openElement;
	
	 var config = {    
		     over: showMenu, // function = onMouseOver callback (REQUIRED)    
		     timeout: 500, // number = milliseconds delay before onMouseOut    
		     out: hideMenu // function = onMouseOut callback (REQUIRED)    
		};

	 $("#main-navigation .lev1>li").hoverIntent(config);	 
	 /*
	 $("#main-navigation .lev1>li").mouseout(function (){
		 if ( ($(activeNavElement).find('ul.lev2').is(":hidden"))){
			 $(activeNavElement).find('ul.lev2').show(200);
		 }
	 });
	 */
	 
	 function showMenu(){	 
		 
		 if ($(activeNavElement).find('a').first().attr('id') != $(this).find('a').first().attr('id')){
			
			$(activeNavElement).find('ul.lev2').hide(0);
			$(tempActive).find('ul.lev2').hide(0);
			$(this).find('ul.lev2').show(200);    	
		 }
	 	tempActive = $(this);
	 
	 	if  ($(activeNavElement).find('a').first().attr('id') == $(this).find('a').first().attr('id')){	 		
	 		$(this).find('ul.lev2').show(200);	 		 
	 	}	 	
	 	
	 }
	 
	 function hideMenu(){
		
	
	 if ($(activeNavElement).find('a').first().attr('id') != $(this).find('a').first().attr('id')){		
		 
		 $(this).find('ul.lev2').hide(200,function (){			 
			 if ( ($(activeNavElement).find('ul.lev2').is(":hidden") && $(tempActive).find('ul.lev2').is(":hidden")   )  ) {
			
			 $(activeNavElement).find('ul.lev2').show(200);
				 
			}
			});
	 	}		 
	 }	 
	 
	 var configTeaser = {    
		     over: showTeaser, // function = onMouseOver callback (REQUIRED)    
		     timeout: 300, // number = milliseconds delay before onMouseOut    
		     out: hideTeaser // function = onMouseOut callback (REQUIRED)    
		};

	 $(".teaser-menu").hoverIntent(configTeaser);	
	 
	 function showTeaser(){
		
		if ($(openElement).find('.teaser-menu-content').html() != $(this).find('.teaser-menu-content').html() ) {
			
		 
		 $(openElement).find('.teaser-menu-content').hide(300);
		 $(this).find('.teaser-menu-content').show(300);
		 $(this).addClass('iehover');
		 openElement = $(this);
	 	}
		else{
			$(openElement).find('.teaser-menu-content').show(300);
			$(openElement).addClass('iehover');
		}
	 }
	 function hideTeaser(){
		
		 if ($('#cboxOverlay').is(':hidden')){
		 $(this).find('.teaser-menu-content').hide(300);
			$(this).removeClass('iehover');
		 }
	 }	 
	 
	 
	 $("#content li a, #loginbox li a ").hover(
			 function () {
				 $(this).parents('li').addClass('li-hover')
		    		    
		  },
		  function () {
			  $(this).parents('li').removeClass('li-hover');
		  }
	 );
	 
	 
	 
	 // LOGIN
	 
	 
	 function showLogin(){			
			if ($(this).find('#loginbox').length == 0){				
				$(this).append($('#loginbox'));
			}		
			$('#loginbox').show();		
		 }
		 function hideLogin(){			
			 $('#loginbox').hide(); 
		 }	 
	 
	 
	 
	 
	 
	 
	 
	 var configLogin = {    
		     over: showLogin, // function = onMouseOver callback (REQUIRED)    
		     timeout: 300, // number = milliseconds delay before onMouseOut    
		     out: hideLogin // function = onMouseOut callback (REQUIRED)    
		};

	 $("#aTag_49").parent('li').hoverIntent(configLogin);
	 $("#aTag_49").attr('href','javascript:;');
	 
	
});

})(jQuery);

jQuery(function(){	
	jQuery(".slider-tabitems").tabs(".slider-items", {
		// enable "cross-fading" effect
		effect: 'fade',
		fadeOutSpeed: 2000,
		fadeInSpeed: 2000,
		rotate: true

	// use the slideshow plugin. It accepts its own configuration
	}).slideshow({interval: 7000, autoplay: true});
		
	tabApi = jQuery(".slider-tabitems").data("tabs");
	slideApi = jQuery(".slider-tabitems").data("slideshow");
	if (tabApi){
		tabApi.onClick(function(index) {
			slideApi.stop();
			setTimeout("continueSlide()",200);
			
		});	
	}
	
});

function continueSlide(){
	slideApi = jQuery(".slider-tabitems").data("slideshow");
	slideApi.play();
}

// ACCORDION


jQuery(function(){
	jQuery('.accordion-items').toggleElements(
		{ fxAnimation:'slide', fxSpeed:'slow', className:'toggler' } );	
});


var toggled = false;

function triggerToggleAll(){
	if (toggled == false){
		
	   jQuery('a.toggler-closed').each(function(){		  
		   jQuery(this).trigger('click');
	   });
	   toggled = true;
	   var fired= true;
	}
	if (toggled == true && !fired){
		
		   jQuery('a.toggler-opened').each(function(){		  
			   jQuery(this).trigger('click');
		   });
		   toggled = false;
	}
}
