function popup(title,msg,prefix,wait,timeout) {
	var zindex = 50;
	var opacity = 70;
	var opaque = (opacity / 100);
	var bgcolor = '#000000';
	var dark=document.getElementById('darkenScreenObject');
	if (!dark)
	{
		var boxHeight = 250;
		var boxWidth = 400;
		var tbody = document.getElementsByTagName("body")[0];
		var tnode = document.createElement('div');
		tnode.style.position='absolute';
		tnode.style.top='0px';
		tnode.style.left='0px';
		tnode.style.overflow='hidden';
		tnode.style.display='none';
		tnode.id='darkenScreenObject';
		
		var msgnode = document.createElement('div');
		msgnode.style.position='absolute';
		msgnode.style.top= (screen.height/3-boxHeight/3)+'px';
		msgnode.style.left=screen.width/3+'px';
		msgnode.style.overflow='hidden';
		msgnode.style.display='none';
		msgnode.id='popupBox';
		msgnode.innerHTML = '<div style="width:100%; height:30px; text-align:left; padding-left:20px; padding-top:10px; background-color:#263B6F; color:#FFFFFF; font-weight:bold"><span id="popupTitle" style="float:left"></span></div><div style="height:180px"><div id="popupMsg" style="padding:30px"></div></div><div style="height:30px; border-top:1px solid #000000;"><img src="'+prefix+'images/close.gif" id="popupCloseBtn" style="float:right; margin-right:30px; cursor:pointer" /></div>';
		tbody.appendChild(msgnode);
		tbody.appendChild(tnode);
		dark=document.getElementById('darkenScreenObject');
		
		var pageWidth='100%';
		var pageHeight='100%';
		dark.style.opacity=opaque;
		dark.style.MozOpacity=opaque;
		dark.style.filter='alpha(opacity='+opacity+')';
		dark.style.zIndex=zindex;
		dark.style.backgroundColor=bgcolor;
		dark.style.width= pageWidth;
		dark.style.height= pageHeight;
		
		document.getElementById("popupCloseBtn").onclick = function() //attach a event handler to hide both div
			{
				dark.style.display="none";
				document.getElementById("popupBox").style.display = "none";
			}
		
		document.getElementById("popupBox").style.zIndex = zindex+10;
		document.getElementById("popupBox").style.border = "#000 solid 1px";
		document.getElementById("popupBox").style.width = boxWidth+"px";
		document.getElementById("popupBox").style.height = boxHeight+"px";
		
		document.getElementById("popupBox").style.textAlign = "center";
		
		document.getElementById("popupBox").style.backgroundColor="#FFF";
	}
	
	dark.style.display='block';
	document.getElementById("popupBox").style.display = "block";
	document.getElementById("popupTitle").innerHTML = title;
	document.getElementById("popupMsg").innerHTML = (wait==true?'<img src="'+prefix+'images/ajax-loader.gif" align="absmiddle" /> ':'')+msg;
	if(timeout!=null)
	{
		setTimeout('document.getElementById("darkenScreenObject").style.display="none";document.getElementById("popupBox").style.display = "none";',timeout);
	}
}