function showDialog(sText,sButtons,funcCallBack,argsCallBack){
	var args=new Array();
	if((typeof(sButtons)=='undefined')||(!sButtons)) sButtons='';
	args["Text"]	=sText;
	args["Buttons"] =sButtons;
	
	var wW=320
	var wH=240;
	
	var windowWidth=window.top.document.body.clientWidth;
	var windowHeight=window.top.document.body.clientHeight;
	var wX=Math.floor(windowWidth/2-wW/2);
	var wY=Math.floor(windowHeight/2-wH/2);
	
	//IE
	if(document.all && window.showModalDialog){
		var retValue=flexDialog(wW,wH,"../_js/flexDialog.html",args,funcCallBack,argsCallBack);
	//Gecko & Safari
	}else{
		var re = new RegExp("\<br\>","ig");
		sText = sText.replace(re, "\n");

		if(sButtons.split(",").length<2){ 
			alert(sText);
		}else if(sButtons=="Yes,No"){
			if(window.confirm(sText)){
				var retValue="Yes";
			}else{
				var retValue="Cancel";
			}
		}else{
			flexDialog(wW,wH,"../_js/flexDialog.html",args,funcCallBack,argsCallBack);
			return;
		}
	}
	return retValue;
}

var flexDialogObject=new Object();
function flexDialog(wW,wH,sURL,inptArgument,funcCallBack,argsCallBack){
	flexDialogObject.inptArgument=inptArgument;
	flexDialogObject.funcCallBack=funcCallBack;
	flexDialogObject.argsCallBack=argsCallBack;

	var windowWidth=window.top.document.body.clientWidth;
	var windowHeight=window.top.document.body.clientHeight;
	var wX=Math.floor(windowWidth/2-wW/2);
	var wY=Math.floor(windowHeight/2-wH/2);
	
	//IE
	if(document.all && window.showModalDialog){
		var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
		if(IE6) wH+=50;
		var retValue=window.showModalDialog(sURL,flexDialogObject,"dialogLeft:"+wX+"px; dialogTop:"+wY+"px;dialogWidth:"+wW+"px; dialogHeight:"+wH+"px;help:0;status:1;scroll:0;");
		return retValue;
	//Gecko & Safari
	}else{
		if(flexDialogObject.win) {flexDialogObject.win.close();flexDialogObject.win=null};
		var sName=sURL;
		var re = new RegExp("[:|\/|\.|\?|\&|_]","ig");
		sName = sName.replace(re, "");
		var win=window.open(sURL,"dlg_"+sName,"left="+wX+",top="+wY+",width="+wW+",height="+wH+",toolbar=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,modal=no");
		win.focus();
		flexDialogObject.win=win;
	}
	
}

function flexDialogArgument(){
	if(window.opener){
		if(window.opener.flexDialogObject) return window.opener.flexDialogObject.inptArgument;
	}else if(window.dialogArguments){
		if(window.dialogArguments.inptArgument){
			return window.dialogArguments.inptArgument;
		}else{
			//fetch standard IE modal dialog "window.dialogArguments" for backward compatibility
			return window.dialogArguments;
		}
	}
	return null;
}

function flexDialogCallBack(retValue){
	var DialogObject=null;
	if(window.opener){
		if(window.opener.flexDialogObject) DialogObject=window.opener.flexDialogObject;
	}else if(window.dialogArguments){
		DialogObject=window.dialogArguments;
	}
	window.returnValue=retValue;
	window.close();
	if(DialogObject) if(DialogObject.funcCallBack) DialogObject.funcCallBack(retValue,DialogObject.argsCallBack);
}


function flexPrompt(sText,sValue){
	//IE
	if(document.all && window.showModalDialog){
		var args=new Array();
		args["Text"]  =sText;
		args["Value"] =sValue;

		var wW=340
		var wH=120;
		
		var windowWidth=window.top.document.body.clientWidth;
		var windowHeight=window.top.document.body.clientHeight;
		var wX=Math.floor(windowWidth/2-wW/2);
		var wY=Math.floor(windowHeight/2-wH/2);

		var retValue=window.showModalDialog("../_js/flexPrompt.asp",args,"dialogLeft:"+wX+"px; dialogTop:"+wY+"px;dialogWidth:"+wW+"px; dialogHeight:"+wH+"px;help:0;status:1;scroll:0;");
	//Gecko & Safari
	}else{
		var retValue=prompt(sText,sValue);
	}
	return retValue;
}