if (typeof(fmCommonPath) == "undefined") alert("The variable for 'fmCommonPath' not defined.");
var sPath= fmCommonPath;

function document.oncontextmenu() {
	var o= event.srcElement;
	var s= o.tagName;
	if (s && s != "INPUT" && s != "TEXTAREA" || o.disabled || o.type != "text" || o.className == "selectBox") event.returnValue= false;
}
function document.onselectstart() {
	var s= event.srcElement.tagName;
	if (s != "INPUT" && s != "TEXTAREA") event.returnValue= false;
}

function document.ondragstart() {
	//event.returnValue= false; // removed 2006-03-09
}
function openStdWin(sPath, sName, iX, iY, scroll, full) {
	if (!iX) iX= 750;
	if (!iY) iY= 510;
	var top, left;
	try {
		if (full) {
			iX= screen.width - 5; iY= screen.availHeight - 60;
			top= 0; left= 0;
		} else {
			left= (screen.width - iX) / 2; top= (screen.availHeight - iY) / 2 - 30;
		}
		var params= "width=" + iX + ",height=" + iY + ",top=" + top + ",left=" + left + ",status=1,resizable=1,scrollbars=" + ((scroll) ? "1" : "0");
		window.open(sPath, sName, params);
	} catch(e) {}
}
function openStdDlg(sPath, oArgs, iX, iY, scroll) {
	return window.showModalDialog(sPath, oArgs, "dialogWidth:" + iX + "px;dialogHeight:" + iY + "px;help:0;status:0;scroll:" + ((scroll) ? "1" : "0") + ";center:1");
}
function openPopup() {
	return window.createPopup();
}
function buildWinName(s) {
	if (s) return s.replace(/[-\{\}]/g, "");
	var d= new Date();
	return d.getTime();
}
var ERROR_STOP= 0;
var ERROR_NONE= 1;
var ERROR_CONTINUE= 2;

function HtmlEncode(s) {
	s= s.replace(/&/g, "&amp;");
	s= s.replace(/</g, "&lt;");
	s= s.replace(/>/g, "&gt;");
	s= s.replace(/\"/g, "&quot;");
	return s;
}

function XmlEncode(s) {
	if (IsNull(s)) return "";
	if (typeof(s) != "string") s= s.toString();
	s= escape(s);
	s= s.replace(/%20/g, " ");
	s= s.replace(/%u(\w{4})/g,	"&#x$1;");
	s= s.replace(/%(\w{2})/g,	"&#x$1;");
	return s;
}
function XmlDecode(s) {
	s= s.replace(/&lt;/g, "<");
	s= s.replace(/&gt;/g, ">");
	s= s.replace(/&apos;/g, "'");
	s= s.replace(/&quot;/g, "\"");
	s= s.replace(/&amp;/g, "&");
	return s;
}
function isArray(item) {
	return (item != null && ((item instanceof Array) || (typeof item.splice) == "function"));
}
function decodeXml(s) {
	// remove all unicode encoded symbols
	try { s= eval('"' + s.replace(/&#x(\w\w\w\w);/g, "\\u$1").replace(/"/g, '\\"') + '"'); } catch (e) {;}
	s= s.replace(/&lt;/g, "<");
	s= s.replace(/&gt;/g, ">");
	s= s.replace(/&apos;/g, "'");
	s= s.replace(/&quot;/g, "\"");
	s= s.replace(/&amp;/g, "&");
	return s;
}
function URLEncode(s) {
	s= s.replace(/ /g, "%20");
	s= s.replace(/"/g, "%22");
	s= s.replace(/#/g, "%23");
	s= s.replace(/&/g, "%26");
	s= s.replace("+", "%2B");
	return s;
}
function Trim(s) {
	return s.replace(/^\s+|\s+$/g,'');
}
function FullTrim(s) {
	s= Trim(s);
	return s.replace(/'|"/g,'');
}
function IsNull(o) {
	return (typeof(o) == "undefined" || typeof(o) == "unknown" || o == null);
}
function formatString() {
if (arguments.length == 0) return "";
var s= arguments[0];
var args= arguments;
if (args.length > 1 && isArray(args[1])) { args= args[1];args.unshift(s); }
for (var i= 1; i < args.length; i++) {
	var argIndex= i - 1;
	s= s.replace(new RegExp("\\{" + argIndex + "\\}", "g"), args[i].toString());
}
return s;
}