function ajax_dialog(title,target,command,data,buttons)
{
	this.buttons = buttons;	
	this.title = title;
	this.target = target;
	this.request=new xmlrequest(command,data);	
	this.width = "400px";
	this.height = "200px";
}

function callback(response)
{
	oResultDiv.innerHTML = response;
	bt_dlg_close.disabled=false;
}

ajax_dialog.prototype.show = function()
{
	oDiv = document.createElement("DIV");
	oDiv.id = "oPopup";
	oDiv.style.cssText = "width:" + this.width + "; height:" + this.height + "; position:absolute;";	
	
	var szHtml = "";
	
	szHtml += "<table style='width:100%; height:100%; border: none;' cellpadding='0' cellspacing='0'>";
	szHtml += "<tr><td style='height:28px;'>";
	szHtml += "<table style='width:100%; height:100%; border: none;' cellpadding='0' cellspacing='0'><tr>";
	szHtml += "<td style='width:5px; background: url(img/clb.gif);'>&nbsp;</td>";
	szHtml += "<td style='background: url(img/chb.gif); font-size: 10pt; font-family: Tahoma; font-weight: bold;'>" + this.title + "</td>";
	szHtml += "<td style='width:5px; background: url(img/crb.gif);'>&nbsp;</td>";
	szHtml += "</tr></table>";	
	szHtml += "</td></tr>";
	szHtml += "<tr><td align='center' valign='top' style='border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; background:white;'>";
	szHtml += "<img src='img/UPload_00.gif'/>";
	szHtml += "<div id='oResultDiv' style='width:100%; height:100%; overflow:auto; font-family: Tahoma; font-size: 8pt;'></div>";
	szHtml += "</td></tr>";
	szHtml += "<tr><td style='border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; background:white;' align='center' valign='middle' style='height:30px;'>";
	if (this.buttons != null)
	{
		szHtml += "<input type='button' value='Ok' style='width:70px; height:20px;font-size: 8pt; font-family: Tahoma;'>";
		szHtml += "<input type='button' value='Cancel' style='width:70px; height:20px;font-size: 8pt; font-family: Tahoma;'>";
	}
	else szHtml += "<input id='bt_dlg_close' onclick = 'document.body.removeChild(oPopup);' disabled type='button' value='Close' style='width:70px; height:20px;font-size: 8pt; font-family: Tahoma;'>";
	szHtml += "</td></tr>";
	szHtml += "<tr><td style='height:5px; font-size: 1px;'>";
	szHtml += "<table style='width:100%; height:5px; font-size: 1px; border: none;' cellpadding='0' cellspacing='0'><tr>";
	szHtml += "<td style='width:5px; background: url(img/cflF5.gif);'>&nbsp;</td>";
	szHtml += "<td style='border-bottom: 1px solid #CCCCCC;background: white;'>&nbsp;</td>";
	szHtml += "<td style='width:5px; background: url(img/cfrF5.gif);'>&nbsp;</td>";
	szHtml += "</tr></table>";
	szHtml += "</td></tr>";
	szHtml += "</table>";
	oDiv.innerHTML = szHtml;
	oDiv.style.top = document.body.scrollHeight/2-Number(this.height.replace("px",""))/2;
	oDiv.style.left =  document.body.scrollWidth/2-Number(this.width.replace("px",""))/2;
	
	
	this.div = oDiv;
	document.body.insertBefore(this.div);
	this.request.Send(this.target,callback);
}