var blnIE = (document.all);
var blnNS = (document.layers);
var blnW3 = (document.getElementById);

function GetElement(objWinDoc, strInFieldName) {
	if (!objWinDoc) {
		return 0;
	}
	if (!blnIE && !blnNS && !blnW3) {
		return 0;
	}

	if (blnW3) {
		objField = objWinDoc.getElementById(strInFieldName);
	}
	else if (blnIE) {
		objField = objWinDoc.all(strInFieldName);
	}
	
	else if (blnNS) {
		objField = objWinDoc.layers[strInFieldName];
	}
	else {
		objField = null;
	}
	return objField;
}

// Replace with Update
function UpdateElement(objElement, strInVal) {
	if (!objElement) {
		return 0;
	}
	if (!blnIE && !blnNS && !blnW3) {
		return 0;
	}
	
	if (blnIE || blnW3) {
		objElement.innerHTML = strInVal;
	}
	else if (blnNS) {
		objElement.document.open();
		objElement.document.write(strInVal);
		objElement.close();
	}
}

// Append Update
function UpdateElement2(objElement, strInVal) {
	if (!objElement) {
		return 0;
	}
	if (!blnIE && !blnNS && !blnW3) {
		return 0;
	}
	
	if (blnIE || blnW3) {
		objElement.innerHTML += strInVal;
	}
	else if (blnNS) {
		// Not Supported
	}
}

// Open Popup and Return if Popped
function PopWin(strInURL, strInTitle, strInOpts) {
	objWin = window.open(strInURL, strInTitle, strInOpts);
	return (objWin != null);
}

// Check/Uncheck All Checkboxes
function CheckAll(objField, blnInChecked) {
	if (!objField) { return false; }

	intFieldCount = objField.length;
	if (intFieldCount) {
		for (intX = 0; intX < intFieldCount; intX++) {
			objField[intX].checked = blnInChecked;
		}
	}
	else {
		objField.checked = blnInChecked;
	}
}