﻿// Controle do menu principal "consulta rápida"
function TrocaMenu() {
    var oBjs = document.getElementById("busca").getElementsByTagName("div");
    for (var i in oBjs)
        if (oBjs[i].id) {
        if (oBjs[i].id == arguments[0])
            oBjs[i].style.display = 'block';
        else
            oBjs[i].style.display = 'none';
    }
}

// Sinaliza
function marca() {
    var oBjs = document.getElementById(arguments[1]);

    switch (arguments[2]) {
        case "off":
            oBjs.style.color = "#FF6600";
            oBjs.style.background = "transparent";
            break;
        default:
            oBjs.style.background = "#FF6600";
            oBjs.style.color = "#FFFFFF";
            arguments[0].onmouseout = new Function("marca(this,'" + arguments[1] + "','off')");
            break;
    }
}

//  Valida busca
function ValidaFrom() {
    var Valida = true;

    for (var i in arguments) {
        var sel = document.getElementById(arguments[i]);
        if (sel.options[sel.selectedIndex].value == "0")
            Valida = false;
    }

    if (!Valida)
        alert("ATENÇÃO\nÉ NECESSARIO ESCOLHER TODAS AS OPÇÕES.");

    return Valida;
}

function SendForm() {
    var Url = "?linha=" + arguments[0] + "&marca=" + arguments[1] + "&modelo=" + arguments[2] + "&aplicacao=" + arguments[3] + "&ano=" + arguments[4] + "&produto=" + arguments[5] + "&sl=" + arguments[6] + "&sub=" + arguments[7].value + "#pd";
    document.getElementById("dvLoad").style.display = '';
    window.location = Url;
}

$(document).ready(function () {
    if ($("._Menu").length > 0) {
        $("._Menu").each(function () {
            $(this).find('span').click(function () {
                //$(this).closest('._Menu').find('li ul').fadeOut();
                $(this).closest('li').find('ul').fadeIn();
            });
        });
    }
});
