function getXMLObject() {
	var xml = false;
	if(window.XMLHttpRequest) {
		try {
			xml = new XMLHttpRequest();
		} catch(e)  {
			xml = false;
		}
	} else if(window.ActiveXObject) {
		try {
			xml = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e)  {
			try {
				xml = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e)  {
				xml = false;
			}
		}
	}
				
	return xml;
}
function sendCommand(action, actionid, confirmMessage) {
	var ok = true;

	if (confirmMessage != '') {
		ok = confirm(confirmMessage);
	}

	if (ok) {
		document.all('action').value = action;
		document.all('actionid').value = actionid;
		document.all('Form1').submit();
	}

}

function returnID(functiontocall){
  eval(functiontocall);
}

function openWindow(URL, height, width, left, top,features)
{
	window.open(URL, "", "HEIGHT=" + height + ",WIDTH=" + width + ",LEFT=" + left + ",TOP=" + top + features)
}

function logout(){if(confirm('Exit RV Intranet?')){window.close();}  }

function FormatNumber(num,decimalNum,bolLeadingZero,bolParens,bolCommas) {
	if (isNaN(parseInt(num))) return "NaN";

	var tmpNum = num;
	var iSign = num < 0 ? -1 : 1;
	tmpNum *= Math.pow(10,decimalNum);
	tmpNum = Math.round(Math.abs(tmpNum))
	tmpNum /= Math.pow(10,decimalNum);
	tmpNum *= iSign;
	
	var tmpNumStr = new String(tmpNum);
	if (!bolLeadingZero && num < 1 && num > -1 && num != 0)
		if (num > 0) { tmpNumStr = tmpNumStr.substring(1,tmpNumStr.length); }
		else { tmpNumStr = "-" + tmpNumStr.substring(2,tmpNumStr.length); }
	if (bolCommas && (num >= 1000 || num <= -1000)) {
		var iStart = tmpNumStr.indexOf(".");
		if (iStart < 0) iStart = tmpNumStr.length;
		iStart -= 3;
		while (iStart >= 1) {
			tmpNumStr = tmpNumStr.substring(0,iStart) + "," + tmpNumStr.substring(iStart,tmpNumStr.length)
			iStart -= 3;
		}
	}

	if (decimalNum > 0) {
		var decPos = tmpNumStr.indexOf('.');
		if (decPos >= 0) { var dec = tmpNumStr.substring(decPos+1,tmpNumStr.length); }
		else { var dec = ''; }
		while (dec.length < decimalNum) {
			dec += '0';
		}
		if (decPos >= 0) { tmpNumStr = tmpNumStr.substring(0, decPos) + '.' + dec; }
		else { tmpNumStr = tmpNumStr + '.' + dec; }
	}
	if (bolParens && num < 0) { tmpNumStr = "(" + tmpNumStr.substring(1,tmpNumStr.length) + ")"; }
	return tmpNumStr;
}
