$(document).ready(function() 
{
	$('#country_select').click(function() {
		if ( $(this).hasClass('active') ) {
			$(this).removeClass('active');
		} else {
			$(this).addClass('active');
		}
		
	});
	
	
	// Tabs zählen & schattierte Linie danach anpassen
	//--------------------------------------------------------------
	
	// Aktuelle Breite des Elements
	var size = $('li.end').width();
	
	$('ul.idTabs').each(function() {
		var count = $(this).children().size();	
		
		if(count == 5) {
			var new_size = size + 102;
			$(this).children('li.end').css('width', new_size);
			$(this).children('li.end').css('margin-left', '-3px');
		}
	
		else if(count == 4) {
			var new_size = size + 202;
			$(this).children('li.end').css('width', new_size);
			$(this).children('li.end').css('margin-left', '-3px');
		}	
		
	});
	
	
	// Fancybox
	// ----------------------------------- 	
	
	// Image
	$("a.lightbox").fancybox({
         'zoomSpeedIn': 300,
         'zoomSpeedOut': 300,
         'overlayShow': true,
         'autoScale': false     
    });
	
	// iFrame Content
	$("a.lightbox-page").fancybox({
		'zoomSpeedIn': 300,
		'zoomSpeedOut': 300,
		'overlayShow': true,
		'width': 650,
		'height': 280,
		'titleShow': false,
		'autoScale' : true,
		'type': 'iframe'
     });

	// iFrame Content
	$("a.lightbox-mdiglance").fancybox({
		'zoomSpeedIn': 300,
		'zoomSpeedOut': 300,
		'overlayShow': true,
		'width': 900,
		'height': 550,
		'titleShow': false,
		'autoScale' : false,
		'type': 'iframe',
		'scrolling': 'auto'
     });
     
     
     
	// Intranet
	// ----------------------------------- 	
	
	
	// Accordion
    //$(".accordion h3:first").addClass("active");
	//$(".accordion div").hide();
	$(".intranet h2").click(function() {

	  $(this).next("div").slideToggle("300").siblings("div:visible").slideUp("slow");
	  $(this).toggleClass("active");
	  $(this).siblings("h2").removeClass("active");

	});
	
	$("h2.intranet + .intranet_content h3").click(function() {

	  $(this).next("ul").slideToggle("300").siblings("div:visible").slideUp("slow");
	  $(this).toggleClass("active");
	  $(this).siblings("h3").removeClass("active");

	});
	
	$("h2.intranet + .participant-net_content h3").click(function() {

	  $(this).next("ul").slideToggle("300").siblings("div:visible").slideUp("slow");
	  $(this).toggleClass("active");
	  $(this).siblings("h3").removeClass("active");

	});

	
	$(".intranet_content li a").parent().css("background-image", "none");
	$(".participant-net_content li a").parent().css("background-image", "none");
	$(".intranet_content li span a").parent().parent().css("background-image", "none");
	$(".participant-net_content li span a").parent().parent().css("background-image", "none");
	$(".intranet_content li div a").parent().parent().css("background-image", "none");
	$(".participant-net_content li div a").parent().parent().css("background-image", "none");
	

});

