function clearField(obj, std_text) {
	if ($(obj).val()==std_text) {
		$(obj).val('');
	}
};

// Expandable menus
jQuery(document).ready(function(){
	// Closing all menus
	var levels = new Array("a.level_1", "a.level_2", "a.level_3", "a.level_4");
	for (var index in levels) {
		var level = levels[index];
		$(level).click(function() {
			var next = $(this).next('ul');
			if (next.length == 0) {
				return true; // There are no other options, follow link
			} else {
				$(this).next().toggle('fast');
                if (!$(this).hasClass('has_products')) {
                    return false;
                }
			}
		}).next().hide();
	};

    // Also closing ul, we only want to see root categories
    $('#productNavigation .left_menu_box h2').each(function() {
        var next_ul = $(this).next('ul');
        next_ul.hide();
        $(this).click(function() {
            next_ul.toggle('fast');
        });
    });

	// Now opening the active one and all its parents
	var active = $('.menu_filter_item');
	if (active.length == 0) {
		// Empty categories don't contain an filter_item
		// We can't always use menu_filter_container because then the children would stay hidden
		active = $('.menu_filter_container');
	}
	active.parents().show();
});


