﻿$(function() {
    $('input.fecha').datepicker({
        changeMonth: true,
        changeYear: true,
        dayNamesMin: cal_dia_corto,
        firstDay: cal_dia_inicio,
        monthNames: cal_mes_largo,
        monthNamesShort: cal_mes_corto,//['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
        dateFormat: cal_formato_fecha,
        yearRange: '1900:2100',
        showAnim: 'blind',
        showOtherMonths: true,
        selectOtherMonths: true
        
    });
});

//$(function() {
//    // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
//    $("#dialog:ui-dialog").dialog("destroy");

//    $("#dialog-confirm").dialog({
//        resizable: false,
//        height: 140,
//        modal: true,
//        buttons: {
//            "Delete all items": function() {
//                $(this).dialog("close");
//            },
//            Cancel: function() {
//                $(this).dialog("close");
//            }
//        }
//    });
//});

$(document).ready(function() {

$('input[type=file]').each(function() {
    $(this).addClass('file').addClass('hidden');
    $(this).parent().append($('<div class="fakefile" />').append($('<input type="text" />').attr('id', $(this).attr('id') + '__fake')));

    $(this).bind('change', function() {
        $('#' + $(this).attr('id') + '__fake').val($(this).val()); ;
    });
    $(this).bind('mouseout', function() {
        $('#' + $(this).attr('id') + '__fake').val($(this).val()); ;
    });
});


    //$("input.autocompletar").css("border", "9px solid red");
    //$("select").sexyCombo();
    $(".box").colorbox();
    /* LightBox en la Ayuda
    $(".iframe,a[href$='Ayuda.aspx']").colorbox({
    initialWidth: "600",
    initialHeight: "400",
    width: "1100",
    height: "700",
    iframe: true 
    });
    */
    /* Sexy ToolTip
    $.each($('a'), function() {
    $(this).tooltip('<p>' + $(this).attr('href') + '</p>', {
    width: 400,
    //  style: 'alert',
    sticky: 0,
    hook: 1
    });
    });
    */
    /*
    $.each($('.tooltip_info'), function() {
    $(this).tooltip('<p><div style="float:left; margin-right:5px"><img src="Imagenes/msjInfo.png"/></div><div>' + $(this).attr('title') + '</div></p>', {
    width: 400,
    //  style: 'alert',
    sticky: 0,
    hook: 1
    });
    });
    */

    $.each($("input.autocompletar"), function() {
        $(this).attr("title", autocompletar_title);
        $(this).tooltip("<p>" + autocompletar_title + "</p>");

        var id = $(this).attr('id');
        var idContenido = '#' + id + "_contenido";
        var v = document.getElementById(idContenido);
        var contenido = $(idContenido).html();
        $(idContenido).hide();
        if (contenido != "") {
            $(this).autocomplete(contenido.split("|"),
            {
                autoFill: true,
                width: 320,
                max: 100,
                scroll: true,
                scrollHeight: 300,
                minChars: 0
            }

            );
        }
    });
    $.each($('.tooltip_info'), function() {
        $(this).tooltip('<p><div style="float:left; margin-right:5px"><img src="Imagenes/msjInfo.png"/></div><div>' + $(this).attr('title') + '</div></p>', {
            width: 400,
            //  style: 'alert',
            sticky: 0,
            hook: 1
        });
    });
});


