﻿var className = "class";
var defaultClass = "libro";
var objetoVentana = null;
$(function () {
    initMenuLateral();
    initProvincias();
});
function initMenuLateral() {
    $("#listado_productos a").each(function (index) {
        $(this).mouseover(function () {
            $("#productos").attr(className, $(this).attr(className));
        });
        $(this).mouseout(function () {
            $("#productos").attr(className, defaultClass);
        });
    });
}
function initProvincias() {
    objetoVentana = new ventana("dialogProvincia", "blind", null, false);
    objetoVentana.maxHeight = 300;
    objetoVentana.maxWidth = 300;
    objetoVentana.minHeight = 100;
    objetoVentana.minWidth = 200;
    $("#Provincia").click(function () {
        if (!objetoVentana.isVisible) {
            objetoVentana.MostrarVentana();
            return false;
        }
        else { objetoVentana.OcultarVentana(); return false };
    });
    $(document).click(function () {
        objetoVentana.OcultarVentana();
    });
    $("#dialogProvincia a").each(function (index) {
        $(this).click(function () {
            var value = $(this).html() + " (" + this.id + ")";
            $("#Provincia label").html(value);
            $("#HiddenProvincia").val($(this).html() + "-(" + this.id + ")");
            objetoVentana.OcultarVentana();
        });
    });
}
