function msgbox(type,width,height,id){
	
	this.show=msgBoxDisplay;
	this.hide=msgBoxHide;
	var scrWidth=window.innerWidth||document.body.clientWidth;
	var scrHeight=window.innerHeight||document.body.clientHeight;
	
	function msgBoxDisplay(text){
		if(type=='load'){
			var el=document.createElement('div');
			if(id){
				if(document.getElementById(id))return;
				el.id=id;
				this.id=id;
			}
			else{ 
				var i='msgbox'+Math.round(100*Math.random());
				el.id=i;
				this.id=i;
			}
			el.className='mybmsgbox';
			var sty=el.style;

			var w=width||200;
			var h=height||100;
			sty.width=parseInt(w)+'px';
			sty.height=parseInt(h)+'px';

			sty.zIndex='9999';

			sty.position='absolute';
			sty.left=((scrWidth-w)/2)+'px';
			sty.top=((scrHeight-h)/2)+'px';

			sty.background='#1F860C';
			sty.border='1px solid white';

			el.innerHTML='<table style="color:white;font:bold 12px tahoma,verdana,sans-serif;width:'+parseInt(w)+'px;height:'+parseInt(h)+'px;text-align:center;"><tr><td style="vertical-align:middle;line-height:17px">'+text+'</td></tr></table>';
			document.body.appendChild(el);
		}
	}

	function msgBoxHide(id){
		if(this.id&&document.getElementById(this.id)){
			document.body.removeChild(document.getElementById(this.id));
		}
		else { //if no id remove all
			var divs=document.getElementsByTagName('div');
			var x=0;
			while(divs[x]){
				if(divs[x].className=='mybmsgbox'){
					document.body.removeChild(divs[x]);
				}
				x++;
			}
		}
	}
}

