function mbox( sHtml , nHeight ,  bAutoClose ) {
/*
  * 06.04.2006 | mauzirio
  * mbox is easy way to create a nifty  modal box
  * by default it has centered  
  * use: 
  * mbox( "<p>Test</p>" )
  * mbox( "<p>Test</p>" , 200 )
  * mbox( "<p>Test</p>" ,, false)
  *
  * sHtml -> html insert into the box
  * nHeight -> ( optional ) mbox height 
  * bAutoClose -> ( optional ) 
  * 
  * v. 0.2
  * 
  */
  
  
 var myclose = function(){ $(".mbox_hide").show();$("#mbox").remove();$("#overlay").remove(); return false; }
    
  
 var getPageScroll = function(){
  /*
   * getPageScroll()
   * Returns array with x,y page scroll values.
   * Core code from - quirksmode.org
   */
 	var yScroll;
 	if (self.pageYOffset) {
 		yScroll = self.pageYOffset;
 	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
 		yScroll = document.documentElement.scrollTop;
 	} else if (document.body) {// all other Explorers
 		yScroll = document.body.scrollTop;
 	}
 	arrayPageScroll = new Array('',yScroll) 
 	return arrayPageScroll;
 }
  
	

var getPageSize = function() {
 /*
  * getPageSize()
  * Returns array with page width, height and window width, height
  * Core code from - quirksmode.org
  * Edit for Firefox by pHaez
  */
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		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
		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 = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
 
 
	$(document.body).append("<div id='overlay'>&nbsp;</div><div id='mbox' >&nbsp;</div>")

	var aSize = getPageSize()
	var aScroll = getPageScroll()
	if (nHeight == undefined) nHeight = ( aSize[3] / 4 ) * 3
		
	var objOverlay = $("#overlay")
	objOverlay.css("opacity",".40");
	objOverlay.css("filter","alpha(opacity=40)");
	objOverlay.css("position","absolute");
	objOverlay.css("top","0px");
	objOverlay.css("left","0px");
	objOverlay.css("z-index","99");
	objOverlay.css("background-color","#333");
	objOverlay.css("margin","0px");
	objOverlay.css("padding","0px");
	objOverlay.css("border","0px");
	objOverlay.css("width",aSize[0]+"px");
	objOverlay.css("height",aSize[1]+"px");	
	
	var objBox = $("#mbox")

	objBox.css("height", nHeight + "px")
	objBox.css("top", aScroll[1] + ( aSize[3]-nHeight) / 2  +"px")
	
	objBox.css("display","none");
	objBox.css("position","absolute");
	objBox.css("overflow","auto");
	objBox.css("left","10%");
	objBox.css("width","80%");
	objBox.css("padding","5px");
	objBox.css("border","10px solid #A1B3C8");
	objBox.css("background-color","#fff");
	objBox.css("text-align","left");
	objBox.css("z-index","99");

	if ( bAutoClose != false ) {	
		objBox.find("a").click( myclose );

		if ( objBox.find("a").size() == 0 ) 
			objOverlay.show().click( myclose );
	}
	$(".mbox_hide").hide()
	$("#mbox").html(sHtml).show().css("display","block");
	
	return $("#mbox");
}