jQuery.fn.extend({
    
    showModal: function(userOptions) {
        
        var options = {    }
        
        jQuery.extend(options, userOptions);
        
        return $('a.my-modal').each(function(){
            //var content_id = '#' + $(this).attr('id') + '-window';
                        
            $(this).click(function(){
             
                $('body').append('<div id="modal-overlay" class="modal-overlay"></div>');    
                //$('#modal-overlay').remove();    
                
                var w = $(this).attr('href').replace(/\//g, '');
                var content_id = '#modal-' + w;
                
                var width = $(content_id).width();
                var height = $(content_id).height();
            
                $('#modal-overlay').show();    
                $(content_id).css({
                    'margin-top' : ((height/2)-height)+'px',
                    'margin-left' : ((width/2)-width)+'px'
                    }).show();
                    
                $('#modal-overlay').show();    
                
                $('.close-window').click(hideModal);
                $('#modal-overlay').click(hideModal);
                            
                return false;    
            });    
        });
            
        function hideModal() {
            $("#modal-overlay").remove();
            $(".modal-window").hide();
            return false; remove
        }
        
    }
    
        
});
