jQuery.noConflict();

function langIn(){}
function langOut(){
    jQuery("#language .f_select").animate({'height' : '18px'}).removeClass('open');
}

function menuIn(){
    jQuery(this).animate({'padding-left' : '10px'}, 300);
}
function menuOut(){
    jQuery(this).animate({'padding-left' : '0px'}, 300);
}

function menuIn_ifsub() {
	jQuery(".hasSub").animate({'padding-left' : '0px'}, 300);
}

jQuery(document).ready(function(){
    
    jQuery('#menu li').each(function(){
        var ahref = jQuery(this).find('a').attr('href');
        var split = ahref.split('/');
        jQuery(this).addClass(split[0] + '_menu');
    }) 

/*Language Animation*/
    
    jQuery("#language span:first-child").click(function(){
        if(jQuery("#language").hasClass('open')){
            jQuery("#language .f_select").stop(true, true).animate({'height' : '18px'}).removeClass('open');
            jQuery("#language .f_select").stop(true, true).animate({'height' : '85px'})
        }else{
            jQuery("#language .f_select").stop(true, true).animate({'height' : '85px'}).addClass('open');
        } 
    });

/*Menu Effects*/

    jQuery("#menu ul li .no").hoverIntent(menuIn, menuOut);
    jQuery("#news-menu ul li").hoverIntent(menuIn, menuOut);
    jQuery("#language").hoverIntent(langIn,langOut);
	jQuery("#menu ul li ul a").hoverIntent(menuIn, menuOut);
    
    
    jQuery(".sub2").hide();
    
    if(jQuery("#menu ul li ul li").hasClass("active_sub")) {
        jQuery(".sub2").show();
    }
 
/*Slideshow*/
 
    jQuery('#slider').after('<div id="slide-panel"></div>').cycle({
		fx: 'fade',
        pause: true,
        speed: 2500,
        timeout: 5000,
        pager: '#slide-panel'
	});  
    
/*Slide-Panel fuer das Submenu*/



/*

        jQuery.extend({
        
          getUrlVars: function(){
        
            var vars = [], hash;
        
            var hashes = window.location.href.slice(window.location.href.indexOf('') + 1).split('/');
            var vars = hashes[1];
        
            return vars;
        
          },
        
          getUrlVar: function(name){
        
            return $.getUrlVars()[name];
        
          }
        
        });
        
        // Get object of URL parameters
        
        var allVars = jQuery.getUrlVars();
        */
        
        
        if(jQuery('#menu_oben ul li:nth-child(1)').hasClass('active'))
        {
            
            
            jQuery(".current-panel").css("left", "217px");
           jQuery(".komponenten").css("display", "none");
           jQuery(".branchen").css("display", "block");
           jQuery("#panel-branchen").addClass("active");            
        }
 
         jQuery("#panel-komponenten").click(function(){
          if(jQuery("#panel-komponenten").hasClass("active")) {
            
            return false;
            
          }
          
          else {
          
          jQuery("#panel-komponenten").addClass("active")
          jQuery("#panel-branchen").removeClass("active")
          jQuery(".current-panel").stop(true, true).animate({
                "left": "+=278px"},
                500);
          jQuery(".branchen").stop(true, true).fadeOut(500)
          jQuery(".komponenten").stop(true, true).fadeIn(500)
          }
         });
     



        if(jQuery('#menu ul li:nth-child(2)').hasClass('active'))
         {
           jQuery(".current-panel").css("left", "495px");
            jQuery(".komponenten").css("display", "block");
            jQuery(".branchen").css("display", "none");
            jQuery("#panel-komponenten").addClass("active");
         }
        
        
        jQuery("#panel-branchen").click(function(){
          if(jQuery("#panel-branchen").hasClass("active")) {
            
            return false;
            
          }
          
          else {
          
              jQuery(".branchen").css("display", "block");  
              jQuery("#panel-branchen").addClass("active")
              jQuery("#panel-komponenten").removeClass("active")
              jQuery(".current-panel").stop(true, true).animate({
                "left": "-=278px"},
                500);
              jQuery(".komponenten").stop(true, true).fadeOut(500)
              jQuery(".branchen").stop(true, true).fadeIn(500)
          }
    });
    
    
   /* jQuery(".hover_parent").hover(function(){
        jQuery(this).find('.hover_pop').stop(true, true).fadeIn(500);
        jQuery(this).find('img').stop(true, true).fadeTo('500', 0.5);  
    }, function(){
        jQuery(this).find('.hover_pop').fadeOut(500);
        jQuery(this).find('img').fadeTo('500', 1);
    });*/
    
    jQuery(".hover_parent_1").find('.hover_pop_1').stop(true, true).fadeIn(1000);
    jQuery(".hover_parent_2").find('.hover_pop_2').stop(true, true).fadeIn(1000);
    jQuery(".hover_parent_3").find('.hover_pop_3').stop(true, true).fadeIn(1000);
    jQuery(".hover_parent_4").find('.hover_pop_4').stop(true, true).fadeIn(1000);
});

