(function($){
	$.fn.popup = function(settings){
		settings = jQuery.extend({
			overlayBgColor		:		'#000',
			overlayOpacity		:		'0.8',
			containerBorder		:		10
		},settings);
		
		var jQueryMatchedObj = this;
		_initialize();
		function _initialize(){
			_start(this,jQueryMatchedObj);
		}
		
		function _start(objClicked,jQueryMatchedObj){
			$('embed, object, select').css({ 'visibility' : 'hidden' });
			_create_interface();
		}
		
		function _create_interface(){
			$('body').append('<div id="jquery-popup-overlay"></div><div id="jquery-popup-signin"><h2>Welcome</h2><form method="post" action="/admin"><table><tr><td>User: </td><td><input type="text" name="user" /></td></tr><tr><td>Password: </td><td><input type="password" name="pass" /></td></tr><tr><td></td><td><input type="submit" name="signin-submit" value="Sign In" /></td></tr></table></form></div>');
			var arrPageSizes = ___getPageSize();
			$('#jquery-popup-overlay').css({
				backgroundColor		:	settings.overlayBgColor,
				opacity				:	settings.overlayOpacity,
				width				:	arrPageSizes[0],
				height				:	arrPageSizes[1]
			}).fadeIn();
			
			$('#jquery-popup-overlay').click(function(){
				_cancel();
			});
			
		}
		
		function _cancel(){
			$('#jquery-popup-signin').remove();
			$('#jquery-popup-overlay').fadeOut(function(){ $('#jquery-popup-overlay').remove(); });
			$('embed, object, select').css({ 'visibility' : 'visible' });
		}
		
		// From Lightbox plugin Thanx to them
		function ___getPageSize() {
			var xScroll, yScroll;
			if (window.innerHeight && window.scrollMaxY) {	
				xScroll = window.innerWidth + window.scrollMaxX;
				yScroll = window.innerHeight + window.scrollMaxY;
			} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
				xScroll = document.body.scrollWidth;
				yScroll = document.body.scrollHeight;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
				xScroll = document.body.offsetWidth;
				yScroll = document.body.offsetHeight;
			}
			var windowWidth, windowHeight;
			if (self.innerHeight) {	// all except Explorer
				if(document.documentElement.clientWidth){
					windowWidth = document.documentElement.clientWidth; 
				} else {
					windowWidth = self.innerWidth;
				}
				windowHeight = self.innerHeight;
			} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
				windowWidth = document.documentElement.clientWidth;
				windowHeight = document.documentElement.clientHeight;
			} else if (document.body) { // other Explorers
				windowWidth = document.body.clientWidth;
				windowHeight = document.body.clientHeight;
			}	
			// for small pages with total height less then height of the viewport
			if(yScroll < windowHeight){
				pageHeight = windowHeight;
			} else { 
				pageHeight = yScroll;
			}
			// for small pages with total width less then width of the viewport
			if(xScroll < windowWidth){	
				pageWidth = xScroll;		
			} else {
				pageWidth = windowWidth;
			}
			arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
			return arrayPageSize;
		};
		
		return this.unbind('click').click(_initialize);
	};
})(jQuery);

		/*
			<div id="jquery-popup-overlay"></div>
			<div id="jquery-popup-signin">
				<h2>Welcome Glenice</h2>
				<form method="post" action="">
					<table>
						<tr>
							<td>User: </td>
							<td><input type="text" name="user" /></td>
						</tr>
						<tr>
							<td>Password: </td>
							<td><input type="password" name="pass" /></td>
						</tr>
						<tr>
							<td></td>
							<td>
								<input type="submit" name="signin-submit" value="Sign In" />
							</td>
						</tr>
					</table>
				</form>
			</div>
		*/
