
$(document).ready(function() {

/** z-index-bugfix **/
//$("ul.c").superfish().find('ul').bgIframe({opacity:false}); 

/* ####### Scrollboxes ######## */   
    $(".scrollDown").show();
    $(".scrollUp").show();
    $(".scrollUp a").click(function() {
		return false;
	});
	$(".scrollDown a").click(function() {
		return false;
	});
    $(".scrollable .scrollUp").fadeTo(0, 0.33);
	$(".scrollable .scrollUp a").hide();
    $(".scrollable").scrollable({    	
    	size:4,
    	vertical:true,
    	speed: 800,
    	onSeek: function()  { 	       
	       if(this.getStatus().index == (this.getStatus().total - this.getStatus().size )) {
	        	$(".scrollable .scrollDown").fadeTo(200, 0.33);
	        	$(".scrollable .scrollDown a").hide();
	       } else {
	       		$(".scrollable .scrollDown").fadeTo(200, 1.0);
	       		$(".scrollable .scrollDown a").show();
	       } 
	        
	        if(this.getStatus().index == 0) {
	        	$(".scrollable .scrollUp").fadeTo(200, 0.33);
	        	$(".scrollable .scrollUp a").hide();
	        } else {
	        	$(".scrollable .scrollUp").fadeTo(200, 1.0);
	       		$(".scrollable .scrollUp a").show();
	        }	                
	    }    	    	  	
	});


/* Slider im  Bereich "Ministerin" */
	$('.ph_ministerinMain').each(function() {
	
		var parent = $(this);
		var width = parent.width();
		var menu = parent.children('#ph_tabNavi').find('li');
		var pos = 0;
		var slider = parent.find('.sliderInner');
		menu.eq(0).addClass('current');
	
		menu.each(function() {
	
			var link = $(this);
			link.click(function() {
				link.children('a').blur();
				menu.eq(pos).removeClass('current');
				pos = link.prevAll().length;
				menu.eq(pos).addClass('current');
				var sWidth = width*pos;
			    slider.stop(true,true).animate({'margin-left' : '-'+sWidth+'px'},0);  //animation entfernt
				
				return false;
			});
		});
	
	});
	
	// Bereich "Standpunkte"
	$('#ministerinStandpunkte').each(function() {
		var parent = $(this);
		var menu = parent.find('div.ph_ministerinStandpunkt');
		var slider = $('#standpunkteFrame');
		var height =  slider.children().eq(0).height();
		var pos = 0;
		menu.eq(0).addClass('ph_ministerinStandpunktHover');
		
		menu.each(function() {
		
			var link = $(this);
			link.mouseover(function() {
				menu.eq(pos).removeClass('ph_ministerinStandpunktHover');
				pos = link.prevAll().length;
				$(this).addClass('ph_ministerinStandpunktHover');
				var sTop = height*pos;
				slider.stop(true,false).animate({'margin-top' : '-'+sTop+'px'}, 0);  //animation entfernt
			}).mouseleave(function() {
				//$(this).removeClass('ph_ministerinStandpunktHover');
				//slider.stop(true,false).animate({'margin-top' : '0'}, 200);
			});
		
		});
	
	});

	//DropDown-Navi per Tastatur steuern
	(function() {
	
		var links = $('#navigation ul li');
		links.each(function() {
		    var isFocus = 0;
			var link = $(this);
			var inner = link.children('a');
			
			inner.focus(function() {
				isFocus++;
				checkFocus();
			}).blur(function() {
				isFocus--;
				checkFocus();
			});
			
			// alle links in untermenue finden
			var sublinks = link.children('ul').find('a');
			sublinks.focus(function() {
				isFocus++;
				checkFocus();
			}).blur(function() {
				isFocus--;
				checkFocus();
			});
			
			
			function checkFocus() {
				
				if(isFocus > 0)
					link.addClass('sfHover');
				else
					link.removeClass('sfHover');
			}
		
		});
	
	})();

	(function(){
 
    //simulate :focus for ie
	$('*').each(function() {
		$(this).focus(function() {
			$(this).addClass('ieFocus');
		}).blur(function() {
			$(this).removeClass('ieFocus');
		});
	});
})();
	
	
});


	
