$(document).ready(function() {
    
    var need_spare_parts = $('select[name=need_spare_parts] option:selected').val();
    if(need_spare_parts == 1) {
        $('div#spare_parts_message').show();
    }
    
    $("select").change(function() {
      var val = $(this).val();
          if(val == 1) {
            $('div#spare_parts_message').show();
        } else {
            $('div#spare_parts_message').hide();
        }
    });

    //cache nav
    var nav = $("div#menu_container");

    //add indicators and hovers to submenu parents
    nav.find("li").each(function() {
            if ($(this).find("ul").length > 0) {
                    //show subnav on hover
                    $(this).mouseenter(function() {
                            $(this).find("ul").stop(true, true).slideDown();
                    });

                    //hide submenus on exit
                    $(this).mouseleave(function() {
                            $(this).find("ul").stop(true, true).slideUp();
                    });
            }
    });
});

function mouseover(obj, image) {
    $(obj).attr("src", "upload/images/"+image);
}

function mouseout(obj, image) {
    $(obj).attr("src", "upload/images/"+image);
}
