function ModalElement(options) 
{
	// INI: Private properties
	var _options = {
		bgColor		: options && options.bgColor ? options.bgColor : '#000',
		opacity		: options && options.opacity ? options.opacity : '0.8',
		fixed		: options && options.fixed === false   ?  false : true
	};
	var _element = null;
	var _originalCss = {};
	
	var _background = $('<div id="ModalElementBackground" />');
	var _this = this;

	var _zIndex = 10000;
	// END: Private properties
	
// INI: Public methods
	// Show Any element in modal mode
	this.showElement = function(elementSelector) {		
		this.hide(function(){
			if (!$(elementSelector).length) {
				return;
			}
			// Get the element to set modal
			_element = $($(elementSelector).get(0));
			// Get the original css basic properties
			_originalCss.display = _element.css('display');
			_originalCss.position = _element.css('position');
			_originalCss.top = _element.css('top');
			_originalCss.left = _element.css('left');
			_originalCss.width = _element.css('width');
			_originalCss.height = _element.css('height');
			// Replace the original element
			_element.after($('<div id="AuxiliarElement" />').css(_originalCss));
			// Resize the elements (background,_element)
			_resize();
			// Reposition the modal element
			$('body').append(_element);
			// Show element in modal mode
			_background.fadeIn('fast', function(){
				_element.fadeIn('fast');
			});
		});
	};
	this.hide = function(callback) {
		if (_element) {
			_element.fadeOut('fast', function(){
				$('#AuxiliarElement').replaceWith(_element.css(_originalCss));
				_background.fadeOut(callback || function(){ });
			});
		}
		else if(callback) {
			callback();
		}
	};
	
// INI: Public methods
	function _resize() {
		if (_element && _element.length > 0) {
			var top = ($(window).height() / 4) - ($(_element).height() / 4);
			var left = ($(window).width() / 2) - (_element.width() / 2);
			var position = _options.fixed ? 'fixed' : 'absolute';
			
			// If ie6, only position 'absolute'
			if (navigator.appVersion.indexOf('MSIE 6.0') != '-1') {
				position = 'absolute';
			}
			
			// Resize background
			_background.css({
				zIndex: 100,
				top: 0,
				left: 0,
				width: $(window).width() + 'px',
				height: $(document).height() > $(window).height() ? $(document).height() : $(window).height() + 'px'
			});
			
			// Move the element to center
			_element.css({
				position: position,
				top: top,
				left: left,
				zIndex: 101
			});
		}
	}
// INI: Private methods
	
// END: Private methods

// Constructor
	(function(){
		// setup background element		
		_background
			.css({
				opacity	: _options.opacity, filter : 'alpha(opacity = 50)', position : 'absolute', 
				background : _options.bgColor, top : 0, left : 0, display : 'none'
			})
			.click(function() { _this.hide(); });
		// append background element to body
		$('body').append(_background);
		$(window).resize(_resize);					
	}());
}