jQuery.noConflict();
jQuery(document).ready(function($) {
    if (!Modernizr.input.placeholder) {
        $("input").each(
                function() {
                    if ($(this).val() == "" && $(this).attr("placeholder") != "") {
                        $(this).val($(this).attr("placeholder"));
                        $(this).focus(function() {
                            if ($(this).val() == $(this).attr("placeholder")) $(this).val("");
                        });
                        $(this).blur(function() {
                            if ($(this).val() == "") $(this).val($(this).attr("placeholder"));
                        });
                    }
                });
    }

    $('img.hoveraction').hover(function() {
        var image = $(this).attr('name');
        var newimage = './themes/industries/images/' + image + '.png';
        $(this).attr('src', newimage);
    }, function() {
        $(this).attr('src', './themes/industries/images/' + $(this).attr('name') + '2.png');
    });

    $('#menu_level_2 li').each(function() {
        var anzahl = $(this).children('ul#menu_level_3').length;
        if (anzahl!=0) {
            var activeclass = $(this).children('a').attr('class');
            $(this).children('a').attr('class',activeclass + ' hue');
        }
    });
    
    
    /*
    $('nav ul li').bind('mouseleave',function() { 
        $(this).children('ul').css('display','block');
        var that = $(this).children('ul');
        window.t = setTimeout(function() {
            that.css('display','none');
        },1500);
    });

    $('nav ul li').bind('mouseenter',function() {
        clearTimeout(window.t);   
        var that = $(this);
        var id = $(this).parent().attr('id');
        $('#' + id + ' li').each(function() {
            if ($(this)!=that) {
                $(this).children('ul').css('display','none');
            }
        });  
        
        $(this).children('ul').css('display','block');
    });   */  
          
      /*   
    $("nav li").hover(
        function () {
            $(this).children("ul").stop(true, true).fadeIn();
        },
        function () {
            $(this).children('ul').css('display','block'); 
            $(this).children("ul").delay(1500).stop(true, true).css('display', 'none');          
        }
    );*/
    
    // Dropdown Menu START //
    $('.menu_level_1').children('li').children('a').mouseenter(function(){
        $('.menu_level_3, .menu_level_4').css('display', 'none');
    });

    $("nav li").mouseleave(
        function (event) {
            if ($(event.relatedTarget).parents('nav').length == 0) {
                clearTimeout(window.t);
                window.t = setTimeout(function() {
                    $('.menu_level_2, .menu_level_3, .menu_level_4').css('display', 'none');
                }, 1000);
            } else {
                $(this).children('ul').css('display', 'none');
            }
        }
    );

    $("nav li a").mouseenter(
        function (event) {
            clearTimeout(window.t);
            var sibls = $(this).siblings('ul');
            if (sibls.length > 0){
                var selector = sibls.attr('class').split(" ");
                $("." + selector[0]).css('display', 'none');
            }
            sibls.css('display', 'block');
        }
    );
     // Dropdown Menu END //
        
    $('aside.left nav ul li.level_3').last().addClass('last');
    
 
    
});

