if (typeof(fmCommonPath) == "undefined") alert("The variable for 'fmCommonPath' not defined.");
var sPath= fmCommonPath;

function document.oncontextmenu() {
	var s = event.srcElement.tagName;
	if (s && s != "INPUT" && s != "TEXTAREA" || event.srcElement.disabled || document.selection.createRange().text.length == 0) {
		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;
}
function openStdWin(sPath, sName, iX, iY) {
	if (!iX) iX = 750;
	if (!iY) iY = 510;
	try {
		window.open(sPath, sName, "width=" + iX + ",height=" + iY + ",status=1,resizable=1,scrollbars=0");
	} catch(e) {}
}
function openStdDlg(sPath, oArgs, iX, iY) {
	return window.showModalDialog(sPath, oArgs, "dialogWidth:" + iX + "px;dialogHeight:" + iY + "px;help:0;status:0;scroll: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) {
	s= s.replace(/&/g, "&amp;");
	s= s.replace(/</g, "&lt;");
	s= s.replace(/>/g, "&gt;");
	s= s.replace(/\"/g, "&quot;")
	s= s.replace(/'/g, "&apos;")
	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 decodeXml(s) {
	// remove all unicode encoded symbols
	try {
		s = eval('"' + s.replace(/&#x(\w\w\w\w);/g, "\\u$1").replace(/"/g, '\\"') + '"');
	}
	catch (e) {;}
	// remove special encoding sequences
	alert(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, "&");
	alert(s);
	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,'');
}