(function( $ ){
    var settings = {
        'url'           : 'calendario_lateral.php', 
        'data_send'     : {}
    };
    
    var methods = {
        init            : function( options ) {
            return this.each(function() {
                var obj_general = jQuery(this);
                if ( options ) { 
                    $.extend( settings, options );
                }
                
                obj_general.calendario("show", settings);
            });
        },destroy       : function(  ) {
            return this.each(function() {
                var obj_general = jQuery(this);
                obj_general.html("");
            });
        },reposition    : function(  ) { 
            //
        },show          : function( options ) { 
            return this.each(function() {
                var obj_general = jQuery(this);
                if ( options ) { 
                    $.extend( settings, options );
                }
                
                $.ajax({
                    url         : settings.url,
                    data        : settings.data_send,
                    beforeSend  : function(){
                        //return obj_general.fadeOut('fast');
                    },
                    success     : function(data) {
                        obj_general.calendario("destroy");
                        obj_general.html(data);
                        //obj_general.fadeIn();
                    }
                });
            });
        },hide          : function( ) { 
            // ... 
        },update        : function( content ) { 
            //
        }
    };

    $.fn.calendario = function( method ) {
        if ( methods[method] ) {
            return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
        } else if ( typeof method === 'object' || ! method ) {
            return methods.init.apply( this, arguments );
        } else {
            $.error( 'Method ' +  method + ' does not exist on jQuery.tooltip' );
        }
    };

})( jQuery );
