function getObjValue( obj ) {
   if (!obj) return "";
   if (obj.tagName == "DIV")        return obj.innerText;
	if (obj.type    == "hidden")     return obj.value;
	if (obj.type    == "text")       return obj.value;
	if (obj.type    == "password")   return obj.value;
	if (obj.type    == "textarea")   return obj.innerText;
	if (obj.type    == "select-one") return obj.value;
   /*
	if (obj.type    == "select-one") {
      var iIndex = obj.selectedIndex;
      return (iIndex == -1) ? "" : obj.options[iIndex].value;
   }
   */
   return "";
}

function doRequestData(url) {
	var iApplet = document.applets["appletServerRequest"];
   var res = iApplet ? iApplet.requestData(escape(url)) : "";
   if (res==null) res = "";
   return res;
}

function doValidateWithServer(valType, valData) {
	return (doRequestData(valType+","+valData)=="");
}

function killEvent() {
   var e = window.event;
   if (e) {
      e.returnValue  = false;
      e.cancelBubble = true;
   }
}

function loadApplet(applId, applClass) {
   if (document.applets[applId]!=null) return;
	var appl = document.createElement("APPLET");
	with (appl) {
		codeBase = "http://ehms.optimalcare.net/applets/";
		code = applClass;
		id = applId;
		with (style) {
			position = "absolute";
			width = 0;
			height = 0;
			top = 0;
			left = 0;
		}
	}
	document.appendChild(appl);
}

function encryptPassword(orgPassword) {
   var iApplet = document.applets["appletPasswordEncrypt"];
   alert(iApplet);
   alert(iApplet.readyState);
   var res = iApplet ? iApplet.encryptPassword(orgPassword) : "";
   if (res==null) res = "";
   return res;
}