function menu(obj){
	if (!obj.length) return;
	$(obj).find("ul").css({display: "none"});
	$(obj).hover(
		function(){ $(this).find('ul').stop(true,true).delay(100).slideDown(300); },			
		function(){ $(this).find('ul').stop(true,true).delay(100).slideUp(300); }
	);
}

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });
 
    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });
 
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};


$(document).ready(function(){
	menu($(".hlist ul li"));
	$("a.zoomimage").fancybox();
	
	$("a.iframe").fancybox({
			'width'         :   1040,
			'height'		:	840,
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	true,
			'padding'       :   0,
			'margin'        :   0,
			'titleShow'     :   false
		});

	$("a.iframe2").fancybox({
			'width'         :   1040,
			'height'		:	840,
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	true,
			'padding'       :   0,
			'margin'        :   0,
			'titleShow'     :   false
		});	

	$("a.zoomvideobox").fancybox({
			'width'         :   640,
			'height'		:	480,
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
    	    'autoScale'    	:   false,
			'scrolling'     :   'no',	
			'margin'        :   0,
		    'padding'       :   0,
			'titleShow'     :   false
		});	
		
	 $("#searchfield").focusin(function() {
	 	var searchstr = $("#searchfield").val();
	 	if(searchstr == "Quickfinder") {
	 		$("#searchfield").val("");
	 		$("#searchfield").removeClass('searchfield').addClass('activ_searchfield');
	 	}
	 }) 
	 
	 $("#more_news a").click(function(event){
	 	 event.preventDefault();
	 	 var url = $("#more_news a").attr("href");
		 $("#shortnewsbox1").load(url);
	 });	
	 
	$("#aktionsleiste").jcarousel({
        auto: 5,
        wrap: "circular",
        animation: "slow",
        scroll: 1,
        initCallback: mycarousel_initCallback
    });	 	

});

