var RootDir="/";
function dbdic(str)
{
try{
	str="dic="+urlencode(str);
	var oXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	oXmlHttp.open("POST","/control/tables/dic.jsp",false);
	oXmlHttp.setRequestHeader("Content-Length",str.length);
	oXmlHttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
	oXmlHttp.send(str);
	return trim(oXmlHttp.responseText);
}catch(e){
	return "";
}
}
function MWalert(intType,s1,d1,s2,d2,s3,d3){

	var strTemp;
	var strVersion;
	var varReturn="";

	if(typeof(d1)!="undefined")d1="1"; else d1="";
	if(typeof(d2)!="undefined")d2="1"; else d2="";
	if(typeof(d3)!="undefined")d3="1"; else d3="";

	if(typeof(s1)=="undefined")s1="";
	if(typeof(s2)=="undefined")s2="";
	if(typeof(s3)=="undefined")s3="";

	if(typeof(parent)=="object")
	if(typeof(parent.bmsgbox)!="undefined" && typeof(parent.smsgbox)!="undefined")
	if(!parent.bmsgbox){
		if(d1=="1")parent.smsgbox=urldecode(dbdic(s1));else 	 parent.smsgbox=urldecode(s1);
		if(d2=="1")parent.smsgbox+=" "+urldecode(dbdic(s2));else parent.smsgbox+=" "+urldecode(s2);
		if(d3=="1")parent.smsgbox+=" "+urldecode(dbdic(s3));else parent.smsgbox+=" "+urldecode(s3);
		return;
	}
	if(typeof(bmsgbox)!="undefined" && typeof(smsgbox)!="undefined")
	if(!bmsgbox){
		if(d1=="1")smsgbox=urldecode(dbdic(s1));else smsgbox=urldecode(s1);
		if(d2=="1")smsgbox+=" "+urldecode(dbdic(s2));else smsgbox+=" "+urldecode(s2);
		if(d3=="1")smsgbox+=" "+urldecode(dbdic(s3));else smsgbox+=" "+urldecode(s3);
		return;
	}

	if(true){
		var b=true;
		strVersion = navigator.appVersion;
		strTemp = RootDir+"control/dialog/alertwindow.jsp?intType="+intType+ "&d1="+d1+"&s1="+s1+ "&d2="+d2+"&s2="+s2+ "&d3="+d3+"&s3="+s3;// + "&Rnd=" + Math.random();
		try{
			if(strVersion.indexOf("MSIE 5")!=0 && strVersion.indexOf("MSIE 5")!=-1){
				varReturn = top.window.showModalDialog(strTemp,top.window,"dialogHeight: 200px; dialogWidth: 300px; center: Yes; help: No; resizable: No; status: no;");
				b=false;
			}
		}catch(exception){}
		if(b)try{
			varReturn = top.window.showModalDialog(strTemp,top.window,"dialogHeight: 200px; dialogWidth: 300px; center: Yes; help: No; resizable: no; status: no;");
			b=false;
		}catch(exception){}
		if(b)try{
			varReturn = window.showModalDialog(strTemp,window,"dialogHeight: 200px; dialogWidth: 300px; center: Yes; help: No; resizable: no; status: no;");
			b=false;
		}catch(exception){}
		if(b)try{
//alert(window.location);
//alert(dialogArguments.document.body.outerHTML);
			var s="";
			if(d1=="1")s=urldecode(dbdic(s1));else s=urldecode(s1);
			if(d2=="1")s+=" "+urldecode(dbdic(s2));else s+=" "+urldecode(s2);
			if(d3=="1")s+=" "+urldecode(dbdic(s3));else s+=" "+urldecode(s3);
			var vbtype=0;
			if(intType=="5")vbtype=4+256;//4:yes/no,256:button2
			if(intType=="2")vbtype=1;
			if(vbtype==0)
				alert(s);
			else
				varReturn=MWalert2(vbtype,s);
			if(varReturn==1)varReturn = "VbYes";//ok
			if(varReturn==2)varReturn = "VbNo"; //cancel
			if(varReturn==6)varReturn = "VbYes";//ok
			if(varReturn==7)varReturn = "VbNo"; //cancel
		}catch(exception){}
	}
	return varReturn;
}
