var XApp_block = function(xobj, options) {
	
	var plugin_name = 'block';
	
	var plugin = function(xobj, options){
		// __construct();
		
		XApp_plugin.apply(this, arguments);
	};
	
	plugin.prototype = $.extend(new XApp_plugin.fn.onload(plugin_name), xobj, {
		
		$overlay : false,
		
		options: {
			blocked: false
		},
		
		init: function()
		{
			XApp_plugin.fn.init.apply(this, arguments);
			
			this.$overlay = $(); 
			
			if( ! this.options.blocked ) {
				this.options.blocked = this.$el;
			}
					
			return this;
		},
		
		block: function()
		{
			if( this.options.blocked ) {
				
				this.$overlay = this.$overlay.length ? this.$overlay : $('<div class="ui-widget-overlay"><!-- --></div>');
				
				this._positioned = $(this.options.blocked).css('position');
				$(this.options.blocked).addClass('ui-overlay').css('position', 'relative').append(this.$overlay);
			}
			
			return this;
		},
		
		unblock: function()
		{
			if( this.options.blocked ) {
				$(this.options.blocked).removeClass('ui-overlay').css('position', this._positioned);
				this.$overlay.remove();
				this.$overlay = $();
			}
			
			return this;
		}
		
	});
	
	return new plugin(xobj, options);
};
