$(document).ready(function(){


	
	//Navi
	
	$(".navi_home a img").hover(
	function () {
    $(this).attr("src","standards/img/navi/freshworld_over.png");
    },
	function () {
    $(this).attr("src","standards/img/navi/freshworld.png");
    });
    
    $(".navi_standort a img").hover(
	function () {
    $(this).attr("src","standards/img/navi/standort_over.png");
    },
	function () {
    $(this).attr("src","standards/img/navi/standort.png");
    });
    
    $(".navi_presse a img").hover(
	function () {
    $(this).attr("src","standards/img/navi/presse_over.png");
    },
	function () {
    $(this).attr("src","standards/img/navi/presse.png");
    });
    
    $(".navi_jobs a img").hover(
	function () {
    $(this).attr("src","standards/img/navi/jobs_over.png");
    },
	function () {
    $(this).attr("src","standards/img/navi/jobs.png");
    });
    
    $(".navi_impressum a img").hover(
	function () {
    $(this).attr("src","standards/img/navi/impressum_over.png");
    },
	function () {
    $(this).attr("src","standards/img/navi/impressum.png");
    });
    
    
    //Submenue
    
    
    $(".navi_presse,.navi_presse_over").hover(
	function () {
		$("#navi_presse_dropdown").slideDown("fast");
    },
    function () {
		$("#navi_presse_dropdown").slideUp("fast");
    }
    );
    
   
	
	
	//Easy Slider groß
	
	$("#angebot_woche_slider").easySlider({
		auto: true,
		continuous: true 
	});
	

	//Carousel
	
	
	function mycarousel_initCallback(carousel) {
    jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).attr("rel")));
        
    	//Aktiven Navipunkt ausschalten
		$(".snactive").each(function(){
			var b = $(this).attr("src");
			var c = b.replace(/_active/,"");
			$(this).attr("src",c);
			$(this).removeClass("snactive");
		});
		
		$(this).find("img").addClass("snactive");
		
		var d = $(this).find("img").attr("src");

        if(d.indexOf("_active")==-1){
        	var e = d.replace(/_over.jpg/,"_active.jpg");
			$(".snactive").attr("src",e);
        }
        return false;
    });
    
    jQuery('.jcarousel-control a').hover(
		function () {
			var g = $(this).find("img").attr("src");
			if(g.indexOf("_over")==-1 && g.indexOf("_active")==-1){
				g = g.replace(/.jpg/,"_over.jpg");
				$(this).find("img").attr("src",g);
			}
		},
		function () {
			var g = $(this).find("img").attr("src");
			if(g.indexOf("_over")>-1 && g.indexOf("_active")==-1){
				g = g.replace(/_over/,"");
				$(this).find("img").attr("src",g);
			}
		}
    );
    

    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });

    jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
    	//Aktiven Navipunkt ausschalten
        $(".snactive").each(function(){
			var b = $(this).attr("src");
			var c = b.replace(/_active/,"");
			$(this).attr("src",c);
			$(this).removeClass("snactive");
		});
		
        return false;
    });

    jQuery('#mycarousel-prev').bind('click', function() {
    	//Aktiven Navipunkt ausschalten
    	$(".snactive").each(function(){
			var b = $(this).attr("src");
			var c = b.replace(/_active/,"");
			$(this).attr("src",c);
			$(this).removeClass("snactive");
		});
		
        carousel.prev();
        return false;
    });
};

// Ride the carousel...
jQuery(document).ready(function() {
    jQuery("#angebote_slider").jcarousel({
        scroll: 1,
        initCallback: mycarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

});



