﻿(function(a) {
    a.fn.extend({
        //        cargarJQueryModal: function() {
        //            var script = document.createElement('script');
        //            script.type = 'text/javascript';
        //            script.src = '/elementos/js/jquery/jquery.simplemodal.1.4.1.min.js';
        //            document.body.appendChild(script);
        //            document.getElementsByTagName('head')[0].appendChild(script);
        //        },


        ventanaSimple: function(ancho, alto, cerrar) {
            var $this = a(this);
            $this.modal({ escClose: cerrar, maxHeight: alto, maxWidth: ancho });
        },

        ventanaCompleja: function(ancho, alto, cerrar) {
            var $this = a(this);
            $this.modal(
                    { onOpen: function(dialog) {
                        dialog.overlay.fadeIn('slow', function() {
                            dialog.data.hide();
                            dialog.container.fadeIn('slow', function() {
                                dialog.data.slideDown('slow');
                            });
                        });
                    },

                        onClose: function(dialog) {
                            dialog.data.fadeOut('slow', function() {
                                dialog.container.hide('slow', function() {
                                    dialog.overlay.slideUp('slow', function() {
                                        $.modal.close();
                                    });
                                });
                            });
                        },
                        maxHeight: alto,
                        maxWidth: ancho,
                        escClose: cerrar
                    });
        },

        ventanaRedireccion: function(ancho, alto, url) {
            var $this = a(this);
            $this.modal(
                    {   onClose: function(dialog) {
                            document.location.href = url;
                        },
                        maxHeight: alto,
                        maxWidth: ancho,
                        escClose: false
                    });
        }


    });
})(jQuery);

























//(function($) {
//$.fn.enfocar = function(options) {
//    // puede recibir un array de parámetros nombrados
//    // invocamos a una función genérica que hace el merge 
//    // entre los recibidos y los de por defecto 
//    var opts = $.extend({}, $.fn.highlight.defaults, options);

//    // para cada componente que puede contener el objeto jQuery que invoca a esta función
//    this.each(function() {
//        // asignamos a la asignación del foco la invocación a una función
//        $(this).focus(function() {
//            // que asigna al fondo el color recibido o el asginado por defecto
//            $(this).css({ "background": opts.background });
//        });
//        // asignamos a la perdida del foco la invocación a una función
//        $(this).blur(function() {
//            // que asigna al fondo un color blanco
//            $(this).css({ "background": "white" });
//        });
//    });

//};

//// definimos los parámetros junto con los valores por defecto de la función
//$.fn.enfocar.defaults = {
//    // para el fondo un color por defecto
//    background: 'yellow'
//};

//})(jQuery);


//    this.each(function() {
//        elem = $(this);
//        alert("nnnnn");

//        elem.focusin(
//            function() {
//                alert("xxx");
//                $(this).css("background-color", "yellow");
//            }
//        );
//        elem.focusout(
//            function() {
//                $(this).css("background-color", "white");
//            }
//        );
//    });
//    return this;
//};



//(function($) {
//    //código del plugin
//})(jQuery);
