$(document).ready(function(){


	// Sprachschalter Auf-/Zuklappen Produktübersicht
	function checkLanguage(){
		var myLocation = window.location.href; 
		var myLocation = myLocation.search("/en/");
		if (myLocation != -1)
  			return 'en';
	}

	var myLanguage = checkLanguage();
	var pClose 	= 'Produktübersicht schließen';
	var pOpen 	= 'Produktübersicht öffnen';
	
	if(myLanguage == 'en'){
		var pClose 	= 'close product overview';
		var pOpen 	= 'open product overview';
	}

    if($('.tabcontent').hasClass('show'))$('div#page_margins2, div#bread').css('background','url(/fileadmin/img/topNavContentBg.png) left top repeat-x #d7dee3');

    // #tabMenu UL Hover
    $('#tabMenu > li').mouseover(function(){
        $(this).addClass('mouseover').removeClass('mouseout');
    }).mouseout(function(){
        $(this).hasClass("selected")?$(this).removeClass('mouseover'):$(this).addClass('mouseout').removeClass('mouseover');
    });

    //Get all LI from the #tabMenu UL
    $('#tabMenu11 > li').click(function(){
    
        //remove the selected class from all LI
        $('#tabMenu > li').removeClass('selected');

        //Reassign the LI
        $(this).addClass('selected');

        //Hide all the DIV in #boxBody
        $('div#boxBody div').css('display', 'none');

        //Look for the right DIV in boxBody according to the Navigation UL index, therefore, the arrangement is very important.
        $('div#boxBody div:eq(' + $('#tabMenu > li').index(this) + ')').show();

        if($(this).hasClass("child")) {
            $('div#page_margins2, div#bread').css('background','url(/fileadmin/img/topNavContentBg.png) left top repeat-x #d7dee3');
            $('div#close').html(pClose).css('background','url(/fileadmin/img/close.png) 0 3px no-repeat');
        }
        else {
            $('div#close').html('');
            $('div#page_margins2, div#bread').css('background', '#ffffff');
        }
    });

    // default Produktübersicht schließen
    if($('div#close').html() == ''){
        if($(".tabcontent").hasClass("show")) {
            $('div#close').html(pClose).css('background','url(/fileadmin/img/close.png) 0 3px no-repeat');
        } else {
            $('div#close').html(pOpen).css('background','url(/fileadmin/img/open.png) 0 1px no-repeat');
        }
    };
    // Produktübersicht öffnen/schließen
    $('div#close').click(function(){
        if($('div#close').html() == pClose) {
            $('div#boxBody div').css('display','none');
            $('div#page_margins2, div#bread').css('background','#ffffff');
            $('div#close').html(pOpen).css('background','url(/fileadmin/img/open.png) 0 1px no-repeat');
        }
        else {
            $('div#boxBody div.act').show();
            $('div#page_margins2, div#bread').css('background','url(/fileadmin/img/topNavContentBg.png) left top repeat-x #d7dee3');
            $('div#close').html(pClose).css('background','url(/fileadmin/img/close.png) 0 3px no-repeat');
        }
    });

    $('.itemBox').mouseover(function(){
        $('.tabcontentTitle',this).addClass('mouseover').removeClass('mouseout');
    }).mouseout(function(){
        $('.tabcontentTitle',this).hasClass('active')?$('.tabcontentTitle',this).addClass('mouseout'):$('.tabcontentTitle',this).addClass('mouseout').removeClass('mouseover');
    });

    // image_zoom
    $('.mclightbox').fancybox({
        'zoomSpeedIn':		300,
        'zoomSpeedOut': 	300,
        'zoomSpeedChange':      300,
        'zoomOpacity':		true,
        'overlayShow':		false,
        'easingIn':		'easeOutBack',
        'easingOut':		'easeInBack'
    });
    
	$(".iframe").fancybox({
		'width'				: 750,
		'height'			: 500,
        'autoScale'     	: false,
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	
	$(".fancymoviebox").fancybox({
	    'padding'           : 0,
		'width'           	: 740,
		'height'            : 415,
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titleShow'			: false,
		'padding'			: 10
	});


    $(".accordionFirst").corner("8px top");
});
