$(function() {
    
    // NAVIGATION
    $('.menu .categories a').click(function(e) {
        if ($('.menu .categories.open').length > 0) {
            $('.menu .categories').removeClass('open');
            $('.cat-submenu').hide("fast");
        } else {
            $('.menu .open').removeClass('open');
            $('.menu .categories').addClass('open');
            $('.tag-submenu').hide('fast');
            $('.cat-submenu').show("fast");
        }
        e.preventDefault();
    })
    
    $('.menu .tags a').click(function(e) {
        if ($('.menu .tags.open').length > 0) {
            $('.menu .tags').removeClass('open');
            $('.tag-submenu').hide("fast");
        } else {
            $('.menu .open').removeClass('open');
            $('.menu .tags').addClass('open');
            $('.cat-submenu').hide('fast');
            $('.tag-submenu').show("fast");
        }
        e.preventDefault();
    })
    
    // DEFAULT TEXT FOR SEARCH FIELD
    $("#menu-s").focus(function() {
        $(this).removeClass("default_text");
        if ($(this).val() == "Suchbegriff") {
            $(this).val("");
        }
    })
    
    $("#menu-s").blur(function() {
       if ($(this).val() == "") {
           $(this).val("Suchbegriff");
           $(this).addClass("default_text");
       }
    })
    
    $("#searchform").submit(function(e) {
        if ($("#menu-s").val() == "" || $("#menu-s").val() == "Suchbegriff") {
            e.preventDefault();
        };
    })
    
    // INIT
    $('#menu-s').blur();
    
});


