//Copyright ©2009, Grizella Corporation. All Rights Reserved.
var comTraceMode = false;var comTraceLog = "";var comExceptLog = "";function isDefined(variable) {return (typeof(window[variable]) == "undefined")?  false: true;}function comTimer() {var startd = null;var endd = null;this.start = function() {startd = new Date();};this.stop = function() {endd = new Date();};this.show = function(msg) {var startMils = startd.getTime();var endMils = endd.getTime();var difMils = endMils - startMils;alert(msg + ": " + difMils.toString());};this.trace = function(msg) {var startMils = startd.getTime();var endMils = endd.getTime();var difMils = endMils - startMils;comTrace(msg + ": " + difMils.toString());};}function comTrace(msg) {try {if (!comTraceMode) return;comTraceLog = comTraceLog + "\n" + msg;} catch (e) {alert("JJS00110 " + e);}}function comTraceShow() {if (!comTraceMode) return;var log = "COM TRACE:\n" + comTraceLog;log = log + "\n\nEXCEPTION TRACE:\n" + comExceptLog;document.getElementById("debugTxt").value = log;setOn("debugWin");}function comTraceHide() {if (!comTraceMode) return;setOff("debugWin");}function comTraceClear() {if (!comTraceMode) return;comTraceLog = "";comExceptLog = "";document.getElementById("debugTxt").value = comTraceLog;}function comExceptTrace(msg) {try {if (!comTraceMode) return;comExceptLog = comExceptLog + "\n" + msg;} catch (e) {alert("JJS00109 " + e);}}function comExceptionCatch(code, e) {comSysError(new comErrorResp(code, e));}function comSysError(resp) {comExceptTrace(resp.code + " -> " + resp.techMsg + " " + resp.displayMsg);alert(resp.code + " Unexpected Error. Please try again or contact technical support.");}function comDefaultSysError(code, techMsg) {comSysError(new comErrorResp(code, techMsg));}function comServRespError(code, servResp) {comExceptTrace("Service Response at code " + code + " resulted in response code " + servResp.code + " -> " + servResp.techMsg);alert(code + " Unexpected Error. Please try again or contact technical support.");}function comTraceResp(resp) {comExceptTrace("System Error " + resp.code + " -> " + resp.techMsg);}function comReqNextPage(pageRoot, subset, sort) {setCookie('PageRoot', pageRoot, 365);setCookie('Subset', subset, 365);setCookie('Sort', sort, 365);window.location="/index.php";}function comOpenPage(pageName, subset, sort) {comSetCookie('PageRoot', pageName, 365);comSetCookie('Subset', subset, 365);comSetCookie('Sort', sort, 365);window.location="/index.php";}function comBackOpenPage(pageName, subset, sort) {comSetCookie('PageRoot', pageName, 365);comSetCookie('Subset', subset, 365);comSetCookie('Sort', sort, 365);window.location="/" + pageName + ".php";}function comPageOpen(pageName, postParms) {comSetCookie('PageRoot', "", 365);comSetCookie('Subset', "", 365);comSetCookie('Sort', "", 365);if (postParms == null) {window.location="/" + pageName + ".php";return;}}function comSubmit(pageName) {var formData = "<form name=\"xxDynFormName\" action=\"" + pageName + ".php\" method=\"POST\"></form>";document.getElementById("xxDynForm").innerHTML = formData;document.xxDynFormName.submit();}function comSubmitWithID(pageName, idVal) {var formData = "<form name=\"xxDynFormName\" action=\"" + pageName + ".php\" method=\"POST\" target=\"_blank\">";formData = formData + "<input type=\"hidden\" name=\"id\" value=\"" + idVal + "\"/>\n";formData = formData + "</form>";document.getElementById("xxDynForm").innerHTML = formData;document.xxDynFormName.submit();}function comSubmitWithParms(pageName, parmList, newPage) {var formData = "";if (newPage) {formData = formData + "<form name=\"xxDynFormName\" action=\"" + pageName + ".php\" method=\"POST\" target=\"_blank\">";} else {formData = formData + "<form name=\"xxDynFormName\" action=\"" + pageName + ".php\" method=\"POST\">";}var parmKeys = parmList.getKeys();for (var i=0; i<parmKeys.length; i++) {formData = formData + "<input type=\"hidden\" name=\"" + parmKeys[i] + "\" value=\"" + parmList.getParm(parmKeys[i]) + "\"/>\n";}formData = formData + "</form>";document.getElementById("xxDynForm").innerHTML = formData;document.xxDynFormName.submit();}function comApprovedResp(code, displayMsg) {return new comResp("APPROVED", "OK", code, displayMsg, "");}function comDeniedResp(code, displayMsg) {return new comResp("DENIED", "OK", code, displayMsg, "");}function comErrorResp(code, techMsg) {return new comResp("ERROR", "OK", code, "", techMsg);}function comResp(status, action, code, displayMsg, techMsg) {this.status = status;this.action = action;this.code = code;this.displayMsg = displayMsg;this.techMsg = techMsg;this.isApproved = function() {try {if (this.status == "APPROVED") return true;return false;} catch (e) {return false;}};this.isDenied = function() {try {if (this.status == "DENIED") return true;return false;} catch (e) {return false;}};this.isError = function() {try {if (this.status == "ERROR") return true;return false;} catch (e) {return false;}};this.show = function() {try {var outln = "Code -> " + this.code + "\n";outln = outln + "Status -> " + this.status + "\n";outln = outln + "Action -> " + this.action + "\n";outln = outln + "Display Msg -> " + this.displayMsg + "\n";outln = outln + "Tech Msg -> " + this.techMsg + "\n";alert(outln);} catch (e) {alert("JJS00049" + e);}};}function comShowParmList(list) {var showStr = "";var keys = list.getKeys();for (var parmPos=0; parmPos<keys.length; parmPos++) {showStr = showStr + keys[parmPos] + "=" + list.getParm(keys[parmPos]) + "\n";}alert(showStr);}function comParmList(parmListName) {this.parmListName = parmListName;var parmList = new Array();this.addParm = function(parmKey, parmValue) {for (var parmPos=0; parmPos<parmList.length; parmPos++) {if (parmList[parmPos][0] == parmKey) {parmList[parmPos][1] = parmValue;return;}}var parm = new Array(parmKey, parmValue);parmList.push(parm);};this.getParm = function(parmKey) {for (var parmPos=0; parmPos<parmList.length; parmPos++) {if (parmList[parmPos][0] == parmKey) return parmList[parmPos][1];}return null;};this.getLength = function() {return parmList.length;};this.getKeys = function() {var keys = new Array();for (var parmPos=0; parmPos<parmList.length; parmPos++) {keys.push(parmList[parmPos][0]);}return keys;};}function comSetCookie(name, value, expiredays) {try {var cookieStr = name + "=" + escape(value);if (expiredays > 0) {var expdate = new Date();expdate.setDate(expdate.getDate() + expiredays);cookieStr = cookieStr + ";expires=" + expdate.toGMTString();}document.cookie=cookieStr;} catch (e) {comExceptTrace("JJS00111 Unable to set cookie " + name + e);}}function comGetCookie(name) {try {if (document.cookie.length > 0) {var start = document.cookie.indexOf(name + "=");if (start!=-1) {start = start + name.length + 1;var end = document.cookie.indexOf(";", start);if (end == -1) end = document.cookie.length;return unescape(document.cookie.substring(start, end));}}return "";} catch (e) {comExceptTrace("JJS00112 Unable to get cookie " + name + e);return "";}}function comCheckCookie() {var subset=getCookie('subset');if (subset!=null && subset!="") {alert('Welcome again '+subset+'!');} else {subset=prompt('Please enter your subset:',"");if (subset!=null && subset!="") {setCookie('subset',subset,2);}}}function comReplaceAll(OldString,FindString,ReplaceString) {var SearchIndex = 0;var NewString = "";while (OldString.indexOf(FindString,SearchIndex) != -1)    {NewString += OldString.substring(SearchIndex,OldString.indexOf(FindString,SearchIndex));NewString += ReplaceString;SearchIndex = (OldString.indexOf(FindString,SearchIndex) + FindString.length);}NewString += OldString.substring(SearchIndex,OldString.length);return NewString;}function comTrim(trimVal) {var outVal = trimVal.replace(/^\s*/, "").replace(/\s*$/, "");return outVal;}function comPrint(printNodeID, printSheet) {var newwindow=window.open("",'Print','left=240, top=170, width=730, height=480, toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=yes, scrollbars=no');var existsNode = newwindow.document.getElementById("print");if (existsNode != null) {alert("Please print or cancel your prior print first.");newwindow.focus();return true;}var printNode = document.getElementById(printNodeID);var newhtml = "";newhtml = newhtml + "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">";newhtml = newhtml + "<html><head>";newhtml = newhtml + "<META http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">";newhtml = newhtml + "<title>PostEverywhere.com - Print Page</title>";newhtml = newhtml + "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"" + printSheet + "\">";newhtml = newhtml + "</head><body><div id=\"print\">";newhtml = newhtml + printNode.innerHTML;newhtml = newhtml + "</div></body></html>";newwindow.document.write(newhtml);newwindow.document.close();if (window.focus) {newwindow.focus();}newwindow.print();newwindow.close();return true;}function comPrintPreview(printNodeID, printSheet) {var newwindow=window.open("",'Print','left=240, top=170, width=700, height=480, toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=yes, scrollbars=yes');var existsNode = newwindow.document.getElementById("print");if (existsNode != null) {alert("Please print or cancel your prior print first.");newwindow.focus();return true;}var printNode = document.getElementById(printNodeID);var newhtml = "";newhtml = newhtml + "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">";newhtml = newhtml + "<html><head>";newhtml = newhtml + "<META http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">";newhtml = newhtml + "<title>PostEverywhere.com - Print Page</title>";newhtml = newhtml + "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"" + printSheet + "\">";newhtml = newhtml + "</head><body><div id=\"print\">";newhtml = newhtml + printNode.innerHTML;newhtml = newhtml + "</div></body></html>";newwindow.document.write(newhtml);newwindow.document.close();if (window.focus) {newwindow.focus();}return true;}function comPrintNodes(printNodeIDs, printSheet) {var newwindow=window.open("",'Print','left=240, top=170, width=730, height=480, toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=yes, scrollbars=no');var existsNode = newwindow.document.getElementById("print");if (existsNode != null) {alert("Please print or cancel your prior print first.");newwindow.focus();return true;}var newhtml = "";newhtml = newhtml + "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">";newhtml = newhtml + "<html><head>";newhtml = newhtml + "<META http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">";newhtml = newhtml + "<title>PostEverywhere.com - Print Page</title>";newhtml = newhtml + "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"" + printSheet + "\">";newhtml = newhtml + "</head><body><div id=\"print\">";for (var i=0; i<printNodeIDs.length; i++) {var printNode = document.getElementById(printNodeIDs[i]);if (printNode == null) {comExceptTrace("JJS00364 Unable to find print node: " + printNodeIDs[i]);continue;}newhtml = newhtml + printNode.innerHTML;}newhtml = newhtml + "</div></body></html>";newwindow.document.write(newhtml);newwindow.document.close();if (window.focus) {newwindow.focus();}newwindow.print();newwindow.close();return true;}function comKeyName(evt) {if (evt.keyCode == Event.KEY_BACKSPACE) return "KEY_BACKSPACE";if (evt.keyCode == Event.KEY_TAB) return "KEY_TAB";if (evt.keyCode == Event.KEY_RETURN) return "KEY_RETURN";if (evt.keyCode == Event.KEY_ESC) return "KEY_ESC";if (evt.keyCode == Event.KEY_LEFT) return "KEY_LEFT";if (evt.keyCode == Event.KEY_UP) return "KEY_UP";if (evt.keyCode == Event.KEY_RIGHT) return "KEY_RIGHT";if (evt.keyCode == Event.KEY_DOWN) return "KEY_DOWN";if (evt.keyCode == Event.KEY_DELETE) return "KEY_DELETE";if (evt.keyCode == Event.KEY_HOME) return "KEY_HOME";if (evt.keyCode == Event.KEY_END) return "KEY_END";if (evt.keyCode == Event.KEY_PAGEUP) return "KEY_PAGEUP";if (evt.keyCode == Event.KEY_PAGEDOWN) return "KEY_PAGEDOWN";if (!evt) evt = window.event;var code = evt.charCode || evt.keyCode;var c = String.fromCharCode(code);if (code == 27) return "ESC";if (code == 13) return "ENTER";if (code == 16) return "KEY_SHIFT";if (code == 17) return "KEY_CTRL";if (code == 18) return "KEY_ALT";if (code == 32) return "SPACE";return c;}function xxeDetermineEvent(evt) {if (!evt) return window.event;return evt;}function xxeGetEventID(xxeEvt) {var evtID = null;try {evtID = xxeEvt.srcElement.id;if (evtID != null && evtID.length > 0) return evtID;} catch (e) {evtID = null;}try {evtID = xxeEvt.target.id;if (evtID != null && evtID.length > 0) return evtID;} catch (e) {evtID = null;}return evtID;}function xxeFireOnScroll(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "onscroll", evt);}function xxeFireMouseDown(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "onmousedown", evt);}function xxeFireMouseOver(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "onmouseover", evt);}function xxeFireMouseUp(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "onmouseup", evt);}function xxeFireDblClick(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "ondblclick", evt);}function xxeFireDocKeyPress(evt) {return comWEQ.fireEvent("DOCUMENT", "DOCUMENT", "onkeypress", evt);}function xxeFireDocKeyDown(evt) {return comWEQ.fireEvent("DOCUMENT", "DOCUMENT", "onkeydown", evt);}function xxeFireDocMouseUp(evt) {return comWEQ.fireEvent("DOCUMENT", "DOCUMENT", "onmouseup", evt);}function xxeFireSelectStart(evt) {return comWEQ.fireEvent("DOCUMENT", "DOCUMENT", "selectstart", evt);}function xxeFireOnFocus(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "onfocus", evt);}function xxeFireKeyDown(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "onkeydown", evt);}function xxeFireKeyPress(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "onkeypress", evt);}function xxeFireKeyUp(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "onkeyup", evt);}function xxeFireOnChange(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "onchange", evt);}function xxeFireOnBlur(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "onblur", evt);}function xxeFireOnClick(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "onclick", evt);}function xxeFireButtonClick(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "buttonclick", evt);}function xxeFireRadioClick(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "radioclick", evt);}function xxeFireSelectChange(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "selectchange", evt);}function xxeFireTRMouseDown(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "trmousedown", evt);}function xxeFireTRMouseOver(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "trmouseover", evt);}function xxeFireTRMouseUp(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "trmouseup", evt);}function xxeFireTRMouseDblClick(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "trmousedblclick", evt);}function xxeFireSubMouseDown(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "submousedown", evt);}function xxeFireSubOnBlur(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "subsetonblur", evt);}function xxeFireTDInputOnFocus(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "tdinputonfocus", evt);}function xxeFireTDInputOnKeydown(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "tdinputonkeydown", evt);}function xxeFireTDInputOnKeypress(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "tdinputonkeypress", evt);}function xxeFireTDInputOnKeyup(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "tdinputonkeyup", evt);}function xxeFireTDInputOnChange(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "tdinputonchange", evt);}function xxeFireTDInputOnBlur(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "tdinputonblur", evt);}function xxeFireTrashMan(evt) {comWEQ.fireEvent("trashman", "trashman", "trashman", null);comWEQ.trashMan();comWEQ = null;document.onload = null;document.onunload = null;}var comWEQ = new comWinEventQueue();function comWinEventQueue() {var evtQ = new Array();this.listen = function(winID, compID, evtType, listenerID, listenerInst, listenerMeth) {for (var evtPos=0; evtPos<evtQ.length; evtPos++) {if (evtQ[evtPos][0] == winID && evtQ[evtPos][1] == compID && evtQ[evtPos][2] == evtType && evtQ[evtPos][3] == listenerID) return;}var listenEvt = new Array(winID, compID, evtType, listenerID, listenerInst, listenerMeth);evtQ.push(listenEvt);};this.listenFirst = function(winID, compID, evtType, listenerID, listenerInst, listenerMeth) {for (var evtPos=0; evtPos<evtQ.length; evtPos++) {if (evtQ[evtPos][0] == winID && evtQ[evtPos][1] == compID && evtQ[evtPos][2] == evtType && evtQ[evtPos][3] == listenerID) return;}var listenEvt = new Array(winID, compID, evtType, listenerID, listenerInst, listenerMeth);evtQ.unshift(listenEvt);};this.fireEvent = function(winIDin, compIDin, evtType, evt) {if (!evt) evt = window.event;var compID = compIDin;if (compID == "COMPID") compID = xxeGetEventID(evt);var winID = winIDin;if (winID == "COMPWINID") {var wp = compID.indexOf(".",0);if (wp < 0) {winID = compID;} else {winID = compID.slice(0,wp);}}if (winID == "WINID") {var workID = xxeGetEventID(evt);winID = workID.slice(0,workID.indexOf(".",0));}var propagate = false;var wildPos = -1;for (var evtPos=0; evtPos<evtQ.length; evtPos++) {if (evtQ[evtPos][0] != "*" && evtQ[evtPos][0] != winID) continue;if (evtQ[evtPos][2] != "*" && evtQ[evtPos][2] != evtType) continue;wildPos = evtQ[evtPos][1].indexOf("*");if (wildPos < 0 && evtQ[evtPos][1] != compID) continue;if (wildPos > 0) {if (compID.substr(0,wildPos) !=  evtQ[evtPos][1].substr(0,wildPos)) continue;}if (evtQ[evtPos][4] == null) {propagate = evtQ[evtPos][5](evt);if (propagate == false) {try {if (evt.stopPropagation) {evt.stopPropagation( );}  else {evt.cancelBubble = true;}if (evt.preventDefault) {evt.preventDefault( );} else {evt.returnValue = false;}} catch (evtexc) {comTrace("JJS01118 " + evtexc.message);}return false;}} else {propagate = evtQ[evtPos][5].call(evtQ[evtPos][4], evt);if (propagate == false) {try {if (evt.stopPropagation) {evt.stopPropagation( );}  else {evt.cancelBubble = true;}if (evt.preventDefault) {evt.preventDefault( );} else {evt.returnValue = false;}} catch (evtexc) {comTrace("JJS01119 " + evtexc.message);}return false;}}}return true;};this.trashMan = function() {for (var evtPos=0; evtPos<evtQ.length; evtPos++) {evtQ[evtPos][0] = null;evtQ[evtPos][1] = null;evtQ[evtPos][2] = null;evtQ[evtPos][3] = null;evtQ[evtPos][4] = null;evtQ[evtPos][5] = null;evtQ[evtPos]= null;}evtQ = null;};this.show = function() {var outln = "comWEQ size is: " + evtQ.length + "\n";for (var evtPos=0; evtPos<evtQ.length; evtPos++) {outln = outln + evtQ[evtPos][0] + " - " + evtQ[evtPos][1] + " - " + evtQ[evtPos][2] + " - " + evtQ[evtPos][3] + "\n";}comTrace(outln);};}var comEQ = new comEventQueue();function comEventQueue() {var evtQ = new Array();this.listen = function(winID, compID, evtType, listenerID, listenerInst, listenerMeth) {for (var evtPos=0; evtPos<evtQ.length; evtPos++) {if (evtQ[evtPos][0] == evtType && evtQ[evtPos][1] == evtHandle && evtQ[evtPos][2] == listenerID) return;}var listenEvt = new Array(winID, compID, evtType, listenerID, listenerInst, listenerMeth);evtQ.push(listenEvt);};this.fireEvent = function(winIDin, compIDin, evtType, evtobj) {var winID = winIDin;var compID = compIDin;for (var evtPos=0; evtPos<evtQ.length; evtPos++) {if ((evtQ[evtPos][0] == "*" || evtQ[evtPos][0] == winID) &&(evtQ[evtPos][1] == "*" || evtQ[evtPos][1] == compID) &&(evtQ[evtPos][2] == "*" || evtQ[evtPos][2] == evtType)) {if (evtQ[evtPos][4] == null) {var propagate = evtQ[evtPos][5](evtobj);if (propagate == false) return false;} else {var propagate = evtQ[evtPos][5].call(evtQ[evtPos][4], evtobj);if (propagate == false) return false;}}}return true;};this.show = function() {var outln = "";for (var evtPos=0; evtPos<evtQ.length; evtPos++) {outln = outln + evtQ[evtPos][0] + " - " + evtQ[evtPos][1] + " - " + evtQ[evtPos][2] + " - " + evtQ[evtPos][3] + "\n";}alert(outln);};}var xxAlert = null;function xxaltWinDef() {var winDef = new xxWinDefEdit("xxalt", "User Edit");winDef.addComp("xxalt.msg", "textfield", "data", "msg", null, "default", null);winDef.addComp("xxalt.OK", "button", "button", "", null, "default", xxaltOK);return winDef;}function xxaltDataDoc() {var doc = new xxDataDoc("MessageDO");doc.addField("msg", false, null, "str");return doc;}function xxAlertInit() {if (xxAlert != null) return;xxAlert = new xxForm("xxAlert", true);xxAlert.makeDraggable();var xxaltDef = xxaltWinDef();var xxaltDoc = xxaltDataDoc();xxaltDef.setDoc(xxaltDoc);xxAlert.addWinDef(xxaltDef);xxAlert.registerTriggers();xxAlert.registerListeners();}function xxAlertOnLoad() {xxAlertWinOpen(null);}function xxAlertOpen(openParms) {xxAlertInit();xxaltDoc = xxAlert.getWinDoc("xxalt");xxaltDoc.initOne();var msg = openParms.getParm("MSG");if (msg == null || msg.length < 1) {comTrace("JJS00854 xxAlertOpen did not receive a message");return;}xxaltDoc.setValue(0, "msg", msg);xxAlert.xwbDocs2Wins();xxAlert.showForm();}function xxaltOK() {xxAlert.hideForm();}function xxForm(formName, modal) {this.formName = formName;this.modal = modal;var winDefList = new Array();this.cmdReq = null;this.cmdResp = null;this.setModal = function(tfVal) {modal = tfVal;};this.isModal = function() {return modal;};this.addWinDef = function(winDef) {var winID = winDef.getWinID();for (var parmPos=0; parmPos<winDefList.length; parmPos++) {if (winDefList[parmPos][0] == winID) {winDefList[parmPos][1] = winDef;return;}}var parm = new Array(winID, winDef);winDefList.push(parm);winDef.setForm(this);};this.showWinDefList = function() {for (var parmPos=0; parmPos<winDefList.length; parmPos++) {alert(winDefList[parmPos][0]);}};this.getWinDef = function(winID) {for (var parmPos=0; parmPos<winDefList.length; parmPos++) {if (winDefList[parmPos][0] == winID) return winDefList[parmPos][1];}return null;};this.getWinDoc = function(winID) {for (var parmPos=0; parmPos<winDefList.length; parmPos++) {if (winDefList[parmPos][0] == winID) return winDefList[parmPos][1].getDoc();}return null;};this.getWinDefbyType = function(defType) {for (var parmPos=0; parmPos<winDefList.length; parmPos++) {if (winDefList[parmPos][1].getDefType() == defType) return winDefList[parmPos][1];}return null;};this.xwbDocs2Wins = function() {this.xwbDocs2Win();};this.xwbDocs2Win = function() {var winDef = null;for (var parmPos=0; parmPos<winDefList.length; parmPos++) {winDef = winDefList[parmPos][1];winDef.xwbDoc2Win();}};this.xwbWins2Docs = function() {var winDef = null;for (var parmPos=0; parmPos<winDefList.length; parmPos++) {winDef = winDefList[parmPos][1];winDef.xwbWin2Doc();}};this.registerTriggers = function() {var winDef = null;for (var parmPos=0; parmPos<winDefList.length; parmPos++) {winDef = winDefList[parmPos][1];winDef.registerTriggers();}};this.trashMan = function() {var winDef = null;for (var parmPos=0; parmPos<winDefList.length; parmPos++) {winDef = winDefList[parmPos][1];winDef.trashMan();winDef = null;}this.formName = null;this.modal = null;winDefList = null;this.cmdReq = null;this.cmdResp = null;};this.registerListeners = function() {var winDef = null;for (var parmPos=0; parmPos<winDefList.length; parmPos++) {winDef = winDefList[parmPos][1];winDef.registerListeners();}};this.showForm = function() {this.setFormResp(comApprovedResp("JJS00076", ""));var winDef = null;for (var parmPos=0; parmPos<winDefList.length; parmPos++) {winDef = winDefList[parmPos][1];winDef.clearWinEdits();}if (this.isModal()) setOn('modalWin');setOn(this.formName);};this.isShowing = function() {var node = document.getElementById(this.formName);if (node.className == 'on') return true;return false;};this.hideForm = function() {if (this.isModal()) setOff('modalWin');setOff(this.formName);comWEQ.fireEvent(this.formName, this.formName, "FormClose", this);};this.edit = function() {this.xwbWins2Docs();var winDef = null;var passedEdits = true;for (var parmPos=0; parmPos<winDefList.length; parmPos++) {winDef = winDefList[parmPos][1];if (!winDef.getDoc().editDoc()) passedEdits = false;winDef.applyWinEdits();}if (passedEdits) {this.setFormResp(comApprovedResp("JJS00138", ""));} else {this.setFormResp(comDeniedResp("JJS00139", "Please correct the errors and try again."));}return passedEdits;};this.clearEdits = function() {var winDef = null;for (var parmPos=0; parmPos<winDefList.length; parmPos++) {winDef = winDefList[parmPos][1];winDef.clearWinEdits();}this.setFormResp(comApprovedResp("JJS00140", ""));};this.setFormResp = function(editResp) {try {var respNode = document.getElementById(this.formName + ".RESPMSG");if (respNode != null && respNode != "undefined") {respNode.innerHTML = editResp.displayMsg;}} catch (e) {}};this.setFormRespServError = function(code, errorResp) {try {var msg = "Server error resp at js code " + code +  ". Service Response:\n" +"   status: " + errorResp.status + "\n" +"   action: " + errorResp.action + "\n" +"   code: " + errorResp.code + "\n" +"   techMsg: " + errorResp.techMsg + "\n" +"   displayMsg: " + errorResp.displayMsg;comExceptTrace(msg);if (errorResp.displayMsg.length < 1) {errorResp.displayMsg = "Error " + errorResp.code + ": Please try again or contact technical support. ";} else {errorResp.displayMsg = "Error " + errorResp.code + ": " + errorResp.displayMsg;}this.setFormResp(errorResp);} catch (e) {comExceptTrace("JJS00662 " + e);}};this.setFormRespException = function(code, exception) {try {var msg = "Server exception resp at js code " + code +  ". Exception: " + exception;comExceptTrace(msg);this.setFormResp(comDeniedResp(code, "Exception " + code + ": Please try again or contact technical support."));} catch (e) {comExceptTrace("JJS00663 " + e);}};this.makeDraggable = function(evt) {try {var dragMent = $($(this.formName + ".dragHandle"));dragMent.onmousedown = xxFormDrag;dragMent.setStyle({cursor: 'move'});} catch (e) {comExceptTrace("JJS00664 " + e);}};}var xxFormDragComp = null;function xxFormDrag(browseEvt) {try {if (xxFormDragComp != null) {xxFormDragComp.destroy();xxFormDragComp = null;}} catch (e) {}try {var evt = xxeDetermineEvent(browseEvt);var compID = xxeGetEventID(evt);var dragComp = compID.split(".")[0];var dragMent = $($(dragComp)).down();xxFormDragComp = new Draggable(dragMent, { revert: false, onEnd : xxFormDragEnd, snap : xxFormDragSnap});} catch (e) {comExceptTrace("JJS00665 " + e);}}function xxFormDragEnd() {xxFormDragComp.destroy();xxFormDragComp = null;}function xxFormDragSnap(x, y) {var retVal = new Array(x, y);xMin = -100;yMin = -40;if (x < xMin) retVal[0] = xMin;if (y < yMin) retVal[1] = yMin;return retVal;}function xxWinDef(winID, winName, winType) {this.winID = winID;this.winName = winName;this.winType = winType;var userDef = null;var formHandle = null;var metaDoc = new Array();var compIDx = 0;var compTypex = 1;var displayTypex = 2;var fieldNamex = 3;var formatterx = 4;var eventTypex = 5;var eventHandlerx = 6;var displayNamex = 7;var widthx = 8;var heightx = 9;var parmList = new Array();var dataDoc = null;this.setUserDef = function(uDef) {userDef = uDef;};this.getUserDef = function() {return userDef;};this.initUserDef = function(defaultUdefFunc) {userDef = new xxWinUserDef(this.winID);userDef.loadFromCookie();if (userDef.isLoaded()) return true;if (userDef.isLoaded()) return true;defaultUdefFunc(userDef);return true;};this.trashMan = function() {this.winID = null;this.winName = null;this.winType = null;userDef = null;formHandle = null;metaDoc = null;compIDx = null;compTypex = null;displayTypex = null;fieldNamex = null;formatterx = null;eventTypex = null;eventHandlerx = null;displayNamex = null;widthx = null;heightx = null;parmList = null;dataDoc = null;};this.setForm = function(form) {formHandle = form;};this.getForm = function() {return formHandle;};this.setDoc = function(doc) {dataDoc = doc;};this.getDoc = function() {return dataDoc;};this.getWinID = function() {if (this.winID == null) return "";return this.winID;};this.getWinName = function() {if (this.winName == null) return "";return this.winName;};this.getWinType = function() {if (this.winID == null) return "";return this.winType;};this.setModal = function(tfVal) {this.addParm("MODAL", tfVal);};this.isModal = function() {var modal = this.getParm("MODAL");if (modal == null) return false;return modal;};this.addComp = function(compID, compType, displayType, fieldName, formatter, eventType, eventHandler, displayName, width, height) {var row = new Array(compID, compType, displayType, fieldName, formatter, eventType, eventHandler, displayName, width, height);metaDoc.push(row);};this.removeComp = function(col) {metaDoc.splice(col,1);};this.getCompCount = function() {return metaDoc.length;};this.getCompID = function(col) {try {return metaDoc[col][compIDx];} catch (e) {throw("JJS00041" + this.getWinID() + " error getting component for column " + col);}};this.getDisplayName = function(col) {try {return metaDoc[col][displayNamex];} catch (e) {throw("JJS00546" + this.getWinID() + " error getting component for column " + col);}};this.getWidth = function(col) {try {return metaDoc[col][widthx];} catch (e) {throw("JJS00547" + this.getWinID() + " error getting component for column " + col);}};this.getHeight = function(col) {try {return metaDoc[col][heightx];} catch (e) {throw("JJS00548" + this.getWinID() + " error getting component for column " + col);}};this.getColbyCompID = function(compID) {for (var i=0; i<metaDoc.length; i++) {if (metaDoc[i][compIDx] == compID) return i;}return -1;};this.getColbyFieldName = function(fieldName) {for (var i=0; i<metaDoc.length; i++) {if (metaDoc[i][fieldNamex] == fieldName) return i;}return -1;};this.getCompType = function(col) {try {return metaDoc[col][compTypex];} catch (e) {throw("JJS00042" + this.getWinID() + " error getting component type for column " + col);}};this.getDisplayType = function(col) {try {return metaDoc[col][displayTypex];} catch (e) {throw("JJS00043" + this.getWinID() + " error getting component display type for column " + col);}};this.getFieldName = function(col) {try {return metaDoc[col][fieldNamex];} catch (e) {throw("JJS00044" + this.getWinID() + " error getting field name for column " + col);}};this.getFormatter = function(col) {try {return metaDoc[col][formatterx];} catch (e) {throw("JJS00045" + this.getWinID() + " error getting field formatter for column " + col);}};this.getEventType = function(col) {try {return metaDoc[col][eventTypex];} catch (e) {throw("JJS00046" + this.getWinID() + " error getting event type for column " + col);}};this.getEventHandler = function(col) {try {return metaDoc[col][eventHandlerx];} catch (e) {throw("JJS00047" + this.getWinID() + " error getting event handler for column " + col);}};this.show = function() {var out = winName + "\n";for (var i=0; i<metaDoc.length; i++) {out = out + metaDoc[i][compIDx] + " - " +metaDoc[i][compTypex] + " - " +metaDoc[i][displayTypex] + " - " +metaDoc[i][fieldNamex] + " - " +metaDoc[i][eventTypex]  + " - " +metaDoc[i][displayNamex] + " - " +metaDoc[i][widthx] + " - " +metaDoc[i][heightx] + "\n";}alert(out);};this.addParm = function(parmKey, parmValue) {for (var parmPos=0; parmPos<parmList.length; parmPos++) {if (parmList[parmPos][0] == parmKey) {parmList[parmPos][1] = parmValue;return;}}var parm = new Array(parmKey, parmValue);parmList.push(parm);};this.getParm = function(parmKey) {for (var parmPos=0; parmPos<parmList.length; parmPos++) {if (parmList[parmPos][0] == parmKey) return parmList[parmPos][1];}return null;};}function xxWinUserDef(wID) {var winID = wID;var userWinDoc = new xxDataDoc("UserWinDoc");userWinDoc.addField("winX", false, null, "int");userWinDoc.addField("winY", false, null, "int");userWinDoc.addField("winWidth", false, null, "int");userWinDoc.addField("winHeight", false, null, "int");userWinDoc.initOne();var userFldDoc = new xxDataDoc("UserDef");userFldDoc.addField("fieldName", false, null, "str");userFldDoc.addField("displayName", false, null, "str");userFldDoc.addField("fldX", false, null, "int");userFldDoc.addField("fldY", false, null, "int");userFldDoc.addField("fldWidth", true, null, "int");userFldDoc.addField("fldHeight", true, null, "int");var loaded = false;var windowSizer = null;this.copy = function() {var copyDef = new xxWinUserDef(winID);copyDef.setUserWinDoc(this.getUserWinDoc().copy());copyDef.setUserFldDoc(this.getUserFldDoc().copy());copyDef.setWinSizer(this.getWinSizer());copyDef.setLoaded(loaded);return copyDef;};this.showTrace = function() {comTrace("xxWinUserDef for " + winID + "\n");this.getUserWinDoc().showTrace();this.getUserFldDoc().showTrace();};this.isLoaded = function() {return loaded;};this.setLoaded = function(val) {loaded = val;};this.setWinSizer = function(sizerFunc) {windowSizer = sizerFunc;};this.getWinSizer = function() {return windowSizer;};this.getUserWinDoc = function() {return userWinDoc;};this.setUserWinDoc = function(doc) {userWinDoc = doc;};this.setWinX = function(val) {userWinDoc.setValue(0, "winX", val);};this.setWinY = function(val) {userWinDoc.setValue(0, "winY", val);};this.setWinWidth = function(val) {userWinDoc.setValue(0, "winWidth", val.toString());};this.getWinWidth = function() {return parseInt(userWinDoc.getValue(0, "winWidth"));};this.setWinHeight = function(val) {userWinDoc.setValue(0, "winHeight", val.toString());};this.getWinHeight = function() {return parseInt(userWinDoc.getValue(0, "winHeight"));};this.getUserFldDoc = function() {return userFldDoc;};this.setUserFldDoc = function(doc) {userFldDoc = doc;};this.addFldRow = function(fieldName, displayName, xPos, YPos, width, height) {userFldDoc.addRowData(new Array(fieldName, displayName, xPos, YPos, width, height));};this.insertFldRow = function(fieldName, displayName, xPos, YPos, width, height) {userFldDoc.insertRow(new Array(fieldName, displayName, xPos, YPos, width, height), 0);};this.loadFromCookie = function() {var cookData = comGetCookie("WinMeta");if (cookData == null || cookData.length < 1) return false;var winMetaList = cookData.split("^W");var winMetaRow = this.getCookMetaRow(winMetaList);if (winMetaRow < 0) return false;var winDefParts = winMetaList[winMetaRow].split("^D");userWinDoc.loadFromCookie(winDefParts[1]);userFldDoc.loadFromCookie(winDefParts[2]);loaded = true;return true;};this.saveToCookie = function() {var winDocCook = userWinDoc.getAsCookie();var fldDocCook = userFldDoc.getAsCookie();var metaCook = winID + "^D" + winDocCook + "^D" + fldDocCook;var winMetaList = null;var winMetaRow = -1;var newCookData = "";var cookData = comGetCookie("WinMeta");if (cookData == null || cookData.length < 1) {newCookData = metaCook;} else {winMetaList = cookData.split("^W");winMetaRow = this.getCookMetaRow(winMetaList);if (winMetaRow < 0) {newCookData = cookData + "^W" + metaCook;} else {winMetaList[winMetaRow] = metaCook;newCookData = winMetaList[0];for (var i=1; i<winMetaList.length; i++) {newCookData = newCookData + "^W" + winMetaList[i];}}}comSetCookie("WinMeta", newCookData, 365);};this.getCookMetaRow = function(winMetaList) {for (var i=0; i<winMetaList.length; i++) {if (winMetaList[i].indexOf(winID) == 0) return i;}return -1;};}function xxWinDefEdit(winID, winName) {var superDef = new xxWinDef(winID, winName, "EDIT");this.initDocFromWin = function(initKey) {var dataDoc = this.getDoc();var node = null;for (var col=0; col < dataDoc.getColCount(); col++) {node = document.getElementById(initKey + "." + dataDoc.getColName(col));if (node == null || node == "undefined") {dataDoc.setColValue(0, col, "");continue;}dataDoc.setColValue(0, col, node.value);}};this.xwbDoc2Win = function() {for (var compCol=0; compCol<this.getCompCount(); compCol++) {this.xwbDocField2Win(compCol);}};this.xwbDocField2Win = function(compCol) {var compID = this.getCompID(compCol);var displayType = this.getDisplayType(compCol);var compType = this.getCompType(compCol);var dataDoc = this.getDoc();var docVal = null;if (compType == "switch") {if (displayType == "showselected") {docVal = dataDoc.getValue(0,this.getFieldName(compCol));if (this.getFormatter(compCol) != null) {this.getFormatter(compCol)(compID, docVal);return;}var compVal = compID.split(".")[2];if (compVal == docVal) {setOn(compID);} else {setOff(compID);}return;}if (displayType == "hideempty") {docVal = dataDoc.getValue(0,this.getFieldName(compCol));if (this.getFormatter(compCol) != null) {this.getFormatter(compCol)(compID, docVal);return;}if (docVal == null || docVal.length < 1) {setOff(compID);} else {setOn(compID);}return;}if (displayType == "showempty") {docVal = dataDoc.getValue(0,this.getFieldName(compCol));if (this.getFormatter(compCol) != null) {this.getFormatter(compCol)(compID, docVal);return;}if (docVal == null || docVal.length < 1) {setOn(compID);} else {setOff(compID);}return;}return;}if (displayType != "data") return;if (this.getFormatter(compCol) != null) {docVal = this.getFormatter(compCol)(dataDoc, 0, dataDoc.getColPos(this.getFieldName(compCol)));} else {docVal = dataDoc.getValue(0,this.getFieldName(compCol));}if (compType == "radio") {if (docVal == null || docVal.length < 1) {var nodes = document.getElementsByName(compID);for (var i=0; i<nodes.length; i++) {nodes[i].checked = false;}return;}var node = document.getElementById(compID + "." + docVal);if (node == null || node == "undefined") {comExceptTrace("JJS00100 " + this.getWinName() + " missing component ID " + compID + "." + docVal);return;}node.checked = true;return;}if (compType == "select") {var node = document.getElementById(compID + "." + docVal);if (node != null) {node.selected = true;}return;}var node = document.getElementById(compID);if (node == null) {comExceptTrace("JJS00032 " + this.getWinName() + " missing component ID " + compID);return;}if (compType == "checkbox") {if (docVal == null || docVal.length < 1) docVal = "false";if (docVal == "true") {node.checked = true;} else {node.checked = false;}return;}if (node.nodeName == "INPUT") {node.value = docVal;return;}if (node.nodeName == "TEXTAREA") {node.value = docVal;node.innerHTML = docVal;return;}if (node.nodeName == "SPAN") {node.innerHTML = docVal;return;}if (node.nodeName == "SELECT") {var node = document.getElementById(this.getFieldName(compCol) + "." + docVal);if (node != null) {node.selected = true;}return;}if (node.nodeName == "B") {node.innerHTML = docVal;return;}};this.xwbWin2Doc = function() {try {for (col=0; col<this.getCompCount(); col++) {this.xwbComp2Doc(col);}} catch (e) {comExceptTrace("JJS01106 " + e);}};this.xwbComp2Doc = function(compPos) {try {var displayType = this.getDisplayType(compPos);if (displayType != "data") return false;var doc = this.getDoc();var compID = this.getCompID(compPos);var fieldName = this.getFieldName(compPos);var compType = this.getCompType(compPos);var node = null;var nodeVal = "";if (compType == "radio") {var nodes = document.getElementsByName(compID);for (var i=0; i<nodes.length; i++) {if (nodes[i].checked == true) {var parts = nodes[i].id.split(".");doc.setValue(0, fieldName, parts[2]);break;}}return true;}if (compType == "select") {node = document.getElementById(compID);if (node != null) {nodeVal = node.options[node.selectedIndex].value;doc.setValue(0, fieldName, nodeVal);doc.edit(0, doc.getColPos(fieldName));}return true;}node = document.getElementById(compID);if (node != null) {if (compType == "checkbox") {if (node.checked == true) {doc.setValue(0, fieldName, "true");} else {doc.setValue(0, fieldName, "false");}return true;}if (node.nodeName == "INPUT") {nodeVal = node.value;} else if (node.nodeName == "TEXTAREA") {nodeVal = node.value;} else if (node.nodeName == "SELECT") {nodeVal = node.options[node.selectedIndex].value;} else if (node.nodeName == "B") {nodeVal = node.innerHTML;} else if (node.nodeName == "SPAN") {nodeVal = node.innerHTML;}doc.setValue(0, fieldName, nodeVal);doc.edit(0, doc.getColPos(fieldName));return true;}return false;} catch (e) {comExceptTrace("JJS01107 " + e);return false;}};this.registerTriggers = function() {var node = null;var compType = null;var eventType = null;for (var col=0; col< this.getCompCount(); col++) {eventType = this.getEventType(col);if (eventType == "none") continue;compType = this.getCompType(col);if (compType == "displayfield") {node = document.getElementById(this.getCompID(col));if (node == null) {comExceptTrace("JJS01108 unable to obtain comp ID " + this.getCompID(col)); continue;}if (eventType == "default") {node.onfocus = xxeFireOnFocus;}continue;}if (compType == "textfield") {node = document.getElementById(this.getCompID(col));if (node == null) {comExceptTrace("JJS01109 unable to obtain comp ID " + this.getCompID(col)); continue;}if (eventType == "default") {node.onfocus = xxeFireOnFocus;node.onkeydown = xxeFireKeyDown;node.onkeypress = xxeFireKeyPress;node.onkeyup = xxeFireKeyUp;node.onchange = xxeFireOnChange;node.onblur = xxeFireOnBlur;}continue;}if (compType == "button" || compType == "switch") {node = document.getElementById(this.getCompID(col));if (node == null) {comExceptTrace("JJS01110 unable to obtain comp ID " + this.getCompID(col)); continue;}if (eventType == "default") {node.onclick = xxeFireButtonClick;node.onkeypress = xxeFireButtonClick;}continue;}if (compType == "radio") {if (eventType == "default") {var nodes = document.getElementsByName(this.getCompID(col));for (var i=0; i<nodes.length; i++) {nodes[i].checked = false;nodes[i].onclick = xxeFireRadioClick;}continue;}continue;}if (compType == "select") {if (eventType == "default") {node = document.getElementById(this.getCompID(col));if (node == null) {comExceptTrace("JJS01111 unable to obtain comp ID " + this.getCompID(col)); continue;}node.onchange = xxeFireSelectChange;continue;}continue;}}};this.registerListeners = function() {var winID = this.getWinID();var compID = null;var compType = null;var eventType = null;for (var col=0; col< this.getCompCount(); col++) {eventType = this.getEventType(col);if (eventType == "none") continue;compID = this.getCompID(col);compType = this.getCompType(col);if (compType == "displayfield") {if (eventType == "default") {comWEQ.listen(winID, compID, "onfocus", winID + "displayfieldonfocus", this, this.displayFieldOnFocus);}continue;}if (compType == "textfield") {if (eventType == "default") {comWEQ.listen(winID, compID, "onfocus", winID + "textfieldonfocus", this, this.onfocus);comWEQ.listen(winID, compID, "onkeypress", winID + "textfieldonkeypress", this, this.onkeypress);comWEQ.listen(winID, compID, "onchange", winID + "textfieldonchange", this, this.onchange);comWEQ.listen(winID, compID, "onblur", winID + "textfieldonblur", this, this.onblur);}continue;}if (compType == "button" || compType == "switch") {comWEQ.listen(winID, "*", "buttonclick", winID, this, this.buttonClick);continue;}if (compType == "radio") {comWEQ.listen(winID, "*", "radioclick", winID, this, this.radioClick);continue;}if (compType == "select") {if (eventType == "default") {comWEQ.listen(winID, compID, "selectchange", winID, this, this.selectChange);}continue;}}};this.trashMan = function() {var node = null;var compType = null;var eventType = null;for (var col=0; col< this.getCompCount(); col++) {eventType = this.getEventType(col);if (eventType == "none") continue;compType = this.getCompType(col);if (compType == "displayfield") {node = document.getElementById(this.getCompID(col));if (node == null) {comExceptTrace("JJS01112 unable to obtain comp ID " + this.getCompID(col)); continue;}node.onfocus = null;continue;}if (compType == "textfield") {node = document.getElementById(this.getCompID(col));if (node == null) {comExceptTrace("JJS01113 unable to obtain comp ID " + this.getCompID(col)); continue;}node.onfocus = null;node.onkeydown = null;node.onkeypress = null;node.onkeyup = null;node.onchange = null;node.onblur = null;continue;}if (compType == "button" || compType == "switch") {node = document.getElementById(this.getCompID(col));if (node == null) {comExceptTrace("JJS01114 unable to obtain comp ID " + this.getCompID(col)); continue;}node.onclick = null;node.onkeypress = null;continue;}if (compType == "radio") {if (eventType == "default") {var nodes = document.getElementsByName(this.getCompID(col));for (var i=0; i<nodes.length; i++) {nodes[i].onclick = null;}continue;}continue;}if (compType == "select") {if (eventType == "default") {node = document.getElementById(this.getCompID(col));if (node == null) {comExceptTrace("JJS01115 unable to obtain comp ID " + this.getCompID(col)); continue;}node.onchange = null;continue;}continue;}}node = null;compType = null;eventType = null;superDef.trashMan();};this.buttonClick = function(evt) {try {if (evt.type == "keypress") {var keyName = comKeyName(evt);if (keyName != "SPACE" && keyName != "ENTER") return true;}var compID = xxeGetEventID(evt);var compPos = this.getColbyCompID(compID);var node = document.getElementById(compID);this.cmdReq = node.name;this.getEventHandler(compPos)(evt);return false;} catch (e) {comSysError(comErrorResp("JJS00035", "buttonClick error " + e));return false;}};this.radioClick = function(evt) {try {if (evt.type == "keypress") {var keyName = comKeyName(evt);if (keyName != "SPACE" && keyName != "ENTER") return true;}var compID = xxeGetEventID(evt);var compParts = compID.split(".");compID = compParts[0] + "." + compParts[1];var compPos = this.getColbyCompID(compID);if (this.getEventHandler(compPos) == null) return true;return this.getEventHandler(compPos)(evt);} catch (e) {comSysError(comErrorResp("JJS00101", "radioClick error " + e.message));return false;}};this.selectChange = function(evt) {try {var compID = xxeGetEventID(evt);var compPos = this.getColbyCompID(compID);if (this.xwbComp2Doc(compPos)) {var docFieldName = this.getFieldName(compPos);var docFieldPos = this.getDoc().getColPos(docFieldName);var docField = this.getDoc().getColField(0, docFieldPos);if (docField.status == true) {this.xwbDocField2Win(compPos);this.getForm().setFormResp(comApprovedResp("JJS00431", ""));}}if (this.getEventHandler(compPos) != null) {return this.getEventHandler(compPos)(evt);}} catch (e) {comSysError(comErrorResp("JJS00426", "selectChange error " + e));return false;}};this.displayFieldOnFocus = function(evt) {try {if (!evt) evt = window.event;var compID = xxeGetEventID(evt);var compPos = this.getColbyCompID(compID);return this.getEventHandler(compPos)(evt);} catch (e) {comTrace(e)}};this.onfocus = function(evt) {try {var compID = xxeGetEventID(evt);var compPos = this.getColbyCompID(compID);var docFieldName = this.getFieldName(compPos);if (docFieldName == null || docFieldName.length < 1) {this.getForm().setFormResp(comApprovedResp("JJS00427", ""));return true;}var docField = this.getDoc().getField(0, docFieldName);if (docField.status == true) {this.getForm().setFormResp(comApprovedResp("JJS00428", ""));return true;}if (docField.msg == null || docField.msg.length < 1) {this.getForm().setFormResp(comApprovedResp("JJS00429", ""));return true;}this.getForm().setFormResp(comDeniedResp("JJS00430", docField.msg));return true;} catch (e) {comTrace("JJS01116 " + e)}};this.onchange = function(evt) {try {if (!evt) evt = window.event;var compID = xxeGetEventID(evt);var compPos = this.getColbyCompID(compID);this.xwbComp2Doc(compPos);var docFieldName = this.getFieldName(compPos);var docFieldPos = this.getDoc().getColPos(docFieldName);var docField = this.getDoc().getColField(0, docFieldPos);this.setFieldError(compID, docField);if (docField.status == true) {this.xwbDocField2Win(compPos);this.getForm().setFormResp(comApprovedResp("JJS00431", ""));}return true;} catch (e) {comTrace("JJS01117 " + e);}};this.onkeyup = function(evt) {var keyName = comKeyName(evt);return true;};this.onblur = function(evt) {if (!evt) evt = window.event;var compID = xxeGetEventID(evt);return true;};this.onkeydown = function(evt) {var keyName = comKeyName(evt);return true;};this.onkeypress = function(evt) {var keyName = comKeyName(evt);if (keyName == "KEY_ESC") {var compID = this.getParm("ESCKEY");if (compID == null) return false;var compPos = this.getColbyCompID(compID);var node = document.getElementById(compID);this.cmdReq = node.name;this.getEventHandler(compPos)(evt);return false;}if (keyName == "KEY_RETURN") {var compID = this.getParm("ENTERKEY");if (compID == null) return true;var compPos = this.getColbyCompID(compID);var node = document.getElementById(compID);this.cmdReq = node.name;this.getEventHandler(compPos)(evt);return false;}return true;};this.clearWinEdits = function() {var field = new xxDataDocField("");field.status = true;var fieldName = null;for (var col=0; col< this.getCompCount(); col++) {fieldName = this.getFieldName(col);if (fieldName == null || fieldName.length < 1) continue;this.setFieldError(this.getCompID(col), field);}};this.applyWinEdits = function() {var dataDoc = this.getDoc();var fieldName = null;for (var col=0; col< this.getCompCount(); col++) {fieldName = this.getFieldName(col);if (fieldName == null || fieldName.length < 1) continue;this.setFieldError(this.getCompID(col), dataDoc.getField(0,fieldName));}};this.applyFieldEdit = function(editFieldName) {this.xwbWin2Doc();var dataDoc = this.getDoc();var fieldName = null;for (var col=0; col< this.getCompCount(); col++) {fieldName = this.getFieldName(col);if (fieldName == null || fieldName.length < 1) continue;if (fieldName != editFieldName) continue;var docCol = dataDoc.getColPos(fieldName);if (!dataDoc.edit(0,docCol)) {this.setFieldError(this.getCompID(col), dataDoc.getColField(0, docCol));break;}}};this.setFieldError = function(compID, docField) {try {if (this.getCompType(this.getColbyCompID(compID)) == "radio") return;var cName = document.getElementById(compID).parentNode.className;cName = cName.toUpperCase();if (cName != "FIELDOK" && cName != "FIELDERROR") return;if (docField.status == true) {document.getElementById(compID).parentNode.className="fieldok";document.getElementById(compID).title = "";} else {document.getElementById(compID).parentNode.className="fielderror";document.getElementById(compID).title = docField.msg;}} catch (e) {comExceptTrace("JJS00102 setFieldError on comp " + compID + ": " + e);}};this.setWinResp = function(editResp) {try {var respNode = document.getElementById(this.getWinID() + ".RESPMSG");if (respNode != null && respNode != "undefined") {if (editResp.displayMsg.length < 1) {respNode.className="off";} else {respNode.className="feedback";}respNode.innerHTML = editResp.displayMsg;}} catch (e) {}};this.getWinID = function() {return superDef.getWinID();};this.getWinName = function() {return superDef.getWinName();};this.getWinType = function() {return superDef.getWinType();};this.getForm = function() {return superDef.getForm();};this.setForm = function(form) {return superDef.setForm(form);};this.getDoc = function() {return superDef.getDoc();};this.setDoc = function(doc) {return superDef.setDoc(doc);};this.setModal = function(tfVal) {return superDef.setModal(tfVal);};this.isModal = function() {return superDef.isModal();};this.addComp = function(compID, compType, displayType, fieldName, formatter, eventType, eventHandler) {return superDef.addComp(compID, compType, displayType, fieldName, formatter, eventType, eventHandler);};this.getCompCount = function() {return superDef.getCompCount();};this.getCompID = function(col) {return superDef.getCompID(col);};this.getColbyCompID = function(compID) {return superDef.getColbyCompID(compID);};this.getColbyFieldName = function(fieldName) {return superDef.getColbyFieldName(fieldName);};this.getCompType = function(col) {return superDef.getCompType(col);};this.getDisplayType = function(col) {return superDef.getDisplayType(col);};this.getFieldName = function(col) {return superDef.getFieldName(col);};this.getFormatter = function(col) {return superDef.getFormatter(col);};this.getEventType = function(col) {return superDef.getEventType(col);};this.getEventHandler = function(col) {return superDef.getEventHandler(col);};this.show = function() {return superDef.show();};this.addParm = function(parmKey, parmValue) {return superDef.addParm(parmKey, parmValue);};this.getParm = function(parmKey) {return superDef.getParm(parmKey);};}var xxwdm2eInputID = null;function xxWinDefMulti2Edit(winID, winName) {var superDef = new xxWinDef(winID, winName, "LIST");var initialized = false;var selMax = 0;var inputMent = null;var inputMode = false;var inputStartVal = "";var inputExit = "";var cursorMent = null;var clipContent = "";var tableHolderHMent = null;var tableHolderBMent = null;var tableHolderCoords = null;var activeCell = null;var selection = null;this.reInit = function() {initialized = false;};this.initTemplate = function() {if (initialized) return true;initialized = true;var uDef = this.getUserDef();var uDefFldDoc = uDef.getUserFldDoc();uDef.getWinSizer()(uDef.getWinWidth(), uDef.getWinHeight());if ($($(this.getWinID() + ".tr.HEADER")) != null) $($(this.getWinID() + ".tr.HEADER")).remove();var tabWidth = 0;for (var compCol=0; compCol<uDefFldDoc.getRowCount(); compCol++) {tabWidth = tabWidth + parseInt(uDefFldDoc.getValue(compCol,"fldWidth"));}$($(this.getWinID() +".TABLE")).setStyle({width: tabWidth + 'px'});var trDiv = new Element('tr', {'id': this.getWinID() + ".tr.HEADER"});var trbDiv = new Element('tr', {'id': this.getWinID() + ".trb.HEADER"});var fieldName = null;for (var compCol=0; compCol<uDefFldDoc.getRowCount(); compCol++) {var compWidth = parseInt(uDefFldDoc.getValue(compCol,"fldWidth"));fieldName = uDefFldDoc.getValue(compCol,"fieldName");var thbDiv = new Element('th', {'id': this.getWinID() + ".thb." + fieldName});thbDiv.setStyle({width: compWidth -1 + 'px'});trbDiv.appendChild(thbDiv);var thID = this.getWinID() + ".th." + fieldName;var thDiv = new Element('th', {'id': thID});thDiv.setStyle({width: compWidth -1 + 'px'});var spanID = this.getWinID() + ".thval." + fieldName;var spanMent = new Element('span', {'id': spanID});spanMent.update(uDefFldDoc.getValue(compCol,"displayName"));thDiv.appendChild(spanMent);trDiv.appendChild(thDiv);}var headerCompID = this.getWinID() + ".HEADERB";$($(headerCompID)).appendChild(trbDiv);var headerCompID = this.getWinID() + ".HEADER";$($(headerCompID)).appendChild(trDiv);return true;};this.xwbDoc2Win = function() {try {this.initTemplate();var tableMent = $($(this.getWinID() + ".TABLE"));var oldBodyMent = $($(this.getWinID() + ".BODY"));var newBodyMent = oldBodyMent.cloneNode(false);newBodyMent.onmousedown = xxeFireTRMouseDown;var dataDoc = this.getDoc();var fieldName = null;var uDef = this.getUserDef().getUserFldDoc();var udefXwdef = new Array();var udefXddef = new Array();for (var col=0; col < uDef.getRowCount(); col++) {fieldName = uDef.getValue(col, "fieldName");udefXwdef.push(this.getColbyFieldName(fieldName));udefXddef.push(dataDoc.getColPos(fieldName));}selMax = dataDoc.getRowCount();var trMent = null;var tdMent = null;var spanMent = null;var formatter = null;var trIDPart = this.getWinID() + ".tr.";var tdIDPart = this.getWinID() + ".td.";var spanIDPart = this.getWinID() + ".data.";var trShellMent = new Element('tr');for (var col=0; col < uDef.getRowCount(); col++) {tdMent = new Element('td', {'class': "unfocused"});spanMent = new Element('span');tdMent.appendChild(spanMent);trShellMent.appendChild(tdMent);}for (var row=0; row < dataDoc.getRowCount(); row++) {trMent = trShellMent.cloneNode(true);trMent.id = trIDPart + row;for (var col=0; col < uDef.getRowCount(); col++) {tdMent = trMent.childNodes[col];tdMent.id = tdIDPart + row + "." + col;spanMent = tdMent.childNodes[0];spanMent.id = spanIDPart + row + "." + col;formatter = this.getFormatter(udefXwdef[col]);if (formatter == null) {spanMent.innerHTML = dataDoc.getColValue(row, udefXddef[col]);} else {spanMent.innerHTML = formatter(dataDoc, row, udefXddef[col]);}}newBodyMent.appendChild(trMent);}oldBodyMent.onmousedown = null;tableMent.removeChild(oldBodyMent);tableMent.appendChild(newBodyMent);return;} catch (e) {comExceptionCatch("JJS00064", e);return;}};this.xwbDocField2Comp = function(row, compCol) {try {var dataDoc = this.getDoc();var docVal = null;var spanMent = $($(this.getWinID() + ".data." +  row + "." + compCol));var uDef = this.getUserDef().getUserFldDoc();var fieldName = uDef.getValue(compCol, "fieldName");var formatter = this.getFormatter(this.getColbyFieldName(fieldName));if (formatter == null) {docVal = dataDoc.getValue(row, fieldName);} else {docVal = formatter(dataDoc, row, dataDoc.getColPos(fieldName));}spanMent.update(docVal);} catch (e) {comExceptionCatch("JJS00064", e);return;}};this.xwbRow2Win = function(row) {try {var dataDoc = this.getDoc();var docVal = null;var fieldName = null;var formatter = null;var spanMent = null;var uDef = this.getUserDef().getUserFldDoc();for (var col=0; col < uDef.getRowCount(); col++) {fieldName = uDef.getValue(col, "fieldName");formatter = this.getFormatter(this.getColbyFieldName(fieldName));if (formatter == null) {docVal = dataDoc.getValue(row, fieldName);} else {docVal = formatter(dataDoc, row, dataDoc.getColPos(fieldName));}spanMent = $($(this.getWinID() + ".data." +  row + "." + col));spanMent.update(docVal);}return true;} catch (e) {comExceptionCatch("JJS00646", e);return true;}};this.xwbWin2Doc = function() {try {var dataDoc = this.getDoc();selMax = dataDoc.getRowCount();var uDef = this.getUserDef().getUserFldDoc();var udefXddef = new Array();for (var col=0; col < uDef.getRowCount(); col++) {var wdefRow = dataDoc.getColPos(uDef.getValue(col, "fieldName"));udefXddef.push(wdefRow);}var tableMent = document.getElementById(this.getWinID() + ".BODY");var tds = tableMent.getElementsByTagName("SPAN");var cellVal = null;var cellPos = 0;for (var row=0; row<selMax; row++) {for (var col=0; col < udefXddef.length; col++) {if (tds[cellPos].childNodes[0] != null) {cellVal = tds[cellPos].childNodes[0].nodeValue;} else {cellVal = "";}cellPos++;dataDoc.setColValue(row, udefXddef[col], cellVal);dataDoc.edit(row, udefXddef[col]);}}return true;} catch (e) {comExceptionCatch("JJS00647", e);return true;}};this.xwbComp2Doc = function(row, winCol, dataCol) {try {var spanMent = document.getElementById(this.getWinID() + ".data." + row.toString() + "." + winCol.toString());this.getDoc().setColValue(row, dataCol, spanMent.innerHTML);this.getDoc().edit(row, dataCol);return true;} catch (e) {comExceptTrace("JJS00648 " + e);return false;}};this.setFieldError = function(row, col, docField) {try {if (docField.status == true) {document.getElementById(this.getWinID() + ".td." + row.toString() + "." + col.toString()).className = "unfocused";} else {document.getElementById(this.getWinID() + ".td." + row.toString() + "." + col.toString()).className = "error";}} catch (e) {comExceptTrace("JJS00102 setFieldError: " + e);}};this.isRowEmpty = function(row) {var dataDoc = this.getDoc();var uDef = this.getUserDef().getUserFldDoc();var dataVal = null;for (var col=0; col < uDef.getRowCount(); col++) {dataVal = dataDoc.getValue(row, uDef.getValue(col, "fieldName"));if (dataVal.length > 0) return false;}return true;};this.applyWinEdits = function() {var dataDoc = this.getDoc();var uDef = this.getUserDef().getUserFldDoc();var udefXddef = new Array();for (var col=0; col < uDef.getRowCount(); col++) {var wdefRow = dataDoc.getColPos(uDef.getValue(col, "fieldName"));udefXddef.push(wdefRow);}var idBuffer = new Array(this.getWinID(), "td", 0, 0);var emptyField = new xxDataDocField("");emptyField.status = true;emptyField.msg = "";var emptyRow = false;for (var row=0; row<selMax; row++) {emptyRow = this.isRowEmpty(row);idBuffer[2] = row;for (var col=0; col < udefXddef.length; col++) {idBuffer[3] = col;if (emptyRow) {document.getElementById(this.getWinID() + ".td." + row.toString() + "." + col.toString()).className = "unfocused";} else {if (dataDoc.getColField(row, udefXddef[col]).status == true) {document.getElementById(this.getWinID() + ".td." + row.toString() + "." + col.toString()).className = "unfocused";} else {document.getElementById(this.getWinID() + ".td." + row.toString() + "." + col.toString()).className = "error";}}}}return;};this.edit = function() {var dataDoc = this.getDoc();var passedEdits = true;var emptyRow = false;var emptyField = null;for (var row=0; row<dataDoc.getRowCount(); row++) {emptyRow = this.isRowEmpty(row);for (var col=0; col < dataDoc.getColCount(); col++) {if (emptyRow) {emptyField = dataDoc.getColField(row, col);emptyField.value = "";emptyField.status = true;emptyField.msg = "";} else {if (!dataDoc.edit(row, col)) {passedEdits = false;}}}}return passedEdits;};this.registerTriggers = function() {if (cursorMent == null) cursorMent = $($(this.getWinID() + ".input"));cursorMent.onkeydown = xxeFireKeyDown;cursorMent.onkeypress = xxeFireKeyPress;cursorMent.onkeyup = xxeFireKeyUp;document.getElementById(this.getWinID() + ".TABLEHOLDERB").onscroll = xxeFireOnScroll;$($(this.getWinID() + ".inputshfttab")).onfocus = xxeFireOnFocus;$($(this.getWinID() + ".inputtab")).onfocus = xxeFireOnFocus;return true;};this.registerListeners = function() {var winID = this.getWinID();comWEQ.listen(winID, "*", "trmousedown", winID+"RowSelect", this, this.select);comWEQ.listen(winID, winID + ".input", "onkeydown", winID+"cursorkeydown", this, this.cursorkeydown);comWEQ.listen(winID, winID + ".input", "onkeypress", winID+"cursorkeypress", this, this.cursorkeypress);comWEQ.listen(winID, winID + ".input", "onkeyup", winID+"cursorkeyup", this, this.cursorkeyup);comWEQ.listen(winID, winID + ".inputshfttab", "onfocus", winID+"cursorkeyup", this, this.cursortab);comWEQ.listen(winID, winID + ".inputtab", "onfocus", winID+"cursorkeyup", this, this.cursortab);comWEQ.listen(winID, "*", "onscroll", winID+"onscroll", this, this.onscroll);comWEQ.listen(winID, "*", "tdinputstart", winID+"tdinputstart", this, this.inputstart);comWEQ.listen(winID, "*", "tdinputonfocus", winID+"inputfocus", this, this.inputfocus);comWEQ.listen(winID, "*", "tdinputonkeydown", winID+"inputkeydown", this, this.inputkeydown);comWEQ.listen(winID, "*", "tdinputonkeypress", winID+"inputkeypress", this, this.inputkeypress);comWEQ.listen(winID, "*", "tdinputonkeyup", winID+"inputkeyup", this, this.inputkeyup);comWEQ.listen(winID, "*", "tdinputonchange", winID+"inputchange", this, this.inputchange);comWEQ.listen(winID, "*", "tdinputonblur", winID+"inputblur", this, this.inputblur);};this.trashMan = function() {if (cursorMent != null) {cursorMent.onkeydown = null;cursorMent.onkeypress = null;cursorMent = null;}tableHolderHMent = null;tableHolderBMent = null;tableHolderCoords = null;if (inputMent != null) {inputMent.onfocus = null;inputMent.onkeydown = null;inputMent.onkeypress = null;inputMent.onkeyup = null;inputMent.onchange = null;inputMent.onblur = null;inputMent = null;}$($(this.getWinID() + ".BODY")).onmousedown = null;superDef.trashMan();};this.onscroll = function(evt) {try {var xpos = document.getElementById(this.getWinID() + ".TABLEHOLDERB").scrollLeft;document.getElementById(this.getWinID() + ".TABLEHOLDERH").scrollLeft = xpos;return true;} catch (e) {}};this.select = function(event) {try {var compID = xxeGetEventID(event);var compParts = compID.split(".");var compRow = parseInt(compParts[2]);var compCol = parseInt(compParts[3]);if (inputMode == true) {inputExit = compRow + "." + compCol;return true;}if (selection == null) {activeCell = new Array(compRow, compCol);this.setSelection(activeCell, activeCell);this.cursorFocus();return false;}if (event.shiftKey) {this.setSelection(activeCell, new Array(compRow, compCol));this.cursorFocus();return false;}activeCell = new Array(compRow, compCol);this.setSelection(activeCell, activeCell);this.cursorFocus();return false;} catch (e) {comTrace("JJS00649: " + e);comExceptionCatch("JJS00649", e);}};this.tableNav = function(direction) {if (activeCell == null) return false;var navRow = activeCell[0];var navCol = activeCell[1];if (direction == "RIGHT") {navCol = navCol + 1;var uDef = this.getUserDef().getUserFldDoc();if (navCol >= uDef.getRowCount()) navCol = 0;} else if (direction == "LEFT") {navCol = navCol - 1;if (navCol < 0) navCol = 0;} else if (direction == "UP") {navRow = navRow - 1;if (navRow < 0) navRow = 0;} else if (direction == "DOWN") {navRow = navRow + 1;if (navRow >= this.getDoc().getRowCount()) navRow = 0;} else if (direction == "CURRENT") {} else {return false;}activeCell = new Array(navRow, navCol);this.setSelection(activeCell, activeCell);return false;};this.cursorkeydown = function(evt) {var keyName = comKeyName(evt);if (inputMode == true) {if (keyName == "KEY_TAB") return false;return true;}if (activeCell == null) return true;if (evt.altKey) return true;if (keyName == "KEY_SHIFT") return true;if (keyName == "KEY_ESC") return true;if (keyName == "KEY_ALT") return true;if (keyName == "KEY_CTRL") return true;if (keyName == "KEY_TAB") {if (evt.shiftKey) {this.tableNav("LEFT");} else {this.tableNav("RIGHT");}return false;}if (keyName == "KEY_RIGHT") {if (evt.shiftKey) {this.changeSelection("RIGHT");} else {this.tableNav("RIGHT");}return false;}if (keyName == "KEY_LEFT") {if (evt.shiftKey) {this.changeSelection("LEFT");} else {this.tableNav("LEFT");}return false;}if (keyName == "KEY_UP") {if (evt.shiftKey) {this.changeSelection("UP");} else {this.tableNav("UP");}return false;}if (keyName == "KEY_DOWN") {if (evt.shiftKey) {this.changeSelection("DOWN");} else {this.tableNav("DOWN");}return false;}if (keyName == "KEY_HOME") {return false;}if (keyName == "KEY_END") {return false;}if (keyName == "KEY_PAGEUP") {return false;}if (keyName == "KEY_PAGEDOWN") {return false;}if (keyName == "KEY_RETURN") {this.setinputmode("INSERT");return false;}if (evt.ctrlKey) {if (keyName.toUpperCase() == "C") {dataMent = $($(this.getWinID() + ".data." + activeCell[0] + "." + activeCell[1]));clipContent = dataMent.innerHTML;return false;}if (keyName.toUpperCase() == "V") {dataMent = $($(this.getWinID() + ".data." + activeCell[0] + "." + activeCell[1]));dataMent.innerHTML = clipContent;var uDef = this.getUserDef();var uDefFldDoc = uDef.getUserFldDoc();var dataCol = this.getDoc().getColPos(uDefFldDoc.getValue(activeCell[1], "fieldName"));this.getDoc().setColValue(activeCell[0], dataCol, clipContent);return false;}return true;}return true;};this.cursortab = function(evt) {document.getElementById(this.getWinID() + '.input').focus();};this.cursorFocus = function() {xxwdm2eInputID = this.getWinID() + '.input';if (Prototype.Browser.IE) {setTimeout(function() {document.getElementById(xxwdm2eInputID).focus();}, 10);} else {document.getElementById(this.getWinID() + '.input').focus();}};this.cursorkeypress = function(evt) {var keyName = comKeyName(evt);if (inputMode == true) {if (keyName == "KEY_TAB") return false;return true;}if (keyName == "KEY_TAB") {return false;}if (keyName == "KEY_RETURN") {return false;}if (evt.ctrlKey) return true;if (evt.altKey) return true;if (!xxfldTypableChar(keyName)) return true;this.setinputmode(keyName);return false;};this.cursorkeyup = function(evt) {var keyName = comKeyName(evt);if (keyName == "KEY_TAB") {return false;}return true;};this.getSelectedRows = function() {var selectedRows = new Array();var trID = "";var wid = this.getWinID();for (var row=0; row<selMax; row++) {trID = wid + ".tr." + row;if (document.getElementById(trID).className == "selected") {selectedRows.push(row);}}return selectedRows;};this.getSelection = function() {return selection;};this.alternativeScrollIntoView = function(scrollParent, scrollChild) {try {if (tableHolderBMent == null) {tableHolderHMent = $($(this.getWinID() + ".TABLEHOLDERH"));tableHolderBMent = $($(this.getWinID() + ".TABLEHOLDERB"));var pWidth = tableHolderBMent.getWidth();var pHeight = tableHolderBMent.getHeight();var pOff = tableHolderBMent.viewportOffset();var pxStart = tableHolderBMent.scrollLeft + pOff[0];var pxEnd = pxStart + pWidth;var pyStart = tableHolderBMent.scrollTop + pOff[1];var pyEnd = pyStart + pHeight;tableHolderCoords = new Array(pxStart,pxEnd,pyStart,pyEnd);}var hScroll = tableHolderBMent.scrollLeft;var origHScroll = hScroll;var vScroll = tableHolderBMent.scrollTop;var origVScroll = vScroll;var vAdjust = 15;var child = document.getElementById(scrollChild);var cWidth = child.getWidth();var cHeight = child.getHeight();var cOff = child.viewportOffset();if (Prototype.Browser.IE) {cOff[1] += vScroll  || 0;cOff[0] += hScroll || 0;}if ((cOff[0] + cWidth) > tableHolderCoords[1]) {var rightDist = cOff[0] + cWidth - tableHolderCoords[1] + 1;hScroll = origHScroll + rightDist;}if (cOff[0] < tableHolderCoords[0]) {var leftDist = tableHolderCoords[0] - cOff[0];var newScrollPos = origHScroll - leftDist - 1;if (newScrollPos < 0) newScrollPos = 0;hScroll = newScrollPos;}if ((cOff[1] + cHeight) > (tableHolderCoords[3] - vAdjust)) {var downDist = cOff[1] + cHeight - (tableHolderCoords[3] - vAdjust) + 1;vScroll = origVScroll + downDist;}if (cOff[1] < tableHolderCoords[2]) {var upDist = tableHolderCoords[2] - cOff[1];var newScrollPos = origVScroll - upDist - 1;if (newScrollPos < 0) newScrollPos = 0;vScroll = newScrollPos;}if (vScroll > 0) {var a = cOff[1] + cHeight + vScroll;if (tableHolderCoords[3] - a > cHeight) {vScroll = 0;}}if (hScroll != origHScroll) {tableHolderBMent.scrollLeft = hScroll;tableHolderHMent.scrollLeft = hScroll;}if (vScroll != origVScroll) {tableHolderBMent.scrollTop = vScroll;}return;} catch (e) {comTrace("JPE01724 alternativeScrollIntoView error: " + e);return;}};this.setSelection = function(cellStart, cellEnd) {var winID = this.getWinID();var newRange = new xxRange(cellStart, cellEnd);var newRangeCoords = newRange.getRangeCoords();var idBuffer = new Array(winID, "td", 0, 0);if (selection != null) {var rangeCoords = selection.getRangeCoords();for (var row=rangeCoords[0]; row<=rangeCoords[2]; row++) {idBuffer[2] = row;for (var col=rangeCoords[1]; col<=rangeCoords[3]; col++) {if (row < newRangeCoords[0] || row > newRangeCoords[2] || col < newRangeCoords[1] || col > newRangeCoords[3]) {idBuffer[3] = col;try {document.getElementById(idBuffer.join(".")).className = "unfocused";} catch (e) {comTrace("buffer join error: " + e);}}}}}selection = newRange;for (var row=newRangeCoords[0]; row<=newRangeCoords[2]; row++) {idBuffer[2] = row;for (var col=newRangeCoords[1]; col<=newRangeCoords[3]; col++) {idBuffer[3] = col;try {document.getElementById(idBuffer.join(".")).className = "focused";} catch (e) {comTrace("buffer join error: " + e);}}}this.alternativeScrollIntoView(winID + ".TABLEHOLDERB",winID + ".td." + cellStart[0] + "." + cellStart[1]);try {if (cellStart[0] != cellEnd[0] || cellStart[1] != cellEnd[1]) return true;var uDef = this.getUserDef();var uDefFldDoc = uDef.getUserFldDoc();var docField = this.getDoc().getField(cellStart[0], uDefFldDoc.getValue(cellStart[1], "fieldName"));if (docField.status == true) {this.getForm().setFormResp(comApprovedResp("JJS00428", ""));return true;}if (docField.msg == null || docField.msg.length < 1) {this.getForm().setFormResp(comApprovedResp("JJS00429", ""));return true;}this.getForm().setFormResp(comDeniedResp("JJS00430", docField.msg));return true;} catch (e) {comTrace("buffer join error: " + e);return true;}};this.changeSelection = function(direction) {var rangeFrom = selection.getRangeFrom();var rangeTo = selection.getRangeTo();if (direction == "RIGHT") {rangeTo[1] = rangeTo[1] + 1;if (rangeTo[1] >= this.getCompCount()) rangeTo[1] = this.getCompCount() - 1;} else if (direction == "LEFT") {rangeTo[1] = rangeTo[1] - 1;if (rangeTo[1] < 0) rangeTo[1] = 0;} else if (direction == "UP") {rangeTo[0] = rangeTo[0] - 1;if (rangeTo[0] < 0) rangeTo[0] = 0;} else if (direction == "DOWN") {rangeTo[0] = rangeTo[0] + 1;if (rangeTo[0] >= this.getDoc().getRowCount()) rangeTo[0] = this.getDoc().getRowCount() - 1;} else {return false;}return this.setSelection(rangeFrom, rangeTo);};this.setinputmode = function(startVal) {var selWinID = this.getWinID();var selRow = activeCell[0];var selCol = activeCell[1];var uDef = this.getUserDef();var uDefFldDoc = uDef.getUserFldDoc();var compWidth = parseInt(uDefFldDoc.getValue(selCol,"fldWidth"));var spanMent = document.getElementById(selWinID + ".data." + selRow.toString() + "." + selCol.toString());var tdMent = document.getElementById(selWinID + ".td." + selRow.toString() + "." + selCol.toString());if (inputMent == null) {inputMent = new Element('input', {'type': 'text'});inputMent.onfocus = xxeFireTDInputOnFocus;inputMent.onkeydown = xxeFireTDInputOnKeydown;inputMent.onkeypress = xxeFireTDInputOnKeypress;inputMent.onkeyup = xxeFireTDInputOnKeyup;inputMent.onchange = xxeFireTDInputOnChange;inputMent.onblur = xxeFireTDInputOnBlur;}var tdInputID = selWinID + ".tdinput." + selCol.toString();inputMent.id = tdInputID;inputMent.value = spanMent.innerHTML;spanMent.className = "off";inputMent.setStyle({width: compWidth -1 + 'px'});tdMent.appendChild(inputMent);inputStartVal = startVal;inputMode = true;inputMent.focus();};this.inputstart = function(event) {inputMent.value = event;};this.inputfocus = function(event) {try {var selWinID = this.getWinID();var selCol = activeCell[1];var tdInputID = selWinID + ".tdinput." + selCol.toString();comWEQ.fireEvent(selWinID, tdInputID, "onfocus", event);if (inputStartVal != "INSERT") {inputMent.value = inputStartVal;}inputStartVal = "";} catch (e) {alert(e);}};this.inputkeydown = function(event) {try {var selWinID = this.getWinID();var selCol = activeCell[1];var tdInputID = selWinID + ".tdinput." + selCol.toString();comWEQ.fireEvent(selWinID, tdInputID, "onkeydown", event);} catch (e) {alert(e);}};this.inputkeypress = function(event) {try {var selWinID = this.getWinID();var selRow = activeCell[0];var selCol = activeCell[1];var tdInputID = selWinID + ".tdinput." + selCol.toString();comWEQ.fireEvent(selWinID, tdInputID, "onkeypress", event);var keyName = comKeyName(event);if (keyName == "KEY_ESC") {var spanMent = $($(selWinID + ".data." + selRow.toString() + "." + selCol.toString()));inputMent.value = spanMent.innerHTML;inputExit = "CURRENT";cursorMent.focus();return;}if (keyName == "KEY_RETURN") {inputExit = "DOWN";cursorMent.focus();return;}} catch (e) {alert(e);}};this.inputkeyup = function(event) {try {var selWinID = this.getWinID();var selCol = activeCell[1];var tdInputID = selWinID + ".tdinput." + selCol.toString();comWEQ.fireEvent(selWinID, tdInputID, "onkeyup", event);} catch (e) {alert(e);}};this.inputchange = function(event) {try {var selWinID = this.getWinID();var selCol = activeCell[1];var tdInputID = selWinID + ".tdinput." + selCol.toString();comWEQ.fireEvent(selWinID, tdInputID, "onchange", event);} catch (e) {alert(e);}};this.inputblur = function(event) {try {var compID = xxeGetEventID(event);var selParts = compID.split(".");var selWinID = selParts[0];var selRow = activeCell[0];var selCol = activeCell[1];var tdInputID = selWinID + ".tdinput." + selCol.toString();comWEQ.fireEvent(selWinID, tdInputID, "onblur", event);var spanID = selWinID + ".data." + selRow.toString() + "." + selCol.toString();var spanMent = $($(spanID));spanMent.update(inputMent.value);inputMent.remove();spanMent.className = "on";inputMode = false;if (inputExit == "CURRENT") {this.tableNav("CURRENT");} else if (inputExit == "DOWN") {this.tableNav("DOWN");} else if (inputExit.indexOf(".") > -1) {activeCell = inputExit.split(".");this.setSelection(activeCell, activeCell);} else {this.tableNav("RIGHT");}inputExit = "";var uDef = this.getUserDef();var uDefFldDoc = uDef.getUserFldDoc();var dataCol = this.getDoc().getColPos(uDefFldDoc.getValue(selCol, "fieldName"));this.getDoc().setColValue(selRow, dataCol, inputMent.value);this.getDoc().edit(selRow, dataCol);this.setFieldError(selRow, selCol, this.getDoc().getColField(selRow, dataCol));this.xwbDocField2Comp(selRow, selCol);cursorMent.focus();return false;} catch (e) {alert(e);}};this.addColumn = function(fieldName, displayName, widthParm) {this.reInit();this.xwbDoc2Win();return true;};this.moveColumn = function(fieldName, direction) {this.reInit();this.xwbDoc2Win();return true;};this.deleteColumn = function(fieldName, fieldCol) {this.reInit();this.xwbDoc2Win();return true;};this.setColumnWidth = function(fieldName, width) {var thID = this.getWinID() + ".th." + fieldName;var oldWidth = parseInt($($(thID)).getStyle('width'));var newWidth = parseInt(width);var dif = newWidth - oldWidth;var oldTable = parseInt($($(this.getWinID() +".TABLE")).getStyle('width'));var newTable = oldTable + dif;$($(this.getWinID() +".TABLE")).setStyle({width: newTable + 'px'});$($(thID)).setStyle({width: width + 'px'});};this.clearWinEdits = function() {return true;};this.getWinID = function() {return superDef.getWinID();};this.getWinName = function() {return superDef.getWinName();};this.getWinType = function() {return superDef.getWinType();};this.getForm = function() {return superDef.getForm();};this.setForm = function(form) {return superDef.setForm(form);};this.setUserDef = function(uDef) {return superDef.setUserDef(uDef);};this.getUserDef = function() {return superDef.getUserDef();};this.initUserDef = function(defaultUdefFunc) {return superDef.initUserDef(defaultUdefFunc);};this.getDoc = function() {return superDef.getDoc();};this.setDoc = function(doc) {return superDef.setDoc(doc);};this.setModal = function(tfVal) {return superDef.setModal(tfVal);};this.isModal = function() {return superDef.isModal();};this.addComp = function(compID, compType, displayType, fieldName, formatter, eventType, eventHandler, displayName, width, height) {return superDef.addComp(compID, compType, displayType, fieldName, formatter, eventType, eventHandler, displayName, width, height);};this.removeComp = function(col) {return superDef.removeComp(col);};this.getCompCount = function() {return superDef.getCompCount();};this.getCompID = function(col) {return superDef.getCompID(col);};this.getColbyCompID = function(compID) {return superDef.getColbyCompID(compID);};this.getColbyFieldName = function(fieldName) {return superDef.getColbyFieldName(fieldName);};this.getCompType = function(col) {return superDef.getCompType(col);};this.getDisplayType = function(col) {return superDef.getDisplayType(col);};this.getFieldName = function(col) {return superDef.getFieldName(col);};this.getFormatter = function(col) {return superDef.getFormatter(col);};this.getEventType = function(col) {return superDef.getEventType(col);};this.getEventHandler = function(col) {return superDef.getEventHandler(col);};this.show = function() {return superDef.show();};this.addParm = function(parmKey, parmValue) {return superDef.addParm(parmKey, parmValue);};this.getParm = function(parmKey) {return superDef.getParm(parmKey);};this.getDisplayName = function(col) {return superDef.getDisplayName(col);};this.getWidth = function(col) {return superDef.getWidth(col);};this.getHeight = function(col) {return superDef.getHeight(col);};}function xxRange(rangeCellFrom, rangeCellTo) {var rangeFrom = rangeCellFrom;var rangeTo = rangeCellTo;this.getRangeFrom = function() {return new Array(rangeFrom[0], rangeFrom[1]);};this.setRangeFrom = function(cell) {rangeFrom = cell;};this.getRangeTo = function() {return new Array(rangeTo[0], rangeTo[1]);};this.setRangeTo = function(cell) {rangeTo = cell;};this.isSingleSelection = function() {if (rangeFrom[0] == rangeTo[0] && rangeFrom[1] == rangeTo[1]) return true;return false;};this.getRangeCoords = function() {var rowStart = rangeFrom[0];var rowEnd = rangeTo[0];if (rangeFrom[0] > rangeTo[0]) {rowStart = rangeTo[0];rowEnd = rangeFrom[0];}var colStart = rangeFrom[1];var colEnd = rangeTo[1];if (rangeFrom[1] > rangeTo[1]) {colStart = rangeTo[1];colEnd = rangeFrom[1];}return new Array(rowStart, colStart, rowEnd, colEnd);};}function xxwdrulFireCMD(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "dataclick", evt);}function xxwdulFireSMD(evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "sortclick", evt);}function xxWinDefUL(winID, winName) {var superDef = new xxWinDef(winID, winName, "UL");var initialized = false;this.initTemplate = function() {if (initialized) return;initialized = true;};this.xwbDoc2Win = function() {try {this.initTemplate();var winID = this.getWinID();var dataDoc = this.getDoc();var ulHolder = document.getElementById(winID + ".ULHOLDER");var ulPlateOld = document.getElementById(winID + ".UL");var ulPlateNew = ulPlateOld.cloneNode(false);if (dataDoc.getRowCount() < 1) {var emptyRowDef = document.getElementById(this.getWinID() + ".EMPTYROWDEF");var emptyRow = emptyRowDef.cloneNode(true);emptyRow.id = winID + ".ROW.0";ulPlateNew.appendChild(emptyRow);ulHolder.removeChild(ulPlateOld);ulHolder.appendChild(ulPlateNew);return;}var templateRow = document.getElementById(this.getWinID() + ".ROWDEF");var rowPlate = null;for (var row=0; row < dataDoc.getRowCount(); row++) {rowPlate = templateRow.cloneNode(true);rowPlate.id = winID + ".ROW." + row;this.traverse(rowPlate, row);ulPlateNew.appendChild(rowPlate);}ulHolder.removeChild(ulPlateOld);ulHolder.appendChild(ulPlateNew);} catch (e) {comDefaultSysError("JJS00064", e);return;}};this.traverse = function(el, row) {if (el.id != null && el.id.indexOf(".REP.") > -1) {this.setElement(el, row);}for (var i=0; i < el.childNodes.length; i++) {this.traverse(el.childNodes[i], row);}};this.setElement = function(el, row) {var dataDoc = this.getDoc();var parts = el.id.split(".");var fieldName = parts[2];var winDefCol = this.getColbyCompID(parts[0] + "." + parts[2]);if (winDefCol < 0) {comTrace("SFW00312 missing windef for id: " + parts[0] + "." + parts[2]);return;}var fieldVal = "";var formatter = this.getFormatter(winDefCol);if (formatter == null) {fieldVal = dataDoc.getValue(row, fieldName);} else {fieldVal = formatter(dataDoc, row, dataDoc.getColPos(fieldName));}el.id = parts[0] + "." + parts[2] + "." + row;el.innerHTML = fieldVal;};this.clearWinEdits = function() {return true;};this.xwbWin2Doc = function() {return true;};this.registerTriggers = function() {return true;};this.registerListeners = function() {var winID = this.getWinID();comWEQ.listen(winID, "*", "dataclick", winID + "dataclick", this, this.dataClick);comWEQ.listen(winID, "*", "sortclick", winID + "sortclick", this, this.sortClick);return true;};this.trashMan = function() {superDef.trashMan();};this.dataClick = function(evt) {try {if (evt.type == "keypress") {var keyName = comKeyName(evt);if (keyName != "SPACE" && keyName != "ENTER") return true;}var compID = xxeGetEventID(evt);var compParts = compID.split(".");compID = compParts[0] + "." +  compParts[1];var compPos = this.getColbyCompID(compID);this.getEventHandler(compPos)(evt, compParts[2]);return false;} catch (e) {comSysError(comErrorResp("JJS00035", "buttonClick error " + e));return false;}};this.sortClick = function(evt) {try {var compID = xxeGetEventID(evt);var compParts = compID.split(".");var sortFields = this.getParm(compParts[2] + "Sort");this.getDoc().sort(sortFields);this.xwbDoc2Win();return false;} catch (e) {alert(e);}};this.applyWinEdits = function() {return true;};this.getWinID = function() {return superDef.getWinID();};this.getWinName = function() {return superDef.getWinName();};this.getWinType = function() {return superDef.getWinType();};this.getForm = function() {return superDef.getForm();};this.setForm = function(form) {return superDef.setForm(form);};this.getDoc = function() {return superDef.getDoc();};this.setDoc = function(doc) {return superDef.setDoc(doc);};this.setModal = function(tfVal) {return superDef.setModal(tfVal);};this.isModal = function() {return superDef.isModal();};this.addComp = function(compID, compType, displayType, fieldName, formatter, eventType, eventHandler) {return superDef.addComp(compID, compType, displayType, fieldName, formatter, eventType, eventHandler);};this.getCompCount = function() {return superDef.getCompCount();};this.getCompID = function(col) {return superDef.getCompID(col);};this.getColbyCompID = function(compID) {return superDef.getColbyCompID(compID);};this.getCompType = function(col) {return superDef.getCompType(col);};this.getDisplayType = function(col) {return superDef.getDisplayType(col);};this.getFieldName = function(col) {return superDef.getFieldName(col);};this.getFormatter = function(col) {return superDef.getFormatter(col);};this.getEventType = function(col) {return superDef.getEventType(col);};this.getEventHandler = function(col) {return superDef.getEventHandler(col);};this.show = function() {return superDef.show();};this.addParm = function(parmKey, parmValue) {return superDef.addParm(parmKey, parmValue);};this.getParm = function(parmKey) {return superDef.getParm(parmKey);};}function xxWinDefRepList(winID, winName) {var superDef = new xxWinDef(winID, winName, "REPLIST");var optionParms = null;var initialized = false;this.initTemplate = function() {if (initialized) return;initialized = true;var plateBody = null;var plateRow = null;var plateTD = null;optionParms = new Array();var plateSpanTxt = new Array();var tBody = document.getElementById(this.getWinID() + ".BODYDEF");plateBody = tBody.cloneNode(false);plateBody.id=this.getWinID() + ".LISTID";var tEmpty = document.getElementById(this.getWinID() + ".EMPTY");if (tEmpty != null) {tEmptyClone = tEmpty.cloneNode(true);this.addParm("TEMPLATEEMPTY", tEmptyClone);}var tRowList = tBody.getElementsByTagName("tr");if (tRowList == null || tRowList.length != 1) return comDefaultSysError("JJS00058", "List template requires one row tag");var tRow = tRowList[0];var tdNode = null;var spanNode = null;plateRow = tRow.cloneNode(false);var tdList = tRow.getElementsByTagName("td");if (tdList == null) return comDefaultSysError("JJS00059", "List template missing td tags");var templateFunc = this.getParm("TEMPLATEFUNC");if (templateFunc == null) throw "JPE01725 Missing template function";for (var col=0; col<tdList.length; col++) {tdNode = tdList[col];spanNode = tdNode.childNodes[0];plateTD = tdNode.cloneNode(false);spanTD = spanNode.cloneNode(false);plateTD.appendChild(spanTD);plateRow.appendChild(plateTD);var spanTxt = templateFunc(col);var tStart = spanTxt.search(/<COLTEMPLATE>/);if (tStart < 0) return comDefaultSysError("JJS00060", "List template missing COLTEMPLATE start tag");tStart = tStart + 13;var tEnd = spanTxt.search(/<\/COLTEMPLATE>/);if (tEnd < 0) return comDefaultSysError("JJS00061", "List template missing COLTEMPLATE end tag");var tTxt = spanTxt.substring(tStart,tEnd);var rx = new RegExp("  *","g");tTxt = tTxt.replace(rx, " ");tTxt = tTxt.replace(/\r/g, "\n");tTxt = tTxt.replace(/\n\n/g, "\n");tTxt = tTxt.replace(/\n\s/g, "\n");tTxt = tTxt.replace(/\s\n/g, "\n");tTxt = tTxt.replace(/\t/g, "");tTxt = tTxt.replace(/^\s*/, "").replace(/\s*$/, "");plateSpanTxt.push(tTxt);var tStart = spanTxt.search(/<OPTIONLIST>/);if (tStart > -1) {tStart = tStart + 12;tEnd = spanTxt.search(/<\/OPTIONLIST>/);if (tEnd < 0) return comDefaultSysError("JJS00062", "List template missing OPTIONLIST end tag");var optTxt = spanTxt.substring(tStart,tEnd);var rx = new RegExp("  *","g");optTxt = optTxt.replace(rx, " ");optTxt = optTxt.replace(/\r/g, "\n");optTxt = optTxt.replace(/\n\n/g, "\n");optTxt = optTxt.replace(/\n\s/g, "\n");optTxt = optTxt.replace(/\s\n/g, "\n");optTxt = optTxt.replace(/\t/g, "");optTxt = optTxt.replace(/^\s*/, "").replace(/\s*$/, "");var optionsArray = optTxt.split('\n');var oper = -1;for(var i = 0; i < optionsArray.length; i++) {var oper = optionsArray[i].indexOf("=",0);this.addOption(optionsArray[i].substring(0,oper), optionsArray[i].substring(oper+1));}}}this.addParm("TEMPLATEBODY", plateBody);this.addParm("TEMPLATEROW", plateRow);this.addParm("TEMPLATECOLINNER", plateSpanTxt);var repArray = new Array();var repColArray = null;var rep = null;var repCompID = null;var repDisplayType = null;var docCol = null;var docVal = null;var repXML = null;var dataDoc = this.getDoc();for (var tplCol=0; tplCol<plateSpanTxt.length; tplCol++) {repColArray = new Array();repXML = plateSpanTxt[tplCol];for (var defCol=0; defCol<this.getCompCount(); defCol++) {repCompID = this.getCompID(defCol);repDisplayType = this.getDisplayType(defCol);if (repDisplayType == "optionlist") {docCol = dataDoc.getColPos(this.getFieldName(defCol));rep = new Array(repCompID, "OPTIONLIST", docCol, defCol);repColArray.push(rep);for (var parmPos=0; parmPos<optionParms.length; parmPos++) {if (optionParms[parmPos][0].indexOf(repCompID + ".") > -1) {repXML = repXML + optionParms[parmPos][1];}}}if (repXML.indexOf(repCompID + ".COLID") > -1) {rep = new Array(repCompID, "COLID", tplCol, defCol);repColArray.push(rep);}if (repXML.indexOf(repCompID + ".VALUE") > -1) {docCol = dataDoc.getColPos(this.getFieldName(defCol));rep = new Array(repCompID, "VALUE", docCol, defCol);repColArray.push(rep);}}repArray.push(repColArray);}this.addParm("TEMPLATEREPARRAY", repArray);};this.addOption = function(parmKey, parmValue) {for (var parmPos=0; parmPos<optionParms.length; parmPos++) {if (optionParms[parmPos][0] == parmKey) {optionParms[parmPos][1] = parmValue;return;}}var parm = new Array(parmKey, parmValue);optionParms.push(parm);};this.getOption = function(parmKey) {for (var parmPos=0; parmPos<optionParms.length; parmPos++) {if (optionParms[parmPos][0] == parmKey) return optionParms[parmPos][1];}return null;};this.showOptions = function() {var showStr = "";for (var parmPos=0; parmPos<optionParms.length; parmPos++) {showStr = showStr + optionParms[parmPos][0] + "=" + optionParms[parmPos][1] + "\n";}comTrace(showStr);};this.xwbDoc2Win = function() {try {this.initTemplate();var templateBody = this.getParm("TEMPLATEBODY").cloneNode(false);var templateRow = this.getParm("TEMPLATEROW");var templateColInner = this.getParm("TEMPLATECOLINNER");var repArray = this.getParm("TEMPLATEREPARRAY");var dataDoc = this.getDoc();var docVal = null;var nRow = null;var nSpanNodes = null;var repHtml = null;var winID = this.getWinID();var formatter = null;if (dataDoc.getRowCount() < 1) {var templateEmpty = this.getParm("TEMPLATEEMPTY");if  (templateEmpty != null) {templateBody.appendChild(templateEmpty);var oldbody = document.getElementById(winID + ".LISTID");var tbl = document.getElementById(winID + ".TABLE");tbl.removeChild(oldbody);tbl.appendChild(templateBody);return;}}for (var row=0; row < dataDoc.getRowCount(); row++) {nRow = templateRow.cloneNode(true);nSpanNodes = nRow.getElementsByTagName("td");nRow.id = winID + "." + row;for (var tplCol=0; tplCol<templateColInner.length; tplCol++) {repHtml = templateColInner[tplCol];repColArray = repArray[tplCol];for (var repCol=0; repCol<repColArray.length; repCol++) {formatter = this.getFormatter(repColArray[repCol][3]);if (repColArray[repCol][1] == "VALUE") {if (formatter == null) {docVal = dataDoc.getColValue(row, repColArray[repCol][2]);} else {docVal = formatter(dataDoc, row, repColArray[repCol][2]);}repHtml = repHtml.replace(repColArray[repCol][0] + ".VALUE", docVal);} else if (repColArray[repCol][1] == "COLID") {repHtml = comReplaceAll(repHtml,repColArray[repCol][0] + ".COLID", repColArray[repCol][0] + "." + row + "." + tplCol);} else if (repColArray[repCol][1] == "OPTIONLIST") {if (formatter == null) {docVal = dataDoc.getColValue(row, repColArray[repCol][2]);} else {docVal = formatter(dataDoc, row, repColArray[repCol][2]);}var optStr = this.getOption(repColArray[repCol][0] + "." + docVal);if (optStr == null) optStr = "";repHtml = repHtml.replace(repColArray[repCol][0] + ".OPTIONLIST", optStr);}}nSpanNodes[tplCol].childNodes[0].innerHTML = repHtml;}templateBody.appendChild(nRow);}var oldbody = document.getElementById(winID + ".LISTID");var tbl = document.getElementById(winID + ".TABLE");tbl.removeChild(oldbody);tbl.appendChild(templateBody);} catch (e) {comDefaultSysError("JJS00064", e);return;}};this.xwbRow2Win = function(row) {try {this.initTemplate();var templateBody = this.getParm("TEMPLATEBODY");var templateRow = this.getParm("TEMPLATEROW");var templateColInner = this.getParm("TEMPLATECOLINNER");var repArray = this.getParm("TEMPLATEREPARRAY");var dataDoc = this.getDoc();var docVal = null;var nRow = null;var nSpanNodes = null;var repHtml = null;var winID = this.getWinID();nRow = templateRow.cloneNode(true);nSpanNodes = nRow.getElementsByTagName("td");nRow.id = winID + "." + row;for (var tplCol=0; tplCol<templateColInner.length; tplCol++) {repHtml = templateColInner[tplCol];repColArray = repArray[tplCol];for (var repCol=0; repCol<repColArray.length; repCol++) {if (repColArray[repCol][1] == "VALUE") {docVal = dataDoc.getColValue(row, repColArray[repCol][2]);repHtml = repHtml.replace(repColArray[repCol][0] + ".VALUE", docVal);} else if (repColArray[repCol][1] == "COLID") {repHtml = comReplaceAll(repHtml,repColArray[repCol][0] + ".COLID", repColArray[repCol][0] + "." + row + "." + tplCol);} else if (repColArray[repCol][1] == "OPTIONLIST") {docVal = dataDoc.getColValue(row, repColArray[repCol][2]);var optStr = this.getOption(repColArray[repCol][0] + "." + docVal);if (optStr == null) throw "JJS00063 Option not found for " + repColArray[repCol][0] + "." + docVal;repHtml = repHtml.replace(repColArray[repCol][0] + ".OPTIONLIST", optStr);}}nSpanNodes[tplCol].childNodes[0].innerHTML = repHtml;}var oldbody = document.getElementById(winID + ".LISTID");oldRow = document.getElementById(winID + "." + row);oldbody.replaceChild(nRow, oldRow);} catch (e) {comDefaultSysError("JJS00103", e);return;}};this.clearWinEdits = function() {return true;};this.xwbWin2Doc = function() {return true;};this.registerTriggers = function() {return true;};this.registerListeners = function() {return true;};this.trashMan = function() {superDef.trashMan();};this.applyWinEdits = function() {return true;};this.getWinID = function() {return superDef.getWinID();};this.getWinName = function() {return superDef.getWinName();};this.getWinType = function() {return superDef.getWinType();};this.getForm = function() {return superDef.getForm();};this.setForm = function(form) {return superDef.setForm(form);};this.getDoc = function() {return superDef.getDoc();};this.setDoc = function(doc) {return superDef.setDoc(doc);};this.setModal = function(tfVal) {return superDef.setModal(tfVal);};this.isModal = function() {return superDef.isModal();};this.addComp = function(compID, compType, displayType, fieldName, formatter, eventType, eventHandler) {return superDef.addComp(compID, compType, displayType, fieldName, formatter, eventType, eventHandler);};this.getCompCount = function() {return superDef.getCompCount();};this.getCompID = function(col) {return superDef.getCompID(col);};this.getColbyCompID = function(compID) {return superDef.getColbyCompID(compID);};this.getCompType = function(col) {return superDef.getCompType(col);};this.getDisplayType = function(col) {return superDef.getDisplayType(col);};this.getFieldName = function(col) {return superDef.getFieldName(col);};this.getFormatter = function(col) {return superDef.getFormatter(col);};this.getEventType = function(col) {return superDef.getEventType(col);};this.getEventHandler = function(col) {return superDef.getEventHandler(col);};this.show = function() {return superDef.show();};this.addParm = function(parmKey, parmValue) {return superDef.addParm(parmKey, parmValue);};this.getParm = function(parmKey) {return superDef.getParm(parmKey);};}function xxWinDefPageMeta(winID, winName, defType) {var superDef = new xxWinDefEdit(winID, winName, defType);this.getDoc = function() {var pageDoc = superDef.getDoc();if (pageDoc != null) return pageDoc;pageDoc = new xxDataDoc("PageDO");pageDoc.addField("pageCurrent", false, null);pageDoc.addField("pageTotal", false, null);pageDoc.addField("pageRecCount", false, null);pageDoc.addField("pageSize", false, null);pageDoc.addField("subset", false, null);pageDoc.addField("sort", false, null);pageDoc.initOne();pageDoc.setValue(0, "pageCurrent", "1");pageDoc.setValue(0, "pageTotal", "1");pageDoc.setValue(0, "pageRecCount", "-1");pageDoc.setValue(0, "pageSize", "500");pageDoc.setValue(0, "subset", "");pageDoc.setValue(0, "sort", "");superDef.setDoc(pageDoc);return pageDoc;};this.clearWinEdits = function() {return true;};this.xwbDoc2Win = function() {return superDef.xwbDoc2Win();};this.xwbWin2Doc = function() {return superDef.xwbWin2Doc();};this.registerTriggers = function() {return superDef.registerTriggers();};this.registerListeners = function() {return superDef.registerListeners();};this.trashMan = function() {superDef.trashMan();};this.getWinID = function() {return superDef.getWinID();};this.getWinName = function() {return superDef.getWinName();};this.getWinType = function() {return superDef.getWinType();};this.getForm = function() {return superDef.getForm();};this.setForm = function(form) {return superDef.setForm(form);};this.setDoc = function(doc) {return superDef.setDoc(doc);};this.setModal = function(tfVal) {return superDef.setModal(tfVal);};this.isModal = function() {return superDef.isModal();};this.addComp = function(compID, compType, displayType, fieldName, formatter, eventType, eventHandler) {return superDef.addComp(compID, compType, displayType, fieldName, formatter, eventType, eventHandler);};this.getCompCount = function() {return superDef.getCompCount();};this.getCompID = function(col) {return superDef.getCompID(col);};this.getColbyCompID = function(compID) {return superDef.getColbyCompID(compID);};this.getCompType = function(col) {return superDef.getCompType(col);};this.getDisplayType = function(col) {return superDef.getDisplayType(col);};this.getFieldName = function(col) {return superDef.getFieldName(col);};this.getFormatter = function(col) {return superDef.getFormatter(col);};this.getEventType = function(col) {return superDef.getEventType(col);};this.getEventHandler = function(col) {return superDef.getEventHandler(col);};this.show = function() {return superDef.show();};this.addParm = function(parmKey, parmValue) {return superDef.addParm(parmKey, parmValue);};this.getParm = function(parmKey) {return superDef.getParm(parmKey);};}function peSListWindowSizer(winID, nWidth, nHeight) {if (nWidth > -1) {var testWidth = nWidth + 18;$($(winID + '.TABLEHOLDER')).setStyle({width: testWidth + 'px'});$($(winID + '.TABLEHOLDERH')).setStyle({width: nWidth + 'px'});var cWidth = nWidth + 33;$($('content')).setStyle({width: cWidth + 'px'});}if (nHeight > -1) {$($(winID + '.TABLEHOLDER')).setStyle({height: nHeight + 'px'});var cHeight = nHeight + 161;$($('content')).setStyle({height: cHeight + 'px'});}}function xxWinDefSList(winID, winName) {var superDef = new xxWinDef(winID, winName, "LIST");var initialized = false;var selLast = "";var selLastIndex = "";var selTo = "";var selMax = 0;var subList = null;var mouseselecting = false;var emptyRow = null;this.reInit = function() {initialized = false;};this.initTemplate = function() {if (initialized) return true;initialized = true;var uDef = this.getUserDef();var uDefFldDoc = uDef.getUserFldDoc();uDef.getWinSizer()(this.getWinID(), uDef.getWinWidth(), uDef.getWinHeight());if ($($(this.getWinID() + ".tr.HEADER")) != null) $($(this.getWinID() + ".tr.HEADER")).remove();if ($($(this.getWinID() + "SUBROW")) != null) $($(this.getWinID() + "SUBROW")).remove();if (emptyRow == null) {emptyRow = $($(this.getWinID() + ".EMPTY")).remove();if (emptyRow != null) emptyRow.className = "empty";}var tabWidth = 0;var subWidth = 0;for (var compCol=0; compCol<uDefFldDoc.getRowCount(); compCol++) {tabWidth = tabWidth + parseInt(uDefFldDoc.getValue(compCol,"fldWidth"));subWidth = subWidth + parseInt(uDefFldDoc.getValue(compCol,"fldWidth") + 1);}$($(this.getWinID() +".TABLEH")).setStyle({width: tabWidth + 'px'});$($(this.getWinID() +".TABLE")).setStyle({width: tabWidth + 'px'});var fieldName = null;var trDiv = new Element('tr', {'id': this.getWinID() + ".tr.HEADER"});var trbDiv = new Element('tr', {'id': this.getWinID() + ".trb.HEADER"});var subrowMent = new Element('div', {'id': this.getWinID() + "SUBROW", 'class': 'subset'});subrowMent.setStyle({width: subWidth + 'px'});for (var compCol=0; compCol<uDefFldDoc.getRowCount(); compCol++) {var compWidth = parseInt(uDefFldDoc.getValue(compCol,"fldWidth"));fieldName = uDefFldDoc.getValue(compCol,"fieldName");var thbDiv = new Element('th', {'id': this.getWinID() + ".thb." + fieldName});thbDiv.setStyle({width: compWidth -1 + 'px'});trbDiv.appendChild(thbDiv);var thDiv = new Element('th', {'id': this.getWinID() + ".th." + fieldName});thDiv.setStyle({width: compWidth -1 + 'px'});var spanID = this.getWinID() + ".thval." + fieldName;var spanMent = new Element('span', {'id': spanID});spanMent.update(uDefFldDoc.getValue(compCol,"displayName"));spanMent.onmousedown = xxeFireMouseDown;thDiv.appendChild(spanMent);trDiv.appendChild(thDiv);var subinputMent = new Element('input', {'id': this.getWinID() + ".subin." + fieldName, 'type': 'text', 'class': 'hide'});subinputMent.setStyle({width: compWidth -3 + 'px'});subinputMent.onblur = xxeFireSubOnBlur;subrowMent.appendChild(subinputMent);}var headerCompID = this.getWinID() + ".HEADERB";$($(headerCompID)).appendChild(trbDiv);var headerCompID = this.getWinID() + ".HEADER";$($(headerCompID)).appendChild(trDiv);$($(this.getWinID() + ".SUBHOLDER")).appendChild(subrowMent);return true;};this.setColumnName = function(fieldName, displayName) {var spanID = this.getWinID() + ".thval." + fieldName;$($(spanID)).update(displayName);};this.setSortHeaders = function(pageDoc) {var sortFields = pageDoc.getValue(0, "sort").split(",");var uDef = this.getUserDef().getUserFldDoc();var sortMent = null;for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");var thID = this.getWinID() + ".th." + fieldName;var spanID = this.getWinID() + ".thval." + fieldName;var sortID = this.getWinID() + ".thsrt." + fieldName;sortMent = $($(sortID));if (sortMent != null) {sortMent.onmousedown = null;sortMent.remove();}for (var i=0; i<sortFields.length; i++) {if (sortFields[i].indexOf(fieldName) == 0) {if (sortFields[i].indexOf(" DESC") > -1) {sortMent = new Element('img', {'id': sortID, 'src': 'graphics/sortDesc.gif', 'width':'10', 'height':'12', 'alt':'Sort', 'title':'Sort'});} else {sortMent = new Element('img', {'id': sortID, 'src': 'graphics/sortAsc.gif', 'width':'10', 'height':'12', 'alt':'Sort', 'title':'Sort'});}sortMent.onmousedown = xxeFireMouseDown;$($(thID)).insertBefore(sortMent, $($(spanID)));}}}};this.addColumn = function(fieldName, displayName, widthParm) {this.reInit();this.xwbDoc2Win();return true;};this.moveColumn = function(fieldName, direction) {this.reInit();this.xwbDoc2Win();return true;};this.deleteColumn = function(fieldName, fieldCol) {this.reInit();this.xwbDoc2Win();return true;};this.setColumnWidth = function(fieldName, width) {var thID = this.getWinID() + ".th." + fieldName;var oldWidth = parseInt($($(thID)).getStyle('width'));var newWidth = parseInt(width);var dif = newWidth - oldWidth;var oldTable = parseInt($($(this.getWinID() +".TABLE")).getStyle('width'));var newTable = oldTable + dif;$($(this.getWinID() +".TABLEH")).setStyle({width: newTable + 'px'});$($(thID)).setStyle({width: width + 'px'});$($(this.getWinID() +".TABLE")).setStyle({width: newTable + 'px'});$($(this.getWinID() + ".thb." + fieldName)).setStyle({width: width + 'px'});$($(this.getWinID() + "SUBROW")).setStyle({width: newTable + 'px'});$($(this.getWinID() + ".subin." + fieldName)).setStyle({width: width -1 + 'px'});};this.xwbDoc2Win = function() {try {this.initTemplate();var tableMent = $($(this.getWinID() + ".TABLE"));var oldBodyMent = $($(this.getWinID() + ".BODY"));var newBodyMent = oldBodyMent.cloneNode(false);var trs = oldBodyMent.getElementsByTagName("TR");for (var i=0; i<trs.length; i++) {trs[i].onmousedown = null;trs[i].onmouseover = null;trs[i].onmouseup = null;trs[i].ondblclick = null;}var uDef = this.getUserDef().getUserFldDoc();var udefXwdef = new Array();for (var col=0; col < uDef.getRowCount(); col++) {var wdefRow = this.getColbyFieldName(uDef.getValue(col, "fieldName"));udefXwdef.push(wdefRow);}var dataDoc = this.getDoc();selMax = dataDoc.getRowCount();if (selMax < 1) {if (emptyRow != null) {if ($($(this.getWinID() + ".SUBHOLDER")).className == "off") {newBodyMent.appendChild(emptyRow);emptyRow.className = "empty";}}tableMent.removeChild(oldBodyMent);tableMent.appendChild(newBodyMent);return;}var trMent = null;var tdMent = null;var spanMent = null;var fieldName = null;var formatter = null;var docVal = null;for (var row=0; row < dataDoc.getRowCount(); row++) {trMent = new Element('tr', {'id': this.getWinID() + ".tr." + row});for (var col=0; col < uDef.getRowCount(); col++) {tdMent = new Element('td', {'id': this.getWinID() + ".td." + row + "." + col});spanMent = new Element('span', {'id': this.getWinID() + ".data." +  row + "." + col});fieldName = uDef.getValue(col, "fieldName");formatter = this.getFormatter(udefXwdef[col]);if (formatter == null) {docVal = dataDoc.getValue(row, fieldName);} else {docVal = formatter(dataDoc, row, dataDoc.getColPos(fieldName));}spanMent.update(docVal);tdMent.appendChild(spanMent);trMent.appendChild(tdMent);trMent.onmousedown = xxeFireTRMouseDown;trMent.onmouseover = xxeFireTRMouseOver;trMent.onmouseup = xxeFireTRMouseUp;trMent.ondblclick = xxeFireTRMouseDblClick;}newBodyMent.appendChild(trMent);}tableMent.removeChild(oldBodyMent);tableMent.appendChild(newBodyMent);trMent = null;tdMent = null;spanMent = null;oldBodyMent = null;newBodyMent = null;tableMent = null;this.reSelect();return;} catch (e) {comExceptionCatch("JJS00064", e);return;}};this.xwbRow2Win = function(row) {try {return true;} catch (e) {comExceptionCatch("JJS00715", e);return true;}};this.setSubsetOn = function() {var subHolder = $($(this.getWinID() + ".SUBHOLDER"));subHolder.className = "on";var uDef = this.getUserDef().getUserFldDoc();var subsetMent = null;for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");var thID = this.getWinID() + ".th." + fieldName;var subID = this.getWinID() + ".thsub." + fieldName;subsetMent = $($(subID));if (subsetMent != null) {subsetMent.onmousedown = null;subsetMent.remove();}subsetMent = new Element('img', {'id': subID, 'src': 'graphics/filter_handle.gif', 'width':'12', 'height':'16', 'alt':'Filter', 'title':'Filter'});subsetMent.onmousedown = xxeFireSubMouseDown;$($(thID)).insert({'top': subsetMent});}$($(this.getWinID() +".TABLEHOLDERH")).setStyle({height: '36px'});return true;};this.setSubsetOff = function() {$($(this.getWinID() +".TABLEHOLDERH")).setStyle({height: '18px'});var subHolder = $($(this.getWinID() + ".SUBHOLDER"));subHolder.className = "off";var uDef = this.getUserDef().getUserFldDoc();var subsetMent = null;for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");var subID = this.getWinID() + ".thsub." + fieldName;subsetMent = $($(subID));if (subsetMent != null) {subsetMent.onmousedown = null;subsetMent.remove();}}subList = null;this.setWinSubset();this.applySubset();return true;};this.getWinSubset = function() {var uDef = this.getUserDef().getUserFldDoc();var subinID = null;var subinMent = null;var subsetStr = "";var subColPos = -1;var subVal = null;subList = new Array();var listDoc = this.getDoc();var subDoc = listDoc.copyStructure();for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");subinID = this.getWinID() + ".subin." + fieldName;subinMent = $($(subinID));if (subinMent.className == 'on') {subColPos = listDoc.getColPos(fieldName);subVal = subinMent.value;if (listDoc.getValidator(subColPos) != null) {subDoc.setColValue(0, subColPos, subVal);listDoc.getValidator(subColPos)(subDoc, 0 , subColPos);subVal = subDoc.getColValue(0, subColPos);}subsetStr = subsetStr + "<" + fieldName + " operator=\"EQ\">" + subVal + "</" + fieldName + ">";subList.push(new Array(fieldName, subColPos, subVal, "EQ"));}}if (subList.length < 1) subList = null;var pageDef = this.getParm("PAGEDEF");var pageDoc = pageDef.getDoc();pageDoc.setValue(0, "subset", subsetStr);};this.setWinSubset = function() {var subinMent = null;var uDef = this.getUserDef().getUserFldDoc();for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");subinMent = $($(this.getWinID() + ".subin." + fieldName));if (subinMent.className == 'on') subinMent.className = "hide";subinMent.value = "";}if (subList == null || subList.length < 1) return true;for (var i=0; i<subList.length; i++) {subinMent = $($(this.getWinID() + ".subin." + subList[i][0]));subinMent.value = subList[i][2];subinMent.className = 'on';}return true;};this.applySubset = function() {if (!initialized) {this.xwbDoc2Win();return true;}this.getWinSubset();var pageDef = this.getParm("PAGEDEF");var pageDoc = pageDef.getDoc();var dssMode = pageDoc.getValue(0, "dssMode");if (dssMode == "LOCAL") {this.getDoc().setSubset(subList);this.xwbDoc2Win();return true;} else if (dssMode == "SERVER") {this.refresh();return true;} else {comDefaultSysError("JJS00716", "invalid dssMode " + dssMode);return false;}};this.refreshAttn = function() {try {var pageDef = this.getParm("PAGEDEF");var refreshID = pageDef.getParm("REFRESHID");var refreshMent = $($(refreshID));refreshMent.className = "attn";refreshMent.setStyle({'opacity': '1.0'});Effect.Pulsate(refreshMent, { pulses: 2, duration: 1.0 });} catch (e) {}};this.refresh = function() {try {var pageDef = this.getParm("PAGEDEF");pageDef.getParm("REFRESHFUNC")();} catch (e) {}};this.subset = function(event) {try {var compID = xxeGetEventID(event);var compParts = compID.split(".");var compWinID = compParts[0];var compType = compParts[1];var compField = compParts[2];subinID = this.getWinID() + ".subin." + compField;var subinMent = $($(subinID));if (subinMent.className == "on") {subinMent.className = "hide";subinMent.value = "";} else {subinMent.className = "on";if (selLast.length > 0) {var selParts = selLast.split(".");var selRow = parseInt(selParts[2]);var subVal = this.getDoc().getValue(selRow, compField);comTrace(compField);comTrace(this.getColbyFieldName(compField));comTrace(subVal);var formatter = this.getFormatter(this.getColbyFieldName(compField));if (formatter != null) {subVal = formatter(this.getDoc(), selRow, this.getDoc().getColPos(compField));comTrace(subVal);}subinMent.value = subVal;} else {this.getForm().setFormResp(comApprovedResp("JJS00717", "Tip: If you select a row before pressing the subset, the subset value will default to the rows value"));if (this.getDoc().getRowCount() > 0) {subinMent.value = this.getDoc().getValue(0, compField);} else {subinMent.value = "";}}}this.applySubset();return false;} catch (e) {comExceptTrace("JJS00718 " + e);}};this.subsetonblur = function(event) {try {var compID = xxeGetEventID(event);var compParts = compID.split(".");var compField = compParts[2];subinID = this.getWinID() + ".subin." + compField;var subinMent = $($(subinID));if (subinMent.className == "hide") return true;this.applySubset();return true;} catch (e) {comExceptTrace("JJS00719 " + e);}};this.trashMan = function() {document.onkeypress = null;document.onmouseup = null;try {document.onselectstart = null;} catch (e) {}var oldBodyMent = $($(this.getWinID() + ".BODY"));var trs = oldBodyMent.getElementsByTagName("TR");for (var i=0; i<trs.length; i++) {trs[i].onmousedown = null;trs[i].onmouseover = null;trs[i].onmouseup = null;trs[i].ondblclick = null;}trs = null;var uDef = this.getUserDef();var uDefFldDoc = uDef.getUserFldDoc();var fieldName = null;var thID = null;var workID = null;var workMent = null;for (var compCol=0; compCol<uDefFldDoc.getRowCount(); compCol++) {fieldName = uDefFldDoc.getValue(compCol,"fieldName");thID = this.getWinID() + ".th." + fieldName;workID = this.getWinID() + ".thval." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onmousedown = null;workID = this.getWinID() + ".thsrt." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onmousedown = null;workID = this.getWinID() + ".thsub." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onmousedown = null;workID = this.getWinID() + ".subin." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onblur = null;}oldBodyMent = null;workID = null;workMent = null;superDef.trashMan();superDef = null;initialized = null;selLast = null;selLastIndex = null;selTo = null;selMax = null;subList = null;mouseselecting = null;emptyRow = null;};this.registerTriggers = function() {document.onkeydown = xxeFireDocKeyDown;document.onmouseup = xxeFireDocMouseUp;document.getElementById(this.getWinID() + ".TABLEHOLDER").onscroll = xxeFireOnScroll;try {document.onselectstart = xxeFireSelectStart;} catch (e) {}return true;};this.registerListeners = function() {var winID = this.getWinID();comWEQ.listen(winID, "*", "onscroll", winID+"onscroll", this, this.onscroll);comWEQ.listen("DOCUMENT", "DOCUMENT", "selectstart", winID+"selectstart", this, this.selectstart);comWEQ.listen("DOCUMENT", "DOCUMENT", "onkeydown", winID+"dockeydown", this, this.docKeyDown);comWEQ.listen(winID, "*", "trmousedown", winID+"RowSelect", this, this.select);comWEQ.listen(winID, "*", "trmouseover", winID+"rowmouseover", this, this.rowmouseover);comWEQ.listen(winID, "*", "trmouseup", winID+"rowmouseup", this, this.rowmouseup);comWEQ.listen(winID, "*", "submousedown", winID+"SubsetClick", this, this.subset);comWEQ.listen(winID, "*", "subsetonblur", winID+"SubsetChange", this, this.subsetonblur);comWEQ.listen(winID, winID + ".thval.*", "onmousedown", winID+"SortClick1", this, this.sort);comWEQ.listen(winID, winID + ".thsrt.*", "onmousedown", winID+"SortClick2", this, this.sort);comWEQ.listen("DOCUMENT", "DOCUMENT", "onmouseup", winID+"onmouseup", this, this.rowmouseup);};this.onscroll = function(evt) {try {var xpos = document.getElementById(this.getWinID() + ".TABLEHOLDER").scrollLeft;document.getElementById(this.getWinID() + ".TABLEHOLDERH").scrollLeft = xpos;return true;} catch (e) {}};this.selectstart = function(evt) {try {var compParts = xxeGetEventID(evt).split(".");if (compParts[0] != this.getWinID()) return true;if (compParts[1] == "td" || compParts[1] == "data") return false;return true;} catch (e) {}};this.docKeyDown = function(evt) {try {var keyName = comKeyName(evt);if (evt.ctrlKey && keyName.toUpperCase() == "A") {return this.ctrlA(evt);}return true;} catch (e) {comExceptionCatch("JJS00720", e);}};this.ctrlA = function(evt) {try {var focNode = this.getElementWithFocus();if (focNode.nodeName.toUpperCase() == "INPUT") return true;var compWinID = this.getWinID();if (focNode.id == this.getWinID() + ".TABLEHOLDER") {for (var i=0; i<selMax; i++) {document.getElementById(compWinID + ".tr." +i).className="selected";}return false;}return false;} catch (e) {comExceptionCatch("JJS00721", e);}};this.getElementWithFocus = function() {var hf;if ( document.activeElement ) hf = document.activeElement;else hf = document.focusNode;return hf;};this.setSelectLast = function(selLastID) {if (selLastID == null || selLastID.length < 1) {selLast = "";selLastIndex = "";return;}var selParts = selLastID.split(".");var selRow = parseInt(selParts[2]);selLast = selLastID;selLastIndex = this.getDoc().getValue(selRow, "stampal");return;};this.reSelect = function() {if (selLast == null || selLast.length < 1) return;var selDocRow = this.getDoc().findRow(this.getDoc().getColPos("stampal"), selLastIndex);if (selDocRow > -1) {this.setSelectLast(this.getWinID() + ".tr." + selDocRow.toString());document.getElementById(selLast).className="selected";} else {this.setSelectLast("");}};this.select = function(evt) {try {$($(this.getWinID() + ".TABLEHOLDER")).focus();var compID = xxeGetEventID(evt);var compParts = compID.split(".");var compWinID = compParts[0];var compRow = parseInt(compParts[2]);var trID = compWinID + ".tr." + compRow.toString();var trMent = $($(trID));if (evt.ctrlKey==1) {if (trMent.className == "selected") {trMent.className="even";} else {trMent.className="selected";}this.setSelectLast(trID);return false;}if (evt.shiftKey==1) {if (selLast == "") {for (var i=0; i<=compRow; i++) {document.getElementById(compWinID + ".tr." +i.toString()).className="selected";}this.setSelectLast(trID);return false;}var selParts = selLast.split(".");var selRow = parseInt(selParts[2]);if (selRow < compRow) {for (var i=selRow; i<=compRow; i++) {document.getElementById(compWinID + ".tr." +i.toString()).className="selected";}this.setSelectLast(trID);return false;}return false;}var theClassName = "even";var oldBodyMent = $($(this.getWinID() + ".BODY"));var trs = oldBodyMent.getElementsByTagName("TR");for (var i=0; i<trs.length; i++) {trs[i].className = theClassName;}trMent.className="selected";this.setSelectLast(trID);selTo = compRow;mouseselecting = true;return false;} catch (e) {comExceptionCatch("JJS00722", e);}};this.rowmouseover = function(event) {if (!mouseselecting) return false;var compID = xxeGetEventID(event);var toRow = parseInt(compID.split(".")[2]);var startRow = parseInt(selLast.split(".")[2]);if (toRow == selTo) return false;var loopTo = toRow;if (selTo > toRow) loopTo = selTo;var preID = this.getWinID() + ".tr.";for (var i=startRow+1; i<=loopTo; i++) {if (i <= toRow) {document.getElementById(preID +i).className="selected";} else {document.getElementById(preID +i).className="even";}}selTo = toRow;return false;};this.rowmouseup = function(event) {mouseselecting = false;return false;};this.sort = function(event) {try {var compID = xxeGetEventID(event);var compParts = compID.split(".");var compWinID = compParts[0];var compType = compParts[1];var compField = compParts[2];var pageDef = this.getParm("PAGEDEF");if (pageDef == null) {comExceptTrace("JJS00723 windef " + this.getWinID() + " missing page definition");return true;}var pageDoc = pageDef.getDoc();var curSort = pageDoc.getValue(0, "sort");if (event.ctrlKey==1) {var curSortFields = curSort.split(",");var curSortPos = -1;if (curSort.length > 0) {for (var i=0 ;i<curSortFields.length; i++) {var curSortField = curSortFields[i].split(" ");if (curSortField[0] == compField) {curSortPos = i;break;}}}if (curSortPos < 0) {if (curSort.length < 1) {pageDoc.setValue(0, "sort", compField);} else {pageDoc.setValue(0, "sort", curSort + "," + compField);}} else {if (curSortFields[i].indexOf(" DESC") > -1) {curSortFields[i] = compField;} else {curSortFields[i] = compField + " DESC";}var newSort = curSortFields.toString();pageDoc.setValue(0, "sort", newSort);}} else {if (curSort.indexOf(",") > -1) {pageDoc.setValue(0, "sort", compField);} else {if (curSort.split(" ")[0] == compField) {if (curSort.indexOf(" DESC") > -1) {pageDoc.setValue(0, "sort", compField);} else {pageDoc.setValue(0, "sort", compField  + " DESC");}} else {pageDoc.setValue(0, "sort", compField);}}}this.setSortHeaders(pageDoc);if (pageDoc.getValue(0, "sort").split(",").length == 1) {this.getForm().setFormResp(comApprovedResp("JJS00724", "Tip: For multi sort, hold down the control key and click another column header"));} else {this.getForm().setFormResp(comApprovedResp("JJS00725", ""));}var dssMode = pageDoc.getValue(0, "dssMode");if (dssMode == "LOCAL") {this.getDoc().sort(pageDoc.getValue(0, "sort"));this.xwbDoc2Win();return false;} else if (dssMode == "SERVER") {try {this.refresh();} catch (e) {}return false;} else {comDefaultSysError("JJS00726", "invalid dssMode " + dssMode);return false;}} catch (e) {comExceptionCatch("JJS00727", "sort exception: " + e);}};this.getSelectedRows = function() {var selectedRows = new Array();var trID = "";var wid = this.getWinID();for (var row=0; row<selMax; row++) {trID = wid + ".tr." + row;if (document.getElementById(trID).className == "selected") {selectedRows.push(row);}}return selectedRows;};this.clearWinEdits = function() {return true;};this.xwbWin2Doc = function() {return true;};this.applyWinEdits = function() {return true;};this.getWinID = function() {return superDef.getWinID();};this.getWinName = function() {return superDef.getWinName();};this.getWinType = function() {return superDef.getWinType();};this.getForm = function() {return superDef.getForm();};this.setForm = function(form) {return superDef.setForm(form);};this.setUserDef = function(uDef) {return superDef.setUserDef(uDef);};this.getUserDef = function() {return superDef.getUserDef();};this.initUserDef = function(defaultUdefFunc) {return superDef.initUserDef(defaultUdefFunc);};this.getDoc = function() {return superDef.getDoc();};this.setDoc = function(doc) {return superDef.setDoc(doc);};this.setModal = function(tfVal) {return superDef.setModal(tfVal);};this.isModal = function() {return superDef.isModal();};this.addComp = function(compID, compType, displayType, fieldName, formatter, eventType, eventHandler, displayName, width, height) {return superDef.addComp(compID, compType, displayType, fieldName, formatter, eventType, eventHandler, displayName, width, height);};this.removeComp = function(col) {return superDef.removeComp(col);};this.getCompCount = function() {return superDef.getCompCount();};this.getCompID = function(col) {return superDef.getCompID(col);};this.getColbyCompID = function(compID) {return superDef.getColbyCompID(compID);};this.getColbyFieldName = function(fieldName) {return superDef.getColbyFieldName(fieldName);};this.getCompType = function(col) {return superDef.getCompType(col);};this.getDisplayType = function(col) {return superDef.getDisplayType(col);};this.getFieldName = function(col) {return superDef.getFieldName(col);};this.getFormatter = function(col) {return superDef.getFormatter(col);};this.getEventType = function(col) {return superDef.getEventType(col);};this.getEventHandler = function(col) {return superDef.getEventHandler(col);};this.show = function() {return superDef.show();};this.addParm = function(parmKey, parmValue) {return superDef.addParm(parmKey, parmValue);};this.getParm = function(parmKey) {return superDef.getParm(parmKey);};this.getDisplayName = function(col) {return superDef.getDisplayName(col);};this.getWidth = function(col) {return superDef.getWidth(col);};this.getHeight = function(col) {return superDef.getHeight(col);};}function xxWinDefSPage(listDef, winID, winName, refreshID, refreshFunc) {var superDef = new xxWinDefEdit(winID, winName, "PAGE");listDef.addParm("PAGEDEF", this);superDef.addParm("REFRESHID", refreshID);superDef.addParm("REFRESHFUNC", refreshFunc);this.getDoc = function() {var dataDoc = superDef.getDoc();if (dataDoc != null) return dataDoc;var dataDoc = new xxDataDoc("PageDO", "SINGLE");dataDoc.addField("pageCurrent", false, null);dataDoc.addField("pageTotal", false, null);dataDoc.addField("pageRecCount", false, null);dataDoc.addField("pageSize", false, null);dataDoc.addField("sort", false, null);dataDoc.addField("subset", false, null);dataDoc.addField("dssMode", false, null);dataDoc.addRow();dataDoc.setValue(0, "pageCurrent", "1");dataDoc.setValue(0, "pageTotal", "1");dataDoc.setValue(0, "pageRecCount", "-1");dataDoc.setValue(0, "pageSize", "200");dataDoc.setValue(0, "subset", "");dataDoc.setValue(0, "sort", "");dataDoc.setValue(0, "dssMode", "");superDef.setDoc(dataDoc);return dataDoc;};this.setSubsetFromArray = function(subList) {var subStr = "";var pageDoc = this.getDoc();if (subList == null || subList.length < 1) {pageDoc.setValue(0, "subset", subStr);return true;}for (var i=0; i<subList.length; i++) {subStr = subStr + "<" + subList[i][0] + " operator=\"EQ\">" + subList[i][2] + "</" + subList[i][0] + ">";}pageDoc.setValue(0, "subset", subStr);return true;};this.clearWinEdits = function() {return true;};this.xwbDoc2Win = function() {return superDef.xwbDoc2Win();};this.xwbWin2Doc = function() {return superDef.xwbWin2Doc();};this.registerTriggers = function() {return superDef.registerTriggers();};this.registerListeners = function() {return superDef.registerListeners();};this.trashMan = function() {superDef.trashMan();};this.applyWinEdits = function() {return true;};this.getWinID = function() {return superDef.getWinID();};this.getWinName = function() {return superDef.getWinName();};this.getWinType = function() {return superDef.getWinType();};this.getForm = function() {return superDef.getForm();};this.setForm = function(form) {return superDef.setForm(form);};this.setDoc = function(doc) {return superDef.setDoc(doc);};this.setModal = function(tfVal) {return superDef.setModal(tfVal);};this.isModal = function() {return superDef.isModal();};this.addComp = function(compID, compType, displayType, fieldName, formatter, eventType, eventHandler) {return superDef.addComp(compID, compType, displayType, fieldName, formatter, eventType, eventHandler);};this.removeComp = function(col) {return superDef.removeComp(col);};this.getCompCount = function() {return superDef.getCompCount();};this.getCompID = function(col) {return superDef.getCompID(col);};this.getColbyCompID = function(compID) {return superDef.getColbyCompID(compID);};this.getCompType = function(col) {return superDef.getCompType(col);};this.getDisplayType = function(col) {return superDef.getDisplayType(col);};this.getFieldName = function(col) {return superDef.getFieldName(col);};this.getFormatter = function(col) {return superDef.getFormatter(col);};this.getEventType = function(col) {return superDef.getEventType(col);};this.getEventHandler = function(col) {return superDef.getEventHandler(col);};this.show = function() {return superDef.show();};this.addParm = function(parmKey, parmValue) {return superDef.addParm(parmKey, parmValue);};this.getParm = function(parmKey) {return superDef.getParm(parmKey);};}function peVListWindowSizer(winID, nWidth, nHeight) {if (nWidth > -1) {var testWidth = nWidth + 18;$($(winID + '.TABLEHOLDER')).setStyle({width: testWidth + 'px'});$($(winID + '.TABLEHOLDERH')).setStyle({width: nWidth + 'px'});var cWidth = nWidth + 33;$($('content')).setStyle({width: cWidth + 'px'});}if (nHeight > -1) {$($(winID + '.TABLEHOLDER')).setStyle({height: nHeight + 'px'});var cHeight = nHeight + 161;$($('content')).setStyle({height: cHeight + 'px'});}}function xxWinDefVList(winID, winName) {var superDef = new xxWinDef(winID, winName, "LIST");var initialized = false;var selLast = "";var selLastIndex = "";var selTo = "";var selMax = 0;var subList = null;var mouseselecting = false;var emptyRow = null;this.reInit = function() {initialized = false;};this.initTemplate = function() {if (initialized) return true;initialized = true;var uDef = this.getUserDef();var uDefFldDoc = uDef.getUserFldDoc();uDef.getWinSizer()(this.getWinID(), uDef.getWinWidth(), uDef.getWinHeight());if ($($(this.getWinID() + ".tr.HEADER")) != null) $($(this.getWinID() + ".tr.HEADER")).remove();if ($($(this.getWinID() + "SUBROW")) != null) $($(this.getWinID() + "SUBROW")).remove();if (emptyRow == null) {emptyRow = $($(this.getWinID() + ".EMPTY")).remove();if (emptyRow != null) emptyRow.className = "empty";}var tabWidth = 0;var subWidth = 0;for (var compCol=0; compCol<uDefFldDoc.getRowCount(); compCol++) {tabWidth = tabWidth + parseInt(uDefFldDoc.getValue(compCol,"fldWidth"));subWidth = subWidth + parseInt(uDefFldDoc.getValue(compCol,"fldWidth") + 1);}$($(this.getWinID() +".TABLEH")).setStyle({width: tabWidth + 'px'});$($(this.getWinID() +".TABLE")).setStyle({width: tabWidth + 'px'});var fieldName = null;var trDiv = new Element('tr', {'id': this.getWinID() + ".tr.HEADER"});var trbDiv = new Element('tr', {'id': this.getWinID() + ".trb.HEADER"});var subrowMent = new Element('div', {'id': this.getWinID() + "SUBROW", 'class': 'subset'});subrowMent.setStyle({width: subWidth + 'px'});for (var compCol=0; compCol<uDefFldDoc.getRowCount(); compCol++) {var compWidth = parseInt(uDefFldDoc.getValue(compCol,"fldWidth"));fieldName = uDefFldDoc.getValue(compCol,"fieldName");var thbDiv = new Element('th', {'id': this.getWinID() + ".thb." + fieldName});thbDiv.setStyle({width: compWidth -1 + 'px'});trbDiv.appendChild(thbDiv);var thDiv = new Element('th', {'id': this.getWinID() + ".th." + fieldName});thDiv.setStyle({width: compWidth -1 + 'px'});var spanID = this.getWinID() + ".thval." + fieldName;var spanMent = new Element('span', {'id': spanID});spanMent.update(uDefFldDoc.getValue(compCol,"displayName"));spanMent.onmousedown = xxeFireMouseDown;thDiv.appendChild(spanMent);trDiv.appendChild(thDiv);var subinputMent = new Element('input', {'id': this.getWinID() + ".subin." + fieldName, 'type': 'text', 'class': 'hide'});subinputMent.setStyle({width: compWidth -3 + 'px'});subinputMent.onblur = xxeFireSubOnBlur;subrowMent.appendChild(subinputMent);}var headerCompID = this.getWinID() + ".HEADERB";$($(headerCompID)).appendChild(trbDiv);var headerCompID = this.getWinID() + ".HEADER";$($(headerCompID)).appendChild(trDiv);$($(this.getWinID() + ".SUBHOLDER")).appendChild(subrowMent);return true;};this.setColumnName = function(fieldName, displayName) {var spanID = this.getWinID() + ".thval." + fieldName;$($(spanID)).update(displayName);};this.setSortHeaders = function(pageDoc) {var sortFields = pageDoc.getValue(0, "sort").split(",");var uDef = this.getUserDef().getUserFldDoc();var sortMent = null;for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");var thID = this.getWinID() + ".th." + fieldName;var spanID = this.getWinID() + ".thval." + fieldName;var sortID = this.getWinID() + ".thsrt." + fieldName;sortMent = $($(sortID));if (sortMent != null) {sortMent.onmousedown = null;sortMent.remove();}for (var i=0; i<sortFields.length; i++) {if (sortFields[i].indexOf(fieldName) == 0) {if (sortFields[i].indexOf(" DESC") > -1) {sortMent = new Element('img', {'id': sortID, 'src': 'graphics/sortDesc.gif', 'width':'10', 'height':'12', 'alt':'Sort', 'title':'Sort'});} else {sortMent = new Element('img', {'id': sortID, 'src': 'graphics/sortAsc.gif', 'width':'10', 'height':'12', 'alt':'Sort', 'title':'Sort'});}sortMent.onmousedown = xxeFireMouseDown;$($(thID)).insertBefore(sortMent, $($(spanID)));}}}};this.addColumn = function(fieldName, displayName, widthParm) {this.reInit();this.xwbDoc2Win();return true;};this.moveColumn = function(fieldName, direction) {this.reInit();this.xwbDoc2Win();return true;};this.deleteColumn = function(fieldName, fieldCol) {this.reInit();this.xwbDoc2Win();return true;};this.setColumnWidth = function(fieldName, width) {var thID = this.getWinID() + ".th." + fieldName;var oldWidth = parseInt($($(thID)).getStyle('width'));var newWidth = parseInt(width);var dif = newWidth - oldWidth;var oldTable = parseInt($($(this.getWinID() +".TABLE")).getStyle('width'));var newTable = oldTable + dif;$($(this.getWinID() +".TABLE")).setStyle({width: newTable + 'px'});$($(thID)).setStyle({width: width + 'px'});$($(this.getWinID() + "SUBROW")).setStyle({width: newTable + 'px'});$($(this.getWinID() + ".subin." + fieldName)).setStyle({width: width -1 + 'px'});};this.xwbDoc2Win = function() {try {this.initTemplate();var tableMent = $($(this.getWinID() + ".TABLE"));var oldBodyMent = $($(this.getWinID() + ".BODY"));var newBodyMent = oldBodyMent.cloneNode(false);var trs = oldBodyMent.getElementsByTagName("TR");for (var i=0; i<trs.length; i++) {trs[i].onmousedown = null;trs[i].onmouseover = null;trs[i].onmouseup = null;trs[i].ondblclick = null;}var uDef = this.getUserDef().getUserFldDoc();var udefXwdef = new Array();for (var col=0; col < uDef.getRowCount(); col++) {var wdefRow = this.getColbyFieldName(uDef.getValue(col, "fieldName"));udefXwdef.push(wdefRow);}var dataDoc = this.getDoc();selMax = dataDoc.getRowCount();if (selMax < 1) {if (emptyRow != null) {if ($($(this.getWinID() + ".SUBHOLDER")).className == "off") {newBodyMent.appendChild(emptyRow);emptyRow.className = "empty";}}tableMent.removeChild(oldBodyMent);tableMent.appendChild(newBodyMent);return;}var trMent = null;var tdMent = null;var spanMent = null;var fieldName = null;var formatter = null;var docVal = null;for (var row=0; row < dataDoc.getRowCount(); row++) {trMent = new Element('tr', {'id': this.getWinID() + ".tr." + row});for (var col=0; col < uDef.getRowCount(); col++) {tdMent = new Element('td', {'id': this.getWinID() + ".td." + row + "." + col});spanMent = new Element('span', {'id': this.getWinID() + ".data." +  row + "." + col});fieldName = uDef.getValue(col, "fieldName");formatter = this.getFormatter(udefXwdef[col]);if (formatter == null) {docVal = dataDoc.getValue(row, fieldName);} else {docVal = formatter(dataDoc, row, dataDoc.getColPos(fieldName));}spanMent.update(docVal);tdMent.appendChild(spanMent);trMent.appendChild(tdMent);trMent.onmousedown = xxeFireTRMouseDown;trMent.onmouseover = xxeFireTRMouseOver;trMent.onmouseup = xxeFireTRMouseUp;trMent.ondblclick = xxeFireTRMouseDblClick;}newBodyMent.appendChild(trMent);}tableMent.removeChild(oldBodyMent);tableMent.appendChild(newBodyMent);trMent = null;tdMent = null;spanMent = null;oldBodyMent = null;newBodyMent = null;tableMent = null;this.reSelect();return;} catch (e) {comExceptionCatch("JJS00064", e);return;}};this.xwbRow2Win = function(row) {try {return true;} catch (e) {comExceptionCatch("JJS00715", e);return true;}};this.setSubsetOn = function() {var subHolder = $($(this.getWinID() + ".SUBHOLDER"));subHolder.className = "on";var uDef = this.getUserDef().getUserFldDoc();var subsetMent = null;for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");var thID = this.getWinID() + ".th." + fieldName;var subID = this.getWinID() + ".thsub." + fieldName;subsetMent = $($(subID));if (subsetMent != null) {subsetMent.onmousedown = null;subsetMent.remove();}subsetMent = new Element('img', {'id': subID, 'src': 'graphics/filter_handle.gif', 'width':'12', 'height':'16', 'alt':'Filter', 'title':'Filter'});subsetMent.onmousedown = xxeFireSubMouseDown;$($(thID)).insert({'top': subsetMent});}$($(this.getWinID() +".TABLEHOLDERH")).setStyle({height: '36px'});return true;};this.setSubsetOff = function() {$($(this.getWinID() +".TABLEHOLDERH")).setStyle({height: '18px'});var subHolder = $($(this.getWinID() + ".SUBHOLDER"));subHolder.className = "off";var uDef = this.getUserDef().getUserFldDoc();var subsetMent = null;for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");var subID = this.getWinID() + ".thsub." + fieldName;subsetMent = $($(subID));if (subsetMent != null) {subsetMent.onmousedown = null;subsetMent.remove();}}subList = null;this.setWinSubset();this.applySubset();return true;};this.getWinSubset = function() {var uDef = this.getUserDef().getUserFldDoc();var subinID = null;var subinMent = null;var subsetStr = "";subList = new Array();for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");subinID = this.getWinID() + ".subin." + fieldName;subinMent = $($(subinID));if (subinMent.className == 'on') {subsetStr = subsetStr + "<" + fieldName + " operator=\"EQ\">" + subinMent.value + "</" + fieldName + ">";subList.push(new Array(fieldName, this.getDoc().getColPos(fieldName), subinMent.value, "EQ"));}}if (subList.length < 1) subList = null;var pageDef = this.getParm("PAGEDEF");var pageDoc = pageDef.getDoc();pageDoc.setValue(0, "subset", subsetStr);};this.setWinSubset = function() {var subinMent = null;var uDef = this.getUserDef().getUserFldDoc();for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");subinMent = $($(this.getWinID() + ".subin." + fieldName));if (subinMent.className == 'on') subinMent.className = "hide";subinMent.value = "";}if (subList == null || subList.length < 1) return true;for (var i=0; i<subList.length; i++) {subinMent = $($(this.getWinID() + ".subin." + subList[i][0]));subinMent.value = subList[i][2];subinMent.className = 'on';}return true;};this.applySubset = function() {if (!initialized) {this.xwbDoc2Win();return true;}this.getWinSubset();var pageDef = this.getParm("PAGEDEF");var pageDoc = pageDef.getDoc();var dssMode = pageDoc.getValue(0, "dssMode");if (dssMode == "LOCAL") {this.getDoc().setSubset(subList);this.xwbDoc2Win();return true;} else if (dssMode == "SERVER") {this.refresh();return true;} else {comDefaultSysError("JJS00716", "invalid dssMode " + dssMode);return false;}};this.refreshAttn = function() {try {var pageDef = this.getParm("PAGEDEF");var refreshID = pageDef.getParm("REFRESHID");var refreshMent = $($(refreshID));refreshMent.className = "attn";refreshMent.setStyle({'opacity': '1.0'});Effect.Pulsate(refreshMent, { pulses: 2, duration: 1.0 });} catch (e) {}};this.refresh = function() {try {var pageDef = this.getParm("PAGEDEF");pageDef.getParm("REFRESHFUNC")();} catch (e) {}};this.subset = function(event) {try {var compID = xxeGetEventID(event);var compParts = compID.split(".");var compWinID = compParts[0];var compType = compParts[1];var compField = compParts[2];subinID = this.getWinID() + ".subin." + compField;var subinMent = $($(subinID));if (subinMent.className == "on") {subinMent.className = "hide";subinMent.value = "";} else {subinMent.className = "on";if (selLast.length > 0) {var selParts = selLast.split(".");var selRow = parseInt(selParts[2]);var subVal = this.getDoc().getValue(selRow, compField);comTrace(compField);comTrace(this.getColbyFieldName(compField));comTrace(subVal);var formatter = this.getFormatter(this.getColbyFieldName(compField));if (formatter != null) {subVal = formatter(this.getDoc(), selRow, this.getDoc().getColPos(compField));comTrace(subVal);}subinMent.value = subVal;} else {this.getForm().setFormResp(comApprovedResp("JJS00717", "Tip: If you select a row before pressing the subset, the subset value will default to the rows value"));if (this.getDoc().getRowCount() > 0) {subinMent.value = this.getDoc().getValue(0, compField);} else {subinMent.value = "";}}}this.applySubset();return false;} catch (e) {comExceptTrace("JJS00718 " + e);}};this.subsetonblur = function(event) {try {var compID = xxeGetEventID(event);var compParts = compID.split(".");var compField = compParts[2];subinID = this.getWinID() + ".subin." + compField;var subinMent = $($(subinID));if (subinMent.className == "hide") return true;this.applySubset();return true;} catch (e) {comExceptTrace("JJS00719 " + e);}};this.trashMan = function() {document.onkeypress = null;document.onmouseup = null;try {document.onselectstart = null;} catch (e) {}var oldBodyMent = $($(this.getWinID() + ".BODY"));var trs = oldBodyMent.getElementsByTagName("TR");for (var i=0; i<trs.length; i++) {trs[i].onmousedown = null;trs[i].onmouseover = null;trs[i].onmouseup = null;trs[i].ondblclick = null;}trs = null;var uDef = this.getUserDef();var uDefFldDoc = uDef.getUserFldDoc();var fieldName = null;var thID = null;var workID = null;var workMent = null;for (var compCol=0; compCol<uDefFldDoc.getRowCount(); compCol++) {fieldName = uDefFldDoc.getValue(compCol,"fieldName");thID = this.getWinID() + ".th." + fieldName;workID = this.getWinID() + ".thval." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onmousedown = null;workID = this.getWinID() + ".thsrt." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onmousedown = null;workID = this.getWinID() + ".thsub." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onmousedown = null;workID = this.getWinID() + ".subin." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onblur = null;}oldBodyMent = null;workID = null;workMent = null;superDef.trashMan();superDef = null;initialized = null;selLast = null;selLastIndex = null;selTo = null;selMax = null;subList = null;mouseselecting = null;emptyRow = null;};this.registerTriggers = function() {document.onkeydown = xxeFireDocKeyDown;document.onmouseup = xxeFireDocMouseUp;document.getElementById(this.getWinID() + ".TABLEHOLDER").onscroll = xxeFireOnScroll;try {document.onselectstart = xxeFireSelectStart;} catch (e) {}return true;};this.registerListeners = function() {var winID = this.getWinID();comWEQ.listen(winID, "*", "onscroll", winID+"onscroll", this, this.onscroll);comWEQ.listen("DOCUMENT", "DOCUMENT", "selectstart", winID+"selectstart", this, this.selectstart);comWEQ.listen("DOCUMENT", "DOCUMENT", "onkeydown", winID+"dockeydown", this, this.docKeyDown);comWEQ.listen(winID, "*", "trmousedown", winID+"RowSelect", this, this.select);comWEQ.listen(winID, "*", "trmouseover", winID+"rowmouseover", this, this.rowmouseover);comWEQ.listen(winID, "*", "trmouseup", winID+"rowmouseup", this, this.rowmouseup);comWEQ.listen(winID, "*", "submousedown", winID+"SubsetClick", this, this.subset);comWEQ.listen(winID, "*", "subsetonblur", winID+"SubsetChange", this, this.subsetonblur);comWEQ.listen(winID, winID + ".thval.*", "onmousedown", winID+"SortClick1", this, this.sort);comWEQ.listen(winID, winID + ".thsrt.*", "onmousedown", winID+"SortClick2", this, this.sort);comWEQ.listen("DOCUMENT", "DOCUMENT", "onmouseup", winID+"onmouseup", this, this.rowmouseup);};this.onscroll = function(evt) {try {var xpos = document.getElementById(this.getWinID() + ".TABLEHOLDER").scrollLeft;document.getElementById(this.getWinID() + ".TABLEHOLDERH").scrollLeft = xpos;return true;} catch (e) {}};this.selectstart = function(evt) {try {var compParts = xxeGetEventID(evt).split(".");if (compParts[0] != this.getWinID()) return true;if (compParts[1] == "td" || compParts[1] == "data") return false;return true;} catch (e) {}};this.docKeyDown = function(evt) {try {var keyName = comKeyName(evt);if (evt.ctrlKey && keyName.toUpperCase() == "A") {return this.ctrlA(evt);}return true;} catch (e) {comExceptionCatch("JJS00720", e);}};this.ctrlA = function(evt) {try {var focNode = this.getElementWithFocus();if (focNode.nodeName.toUpperCase() == "INPUT") return true;var compWinID = this.getWinID();if (focNode.id == this.getWinID() + ".TABLEHOLDER") {for (var i=0; i<selMax; i++) {document.getElementById(compWinID + ".tr." +i).className="selected";}return false;}return false;} catch (e) {comExceptionCatch("JJS00721", e);}};this.getElementWithFocus = function() {var hf;if ( document.activeElement ) hf = document.activeElement;else hf = document.focusNode;return hf;};this.setSelectLast = function(selLastID) {if (selLastID == null || selLastID.length < 1) {selLast = "";selLastIndex = "";return;}var selParts = selLastID.split(".");var selRow = parseInt(selParts[2]);selLast = selLastID;selLastIndex = this.getDoc().getValue(selRow, "stampal");return;};this.reSelect = function() {if (selLast == null || selLast.length < 1) return;var selDocRow = this.getDoc().findRow(this.getDoc().getColPos("stampal"), selLastIndex);if (selDocRow > -1) {this.setSelectLast(this.getWinID() + ".tr." + selDocRow.toString());document.getElementById(selLast).className="selected";} else {this.setSelectLast("");}};this.select = function(evt) {try {$($(this.getWinID() + ".TABLEHOLDER")).focus();var compID = xxeGetEventID(evt);var compParts = compID.split(".");var compWinID = compParts[0];var compRow = parseInt(compParts[2]);var trID = compWinID + ".tr." + compRow.toString();var trMent = $($(trID));if (evt.ctrlKey==1) {if (trMent.className == "selected") {trMent.className="even";} else {trMent.className="selected";}this.setSelectLast(trID);return false;}if (evt.shiftKey==1) {if (selLast == "") {for (var i=0; i<=compRow; i++) {document.getElementById(compWinID + ".tr." +i.toString()).className="selected";}this.setSelectLast(trID);return false;}var selParts = selLast.split(".");var selRow = parseInt(selParts[2]);if (selRow < compRow) {for (var i=selRow; i<=compRow; i++) {document.getElementById(compWinID + ".tr." +i.toString()).className="selected";}this.setSelectLast(trID);return false;}return false;}var theClassName = "even";var oldBodyMent = $($(this.getWinID() + ".BODY"));var trs = oldBodyMent.getElementsByTagName("TR");for (var i=0; i<trs.length; i++) {trs[i].className = theClassName;}trMent.className="selected";this.setSelectLast(trID);selTo = compRow;mouseselecting = true;return false;} catch (e) {comExceptionCatch("JJS00722", e);}};this.rowmouseover = function(event) {if (!mouseselecting) return false;var compID = xxeGetEventID(event);var toRow = parseInt(compID.split(".")[2]);var startRow = parseInt(selLast.split(".")[2]);if (toRow == selTo) return false;var loopTo = toRow;if (selTo > toRow) loopTo = selTo;var preID = this.getWinID() + ".tr.";for (var i=startRow+1; i<=loopTo; i++) {if (i <= toRow) {document.getElementById(preID +i).className="selected";} else {document.getElementById(preID +i).className="even";}}selTo = toRow;return false;};this.rowmouseup = function(event) {mouseselecting = false;return false;};this.sort = function(event) {try {var compID = xxeGetEventID(event);var compParts = compID.split(".");var compWinID = compParts[0];var compType = compParts[1];var compField = compParts[2];var pageDef = this.getParm("PAGEDEF");if (pageDef == null) {comExceptTrace("JJS00723 windef " + this.getWinID() + " missing page definition");return true;}var pageDoc = pageDef.getDoc();var curSort = pageDoc.getValue(0, "sort");if (event.ctrlKey==1) {var curSortFields = curSort.split(",");var curSortPos = -1;if (curSort.length > 0) {for (var i=0 ;i<curSortFields.length; i++) {var curSortField = curSortFields[i].split(" ");if (curSortField[0] == compField) {curSortPos = i;break;}}}if (curSortPos < 0) {if (curSort.length < 1) {pageDoc.setValue(0, "sort", compField);} else {pageDoc.setValue(0, "sort", curSort + "," + compField);}} else {if (curSortFields[i].indexOf(" DESC") > -1) {curSortFields[i] = compField;} else {curSortFields[i] = compField + " DESC";}var newSort = curSortFields.toString();pageDoc.setValue(0, "sort", newSort);}} else {if (curSort.indexOf(",") > -1) {pageDoc.setValue(0, "sort", compField);} else {if (curSort.split(" ")[0] == compField) {if (curSort.indexOf(" DESC") > -1) {pageDoc.setValue(0, "sort", compField);} else {pageDoc.setValue(0, "sort", compField  + " DESC");}} else {pageDoc.setValue(0, "sort", compField);}}}this.setSortHeaders(pageDoc);if (pageDoc.getValue(0, "sort").split(",").length == 1) {this.getForm().setFormResp(comApprovedResp("JJS00724", "Tip: For multi sort, hold down the control key and click another column header"));} else {this.getForm().setFormResp(comApprovedResp("JJS00725", ""));}var dssMode = pageDoc.getValue(0, "dssMode");if (dssMode == "LOCAL") {this.getDoc().sort(pageDoc.getValue(0, "sort"));this.xwbDoc2Win();return false;} else if (dssMode == "SERVER") {try {this.refresh();} catch (e) {}return false;} else {comDefaultSysError("JJS00726", "invalid dssMode " + dssMode);return false;}} catch (e) {comExceptionCatch("JJS00727", "sort exception: " + e);}};this.getSelectedRows = function() {var selectedRows = new Array();var trID = "";var wid = this.getWinID();for (var row=0; row<selMax; row++) {trID = wid + ".tr." + row;if (document.getElementById(trID).className == "selected") {selectedRows.push(row);}}return selectedRows;};this.clearWinEdits = function() {return true;};this.xwbWin2Doc = function() {return true;};this.applyWinEdits = function() {return true;};this.getWinID = function() {return superDef.getWinID();};this.getWinName = function() {return superDef.getWinName();};this.getWinType = function() {return superDef.getWinType();};this.getForm = function() {return superDef.getForm();};this.setForm = function(form) {return superDef.setForm(form);};this.setUserDef = function(uDef) {return superDef.setUserDef(uDef);};this.getUserDef = function() {return superDef.getUserDef();};this.initUserDef = function(defaultUdefFunc) {return superDef.initUserDef(defaultUdefFunc);};this.getDoc = function() {return superDef.getDoc();};this.setDoc = function(doc) {return superDef.setDoc(doc);};this.setModal = function(tfVal) {return superDef.setModal(tfVal);};this.isModal = function() {return superDef.isModal();};this.addComp = function(compID, compType, displayType, fieldName, formatter, eventType, eventHandler, displayName, width, height) {return superDef.addComp(compID, compType, displayType, fieldName, formatter, eventType, eventHandler, displayName, width, height);};this.removeComp = function(col) {return superDef.removeComp(col);};this.getCompCount = function() {return superDef.getCompCount();};this.getCompID = function(col) {return superDef.getCompID(col);};this.getColbyCompID = function(compID) {return superDef.getColbyCompID(compID);};this.getColbyFieldName = function(fieldName) {return superDef.getColbyFieldName(fieldName);};this.getCompType = function(col) {return superDef.getCompType(col);};this.getDisplayType = function(col) {return superDef.getDisplayType(col);};this.getFieldName = function(col) {return superDef.getFieldName(col);};this.getFormatter = function(col) {return superDef.getFormatter(col);};this.getEventType = function(col) {return superDef.getEventType(col);};this.getEventHandler = function(col) {return superDef.getEventHandler(col);};this.show = function() {return superDef.show();};this.addParm = function(parmKey, parmValue) {return superDef.addParm(parmKey, parmValue);};this.getParm = function(parmKey) {return superDef.getParm(parmKey);};this.getDisplayName = function(col) {return superDef.getDisplayName(col);};this.getWidth = function(col) {return superDef.getWidth(col);};this.getHeight = function(col) {return superDef.getHeight(col);};}function xxWinDefVPage(listDef, winID, winName, refreshID, refreshFunc) {var superDef = new xxWinDefEdit(winID, winName, "PAGE");listDef.addParm("PAGEDEF", this);superDef.addParm("REFRESHID", refreshID);superDef.addParm("REFRESHFUNC", refreshFunc);this.getDoc = function() {var dataDoc = superDef.getDoc();if (dataDoc != null) return dataDoc;var dataDoc = new xxDataDoc("PageDO", "SINGLE");dataDoc.addField("pageCurrent", false, null);dataDoc.addField("pageTotal", false, null);dataDoc.addField("pageRecCount", false, null);dataDoc.addField("pageSize", false, null);dataDoc.addField("sort", false, null);dataDoc.addField("subset", false, null);dataDoc.addField("dssMode", false, null);dataDoc.addRow();dataDoc.setValue(0, "pageCurrent", "1");dataDoc.setValue(0, "pageTotal", "1");dataDoc.setValue(0, "pageRecCount", "-1");dataDoc.setValue(0, "pageSize", "200");dataDoc.setValue(0, "subset", "");dataDoc.setValue(0, "sort", "");dataDoc.setValue(0, "dssMode", "");superDef.setDoc(dataDoc);return dataDoc;};this.setSubsetFromArray = function(subList) {var subStr = "";var pageDoc = this.getDoc();if (subList == null || subList.length < 1) {pageDoc.setValue(0, "subset", subStr);return true;}for (var i=0; i<subList.length; i++) {subStr = subStr + "<" + subList[i][0] + " operator=\"EQ\">" + subList[i][2] + "</" + subList[i][0] + ">";}pageDoc.setValue(0, "subset", subStr);return true;};this.clearWinEdits = function() {return true;};this.xwbDoc2Win = function() {return superDef.xwbDoc2Win();};this.xwbWin2Doc = function() {return superDef.xwbWin2Doc();};this.registerTriggers = function() {return superDef.registerTriggers();};this.registerListeners = function() {return superDef.registerListeners();};this.trashMan = function() {superDef.trashMan();};this.applyWinEdits = function() {return true;};this.getWinID = function() {return superDef.getWinID();};this.getWinName = function() {return superDef.getWinName();};this.getWinType = function() {return superDef.getWinType();};this.getForm = function() {return superDef.getForm();};this.setForm = function(form) {return superDef.setForm(form);};this.setDoc = function(doc) {return superDef.setDoc(doc);};this.setModal = function(tfVal) {return superDef.setModal(tfVal);};this.isModal = function() {return superDef.isModal();};this.addComp = function(compID, compType, displayType, fieldName, formatter, eventType, eventHandler) {return superDef.addComp(compID, compType, displayType, fieldName, formatter, eventType, eventHandler);};this.removeComp = function(col) {return superDef.removeComp(col);};this.getCompCount = function() {return superDef.getCompCount();};this.getCompID = function(col) {return superDef.getCompID(col);};this.getColbyCompID = function(compID) {return superDef.getColbyCompID(compID);};this.getCompType = function(col) {return superDef.getCompType(col);};this.getDisplayType = function(col) {return superDef.getDisplayType(col);};this.getFieldName = function(col) {return superDef.getFieldName(col);};this.getFormatter = function(col) {return superDef.getFormatter(col);};this.getEventType = function(col) {return superDef.getEventType(col);};this.getEventHandler = function(col) {return superDef.getEventHandler(col);};this.show = function() {return superDef.show();};this.addParm = function(parmKey, parmValue) {return superDef.addParm(parmKey, parmValue);};this.getParm = function(parmKey) {return superDef.getParm(parmKey);};}function peV2ListWindowSizer(winID, nWidth, nHeight) {if (nWidth > -1) {var testWidth = nWidth + 18;$($(winID + '.TABLEHOLDER')).setStyle({width: testWidth + 'px'});$($(winID + '.TABLEHOLDERH')).setStyle({width: nWidth + 'px'});var cWidth = nWidth + 33;$($('content')).setStyle({width: cWidth + 'px'});}if (nHeight > -1) {$($(winID + '.TABLEHOLDER')).setStyle({height: nHeight + 'px'});var cHeight = nHeight + 161;$($('content')).setStyle({height: cHeight + 'px'});}}function xxWinDefV2List(winID, winName) {var superDef = new xxWinDef(winID, winName, "LIST");var initialized = false;var selLast = "";var selLastIndex = "";var selTo = "";var selMax = 0;var subList = null;var mouseselecting = false;var emptyRow = null;this.reInit = function() {initialized = false;};this.initTemplate = function() {if (initialized) return true;initialized = true;var uDef = this.getUserDef();var uDefFldDoc = uDef.getUserFldDoc();uDef.getWinSizer()(this.getWinID(), uDef.getWinWidth(), uDef.getWinHeight());if ($($(this.getWinID() + ".tr.HEADER")) != null) $($(this.getWinID() + ".tr.HEADER")).remove();if ($($(this.getWinID() + "SUBROW")) != null) $($(this.getWinID() + "SUBROW")).remove();if (emptyRow == null) {emptyRow = $($(this.getWinID() + ".EMPTY")).remove();if (emptyRow != null) emptyRow.className = "empty";}var tabWidth = 0;var subWidth = 0;for (var compCol=0; compCol<uDefFldDoc.getRowCount(); compCol++) {tabWidth = tabWidth + parseInt(uDefFldDoc.getValue(compCol,"fldWidth"));subWidth = subWidth + parseInt(uDefFldDoc.getValue(compCol,"fldWidth") + 1);}$($(this.getWinID() +".TABLEH")).setStyle({width: tabWidth + 'px'});$($(this.getWinID() +".TABLE")).setStyle({width: tabWidth + 'px'});var fieldName = null;var trDiv = new Element('tr', {'id': this.getWinID() + ".tr.HEADER"});var trbDiv = new Element('tr', {'id': this.getWinID() + ".trb.HEADER"});var subrowMent = new Element('div', {'id': this.getWinID() + "SUBROW", 'class': 'subset'});subrowMent.setStyle({width: subWidth + 'px'});for (var compCol=0; compCol<uDefFldDoc.getRowCount(); compCol++) {var compWidth = parseInt(uDefFldDoc.getValue(compCol,"fldWidth"));fieldName = uDefFldDoc.getValue(compCol,"fieldName");var thbDiv = new Element('th', {'id': this.getWinID() + ".thb." + fieldName});thbDiv.setStyle({width: compWidth -1 + 'px'});trbDiv.appendChild(thbDiv);var thDiv = new Element('th', {'id': this.getWinID() + ".th." + fieldName});thDiv.setStyle({width: compWidth -1 + 'px'});var spanID = this.getWinID() + ".thval." + fieldName;var spanMent = new Element('span', {'id': spanID});spanMent.update(uDefFldDoc.getValue(compCol,"displayName"));spanMent.onmousedown = xxeFireMouseDown;thDiv.appendChild(spanMent);trDiv.appendChild(thDiv);var subinputMent = new Element('input', {'id': this.getWinID() + ".subin." + fieldName, 'type': 'text', 'class': 'hide'});subinputMent.setStyle({width: compWidth -3 + 'px'});subinputMent.onblur = xxeFireSubOnBlur;subrowMent.appendChild(subinputMent);}var headerCompID = this.getWinID() + ".HEADERB";$($(headerCompID)).appendChild(trbDiv);var headerCompID = this.getWinID() + ".HEADER";$($(headerCompID)).appendChild(trDiv);$($(this.getWinID() + ".SUBHOLDER")).appendChild(subrowMent);return true;};this.setColumnName = function(fieldName, displayName) {var spanID = this.getWinID() + ".thval." + fieldName;$($(spanID)).update(displayName);};this.setSortHeaders = function(pageDoc) {var sortFields = pageDoc.getValue(0, "sort").split(",");var uDef = this.getUserDef().getUserFldDoc();var sortMent = null;for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");var thID = this.getWinID() + ".th." + fieldName;var spanID = this.getWinID() + ".thval." + fieldName;var sortID = this.getWinID() + ".thsrt." + fieldName;sortMent = $($(sortID));if (sortMent != null) {sortMent.onmousedown = null;sortMent.remove();}for (var i=0; i<sortFields.length; i++) {if (sortFields[i].indexOf(fieldName) == 0) {if (sortFields[i].indexOf(" DESC") > -1) {sortMent = new Element('img', {'id': sortID, 'src': 'graphics/sortDesc.gif', 'width':'10', 'height':'12', 'alt':'Sort', 'title':'Sort'});} else {sortMent = new Element('img', {'id': sortID, 'src': 'graphics/sortAsc.gif', 'width':'10', 'height':'12', 'alt':'Sort', 'title':'Sort'});}sortMent.onmousedown = xxeFireMouseDown;$($(thID)).insertBefore(sortMent, $($(spanID)));}}}};this.addColumn = function(fieldName, displayName, widthParm) {this.reInit();this.xwbDoc2Win();return true;};this.moveColumn = function(fieldName, direction) {this.reInit();this.xwbDoc2Win();return true;};this.deleteColumn = function(fieldName, fieldCol) {this.reInit();this.xwbDoc2Win();return true;};this.setColumnWidth = function(fieldName, width) {var thID = this.getWinID() + ".th." + fieldName;var oldWidth = parseInt($($(thID)).getStyle('width'));var newWidth = parseInt(width);var dif = newWidth - oldWidth;var oldTable = parseInt($($(this.getWinID() +".TABLE")).getStyle('width'));var newTable = oldTable + dif;$($(this.getWinID() +".TABLEH")).setStyle({width: newTable + 'px'});$($(thID)).setStyle({width: width + 'px'});$($(this.getWinID() +".TABLE")).setStyle({width: newTable + 'px'});$($(this.getWinID() + ".thb." + fieldName)).setStyle({width: width + 'px'});$($(this.getWinID() + "SUBROW")).setStyle({width: newTable + 'px'});$($(this.getWinID() + ".subin." + fieldName)).setStyle({width: width -1 + 'px'});};this.xwbDoc2Win = function() {try {this.initTemplate();var tableMent = $($(this.getWinID() + ".TABLE"));var oldBodyMent = $($(this.getWinID() + ".BODY"));var newBodyMent = oldBodyMent.cloneNode(false);var trs = oldBodyMent.getElementsByTagName("TR");for (var i=0; i<trs.length; i++) {trs[i].onmousedown = null;trs[i].onmouseover = null;trs[i].onmouseup = null;trs[i].ondblclick = null;}var uDef = this.getUserDef().getUserFldDoc();var udefXwdef = new Array();for (var col=0; col < uDef.getRowCount(); col++) {var wdefRow = this.getColbyFieldName(uDef.getValue(col, "fieldName"));udefXwdef.push(wdefRow);}var dataDoc = this.getDoc();selMax = dataDoc.getRowCount();if (selMax < 1) {if (emptyRow != null) {if ($($(this.getWinID() + ".SUBHOLDER")).className == "off") {newBodyMent.appendChild(emptyRow);emptyRow.className = "empty";}}tableMent.removeChild(oldBodyMent);tableMent.appendChild(newBodyMent);return;}var trMent = null;var tdMent = null;var spanMent = null;var fieldName = null;var formatter = null;var docVal = null;for (var row=0; row < dataDoc.getRowCount(); row++) {trMent = new Element('tr', {'id': this.getWinID() + ".tr." + row});for (var col=0; col < uDef.getRowCount(); col++) {tdMent = new Element('td', {'id': this.getWinID() + ".td." + row + "." + col});spanMent = new Element('span', {'id': this.getWinID() + ".data." +  row + "." + col});fieldName = uDef.getValue(col, "fieldName");formatter = this.getFormatter(udefXwdef[col]);if (formatter == null) {docVal = dataDoc.getValue(row, fieldName);} else {docVal = formatter(dataDoc, row, dataDoc.getColPos(fieldName));}spanMent.update(docVal);tdMent.appendChild(spanMent);trMent.appendChild(tdMent);trMent.onmousedown = xxeFireTRMouseDown;trMent.onmouseover = xxeFireTRMouseOver;trMent.onmouseup = xxeFireTRMouseUp;trMent.ondblclick = xxeFireTRMouseDblClick;}newBodyMent.appendChild(trMent);}tableMent.removeChild(oldBodyMent);tableMent.appendChild(newBodyMent);trMent = null;tdMent = null;spanMent = null;oldBodyMent = null;newBodyMent = null;tableMent = null;this.reSelect();return;} catch (e) {comExceptionCatch("JJS00064", e);return;}};this.xwbRow2Win = function(row) {try {return true;} catch (e) {comExceptionCatch("JJS00715", e);return true;}};this.setSubsetOn = function() {var subHolder = $($(this.getWinID() + ".SUBHOLDER"));subHolder.className = "on";var uDef = this.getUserDef().getUserFldDoc();var subsetMent = null;for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");var thID = this.getWinID() + ".th." + fieldName;var subID = this.getWinID() + ".thsub." + fieldName;subsetMent = $($(subID));if (subsetMent != null) {subsetMent.onmousedown = null;subsetMent.remove();}subsetMent = new Element('img', {'id': subID, 'src': 'graphics/filter_handle.gif', 'width':'12', 'height':'16', 'alt':'Filter', 'title':'Filter'});subsetMent.onmousedown = xxeFireSubMouseDown;$($(thID)).insert({'top': subsetMent});}$($(this.getWinID() +".TABLEHOLDERH")).setStyle({height: '36px'});return true;};this.setSubsetOff = function() {$($(this.getWinID() +".TABLEHOLDERH")).setStyle({height: '18px'});var subHolder = $($(this.getWinID() + ".SUBHOLDER"));subHolder.className = "off";var uDef = this.getUserDef().getUserFldDoc();var subsetMent = null;for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");var subID = this.getWinID() + ".thsub." + fieldName;subsetMent = $($(subID));if (subsetMent != null) {subsetMent.onmousedown = null;subsetMent.remove();}}subList = null;this.setWinSubset();this.applySubset();return true;};this.getWinSubset = function() {var uDef = this.getUserDef().getUserFldDoc();var subinID = null;var subinMent = null;var subsetStr = "";var subColPos = -1;var subVal = null;subList = new Array();var listDoc = this.getDoc();var subDoc = listDoc.copyStructure();for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");subinID = this.getWinID() + ".subin." + fieldName;subinMent = $($(subinID));if (subinMent.className == 'on') {subColPos = listDoc.getColPos(fieldName);subVal = subinMent.value;if (listDoc.getValidator(subColPos) != null) {subDoc.setColValue(0, subColPos, subVal);listDoc.getValidator(subColPos)(subDoc, 0 , subColPos);subVal = subDoc.getColValue(0, subColPos);}subsetStr = subsetStr + "<" + fieldName + " operator=\"EQ\">" + subVal + "</" + fieldName + ">";subList.push(new Array(fieldName, subColPos, subVal, "EQ"));}}if (subList.length < 1) subList = null;var pageDef = this.getParm("PAGEDEF");var pageDoc = pageDef.getDoc();pageDoc.setValue(0, "subset", subsetStr);};this.setWinSubset = function() {var subinMent = null;var uDef = this.getUserDef().getUserFldDoc();for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");subinMent = $($(this.getWinID() + ".subin." + fieldName));if (subinMent.className == 'on') subinMent.className = "hide";subinMent.value = "";}if (subList == null || subList.length < 1) return true;for (var i=0; i<subList.length; i++) {subinMent = $($(this.getWinID() + ".subin." + subList[i][0]));subinMent.value = subList[i][2];subinMent.className = 'on';}return true;};this.applySubset = function() {if (!initialized) {this.xwbDoc2Win();return true;}this.getWinSubset();var pageDef = this.getParm("PAGEDEF");var pageDoc = pageDef.getDoc();var dssMode = pageDoc.getValue(0, "dssMode");if (dssMode == "LOCAL") {this.getDoc().setSubset(subList);this.xwbDoc2Win();return true;} else if (dssMode == "SERVER") {this.refresh();return true;} else {comDefaultSysError("JJS00716", "invalid dssMode " + dssMode);return false;}};this.refreshAttn = function() {try {var pageDef = this.getParm("PAGEDEF");var refreshID = pageDef.getParm("REFRESHID");var refreshMent = $($(refreshID));refreshMent.className = "attn";refreshMent.setStyle({'opacity': '1.0'});Effect.Pulsate(refreshMent, { pulses: 2, duration: 1.0 });} catch (e) {}};this.refresh = function() {try {var pageDef = this.getParm("PAGEDEF");pageDef.getParm("REFRESHFUNC")();} catch (e) {}};this.subset = function(event) {try {var compID = xxeGetEventID(event);var compParts = compID.split(".");var compWinID = compParts[0];var compType = compParts[1];var compField = compParts[2];subinID = this.getWinID() + ".subin." + compField;var subinMent = $($(subinID));if (subinMent.className == "on") {subinMent.className = "hide";subinMent.value = "";} else {subinMent.className = "on";if (selLast.length > 0) {var selParts = selLast.split(".");var selRow = parseInt(selParts[2]);var subVal = this.getDoc().getValue(selRow, compField);comTrace(compField);comTrace(this.getColbyFieldName(compField));comTrace(subVal);var formatter = this.getFormatter(this.getColbyFieldName(compField));if (formatter != null) {subVal = formatter(this.getDoc(), selRow, this.getDoc().getColPos(compField));comTrace(subVal);}subinMent.value = subVal;} else {this.getForm().setFormResp(comApprovedResp("JJS00717", "Tip: If you select a row before pressing the subset, the subset value will default to the rows value"));if (this.getDoc().getRowCount() > 0) {subinMent.value = this.getDoc().getValue(0, compField);} else {subinMent.value = "";}}}this.applySubset();return false;} catch (e) {comExceptTrace("JJS00718 " + e);}};this.subsetonblur = function(event) {try {var compID = xxeGetEventID(event);var compParts = compID.split(".");var compField = compParts[2];subinID = this.getWinID() + ".subin." + compField;var subinMent = $($(subinID));if (subinMent.className == "hide") return true;this.applySubset();return true;} catch (e) {comExceptTrace("JJS00719 " + e);}};this.trashMan = function() {document.onkeypress = null;document.onmouseup = null;try {document.onselectstart = null;} catch (e) {}var oldBodyMent = $($(this.getWinID() + ".BODY"));var trs = oldBodyMent.getElementsByTagName("TR");for (var i=0; i<trs.length; i++) {trs[i].onmousedown = null;trs[i].onmouseover = null;trs[i].onmouseup = null;trs[i].ondblclick = null;}trs = null;var uDef = this.getUserDef();var uDefFldDoc = uDef.getUserFldDoc();var fieldName = null;var thID = null;var workID = null;var workMent = null;for (var compCol=0; compCol<uDefFldDoc.getRowCount(); compCol++) {fieldName = uDefFldDoc.getValue(compCol,"fieldName");thID = this.getWinID() + ".th." + fieldName;workID = this.getWinID() + ".thval." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onmousedown = null;workID = this.getWinID() + ".thsrt." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onmousedown = null;workID = this.getWinID() + ".thsub." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onmousedown = null;workID = this.getWinID() + ".subin." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onblur = null;}oldBodyMent = null;workID = null;workMent = null;superDef.trashMan();superDef = null;initialized = null;selLast = null;selLastIndex = null;selTo = null;selMax = null;subList = null;mouseselecting = null;emptyRow = null;};this.registerTriggers = function() {document.onkeydown = xxeFireDocKeyDown;document.onmouseup = xxeFireDocMouseUp;document.getElementById(this.getWinID() + ".TABLEHOLDER").onscroll = xxeFireOnScroll;try {document.onselectstart = xxeFireSelectStart;} catch (e) {}return true;};this.registerListeners = function() {var winID = this.getWinID();comWEQ.listen(winID, "*", "onscroll", winID+"onscroll", this, this.onscroll);comWEQ.listen("DOCUMENT", "DOCUMENT", "selectstart", winID+"selectstart", this, this.selectstart);comWEQ.listen("DOCUMENT", "DOCUMENT", "onkeydown", winID+"dockeydown", this, this.docKeyDown);comWEQ.listen(winID, "*", "trmousedown", winID+"RowSelect", this, this.select);comWEQ.listen(winID, "*", "trmouseover", winID+"rowmouseover", this, this.rowmouseover);comWEQ.listen(winID, "*", "trmouseup", winID+"rowmouseup", this, this.rowmouseup);comWEQ.listen(winID, "*", "submousedown", winID+"SubsetClick", this, this.subset);comWEQ.listen(winID, "*", "subsetonblur", winID+"SubsetChange", this, this.subsetonblur);comWEQ.listen(winID, winID + ".thval.*", "onmousedown", winID+"SortClick1", this, this.sort);comWEQ.listen(winID, winID + ".thsrt.*", "onmousedown", winID+"SortClick2", this, this.sort);comWEQ.listen("DOCUMENT", "DOCUMENT", "onmouseup", winID+"onmouseup", this, this.rowmouseup);};this.onscroll = function(evt) {try {var xpos = document.getElementById(this.getWinID() + ".TABLEHOLDER").scrollLeft;document.getElementById(this.getWinID() + ".TABLEHOLDERH").scrollLeft = xpos;return true;} catch (e) {}};this.selectstart = function(evt) {try {var compParts = xxeGetEventID(evt).split(".");if (compParts[0] != this.getWinID()) return true;if (compParts[1] == "td" || compParts[1] == "data") return false;return true;} catch (e) {}};this.docKeyDown = function(evt) {try {var keyName = comKeyName(evt);if (evt.ctrlKey && keyName.toUpperCase() == "A") {return this.ctrlA(evt);}return true;} catch (e) {comExceptionCatch("JJS00720", e);}};this.ctrlA = function(evt) {try {var focNode = this.getElementWithFocus();if (focNode.nodeName.toUpperCase() == "INPUT") return true;var compWinID = this.getWinID();if (focNode.id == this.getWinID() + ".TABLEHOLDER") {for (var i=0; i<selMax; i++) {document.getElementById(compWinID + ".tr." +i).className="selected";}return false;}return false;} catch (e) {comExceptionCatch("JJS00721", e);}};this.getElementWithFocus = function() {var hf;if ( document.activeElement ) hf = document.activeElement;else hf = document.focusNode;return hf;};this.setSelectLast = function(selLastID) {if (selLastID == null || selLastID.length < 1) {selLast = "";selLastIndex = "";return;}var selParts = selLastID.split(".");var selRow = parseInt(selParts[2]);selLast = selLastID;selLastIndex = this.getDoc().getValue(selRow, "stampal");return;};this.reSelect = function() {if (selLast == null || selLast.length < 1) return;var selDocRow = this.getDoc().findRow(this.getDoc().getColPos("stampal"), selLastIndex);if (selDocRow > -1) {this.setSelectLast(this.getWinID() + ".tr." + selDocRow.toString());document.getElementById(selLast).className="selected";} else {this.setSelectLast("");}};this.select = function(evt) {try {$($(this.getWinID() + ".TABLEHOLDER")).focus();var compID = xxeGetEventID(evt);var compParts = compID.split(".");var compWinID = compParts[0];var compRow = parseInt(compParts[2]);var trID = compWinID + ".tr." + compRow.toString();var trMent = $($(trID));if (evt.ctrlKey==1) {if (trMent.className == "selected") {trMent.className="even";} else {trMent.className="selected";}this.setSelectLast(trID);return false;}if (evt.shiftKey==1) {if (selLast == "") {for (var i=0; i<=compRow; i++) {document.getElementById(compWinID + ".tr." +i.toString()).className="selected";}this.setSelectLast(trID);return false;}var selParts = selLast.split(".");var selRow = parseInt(selParts[2]);if (selRow < compRow) {for (var i=selRow; i<=compRow; i++) {document.getElementById(compWinID + ".tr." +i.toString()).className="selected";}this.setSelectLast(trID);return false;}return false;}var theClassName = "even";var oldBodyMent = $($(this.getWinID() + ".BODY"));var trs = oldBodyMent.getElementsByTagName("TR");for (var i=0; i<trs.length; i++) {trs[i].className = theClassName;}trMent.className="selected";this.setSelectLast(trID);selTo = compRow;mouseselecting = true;return false;} catch (e) {comExceptionCatch("JJS00722", e);}};this.rowmouseover = function(event) {if (!mouseselecting) return false;var compID = xxeGetEventID(event);var toRow = parseInt(compID.split(".")[2]);var startRow = parseInt(selLast.split(".")[2]);if (toRow == selTo) return false;var loopTo = toRow;if (selTo > toRow) loopTo = selTo;var preID = this.getWinID() + ".tr.";for (var i=startRow+1; i<=loopTo; i++) {if (i <= toRow) {document.getElementById(preID +i).className="selected";} else {document.getElementById(preID +i).className="even";}}selTo = toRow;return false;};this.rowmouseup = function(event) {mouseselecting = false;return false;};this.sort = function(event) {try {var compID = xxeGetEventID(event);var compParts = compID.split(".");var compWinID = compParts[0];var compType = compParts[1];var compField = compParts[2];var pageDef = this.getParm("PAGEDEF");if (pageDef == null) {comExceptTrace("JJS00723 windef " + this.getWinID() + " missing page definition");return true;}var pageDoc = pageDef.getDoc();var curSort = pageDoc.getValue(0, "sort");if (event.ctrlKey==1) {var curSortFields = curSort.split(",");var curSortPos = -1;if (curSort.length > 0) {for (var i=0 ;i<curSortFields.length; i++) {var curSortField = curSortFields[i].split(" ");if (curSortField[0] == compField) {curSortPos = i;break;}}}if (curSortPos < 0) {if (curSort.length < 1) {pageDoc.setValue(0, "sort", compField);} else {pageDoc.setValue(0, "sort", curSort + "," + compField);}} else {if (curSortFields[i].indexOf(" DESC") > -1) {curSortFields[i] = compField;} else {curSortFields[i] = compField + " DESC";}var newSort = curSortFields.toString();pageDoc.setValue(0, "sort", newSort);}} else {if (curSort.indexOf(",") > -1) {pageDoc.setValue(0, "sort", compField);} else {if (curSort.split(" ")[0] == compField) {if (curSort.indexOf(" DESC") > -1) {pageDoc.setValue(0, "sort", compField);} else {pageDoc.setValue(0, "sort", compField  + " DESC");}} else {pageDoc.setValue(0, "sort", compField);}}}this.setSortHeaders(pageDoc);if (pageDoc.getValue(0, "sort").split(",").length == 1) {this.getForm().setFormResp(comApprovedResp("JJS00724", "Tip: For multi sort, hold down the control key and click another column header"));} else {this.getForm().setFormResp(comApprovedResp("JJS00725", ""));}var dssMode = pageDoc.getValue(0, "dssMode");if (dssMode == "LOCAL") {this.getDoc().sort(pageDoc.getValue(0, "sort"));this.xwbDoc2Win();return false;} else if (dssMode == "SERVER") {try {this.refresh();} catch (e) {}return false;} else {comDefaultSysError("JJS00726", "invalid dssMode " + dssMode);return false;}} catch (e) {comExceptionCatch("JJS00727", "sort exception: " + e);}};this.getSelectedRows = function() {var selectedRows = new Array();var trID = "";var wid = this.getWinID();for (var row=0; row<selMax; row++) {trID = wid + ".tr." + row;if (document.getElementById(trID).className == "selected") {selectedRows.push(row);}}return selectedRows;};this.clearWinEdits = function() {return true;};this.xwbWin2Doc = function() {return true;};this.applyWinEdits = function() {return true;};this.getWinID = function() {return superDef.getWinID();};this.getWinName = function() {return superDef.getWinName();};this.getWinType = function() {return superDef.getWinType();};this.getForm = function() {return superDef.getForm();};this.setForm = function(form) {return superDef.setForm(form);};this.setUserDef = function(uDef) {return superDef.setUserDef(uDef);};this.getUserDef = function() {return superDef.getUserDef();};this.initUserDef = function(defaultUdefFunc) {return superDef.initUserDef(defaultUdefFunc);};this.getDoc = function() {return superDef.getDoc();};this.setDoc = function(doc) {return superDef.setDoc(doc);};this.setModal = function(tfVal) {return superDef.setModal(tfVal);};this.isModal = function() {return superDef.isModal();};this.addComp = function(compID, compType, displayType, fieldName, formatter, eventType, eventHandler, displayName, width, height) {return superDef.addComp(compID, compType, displayType, fieldName, formatter, eventType, eventHandler, displayName, width, height);};this.removeComp = function(col) {return superDef.removeComp(col);};this.getCompCount = function() {return superDef.getCompCount();};this.getCompID = function(col) {return superDef.getCompID(col);};this.getColbyCompID = function(compID) {return superDef.getColbyCompID(compID);};this.getColbyFieldName = function(fieldName) {return superDef.getColbyFieldName(fieldName);};this.getCompType = function(col) {return superDef.getCompType(col);};this.getDisplayType = function(col) {return superDef.getDisplayType(col);};this.getFieldName = function(col) {return superDef.getFieldName(col);};this.getFormatter = function(col) {return superDef.getFormatter(col);};this.getEventType = function(col) {return superDef.getEventType(col);};this.getEventHandler = function(col) {return superDef.getEventHandler(col);};this.show = function() {return superDef.show();};this.addParm = function(parmKey, parmValue) {return superDef.addParm(parmKey, parmValue);};this.getParm = function(parmKey) {return superDef.getParm(parmKey);};this.getDisplayName = function(col) {return superDef.getDisplayName(col);};this.getWidth = function(col) {return superDef.getWidth(col);};this.getHeight = function(col) {return superDef.getHeight(col);};}function xxWinDefV2Page(listDef, winID, winName, refreshID, refreshFunc) {var superDef = new xxWinDefEdit(winID, winName, "PAGE");listDef.addParm("PAGEDEF", this);superDef.addParm("REFRESHID", refreshID);superDef.addParm("REFRESHFUNC", refreshFunc);this.getDoc = function() {var dataDoc = superDef.getDoc();if (dataDoc != null) return dataDoc;var dataDoc = new xxDataDoc("PageDO", "SINGLE");dataDoc.addField("pageCurrent", false, null);dataDoc.addField("pageTotal", false, null);dataDoc.addField("pageRecCount", false, null);dataDoc.addField("pageSize", false, null);dataDoc.addField("sort", false, null);dataDoc.addField("subset", false, null);dataDoc.addField("dssMode", false, null);dataDoc.addRow();dataDoc.setValue(0, "pageCurrent", "1");dataDoc.setValue(0, "pageTotal", "1");dataDoc.setValue(0, "pageRecCount", "-1");dataDoc.setValue(0, "pageSize", "200");dataDoc.setValue(0, "subset", "");dataDoc.setValue(0, "sort", "");dataDoc.setValue(0, "dssMode", "");superDef.setDoc(dataDoc);return dataDoc;};this.setSubsetFromArray = function(subList) {var subStr = "";var pageDoc = this.getDoc();if (subList == null || subList.length < 1) {pageDoc.setValue(0, "subset", subStr);return true;}for (var i=0; i<subList.length; i++) {subStr = subStr + "<" + subList[i][0] + " operator=\"EQ\">" + subList[i][2] + "</" + subList[i][0] + ">";}pageDoc.setValue(0, "subset", subStr);return true;};this.clearWinEdits = function() {return true;};this.xwbDoc2Win = function() {return superDef.xwbDoc2Win();};this.xwbWin2Doc = function() {return superDef.xwbWin2Doc();};this.registerTriggers = function() {return superDef.registerTriggers();};this.registerListeners = function() {return superDef.registerListeners();};this.trashMan = function() {superDef.trashMan();};this.applyWinEdits = function() {return true;};this.getWinID = function() {return superDef.getWinID();};this.getWinName = function() {return superDef.getWinName();};this.getWinType = function() {return superDef.getWinType();};this.getForm = function() {return superDef.getForm();};this.setForm = function(form) {return superDef.setForm(form);};this.setDoc = function(doc) {return superDef.setDoc(doc);};this.setModal = function(tfVal) {return superDef.setModal(tfVal);};this.isModal = function() {return superDef.isModal();};this.addComp = function(compID, compType, displayType, fieldName, formatter, eventType, eventHandler) {return superDef.addComp(compID, compType, displayType, fieldName, formatter, eventType, eventHandler);};this.removeComp = function(col) {return superDef.removeComp(col);};this.getCompCount = function() {return superDef.getCompCount();};this.getCompID = function(col) {return superDef.getCompID(col);};this.getColbyCompID = function(compID) {return superDef.getColbyCompID(compID);};this.getCompType = function(col) {return superDef.getCompType(col);};this.getDisplayType = function(col) {return superDef.getDisplayType(col);};this.getFieldName = function(col) {return superDef.getFieldName(col);};this.getFormatter = function(col) {return superDef.getFormatter(col);};this.getEventType = function(col) {return superDef.getEventType(col);};this.getEventHandler = function(col) {return superDef.getEventHandler(col);};this.show = function() {return superDef.show();};this.addParm = function(parmKey, parmValue) {return superDef.addParm(parmKey, parmValue);};this.getParm = function(parmKey) {return superDef.getParm(parmKey);};}function peV3ListWindowSizer(winID, nWidth, nHeight) {if (nWidth > -1) {var testWidth = nWidth + 18;$($(winID + '.TABLEHOLDER')).setStyle({width: testWidth + 'px'});$($(winID + '.TABLEHOLDERH')).setStyle({width: nWidth + 'px'});var cWidth = nWidth + 33;$($('content')).setStyle({width: cWidth + 'px'});}if (nHeight > -1) {$($(winID + '.TABLEHOLDER')).setStyle({height: nHeight + 'px'});var cHeight = nHeight + 161;$($('content')).setStyle({height: cHeight + 'px'});}}function xxWinDefV3List(winID, winName) {var superDef = new xxWinDef(winID, winName, "LIST");var initialized = false;var indexField = "id";var selLast = "";var selLastIndex = "";var selTo = "";var selMax = 0;var subList = null;var mouseselecting = false;var emptyRow = null;this.setIndexField = function(fieldName) {indexField = fieldName;};this.reInit = function() {initialized = false;};this.initTemplate = function() {if (initialized) return true;initialized = true;var uDef = this.getUserDef();var uDefFldDoc = uDef.getUserFldDoc();uDef.getWinSizer()(this.getWinID(), uDef.getWinWidth(), uDef.getWinHeight());if ($($(this.getWinID() + ".tr.HEADER")) != null) $($(this.getWinID() + ".tr.HEADER")).remove();if ($($(this.getWinID() + "SUBROW")) != null) $($(this.getWinID() + "SUBROW")).remove();if (emptyRow == null) {emptyRow = $($(this.getWinID() + ".EMPTY")).remove();if (emptyRow != null) emptyRow.className = "empty";}var tabWidth = 0;var subWidth = 0;for (var compCol=0; compCol<uDefFldDoc.getRowCount(); compCol++) {tabWidth = tabWidth + parseInt(uDefFldDoc.getValue(compCol,"fldWidth"));subWidth = subWidth + parseInt(uDefFldDoc.getValue(compCol,"fldWidth") + 1);}$($(this.getWinID() +".TABLEH")).setStyle({width: tabWidth + 'px'});$($(this.getWinID() +".TABLE")).setStyle({width: tabWidth + 'px'});var fieldName = null;var trDiv = new Element('tr', {'id': this.getWinID() + ".tr.HEADER"});var trbDiv = new Element('tr', {'id': this.getWinID() + ".trb.HEADER"});var subrowMent = new Element('div', {'id': this.getWinID() + "SUBROW", 'class': 'subset'});subrowMent.setStyle({width: subWidth + 'px'});for (var compCol=0; compCol<uDefFldDoc.getRowCount(); compCol++) {var compWidth = parseInt(uDefFldDoc.getValue(compCol,"fldWidth"));fieldName = uDefFldDoc.getValue(compCol,"fieldName");var thbDiv = new Element('th', {'id': this.getWinID() + ".thb." + fieldName});thbDiv.setStyle({width: compWidth -1 + 'px'});trbDiv.appendChild(thbDiv);var thDiv = new Element('th', {'id': this.getWinID() + ".th." + fieldName});thDiv.setStyle({width: compWidth -1 + 'px'});var spanID = this.getWinID() + ".thval." + fieldName;var spanMent = new Element('span', {'id': spanID});spanMent.update(uDefFldDoc.getValue(compCol,"displayName"));spanMent.onmousedown = xxeFireMouseDown;thDiv.appendChild(spanMent);trDiv.appendChild(thDiv);var subinputMent = new Element('input', {'id': this.getWinID() + ".subin." + fieldName, 'type': 'text', 'class': 'hide'});subinputMent.setStyle({width: compWidth -3 + 'px'});subinputMent.onblur = xxeFireSubOnBlur;subrowMent.appendChild(subinputMent);}var headerCompID = this.getWinID() + ".HEADERB";$($(headerCompID)).appendChild(trbDiv);var headerCompID = this.getWinID() + ".HEADER";$($(headerCompID)).appendChild(trDiv);$($(this.getWinID() + ".SUBHOLDER")).appendChild(subrowMent);var pageDef = this.getParm("PAGEDEF");var pageDoc = pageDef.getDoc();pageDef.xwbDoc2Win();this.setSortHeaders(pageDoc);subList = this.subListFromString(pageDoc.getValue(0,"subset"));if (subList != null) {this.setWinSubset();try {document.getElementById(this.getParm("FILTERBUTTON")).className = "pressed"; } catch (e) {}this.setSubsetOn();}return true;};this.setColumnName = function(fieldName, displayName) {var spanID = this.getWinID() + ".thval." + fieldName;$($(spanID)).update(displayName);};this.setSortHeaders = function(pageDoc) {var sortFields = pageDoc.getValue(0, "sort").split(",");var uDef = this.getUserDef().getUserFldDoc();var sortMent = null;for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");var thID = this.getWinID() + ".th." + fieldName;var spanID = this.getWinID() + ".thval." + fieldName;var sortID = this.getWinID() + ".thsrt." + fieldName;sortMent = $($(sortID));if (sortMent != null) {sortMent.onmousedown = null;sortMent.remove();}for (var i=0; i<sortFields.length; i++) {if (sortFields[i].indexOf(fieldName) == 0) {if (sortFields[i].indexOf(" DESC") > -1) {sortMent = new Element('img', {'id': sortID, 'src': 'graphics/sortDesc.gif', 'width':'10', 'height':'12', 'alt':'Sort', 'title':'Sort'});} else {sortMent = new Element('img', {'id': sortID, 'src': 'graphics/sortAsc.gif', 'width':'10', 'height':'12', 'alt':'Sort', 'title':'Sort'});}sortMent.onmousedown = xxeFireMouseDown;$($(thID)).insertBefore(sortMent, $($(spanID)));}}}};this.addColumn = function(fieldName, displayName, widthParm) {this.reInit();this.xwbDoc2Win();return true;};this.moveColumn = function(fieldName, direction) {this.reInit();this.xwbDoc2Win();return true;};this.deleteColumn = function(fieldName, fieldCol) {this.reInit();this.xwbDoc2Win();return true;};this.setColumnWidth = function(fieldName, width) {var thID = this.getWinID() + ".th." + fieldName;var oldWidth = parseInt($($(thID)).getStyle('width'));var newWidth = parseInt(width);var dif = newWidth - oldWidth;var oldTable = parseInt($($(this.getWinID() +".TABLE")).getStyle('width'));var newTable = oldTable + dif;$($(this.getWinID() +".TABLEH")).setStyle({width: newTable + 'px'});$($(thID)).setStyle({width: width + 'px'});$($(this.getWinID() +".TABLE")).setStyle({width: newTable + 'px'});$($(this.getWinID() + ".thb." + fieldName)).setStyle({width: width + 'px'});$($(this.getWinID() + "SUBROW")).setStyle({width: newTable + 'px'});$($(this.getWinID() + ".subin." + fieldName)).setStyle({width: width -1 + 'px'});};this.getRequestXML = function(action) {var dataDoc = this.getDoc();var pageDef = this.getParm("PAGEDEF");var pageDoc = pageDef.getDoc();var xmlDoc= "<" + action + ">\n";xmlDoc= xmlDoc + "<FieldList>" + dataDoc.getFieldListComma() + "</FieldList>\n";xmlDoc= xmlDoc + "<PageSize>" + pageDoc.getValue(0, "pageSize") + "</PageSize>\n";xmlDoc= xmlDoc + "<Page>" + pageDoc.getValue(0, "pageCurrent") + "</Page>\n";xmlDoc= xmlDoc + "<Sort>" + pageDoc.getValue(0, "sort") + "</Sort>\n";var subsetXML = this.subXMLFromString(pageDoc.getValue(0, "subset"));if (pageDoc.getValue(0, "dssMode") == "LOCAL") {xmlDoc= xmlDoc + "<Subset></Subset>\n";} else {xmlDoc= xmlDoc + "<Subset>" +  subsetXML + "</Subset>\n";}xmlDoc = xmlDoc + "</" + action + ">\n";return xmlDoc;};this.xwbDoc2Win = function() {try {this.initTemplate();this.getParm("PAGEDEF").saveToCookie();var tableMent = $($(this.getWinID() + ".TABLE"));var oldBodyMent = $($(this.getWinID() + ".BODY"));var newBodyMent = oldBodyMent.cloneNode(false);var trs = oldBodyMent.getElementsByTagName("TR");for (var i=0; i<trs.length; i++) {trs[i].onmousedown = null;trs[i].onmouseover = null;trs[i].onmouseup = null;trs[i].ondblclick = null;}var uDef = this.getUserDef().getUserFldDoc();var udefXwdef = new Array();for (var col=0; col < uDef.getRowCount(); col++) {var wdefRow = this.getColbyFieldName(uDef.getValue(col, "fieldName"));udefXwdef.push(wdefRow);}var dataDoc = this.getDoc();selMax = dataDoc.getRowCount();if (selMax < 1) {if (emptyRow != null) {if ($($(this.getWinID() + ".SUBHOLDER")).className == "off") {newBodyMent.appendChild(emptyRow);emptyRow.className = "empty";}}tableMent.removeChild(oldBodyMent);tableMent.appendChild(newBodyMent);return;}var trMent = null;var tdMent = null;var spanMent = null;var fieldName = null;var formatter = null;var docVal = null;for (var row=0; row < dataDoc.getRowCount(); row++) {trMent = new Element('tr', {'id': this.getWinID() + ".tr." + row});for (var col=0; col < uDef.getRowCount(); col++) {tdMent = new Element('td', {'id': this.getWinID() + ".td." + row + "." + col});spanMent = new Element('span', {'id': this.getWinID() + ".data." +  row + "." + col});fieldName = uDef.getValue(col, "fieldName");formatter = this.getFormatter(udefXwdef[col]);if (formatter == null) {docVal = dataDoc.getValue(row, fieldName);} else {docVal = formatter(dataDoc, row, dataDoc.getColPos(fieldName));}spanMent.update(docVal);tdMent.appendChild(spanMent);trMent.appendChild(tdMent);trMent.onmousedown = xxeFireTRMouseDown;trMent.onmouseover = xxeFireTRMouseOver;trMent.onmouseup = xxeFireTRMouseUp;trMent.ondblclick = xxeFireTRMouseDblClick;}newBodyMent.appendChild(trMent);}tableMent.removeChild(oldBodyMent);tableMent.appendChild(newBodyMent);trMent = null;tdMent = null;spanMent = null;oldBodyMent = null;newBodyMent = null;tableMent = null;this.reSelect();return;} catch (e) {comExceptionCatch("JJS00064", e);return;}};this.xwbRow2Win = function(row) {try {return true;} catch (e) {comExceptionCatch("JJS00715", e);return true;}};this.setSubsetOn = function() {var subHolder = $($(this.getWinID() + ".SUBHOLDER"));subHolder.className = "on";var uDef = this.getUserDef().getUserFldDoc();var subsetMent = null;for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");var thID = this.getWinID() + ".th." + fieldName;var subID = this.getWinID() + ".thsub." + fieldName;subsetMent = $($(subID));if (subsetMent != null) {subsetMent.onmousedown = null;subsetMent.remove();}subsetMent = new Element('img', {'id': subID, 'src': 'graphics/filter_handle.gif', 'width':'12', 'height':'16', 'alt':'Filter', 'title':'Filter'});subsetMent.onmousedown = xxeFireSubMouseDown;$($(thID)).insert({'top': subsetMent});}$($(this.getWinID() +".TABLEHOLDERH")).setStyle({height: '36px'});return true;};this.setSubsetOff = function() {$($(this.getWinID() +".TABLEHOLDERH")).setStyle({height: '18px'});var subHolder = $($(this.getWinID() + ".SUBHOLDER"));subHolder.className = "off";var uDef = this.getUserDef().getUserFldDoc();var subsetMent = null;for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");var subID = this.getWinID() + ".thsub." + fieldName;subsetMent = $($(subID));if (subsetMent != null) {subsetMent.onmousedown = null;subsetMent.remove();}}subList = null;this.setWinSubset();this.applySubset();return true;};this.getWinSubset = function() {var uDef = this.getUserDef().getUserFldDoc();var subinID = null;var subinMent = null;var subColPos = -1;var subVal = null;subList = new Array();var listDoc = this.getDoc();var subDoc = listDoc.copyStructure();var defaultSubOp = this.getParm("SUBSETOPERATOR");if (defaultSubOp == null) defaultSubOp = "EQ";for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");subinID = this.getWinID() + ".subin." + fieldName;subinMent = $($(subinID));if (subinMent.className == 'on') {subColPos = listDoc.getColPos(fieldName);subVal = subinMent.value;if (listDoc.getValidator(subColPos) != null) {subDoc.setColValue(0, subColPos, subVal);listDoc.getValidator(subColPos)(subDoc, 0 , subColPos);subVal = subDoc.getColValue(0, subColPos);}subList.push(new Array(fieldName, subColPos, subVal, defaultSubOp));}}if (subList.length < 1) subList = null;var pageDef = this.getParm("PAGEDEF");var pageDoc = pageDef.getDoc();pageDoc.setValue(0, "subset", this.subListToString(subList));};this.setWinSubset = function() {var subinMent = null;var uDef = this.getUserDef().getUserFldDoc();for (var compCol=0; compCol<uDef.getRowCount(); compCol++) {var fieldName = uDef.getValue(compCol,"fieldName");subinMent = $($(this.getWinID() + ".subin." + fieldName));if (subinMent.className == 'on') subinMent.className = "hide";subinMent.value = "";}if (subList == null || subList.length < 1) return true;for (var i=0; i<subList.length; i++) {subinMent = $($(this.getWinID() + ".subin." + subList[i][0]));subinMent.value = subList[i][2];subinMent.className = 'on';}return true;};this.subListToString = function(subList) {var subListStr = "";if (subList == null || subList.length < 1) return subListStr;subListStr = subList[0][0] + "~" + subList[0][3] + "~" + subList[0][2];for (var i=1; i<subList.length; i++) {subListStr = subListStr + "," + subList[i][0] + "~" + subList[i][3] + "~" + subList[i][2];}return subListStr;};this.subListFromString = function(subListStr) {if (subListStr == null || subListStr.length < 1) return null;var subArray = new Array();var listDoc = this.getDoc();var subColPos = -1;var rows = subListStr.split(",");if (rows.length < 1) return null;for (var row=0; row<rows.length; row++) {var cols = rows[row].split("~");if (cols.length != 3) return null;subColPos = listDoc.getColPos(cols[0]);if (subColPos < 0) continue;subArray.push(new Array(cols[0], subColPos, cols[2], cols[1]));}return subArray;};this.subXMLFromString = function(subListStr) {var subXML = "";if (subListStr == null || subListStr.length < 1) return subXML;var rows = subListStr.split(",");if (rows.length < 1) return null;for (var row=0; row<rows.length; row++) {var cols = rows[row].split("~");if (cols.length != 3) continue;subXML = subXML + "<" + cols[0] + " operator=\"" + cols[1] + "\">" + cols[2] + "</" + cols[0] + ">";}return subXML;};this.applySubset = function() {this.getWinSubset();var pageDef = this.getParm("PAGEDEF");var pageDoc = pageDef.getDoc();var dssMode = pageDoc.getValue(0, "dssMode");if (dssMode == "LOCAL") {this.getDoc().setSubset(subList);this.xwbDoc2Win();return true;} else if (dssMode == "SERVER") {this.refresh();return true;} else {comDefaultSysError("JJS00716", "invalid dssMode " + dssMode);return false;}};this.refreshAttn = function() {try {var pageDef = this.getParm("PAGEDEF");var refreshID = pageDef.getParm("REFRESHID");var refreshMent = $($(refreshID));refreshMent.className = "attn";refreshMent.setStyle({'opacity': '1.0'});Effect.Pulsate(refreshMent, { pulses: 2, duration: 1.0 });} catch (e) {}};this.refresh = function() {try {var pageDef = this.getParm("PAGEDEF");pageDef.getParm("REFRESHFUNC")();} catch (e) {}};this.subset = function(event) {try {var compID = xxeGetEventID(event);var compParts = compID.split(".");var compWinID = compParts[0];var compType = compParts[1];var compField = compParts[2];subinID = this.getWinID() + ".subin." + compField;var subinMent = $($(subinID));if (subinMent.className == "on") {subinMent.className = "hide";subinMent.value = "";} else {subinMent.className = "on";if (selLast.length > 0) {var selParts = selLast.split(".");var selRow = parseInt(selParts[2]);var subVal = this.getDoc().getValue(selRow, compField);var formatter = this.getFormatter(this.getColbyFieldName(compField));if (formatter != null) {subVal = formatter(this.getDoc(), selRow, this.getDoc().getColPos(compField));}subinMent.value = subVal;} else {this.getForm().setFormResp(comApprovedResp("JJS00717", "Tip: If you select a row before pressing the subset, the subset value will default to the rows value"));if (this.getDoc().getRowCount() > 0) {subinMent.value = this.getDoc().getValue(0, compField);} else {subinMent.value = "";}}}this.applySubset();return false;} catch (e) {comExceptTrace("JJS00718 " + e);}};this.subsetonblur = function(event) {try {var compID = xxeGetEventID(event);var compParts = compID.split(".");var compField = compParts[2];subinID = this.getWinID() + ".subin." + compField;var subinMent = $($(subinID));if (subinMent.className == "hide") return true;this.applySubset();return true;} catch (e) {comExceptTrace("JJS00719 " + e);}};this.trashMan = function() {document.onkeypress = null;document.onmouseup = null;try {document.onselectstart = null;} catch (e) {}var oldBodyMent = $($(this.getWinID() + ".BODY"));var trs = oldBodyMent.getElementsByTagName("TR");for (var i=0; i<trs.length; i++) {trs[i].onmousedown = null;trs[i].onmouseover = null;trs[i].onmouseup = null;trs[i].ondblclick = null;}trs = null;var uDef = this.getUserDef();var uDefFldDoc = uDef.getUserFldDoc();var fieldName = null;var thID = null;var workID = null;var workMent = null;for (var compCol=0; compCol<uDefFldDoc.getRowCount(); compCol++) {fieldName = uDefFldDoc.getValue(compCol,"fieldName");thID = this.getWinID() + ".th." + fieldName;workID = this.getWinID() + ".thval." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onmousedown = null;workID = this.getWinID() + ".thsrt." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onmousedown = null;workID = this.getWinID() + ".thsub." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onmousedown = null;workID = this.getWinID() + ".subin." + fieldName;workMent = $($(workID));if (workMent != null) workMent.onblur = null;}oldBodyMent = null;workID = null;workMent = null;superDef.trashMan();superDef = null;initialized = null;selLast = null;selLastIndex = null;selTo = null;selMax = null;subList = null;mouseselecting = null;emptyRow = null;};this.registerTriggers = function() {document.onkeydown = xxeFireDocKeyDown;document.onmouseup = xxeFireDocMouseUp;document.getElementById(this.getWinID() + ".TABLEHOLDER").onscroll = xxeFireOnScroll;try {document.onselectstart = xxeFireSelectStart;} catch (e) {}return true;};this.registerListeners = function() {var winID = this.getWinID();comWEQ.listen(winID, "*", "onscroll", winID+"onscroll", this, this.onscroll);comWEQ.listen("DOCUMENT", "DOCUMENT", "selectstart", winID+"selectstart", this, this.selectstart);comWEQ.listen("DOCUMENT", "DOCUMENT", "onkeydown", winID+"dockeydown", this, this.docKeyDown);comWEQ.listen(winID, "*", "trmousedown", winID+"RowSelect", this, this.select);comWEQ.listen(winID, "*", "trmouseover", winID+"rowmouseover", this, this.rowmouseover);comWEQ.listen(winID, "*", "trmouseup", winID+"rowmouseup", this, this.rowmouseup);comWEQ.listen(winID, "*", "submousedown", winID+"SubsetClick", this, this.subset);comWEQ.listen(winID, "*", "subsetonblur", winID+"SubsetChange", this, this.subsetonblur);comWEQ.listen(winID, winID + ".thval.*", "onmousedown", winID+"SortClick1", this, this.sort);comWEQ.listen(winID, winID + ".thsrt.*", "onmousedown", winID+"SortClick2", this, this.sort);comWEQ.listen("DOCUMENT", "DOCUMENT", "onmouseup", winID+"onmouseup", this, this.rowmouseup);};this.onscroll = function(evt) {try {var xpos = document.getElementById(this.getWinID() + ".TABLEHOLDER").scrollLeft;document.getElementById(this.getWinID() + ".TABLEHOLDERH").scrollLeft = xpos;return true;} catch (e) {}};this.selectstart = function(evt) {try {var compParts = xxeGetEventID(evt).split(".");if (compParts[0] != this.getWinID()) return true;if (compParts[1] == "td" || compParts[1] == "data") return false;return true;} catch (e) {}};this.docKeyDown = function(evt) {try {var keyName = comKeyName(evt);if (evt.ctrlKey && keyName.toUpperCase() == "A") {return this.ctrlA(evt);}return true;} catch (e) {comExceptionCatch("JJS00720", e);}};this.ctrlA = function(evt) {try {var focNode = this.getElementWithFocus();if (focNode.nodeName.toUpperCase() == "INPUT") return true;var compWinID = this.getWinID();if (focNode.id == this.getWinID() + ".TABLEHOLDER") {for (var i=0; i<selMax; i++) {document.getElementById(compWinID + ".tr." +i).className="selected";}return false;}return false;} catch (e) {comExceptionCatch("JJS00721", e);}};this.getElementWithFocus = function() {var hf;if ( document.activeElement ) hf = document.activeElement;else hf = document.focusNode;return hf;};this.setSelectLast = function(selLastID) {if (selLastID == null || selLastID.length < 1) {selLast = "";selLastIndex = "";return;}var selParts = selLastID.split(".");var selRow = parseInt(selParts[2]);selLast = selLastID;selLastIndex = this.getDoc().getValue(selRow, indexField);return;};this.reSelect = function() {if (selLast == null || selLast.length < 1) return;var selDocRow = this.getDoc().findRow(this.getDoc().getColPos(indexField), selLastIndex);if (selDocRow > -1) {this.setSelectLast(this.getWinID() + ".tr." + selDocRow.toString());document.getElementById(selLast).className="selected";} else {this.setSelectLast("");}};this.select = function(evt) {try {$($(this.getWinID() + ".TABLEHOLDER")).focus();var compID = xxeGetEventID(evt);var compParts = compID.split(".");var compWinID = compParts[0];var compRow = parseInt(compParts[2]);var trID = compWinID + ".tr." + compRow.toString();var trMent = $($(trID));if (evt.ctrlKey==1) {if (trMent.className == "selected") {trMent.className="even";} else {trMent.className="selected";}this.setSelectLast(trID);return false;}if (evt.shiftKey==1) {if (selLast == "") {for (var i=0; i<=compRow; i++) {document.getElementById(compWinID + ".tr." +i.toString()).className="selected";}this.setSelectLast(trID);return false;}var selParts = selLast.split(".");var selRow = parseInt(selParts[2]);if (selRow < compRow) {for (var i=selRow; i<=compRow; i++) {document.getElementById(compWinID + ".tr." +i.toString()).className="selected";}this.setSelectLast(trID);return false;}return false;}var theClassName = "even";var oldBodyMent = $($(this.getWinID() + ".BODY"));var trs = oldBodyMent.getElementsByTagName("TR");for (var i=0; i<trs.length; i++) {trs[i].className = theClassName;}trMent.className="selected";this.setSelectLast(trID);selTo = compRow;mouseselecting = true;return false;} catch (e) {comExceptionCatch("JJS00722", e);}};this.rowmouseover = function(event) {if (!mouseselecting) return false;var compID = xxeGetEventID(event);var toRow = parseInt(compID.split(".")[2]);var startRow = parseInt(selLast.split(".")[2]);if (toRow == selTo) return false;var loopTo = toRow;if (selTo > toRow) loopTo = selTo;var preID = this.getWinID() + ".tr.";for (var i=startRow+1; i<=loopTo; i++) {if (i <= toRow) {document.getElementById(preID +i).className="selected";} else {document.getElementById(preID +i).className="even";}}selTo = toRow;return false;};this.rowmouseup = function(event) {mouseselecting = false;return false;};this.sort = function(event) {try {var compID = xxeGetEventID(event);var compParts = compID.split(".");var compWinID = compParts[0];var compType = compParts[1];var compField = compParts[2];var pageDef = this.getParm("PAGEDEF");if (pageDef == null) {comExceptTrace("JJS00723 windef " + this.getWinID() + " missing page definition");return true;}var pageDoc = pageDef.getDoc();var curSort = pageDoc.getValue(0, "sort");if (event.ctrlKey==1) {var curSortFields = curSort.split(",");var curSortPos = -1;if (curSort.length > 0) {for (var i=0 ;i<curSortFields.length; i++) {var curSortField = curSortFields[i].split(" ");if (curSortField[0] == compField) {curSortPos = i;break;}}}if (curSortPos < 0) {if (curSort.length < 1) {pageDoc.setValue(0, "sort", compField);} else {pageDoc.setValue(0, "sort", curSort + "," + compField);}} else {if (curSortFields[i].indexOf(" DESC") > -1) {curSortFields[i] = compField;} else {curSortFields[i] = compField + " DESC";}var newSort = curSortFields.toString();pageDoc.setValue(0, "sort", newSort);}} else {if (curSort.indexOf(",") > -1) {pageDoc.setValue(0, "sort", compField);} else {if (curSort.split(" ")[0] == compField) {if (curSort.indexOf(" DESC") > -1) {pageDoc.setValue(0, "sort", compField);} else {pageDoc.setValue(0, "sort", compField  + " DESC");}} else {pageDoc.setValue(0, "sort", compField);}}}this.setSortHeaders(pageDoc);if (pageDoc.getValue(0, "sort").split(",").length == 1) {this.getForm().setFormResp(comApprovedResp("JJS00724", "Tip: For multi sort, hold down the control key and click another column header"));} else {this.getForm().setFormResp(comApprovedResp("JJS00725", ""));}var dssMode = pageDoc.getValue(0, "dssMode");if (dssMode == "LOCAL") {this.getDoc().sort(pageDoc.getValue(0, "sort"));this.xwbDoc2Win();return false;} else if (dssMode == "SERVER") {try {this.refresh();} catch (e) {}return false;} else {comDefaultSysError("JJS00726", "invalid dssMode " + dssMode);return false;}} catch (e) {comExceptionCatch("JJS00727", "sort exception: " + e);}};this.getSelectedRows = function() {var selectedRows = new Array();var trID = "";var wid = this.getWinID();for (var row=0; row<selMax; row++) {trID = wid + ".tr." + row;if (document.getElementById(trID).className == "selected") {selectedRows.push(row);}}return selectedRows;};this.clearWinEdits = function() {return true;};this.xwbWin2Doc = function() {return true;};this.applyWinEdits = function() {return true;};this.getWinID = function() {return superDef.getWinID();};this.getWinName = function() {return superDef.getWinName();};this.getWinType = function() {return superDef.getWinType();};this.getForm = function() {return superDef.getForm();};this.setForm = function(form) {return superDef.setForm(form);};this.setUserDef = function(uDef) {return superDef.setUserDef(uDef);};this.getUserDef = function() {return superDef.getUserDef();};this.initUserDef = function(defaultUdefFunc) {return superDef.initUserDef(defaultUdefFunc);};this.getDoc = function() {return superDef.getDoc();};this.setDoc = function(doc) {return superDef.setDoc(doc);};this.setModal = function(tfVal) {return superDef.setModal(tfVal);};this.isModal = function() {return superDef.isModal();};this.addComp = function(compID, compType, displayType, fieldName, formatter, eventType, eventHandler, displayName, width, height) {return superDef.addComp(compID, compType, displayType, fieldName, formatter, eventType, eventHandler, displayName, width, height);};this.removeComp = function(col) {return superDef.removeComp(col);};this.getCompCount = function() {return superDef.getCompCount();};this.getCompID = function(col) {return superDef.getCompID(col);};this.getColbyCompID = function(compID) {return superDef.getColbyCompID(compID);};this.getColbyFieldName = function(fieldName) {return superDef.getColbyFieldName(fieldName);};this.getCompType = function(col) {return superDef.getCompType(col);};this.getDisplayType = function(col) {return superDef.getDisplayType(col);};this.getFieldName = function(col) {return superDef.getFieldName(col);};this.getFormatter = function(col) {return superDef.getFormatter(col);};this.getEventType = function(col) {return superDef.getEventType(col);};this.getEventHandler = function(col) {return superDef.getEventHandler(col);};this.show = function() {return superDef.show();};this.addParm = function(parmKey, parmValue) {return superDef.addParm(parmKey, parmValue);};this.getParm = function(parmKey) {return superDef.getParm(parmKey);};this.getDisplayName = function(col) {return superDef.getDisplayName(col);};this.getWidth = function(col) {return superDef.getWidth(col);};this.getHeight = function(col) {return superDef.getHeight(col);};}function xxWinDefV3Page(listDef, winID, winName, refreshID, refreshFunc) {var superDef = new xxWinDefEdit(winID, winName, "PAGE");listDef.addParm("PAGEDEF", this);superDef.addParm("REFRESHID", refreshID);superDef.addParm("REFRESHFUNC", refreshFunc);this.getDoc = function() {var dataDoc = superDef.getDoc();if (dataDoc != null) return dataDoc;var dataDoc = new xxDataDoc("PageDO", "SINGLE");dataDoc.addField("pageCurrent", false, null);dataDoc.addField("pageTotal", false, null);dataDoc.addField("pageRecCount", false, null);dataDoc.addField("pageSize", false, null);dataDoc.addField("sort", false, null);dataDoc.addField("subset", false, null);dataDoc.addField("dssMode", false, null);dataDoc.addRow();if (!this.loadFromCookie(dataDoc)) {dataDoc.setValue(0, "pageCurrent", "1");dataDoc.setValue(0, "pageTotal", "1");dataDoc.setValue(0, "pageRecCount", "-1");dataDoc.setValue(0, "pageSize", "200");dataDoc.setValue(0, "subset", "");dataDoc.setValue(0, "sort", "");dataDoc.setValue(0, "dssMode", "SERVER");}superDef.setDoc(dataDoc);return dataDoc;};this.loadFromCookie = function(dataDoc) {try {var cookData = comGetCookie("xxWinDefV3Page");if (cookData == null || cookData.length < 1) return false;var winStateList = cookData.split("^W");var winStateRow = this.getCookMetaRow(winStateList);if (winStateRow < 0) return false;var winDefParts = winStateList[winStateRow].split("^D");dataDoc.loadFromCookie(winDefParts[1]);var dssMode = dataDoc.getValue(0, "dssMode");if (dssMode != "LOCAL" && dssMode != "SERVER") dataDoc.setValue(0, "dssMode", "SERVER");return true;} catch (e) {return false;}};this.saveToCookie = function() {var pageDoc = this.getDoc();var docCookData = this.getWinID() + "^D" + pageDoc.getAsCookie();var winStateList = null;var winStateRow = -1;var newCookData = "";var cookData = comGetCookie("xxWinDefV3Page");if (cookData == null || cookData.length < 1) {newCookData = docCookData;} else {winStateList = cookData.split("^W");winStateRow = this.getCookMetaRow(winStateList);if (winStateRow < 0) {newCookData = cookData + "^W" + docCookData;} else {winStateList[winStateRow] = docCookData;newCookData = winStateList[0];for (var i=1; i<winStateList.length; i++) {newCookData = newCookData + "^W" + winStateList[i];}}}comSetCookie("xxWinDefV3Page", newCookData, 365);};this.getCookMetaRow = function(winStateList) {var pageWinID = this.getWinID();for (var i=0; i<winStateList.length; i++) {if (winStateList[i].indexOf(pageWinID) == 0) return i;}return -1;};this.clearWinEdits = function() {return true;};this.xwbDoc2Win = function() {return superDef.xwbDoc2Win();};this.xwbWin2Doc = function() {return superDef.xwbWin2Doc();};this.registerTriggers = function() {return superDef.registerTriggers();};this.registerListeners = function() {return superDef.registerListeners();};this.trashMan = function() {superDef.trashMan();};this.applyWinEdits = function() {return true;};this.getWinID = function() {return superDef.getWinID();};this.getWinName = function() {return superDef.getWinName();};this.getWinType = function() {return superDef.getWinType();};this.getForm = function() {return superDef.getForm();};this.setForm = function(form) {return superDef.setForm(form);};this.setDoc = function(doc) {return superDef.setDoc(doc);};this.setModal = function(tfVal) {return superDef.setModal(tfVal);};this.isModal = function() {return superDef.isModal();};this.addComp = function(compID, compType, displayType, fieldName, formatter, eventType, eventHandler) {return superDef.addComp(compID, compType, displayType, fieldName, formatter, eventType, eventHandler);};this.removeComp = function(col) {return superDef.removeComp(col);};this.getCompCount = function() {return superDef.getCompCount();};this.getCompID = function(col) {return superDef.getCompID(col);};this.getColbyCompID = function(compID) {return superDef.getColbyCompID(compID);};this.getCompType = function(col) {return superDef.getCompType(col);};this.getDisplayType = function(col) {return superDef.getDisplayType(col);};this.getFieldName = function(col) {return superDef.getFieldName(col);};this.getFormatter = function(col) {return superDef.getFormatter(col);};this.getEventType = function(col) {return superDef.getEventType(col);};this.getEventHandler = function(col) {return superDef.getEventHandler(col);};this.show = function() {return superDef.show();};this.addParm = function(parmKey, parmValue) {return superDef.addParm(parmKey, parmValue);};this.getParm = function(parmKey) {return superDef.getParm(parmKey);};}function xxDataDoc(docName) {this.docName = docName;var dmFieldName = 0;var dmRequired = 1;var dmValidator = 2;var dmFormatter = 3;var metaDoc = new Array();var dataDoc = null;var subsetList = null;var subsetMap = null;this.copy = function() {var copyDef = new xxDataDoc(this.docName);copyDef.setMeta(metaDoc.slice());copyDef.setDataDoc(dataDoc.slice());return copyDef;};this.copyStructure = function() {var copyDef = new xxDataDoc(this.docName);copyDef.setMeta(metaDoc.slice());copyDef.initOne();return copyDef;};this.addField = function(fieldName, required, validator, formatter) {var row = new Array(fieldName, required, validator, formatter);metaDoc.push(row);};this.setMeta = function(meta) {metaDoc = meta;};this.getValidator = function(col) {return metaDoc[col][dmValidator];};this.getColCount = function() {return metaDoc.length;};this.getColName = function(col) {try {return metaDoc[col][dmFieldName];} catch (e) {alert("Unable to find column " + col);}};this.getColPos = function(fieldName) {for (var dmRow=0; dmRow<metaDoc.length; dmRow++) {if (metaDoc[dmRow][dmFieldName] == fieldName) return dmRow;}return -1;};this.getFieldListComma = function() {var out = metaDoc[0][dmFieldName];for (var dmRow=1; dmRow<metaDoc.length; dmRow++) {out = out + "," + metaDoc[dmRow][dmFieldName];}return out;};this.setFromParms = function(row, parmList) {if (this.getRowCount() < row+1) {comSysError(new comErrorResp("JJS00036",doName + " not found in response"));return false;}var keys = parmList.getKeys();for (var parmPos=0; parmPos<keys.length; parmPos++) {if (this.getColPos(keys[parmPos]) > -1) {this.setValue(row, keys[parmPos], parmList.getParm(keys[parmPos]));}}return true;};this.getAsHiddenInput = function(row) {var out = "";for (var col=0; col<metaDoc.length; col++) {out = out + "<input type=\"hidden\" name=\"" + metaDoc[col][dmFieldName] + "\" value=\"" + dataDoc[row][col].value + "\"/>\n";}return out;};this.getField = function(row, fieldName) {try {var col = this.getColPos(fieldName);if (subsetMap != null) {return dataDoc[subsetMap[row]][col];} else {return dataDoc[row][col];}} catch (e) {comExceptTrace("JJS00695 Unable to get field for fieldName " + fieldName + ". " + e);}};this.getColField = function(row, col) {try {if (subsetMap != null) {return dataDoc[subsetMap[row]][col];} else {return dataDoc[row][col];}} catch (e) {comExceptTrace("JJS00696 Unable to get field for column " + col + ". " + e);}};this.getValueEncode = function(row, fieldName) {try {var val = this.getValue(row, fieldName);val = this.encodeForXML(val);return val;} catch (e) {comExceptTrace("JJS00697 Unable to encode field " + fieldName + ". " + e);}};this.encodeForXML = function(val) {if (val.length < 1) return val;val = val.replace(/\&/g,'&amp;');val = val.replace(/</g,'&lt;');val = val.replace(/>/g,'&gt;');val = val.replace(/"/g,'&quot;');val = val.replace(/'/g,'&apos;');return val;};this.getValue = function(rowIn, fieldName) {try {var row = rowIn;if (subsetMap != null) row = subsetMap[row];for (var dmCol=0; dmCol<metaDoc.length; dmCol++) {if (metaDoc[dmCol][dmFieldName] == fieldName) return dataDoc[row][dmCol].value;}comExceptTrace("JJS00039 Error getting value for field " + fieldName);throw "JJS00039 Error getting value for field " + fieldName;} catch (e) {comExceptTrace("JJS00040 Error getting value for field " + fieldName);throw "JJS00040 Error getting value for field " + fieldName + ": " + e;}};this.getColValue = function(row, col) {try {if (subsetMap != null) {return dataDoc[subsetMap[row]][col].value;} else {return dataDoc[row][col].value;}} catch (e) {comExceptTrace("JJS00698 Error getting value for col " + col + ". " + e);}};this.setValue = function(row, fieldName, value) {try {value = value.replace(/^\s*/, "").replace(/\s*$/, "");if (subsetMap != null) {dataDoc[subsetMap[row]][this.getColPos(fieldName)].value = value;} else {dataDoc[row][this.getColPos(fieldName)].value = value;}} catch (e) {comExceptTrace("Unable to set value for " + fieldName + ". " + e);}};this.setColValue = function(row, col, value) {try {value = value.replace(/^\s*/, "").replace(/\s*$/, "");if (subsetMap != null) {dataDoc[subsetMap[row]][col].value = value;} else {dataDoc[row][col].value = value;}} catch (e) {comExceptTrace("Unable to set col value " + col + ". " + e);}};this.checkDocChars = function(disallowed) {try {var passedEdits = true;if (dataDoc == null) this.init();for (var row=0; row<dataDoc.length; row++) {for (var col=0; col<metaDoc.length; col++) {if (!this.checkChars(row, col, disallowed)) passedEdits = false;}}return passedEdits;} catch (e) {comExceptTrace("JPE01174 Unable to check doc chars " + this.docName + ". " + e);return false;}};this.checkChars = function(row, col, disallowed) {try {var val = this.getColValue(row, col);if (val.length < 1) return true;var ch = null;var replacements = false;var newVal = "";for (var i=0; i<val.length; i++) {ch = val.charAt(i);if (ch == " ") {newVal = newVal + ch;continue;}if (!xxfldTypableChar(ch)) {replacements = true;continue;}if (disallowed.indexOf(ch,0) > -1) {replacements = true;continue;}newVal = newVal + ch;}if (replacements) {this.setColValue(row, col, newVal);return false;} else {return true;}} catch (e) {comExceptTrace("JPE01175 checkChars error in doc " + this.docName + ". " + e);return false;}};this.editDoc = function() {try {var passedEdits = true;if (dataDoc == null) this.init();for (var row=0; row<dataDoc.length; row++) {for (var col=0; col<metaDoc.length; col++) {if (!this.edit(row, col)) passedEdits = false;}}return passedEdits;} catch (e) {comExceptTrace("JJS00699 Unable to edit doc " + this.docName + ". " + e);}};this.edit = function(row, col) {try {if (dataDoc == null) this.init();if (metaDoc[col][dmRequired] == true) {if (dataDoc[row][col].value.length < 1) {dataDoc[row][col].status = false;dataDoc[row][col].msg = "A value is required";return dataDoc[row][col].status;}}if (metaDoc[col][dmValidator] == null) {dataDoc[row][col].status = true;dataDoc[row][col].msg = null;return dataDoc[row][col].status;}var resp = metaDoc[col][dmValidator](this, row, col);if (resp.isApproved()) {dataDoc[row][col].status = true;dataDoc[row][col].msg = resp.displayMsg;return dataDoc[row][col].status;} else if (resp.isDenied()) {dataDoc[row][col].status = false;dataDoc[row][col].msg = resp.displayMsg;return dataDoc[row][col].status;} else if (resp.isError()) {dataDoc[row][col].status = false;dataDoc[row][col].msg = resp.displayMsg;comTrace("JJS00224 " + this.docName + " edit. Validator returned system error response");comTraceResp(resp);return dataDoc[row][col].status;} else {dataDoc[row][col].status = false;dataDoc[row][col].msg = resp.displayMsg;comTrace("JJS00225 " + this.docName + " edit. Validator returned invalid response status");return dataDoc[row][col].status;}} catch (e) {comTrace("JJS00226 " + this.docName + " exception validating field at row " + row + " col " + col + ": " + e);throw e;}};this.getRowCount = function() {if (dataDoc == null) this.initDoc();if (subsetMap != null) {return subsetMap.length;} else {return dataDoc.length;}};this.getRowFormattedXML = function() {if (dataDoc == null) this.init();var out = "";var val = null;for (var col=0; col<metaDoc.length; col++) {val = this.encodeForXML(dataDoc[0][col].value);out = out + "<" + metaDoc[col][dmFieldName] + ">" + val + "</" + metaDoc[col][dmFieldName] + ">\n";}return out;};this.getXML = function() {try {var xmlDoc= "";for (var row=0; row<this.getRowCount(); row++) {xmlDoc = xmlDoc + "<DOItem>\n";xmlDoc = xmlDoc + this.getRowXML(row);xmlDoc = xmlDoc + "</DOItem>\n";}return xmlDoc;} catch(e) {comTrace("SFW00011 " + e);return "";}};this.getRowXML = function(row) {if (dataDoc == null) this.init();var out = "";var val = null;for (var col=0; col<metaDoc.length; col++) {val = this.encodeForXML(dataDoc[row][col].value);out = out + "<" + metaDoc[col][dmFieldName] + ">" + val + "</" + metaDoc[col][dmFieldName] + ">\n";}return out;};this.setRowFromDoc = function(rowIn, srcDoc, srcRow) {try {if (dataDoc == null) this.init();var row = rowIn;if (subsetMap != null) row = subsetMap[row];var srcColPos = -1;for (var col=0; col<metaDoc.length; col++) {srcColPos = srcDoc.getColPos(metaDoc[col][dmFieldName]);if (srcColPos < 0) {dataDoc[row][col].value = "";} else {dataDoc[row][col].value = srcDoc.getColValue(srcRow,srcColPos);}}} catch (e) {comExceptTrace("JJS00700 Unable to set row " + e);}};this.updateRowFromDoc = function(rowIn, srcDoc, srcRow) {try {if (dataDoc == null) this.init();var row = rowIn;if (subsetMap != null) row = subsetMap[row];var srcColPos = -1;for (var col=0; col<metaDoc.length; col++) {srcColPos = srcDoc.getColPos(metaDoc[col][dmFieldName]);if (srcColPos > -1) {dataDoc[row][col].value = srcDoc.getColValue(srcRow,srcColPos);}}} catch (e) {comExceptTrace("JJS00701 Unable to set row " + e);}};this.getNewRow = function() {try {if (dataDoc == null) this.initDoc();var row = new Array(this.getColCount());for (var i=0; i<row.length; i++) {row[i] = new xxDataDocField("");}return row;} catch (e) {comExceptTrace("JPE01634 Unable to get new row");}};this.addRow = function() {try {if (dataDoc == null) this.initDoc();var row = new Array(this.getColCount());for (var i=0; i<row.length; i++) {row[i] = new xxDataDocField("");}dataDoc.push(row);} catch (e) {comExceptTrace("JJS00702 Unable to add row");}};this.clearRow = function(row) {try {if (row < 0 || row > this.getRowCount()) return false;for (var col=0; col<this.getColCount(); col++) {this.setColValue(row, col, "");}return true;} catch (e) {comExceptTrace("JJS00703 Unable to clear row");}};this.removeRow = function(rowIn) {try {if (dataDoc == null) return;var row = rowIn;if (subsetMap != null) row = subsetMap[row];dataDoc.splice(row, 1);} catch (e) {comExceptTrace("JJS00301 Exception removeRow: " + e);}};this.insertRow = function(rowFieldsIN, afterRow) {try {if (dataDoc == null) return;dataDoc.splice(afterRow, 0, rowFieldsIN);} catch (e) {comExceptTrace("JJS00704 Exception removeRow: " + e);}};this.addRowData = function(rowIN) {try {if (dataDoc == null) this.init();if (rowIN.length != metaDoc.length) {comExceptTrace("JJS00104 addRowData rowIN contains wrong number of columns");return false;}var newRow = new Array(this.getColCount());for (var i=0; i<newRow.length; i++) {newRow[i] = new xxDataDocField(rowIN[i]);}dataDoc.push(newRow);return true;} catch (e) {comExceptTrace("JJS00105 Exception addRowData: " + e);return false;}};this.addRowFields = function(rowIN) {try {if (dataDoc == null) this.init();if (rowIN.length != metaDoc.length) {comExceptTrace("JJS00705 addRowFields rowIN contains wrong number of columns");return false;}var newRow = new Array(this.getColCount());for (var i=0; i<newRow.length; i++) {newRow[i] = new xxDataDocField(rowIN[i].value);}dataDoc.push(newRow);return true;} catch (e) {comExceptTrace("JJS00706 Exception addRowFields: " + e);return false;}};this.getRowFields = function(row) {try {if (subsetMap != null) {return dataDoc[subsetMap[row]];} else {return dataDoc[row];}} catch (e) {comExceptTrace("JJS00707 Exception getRowData: " + e);}};this.findRow = function(col, value) {if (subsetMap != null) {for (var row=0; row<subsetMap.length; row++) {if (dataDoc[subsetMap[row]][col].value == value) return row;}} else {for (var row=0; row<dataDoc.length; row++) {if (dataDoc[row][col].value == value) return row;}}return -1;};this.findRowByMult = function(fieldsArray, valsArray) {for (var cols=0; cols<fieldsArray.length; cols++) fieldsArray[cols] = this.getColPos(fieldsArray[cols]);var found = true;for (var row=0; row<dataDoc.length; row++) {found = true;for (var cols=0; cols<fieldsArray.length; cols++) {if (dataDoc[row][fieldsArray[cols]].value != valsArray[cols]) {found = false;break;}}if (found) return row;}return -1;};this.initDoc = function() {dataDoc = new Array(); subsetMap = null; subsetList = null;};this.clear = function() {dataDoc = null; subsetMap = null; subsetList = null;};this.getDataDocArray = function() {return dataDoc;};this.setDataDoc = function(dataDocIn) {dataDoc = dataDocIn;};this.init = function() {dataDoc = new Array();subsetMap = null;subsetList = null;};this.initOne = function() {dataDoc = new Array();subsetMap = null;subsetList = null;this.addRow();};this.copyFromDoc = function(fromDoc) {var currentRow = -1;for (var fromRow=0; fromRow < fromDoc.getRowCount(); fromRow++) {this.addRow();currentRow = this.getRowCount() - 1;for (var col=0; col<this.getColCount(); col++) {if (fromDoc.getColPos(metaDoc[col][dmFieldName]) > -1) {this.setColValue(currentRow, col, fromDoc.getValue(fromRow, metaDoc[col][dmFieldName]));}}}};this.getAsCookie = function() {var out = "";var val = null;for (var row=0; row<this.getRowCount(); row++) {if (row > 0) out = out + "^R";for (var col=0; col<this.getColCount(); col++) {val = this.getColValue(row, col);val = val.replace(/\^/g,"");if (col == 0) {out = out + val;} else {out = out + "^F" + val;}}}return out;};this.loadFromCookie = function(cookData) {try {this.clear();if (cookData == null || cookData.length < 1) return false;var rows = cookData.split("^R");for (var row=0; row<rows.length; row++) {this.addRow();var cols = rows[row].split("^F");if (cols.length != this.getColCount()) {comExceptTrace("JJS00708 cookie to document mismatch col count");this.clear();return false;}for (var col=0; col<cols.length; col++) {this.setColValue(row,col,cols[col]);}}return true;} catch (e) {comExceptTrace("JJS00709 loadFromCookie Exception: " + e);return false;}};this.getCookieFormat = function() {var out = "";for (var row=0; row<this.getRowCount(); row++) {if (row > 0) out = out + "~";for (var col=0; col<this.getColCount(); col++) {if (col == 0) {out = out + this.getColValue(row, col);} else {out = out + "|" + this.getColValue(row, col);}}}return out;};this.setFromCookie = function(cookData) {try {this.clear();if (cookData == null || cookData.length < 1) return true;var rows = cookData.split("~");for (var row=0; row<rows.length; row++) {this.addRow();var cols = rows[row].split("|");if (cols.length != this.getColCount()) throw "JJS00227 cookie to document mismatch col count";for (var col=0; col<cols.length; col++) {this.setColValue(row,col,cols[col]);}}return true;} catch (e) {throw "JJS00228 setFromCookie Exception" + e;}};this.setFromCookieQuiet = function(cookData) {try {this.clear();if (cookData == null || cookData.length < 1) return true;var rows = cookData.split("~");for (var row=0; row<rows.length; row++) {this.addRow();var cols = rows[row].split("|");for (var col=0; col<cols.length; col++) {this.setColValue(row,col,cols[col]);}}return true;} catch (e) {throw "JJS00710 setFromCookie Exception" + e;}};this.show = function() {alert(this.showGet());};this.showTrace = function() {comTrace(this.showGet());};this.showGet = function() {var out = docName + "\n";for (var col=0; col<metaDoc.length-1; col++) {out = out + metaDoc[col][dmFieldName] + ",";}out = out + metaDoc[metaDoc.length-1][dmFieldName];out = out + "\n";if (dataDoc == null) {out = out + "Uninitialized!!!\n";} else {for (var row=0; row<dataDoc.length; row++) {for (var col=0; col<metaDoc.length; col++) {out = out + "  " + metaDoc[col][dmFieldName] + "=" +dataDoc[row][col].value + "|" +dataDoc[row][col].status + "|" +dataDoc[row][col].msg + "\n";}}out = out + "row " + row + "\n";}return out;};this.showSubset = function(subList) {if (subList == null) {comTrace("Current subset for " + this.docName + ": null");return;}comTrace("Current subset for " + this.docName + ":");for (var sub=0; sub < subList.length; sub++) {comTrace("  -> " + subList[sub][0] + " - " + subList[sub][1] + " - " + subList[sub][2] + " - " + subList[sub][3] + " - ");}return;};this.setSubset = function(subsetListIn) {try {if (subsetListIn == null) {subsetList = null;subsetMap = null;return;}subsetList = subsetListIn;subsetMap = new Array();for (var sub=0; sub < subsetList.length; sub++) {subsetList[sub][2] = subsetList[sub][2].toUpperCase();}var useIt = true;var subRow = -1;for (var row=0; row<dataDoc.length; row++) {useIt = true;for (var sub=0; sub < subsetList.length; sub++) {if (subsetList[sub][3] == "LIKE") {if (dataDoc[row][subsetList[sub][1]].value.toUpperCase().indexOf(subsetList[sub][2]) < 0) {useIt = false;continue;}} else {if (dataDoc[row][subsetList[sub][1]].value.toUpperCase() != subsetList[sub][2]) {useIt = false;continue;}}}if (useIt) {subRow++;subsetMap[subRow] = row;}}} catch (e) {comExceptionCatch("JJS00711" + "Document subset exception: " + e);}};this.sort = function(sortList) {try {var sortField = null;var ascending = true;var sortFields = sortList.split(",");for (var i = sortFields.length-1; i> -1; i--) {if (sortFields[i].indexOf(" DESC") > -1) {sortField = sortFields[i].split(" ")[0];ascending = false;} else {sortField = sortFields[i];ascending = true;}xxSortCol = this.getColPos(sortField);if (ascending) {dataDoc.sort(xxSortCompareAsc);} else {dataDoc.sort(xxSortCompareDesc);}}this.setSubset(subsetList);} catch (e) {comExceptionCatch("JJS00712" + "Document sort exception: " + e);}};}var xxSortCol = -1;function xxSortCompareAsc(a, b) {var aVal = a[xxSortCol].value.toLowerCase();var bVal = b[xxSortCol].value.toLowerCase();if (aVal < bVal) return -1;if (aVal > bVal) return 1;return 0;}function xxSortCompareDesc(a, b) {var aVal = a[xxSortCol].value.toLowerCase();var bVal = b[xxSortCol].value.toLowerCase();if (aVal < bVal) return 1;if (aVal > bVal) return -1;return 0;}function xxDataDocField(value) {this.value = value;this.status = null;this.msg = null;}function xxqGetSaveMultiXML(serviceName, serviceAction, doName, dataDoc) {try {var xmlDoc= "<" + serviceName + "." + serviceAction + ">\n<" + doName + ">\n";for (var row=0; row<dataDoc.getRowCount(); row++) {xmlDoc = xmlDoc + "<DOItem>\n";xmlDoc = xmlDoc + dataDoc.getRowXML(row);xmlDoc = xmlDoc + "</DOItem>\n";}xmlDoc = xmlDoc + "</" + doName + "></" + serviceName + "." +  serviceAction + ">\n";return xmlDoc;} catch(e) {comSysError(new comErrorResp("JJS01103","xxqGetSaveMultiXML Exception: "+e));}}function xxqDataRequest(serviceName, serviceAction) {this.serviceName = serviceName;this.serviceAction = serviceAction;var xxqHttpReq = null;var xxqCompleteFunc = null;var xmlResponse = null;var servResp = null;var itsme = this;var xxqParmList = null;this.getServResp = function() {return servResp;};this.getXMLResp = function() {return xmlResponse;};this.setParmList = function(parmList) {xxqParmList = parmList;};this.getParmList = function() {return xxqParmList;};this.trace = function() {comTrace(xxqHttpReq.responseText);};this.show = function() {var respTxt = xxqHttpReq.responseText;var fmtTxt = "";var counter = 0;for (var i=0; i<respTxt.length; i++) {fmtTxt = fmtTxt + respTxt.substr(i,1);counter = counter + 1;if (counter > 100) {fmtTxt = fmtTxt + "\n";counter = 0;}}alert(fmtTxt);};this.getTheRespText = function() {var respTxt = xxqHttpReq.responseText;return respTxt;};this.doCustom = function(xmlDoc, callBack) {try {xxqCompleteFunc = callBack;resetHttpReq();if (xxqHttpReq == null) return;xxqHttpReq.onreadystatechange=stateMonitor;var url = xxqWebApp + "/" + this.serviceName + ".php?Action=" + this.serviceName + "." + this.serviceAction;xxqHttpReq.open("POST",url,true);xxqHttpReq.setRequestHeader('Content-Type','text/xml');xxqHttpReq.send(xmlDoc);} catch(e) {comSysError(new comErrorResp("JJS00008","Exception getting data: "+e));}};this.doCustomWithHeader = function(header, xmlDoc, callBack) {try {xxqCompleteFunc = callBack;resetHttpReq();if (xxqHttpReq == null) return;xxqHttpReq.onreadystatechange=stateMonitor;var url = xxqWebApp + "/" + this.serviceName + ".php?Action=" + this.serviceName + "." + this.serviceAction + "&" + header;xxqHttpReq.open("POST",url,true);xxqHttpReq.setRequestHeader('Content-Type','text/xml');xxqHttpReq.send(xmlDoc);} catch(e) {comSysError(new comErrorResp("JJS00008","Exception getting data: "+e));}};this.doGet = function(subset, dataDoc, callBack) {try {xxqCompleteFunc = callBack;var xmlDoc= "<" + this.serviceName + "." + "Get" + ">\n" + getSubsetXML(subset) + "\n";xmlDoc= xmlDoc + "<FieldList>" + dataDoc.getFieldListComma() + "</FieldList>\n";xmlDoc = xmlDoc + "</" + this.serviceName + "." +  "Get" + ">\n";resetHttpReq();if (xxqHttpReq == null) return;xxqHttpReq.onreadystatechange=stateMonitor;var url = xxqWebApp + "/" + this.serviceName + ".php?Action=" + this.serviceName + "." + this.serviceAction;xxqHttpReq.open("POST",url,true);xxqHttpReq.setRequestHeader('Content-Type','text/xml');xxqHttpReq.send(xmlDoc);} catch(e) {comSysError(new comErrorResp("JJS00018","Exception getting page data: "+e));}};this.doGetPage = function(subset, sort, pageSize, currentPage, dataDoc, callBack) {try {xxqCompleteFunc = callBack;var xmlDoc= "<" + this.serviceName + "." + "GetPage" + ">\n";xmlDoc= xmlDoc + "<Subset>" +  getSubsetXML(subset) + "</Subset>\n";xmlDoc= xmlDoc + "<Sort>" + sort + "</Sort>\n";xmlDoc= xmlDoc + "<FieldList>" + dataDoc.getFieldListComma() + "</FieldList>\n";xmlDoc= xmlDoc + "<PageSize>" + pageSize + "</PageSize>\n";xmlDoc= xmlDoc + "<Page>" + currentPage + "</Page>\n";xmlDoc = xmlDoc + "</" + this.serviceName + "." +  "GetPage" + ">\n";resetHttpReq();if (xxqHttpReq == null) return;xxqHttpReq.onreadystatechange=stateMonitor;var url = xxqWebApp + "/" + this.serviceName + ".php?Action=" + this.serviceName + "." + this.serviceAction;xxqHttpReq.open("POST",url,true);xxqHttpReq.setRequestHeader('Content-Type','text/xml');xxqHttpReq.send(xmlDoc);} catch(e) {comSysError(new comErrorResp("JJS00019","Exception getting page data: "+e));}};this.doGetPageListGetXML = function(pageDoc, dataDoc) {var xmlDoc= "<" + this.serviceName + "." + "GetPage" + ">\n";xmlDoc= xmlDoc + "<FieldList>" + dataDoc.getFieldListComma() + "</FieldList>\n";xmlDoc= xmlDoc + "<PageSize>" + pageDoc.getValue(0, "pageSize") + "</PageSize>\n";xmlDoc= xmlDoc + "<Page>" + pageDoc.getValue(0, "pageCurrent") + "</Page>\n";xmlDoc= xmlDoc + "<Sort>" + pageDoc.getValue(0, "sort") + "</Sort>\n";if (pageDoc.getColPos("dssMode") > -1) {if (pageDoc.getValue(0, "dssMode") == "LOCAL") {xmlDoc= xmlDoc + "<Subset></Subset>\n";} else {xmlDoc= xmlDoc + "<Subset>" +  pageDoc.getValue(0, "subset") + "</Subset>\n";}} else {xmlDoc= xmlDoc + "<Subset>" +  pageDoc.getValue(0, "subset") + "</Subset>\n";}xmlDoc = xmlDoc + "</" + this.serviceName + "." +  "GetPage" + ">\n";return xmlDoc;};this.doGetPageList = function(pageDoc, dataDoc, callBack) {try {xxqCompleteFunc = callBack;var xmlDoc = this.doGetPageListGetXML(pageDoc, dataDoc);resetHttpReq();if (xxqHttpReq == null) return;xxqHttpReq.onreadystatechange=stateMonitor;var url = xxqWebApp + "/" + this.serviceName + ".php?Action=" + this.serviceName + "." + this.serviceAction;xxqHttpReq.open("POST",url,true);xxqHttpReq.setRequestHeader('Content-Type','text/xml');xxqHttpReq.send(xmlDoc);} catch(e) {comSysError(new comErrorResp("JJS00020","Exception getting page data: "+e));}};this.doSave = function(doName, dataDoc, callBack) {try {xxqCompleteFunc = callBack;var xmlDoc= "<" + this.serviceName + "." + "Save" + ">\n<" + doName + ">\n";xmlDoc= xmlDoc + dataDoc.getRowFormattedXML();xmlDoc = xmlDoc + "</" + doName + "></" + this.serviceName + "." +  "Save" + ">\n";resetHttpReq();if (xxqHttpReq == null) return;xxqHttpReq.onreadystatechange=stateMonitor;var url = xxqWebApp + "/" + this.serviceName + ".php?Action=" + this.serviceName + "." + this.serviceAction;xxqHttpReq.open("POST",url,true);xxqHttpReq.setRequestHeader('Content-Type','text/xml');xxqHttpReq.send(xmlDoc);} catch(e) {comSysError(new comErrorResp("JJS00021","Exception saving data: "+e));}};this.getDO = function(doName, dataDoc) {dataDoc.clear();var nodeVal = null;var doNode = xmlResponse.getElementsByTagName(doName);if (doNode == null || doNode.length < 1) return dataDoc;if (!doNode[0].hasChildNodes) {comSysError(new comErrorResp("JJS00023",doName + " missing items in response"));return false;}var itemNodes = doNode[0].getElementsByTagName("DOItem");for (var row=0; row<itemNodes.length; row++) {dataDoc.addRow();for (var col=0; col<dataDoc.getColCount(); col++) {nodeVal = getNodeVal(itemNodes[row], dataDoc.getColName(col));dataDoc.setColValue(row, col, nodeVal);}}dataDoc.editDoc();return true;};this.addDOData = function(doName, dataDoc) {var nodeVal = null;var doNode = xmlResponse.getElementsByTagName(doName);if (doNode == null || doNode.length < 1) return dataDoc;if (!doNode[0].hasChildNodes) {comSysError(new comErrorResp("JJS00023",doName + " missing items in response"));return false;}var itemNodes = doNode[0].getElementsByTagName("DOItem");for (var row=0; row<itemNodes.length; row++) {for (var col=0; col<dataDoc.getColCount(); col++) {if (hasNodeVal(itemNodes[row], dataDoc.getColName(col))) {nodeVal = getNodeVal(itemNodes[row], dataDoc.getColName(col));dataDoc.setColValue(row, col, nodeVal);}}}dataDoc.editDoc();return true;};this.getDOPage = function(doName, pageDoc, dataDoc) {dataDoc.clear();var nodeVal = null;var doNode = xmlResponse.getElementsByTagName(doName);if (doNode == null || doNode.length < 1 || !doNode[0].hasChildNodes) {pageDoc.setValue(0, "pageCurrent", "1");pageDoc.setValue(0, "pageTotal", "1");pageDoc.setValue(0, "pageRecCount", "-1");return true;}var itemNodes = doNode[0].getElementsByTagName("DOItem");var listItemsCount = itemNodes.length;for (var row=0; row<listItemsCount; row++) {dataDoc.addRow();for (var col=0; col<dataDoc.getColCount(); col++) {nodeVal = getNodeVal(itemNodes[row], dataDoc.getColName(col));dataDoc.setColValue(row, col, nodeVal);}}dataDoc.editDoc();itemNodes = doNode[0].getElementsByTagName("RecCount");if (itemNodes == null || itemNodes.length < 1) {pageDoc.setValue(0, "pageTotal", "1");pageDoc.setValue(0, "pageRecCount", listItemsCount);pageDoc.setValue(0, "pageCurrent", "1");} else {var pageRecCount = itemNodes[0].childNodes[0].nodeValue;var pageSize = pageDoc.getValue(0,"pageSize");var pageCurrent = parseInt(pageDoc.getValue(0,"pageCurrent"));var pageTotal = Math.floor(pageRecCount/pageSize);if (pageRecCount % pageSize > 0) pageTotal = pageTotal + 1;pageDoc.setValue(0, "pageTotal", pageTotal.toString());pageDoc.setValue(0, "pageRecCount", pageRecCount);if (pageCurrent > pageTotal) pageDoc.setValue(0, "pageCurrent", pageTotal.toString());}return true;};this.getDOVPage = function(doName, pageDoc, dataDoc) {dataDoc.clear();var nodeVal = null;var doNode = xmlResponse.getElementsByTagName(doName);if (doNode == null || doNode.length < 1 || !doNode[0].hasChildNodes) {pageDoc.setValue(0, "pageCurrent", "1");pageDoc.setValue(0, "pageTotal", "1");pageDoc.setValue(0, "pageRecCount", "-1");if (pageDoc.getValue(0, "subset").length < 1) pageDoc.setValue(0, "dssMode", "LOCAL");return true;}var itemNodes = doNode[0].getElementsByTagName("DOItem");var listItemsCount = itemNodes.length;for (var row=0; row<listItemsCount; row++) {dataDoc.addRow();for (var col=0; col<dataDoc.getColCount(); col++) {nodeVal = getNodeVal(itemNodes[row], dataDoc.getColName(col));dataDoc.setColValue(row, col, nodeVal);}}dataDoc.editDoc();itemNodes = doNode[0].getElementsByTagName("RecCount");if (itemNodes == null || itemNodes.length < 1) {pageDoc.setValue(0, "pageTotal", "1");pageDoc.setValue(0, "pageRecCount", listItemsCount);pageDoc.setValue(0, "pageCurrent", "1");if (pageDoc.getValue(0, "subset").length < 1) pageDoc.setValue(0, "dssMode", "LOCAL");} else {var pageRecCount = itemNodes[0].childNodes[0].nodeValue;var pageSize = pageDoc.getValue(0,"pageSize");var pageCurrent = parseInt(pageDoc.getValue(0,"pageCurrent"));var pageTotal = Math.floor(pageRecCount/pageSize);if (pageRecCount % pageSize > 0) pageTotal = pageTotal + 1;pageDoc.setValue(0, "pageTotal", pageTotal.toString());pageDoc.setValue(0, "pageRecCount", pageRecCount);if (pageCurrent > pageTotal) pageDoc.setValue(0, "pageCurrent", pageTotal.toString());if (pageDoc.getValue(0, "subset").length < 1) {if (pageTotal > 1) {pageDoc.setValue(0, "dssMode", "SERVER");} else {pageDoc.setValue(0, "dssMode", "LOCAL");}}}return true;};var resetHttpReq = function() {if (window.XMLHttpRequest) {xxqHttpReq = new XMLHttpRequest();} else if (window.ActiveXObject) {xxqHttpReq = new ActiveXObject("Microsoft.XMLHTTP");}if (xxqHttpReq == null) {alert("KEY09282 Your browser does not support XMLHTTP.");return;}};var stateMonitor = function() {if (xxqHttpReq.readyState < 4) {try {if (document.getElementById("progressWin").getAttribute("class") == "on") {} else {setOn('progressWin');}} catch (e) {alert(e.discription);}}if (xxqHttpReq.readyState==4) {try {setOff('progressWin');servResp = getStateResp();}catch (e) {servResp = new comResp("ERROR","SHOWMESSAGE","JJS00009","","Exception communicating with server: " +e);}xxqCompleteFunc(itsme);}};var getStateResp = function() {try {if (xxqHttpReq.status != 200) {return new comResp("ERROR","SHOWMESSAGE","JJS00010","Error communicating with the server","Server responded with status of " + xxqHttpReq.status);}xmlResponse = xxqHttpReq.responseXML;if (!xmlResponse) {return new comResp("ERROR","SHOWMESSAGE","JJS00011","Error communicating with the server","Failed to parse response as XML.");}try {var respNode = xmlResponse.getElementsByTagName("ResponseDO");if (!respNode[0].hasChildNodes) {return new comResp("ERROR","SHOWMESSAGE","JJS00012","","Missing response from server.");}var sResp = new comResp("","","","","");sResp.status = getDocVal(respNode[0], "status");sResp.action = getDocVal(respNode[0], "action");sResp.code = getDocVal(respNode[0], "code");sResp.displayMsg = getDocVal(respNode[0], "displayMsg");sResp.techMsg = getDocVal(respNode[0], "techMsg");if (sResp.status.length < 1) {return new comResp("ERROR","SHOWMESSAGE","JJS00013","","Missing server response status");}if (sResp.status != "APPROVED" && sResp.status != "DENIED" && sResp.status != "ERROR") {return new comResp("ERROR","SHOWMESSAGE","JJS00014","","Invalid server response status " + servResp.status);}if (sResp.action.length < 1) {return new comResp("ERROR","SHOWMESSAGE","JJS00015","","Missing server response action");}return sResp;} catch (e) {return new comResp("ERROR","SHOWMESSAGE","JJS00016","","Error getting response: " + e);}} catch (e) {return new comResp("ERROR","SHOWMESSAGE","JJS00017","","Exception communicating with server: " +e);}};var getDocVal = function(node, tagName) {try {var val = node.getElementsByTagName(tagName)[0];if (val.hasChildNodes()) {return val.childNodes[0].nodeValue;} else {return "";}} catch (e) {return "";}};var getSubsetXML = function(subset) {if (subset.length < 1) return "";var subParts = subset.split("|");var subsetXML = "";for (var i=0; i<subParts.length; i=i+3) {subsetXML = subsetXML + "<" + subParts[i] + " operator=\"" + subParts[i+1] + "\">" + subParts[i+2] + "</" + subParts[i] + ">";}return subsetXML;};var hasNodeVal = function(node, tagName) {try {var val = node.getElementsByTagName(tagName)[0];if (val.hasChildNodes()) {return true;} else {return false;}} catch (e) {return false;}};var getNodeVal = function(node, tagName) {try {var val = node.getElementsByTagName(tagName)[0];if (val.hasChildNodes()) {return val.childNodes[0].nodeValue;} else {return "";}} catch (e) {return "";}};}function xxfldGetNumeric(strVal) {var retVal = "";var sign = "";for (var i=0; i < strVal.length; i++) {var c = strVal.substring(i,i+1);if (c=="-"||c=="(") {sign = "-";continue;}if (c=="1"||c=="2"||c=="3"||c=="4"||c=="5"||c=="6"||c=="7"||c=="8"||c=="9"||c=="0") retVal = retVal + c;}retVal = retVal.replace(/^[0]+/g,"");if (retVal.length < 1) return "0";return sign + retVal;}function xxfldTypableChar(ch){if (ch.length != 1) return false;var alphaExp = /^[0-9a-zA-Z]/;if (ch.match(alphaExp)) return true;if (ch == "`") return true;if (ch == "~") return true;if (ch == "!") return true;if (ch == "@") return true;if (ch == "#") return true;if (ch == "$") return true;if (ch == "%") return true;if (ch == "^") return true;if (ch == "&") return true;if (ch == "*") return true;if (ch == "(") return true;if (ch == ")") return true;if (ch == "-") return true;if (ch == "_") return true;if (ch == "=") return true;if (ch == "+") return true;if (ch == "[") return true;if (ch == "{") return true;if (ch == "]") return true;if (ch == "}") return true;if (ch == "\\") return true;if (ch == "|") return true;if (ch == ";") return true;if (ch == ":") return true;if (ch == "'") return true;if (ch == '"') return true;if (ch == ",") return true;if (ch == "<") return true;if (ch == ".") return true;if (ch == ">") return true;if (ch == "?") return true;if (ch == "/") return true;return false;}function xxfldGetDigits(strVal) {var retVal = "";for (var i=0; i < strVal.length; i++) {var c = strVal.substring(i,i+1);if (c=="1"||c=="2"||c=="3"||c=="4"||c=="5"||c=="6"||c=="7"||c=="8"||c=="9"||c=="0") retVal = retVal + c;}return retVal;}function xxfldIsAlpha(value) {var include = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";if (value.length < 1) return true;for (var i=0; i<value.length; i++) {if (include.indexOf(value.charAt(i),0) == -1) return false;}return true;}function xxfldIsNumeric(value) {var include = "0123456789";if (value.length < 1) return true;for (var i=0; i<value.length; i++) {if (include.indexOf(value.charAt(i),0) == -1) return false;}return true;}function xxfldContainsOnly(value, checkChars) {if (value.length < 1) return true;for (var i=0; i<value.length; i++) {if (checkChars.indexOf(value.charAt(i),0) == -1) return false;}return true;}function xxDateFromBase(baseDate) {var dateParts = baseDate.split("-");var wDate = new Date();var y = xxfldGetNumeric(dateParts[0]);var m = xxfldGetNumeric(dateParts[1]) - 1;var d = xxfldGetNumeric(dateParts[2]);wDate.setFullYear(y, m, d);return wDate;}function xxDateToBase(wDate) {var mStr = wDate.getMonth() + 1;mStr = mStr.toString();if (mStr.length < 2) mStr = "0" + mStr;var dStr = wDate.getDate().toString();if (dStr.length < 2) dStr = "0" + dStr;var baseDate = wDate.getFullYear().toString() + "-" + mStr + "-" + dStr;return baseDate;}function xxDateDaysDiff(baseDate1, baseDate2) {var date1 = xxDateFromBase(baseDate1);var date2 = xxDateFromBase(baseDate2);var oneDay=1000*60*60*24;var milsDif = date1.getTime() - date2.getTime();var itsNeg = false;if (milsDif < 0) {itsNeg = true;milsDif = milsDif * -1;}var retDays = Math.ceil(milsDif/oneDay);if (itsNeg) retDays = retDays * -1;return retDays;}function xxDateToday() {var tday = new Date();return(xxDateToBase(tday));}function xxDateDaysAdd(baseDate, days) {var wDate = xxDateFromBase(baseDate);wDate.setDate(wDate.getDate()+days);return(xxDateToBase(wDate));}function popNew(url) {var newwindow=window.open(url,'New','left=0, top=0, width=900, height=600, toolbar=yes, directories=yes, location=yes, status=yes, menubar=yes, resizable=yes, scrollbars=yes');if (window.focus) {newwindow.focus();}}function popPDF(url) {var pdfwindow=window.open(url,'PDF','left=10, top=20, width=878, height=600, toolbar=yes, directories=yes, location=yes, status=yes, menubar=yes, resizable=yes, scrollbars=yes');if (window.focus) {pdfwindow.focus();}}function popHelp(url) {var helpwindow=window.open(url,'Help','left=25, top=65, width=640, height=480, toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=yes, scrollbars=yes');if (window.focus) {helpwindow.focus()}}function popContact(url) {var contactwindow=window.open(url,'Contact','left=30, top=20, width=670, height=580, toolbar=no, directories=no, location=no, status=no, menubar=no, resizable=yes, scrollbars=yes');if (window.focus) {contactwindow.focus()}}function popCenter(url, name, w, h) {w += 32;h += 96;var wleft = (screen.width - w) / 2;var wtop = (screen.height - h) / 2;if (wleft < 0) {w = screen.width;wleft = 0;}if (wtop < 0) {h = screen.height;wtop = 0;}var win = window.open(url,name,'width=' + w + ', height=' + h + ', ' +'left=' + wleft + ', top=' + wtop + ', ' +'location=no, menubar=no, directories=no' +'status=no, toolbar=no, scrollbars=no, resizable=no');win.resizeTo(w, h);win.moveTo(wleft, wtop);win.focus();}function setFav(url,title) {if (document.all) {window.external.AddFavorite(url,title);}}function onOff(id) {try {var oo = document.getElementById(id);if (oo.className == 'off') {oo.className = 'on';} else {oo.className = 'off';}} catch (e) {comExceptionCatch("JJS00756", "toolbox exception: " + e);}}function setOn(id) {try {var on = document.getElementById(id);if (on.className == 'off') {on.className = 'on';}} catch (e) {comExceptionCatch("JJS00757", "toolbox exception: " + e);}}function setOff(id) {try {var off = document.getElementById(id);if (off.className == 'on') {off.className = 'off';}} catch (e) {comExceptionCatch("JJS00758", "toolbox exception: " + e);}}function hideThis(id) {try {var hide = document.getElementById(id);if (hide.className != 'never') {hide.className = 'hide';}} catch (e) {comExceptionCatch("JJS00759", "toolbox exception: " + e);}}function hereThis(id) {try {var here = document.getElementById(id);if (here.className != 'never') {here.className = 'here';}} catch (e) {comExceptionCatch("JJS00760", "toolbox exception: " + e);}}function pressThis(id) {try {var press = document.getElementById(id);if (press.className != 'never') {press.className = 'pressed';}} catch (e) {comExceptionCatch("JJS00761", "toolbox exception: " + e);}}function buttonThis(id) {try {var button = document.getElementById(id);if (button.className != 'never') {button.className = 'button';}} catch (e) {comExceptionCatch("JJS00762", "toolbox exception: " + e);}}function disThis(id) {try {var dis = document.getElementById(id);if (dis.className != 'never') {dis.className = 'dissed';}} catch (e) {comExceptionCatch("JJS00763", "toolbox exception: " + e);}}function hoverThis(id) {try {var hover = document.getElementById(id);if (hover.className != 'never') {hover.className = 'hover';}} catch (e) {comExceptionCatch("JJS00764", "toolbox exception: " + e);}}function oddThis(id) {try {var odd = document.getElementById(id);if (odd.className == 'hover') {odd.className = 'odd';}} catch (e) {comExceptionCatch("JJS00765", "toolbox exception: " + e);}}function evenThis(id) {try {var even = document.getElementById(id);if (even.className == 'hover') {even.className = 'even';}} catch (e) {comExceptionCatch("JJS00766", "toolbox exception: " + e);}}function xxfPipeListToComma(dataDoc, row, col) {var field = dataDoc.getColField(row, col);if (field.status == null || field.status == false) return field.value;var cVal = comReplaceAll(field.value,"|",", ");cVal = comTrim(cVal);return cVal;}function xxfDateMMDDYYYYSlash(dataDoc, row, col) {try {var field = dataDoc.getColField(row, col);if (field.status == null || field.status == false) return field.value;if (field.value.length < 1) return "";var dateParts = field.value.split("-");return dateParts[1].toString() + "/" + dateParts[2].toString() + "/" + dateParts[0].toString();} catch (e) {return dataDoc.getColValue(row, col);}}function xxfDateMDYYSlash(dataDoc, row, col) {try {var field = dataDoc.getColField(row, col);if (field.status == null || field.status == false) return field.value;if (field.value.length < 1) return "";return xxfDate(field.value, "M/D/YY");} catch (e) {return dataDoc.getColValue(row, col);}}function xxfDate(dateVal, format) {try {var dateParts = dateVal.split("-");var retVal = format.replace(/MM/g, dateParts[1].toString());var retVal = retVal.replace(/DD/g, dateParts[2].toString());var retVal = retVal.replace(/YYYY/g, dateParts[0].toString());var yyVal = dateParts[0].substring(2);var mVal = dateParts[1].replace(/^[0]+/g,"");var dVal = dateParts[2].replace(/^[0]+/g,"");var retVal = retVal.replace(/YY/g, yyVal);var retVal = retVal.replace(/M/g, mVal);var retVal = retVal.replace(/D/g, dVal);return retVal;} catch (e) {return dateVal;}}function xxfTime(timeVal, format) {try {return timeVal;} catch (e) {return timeVal;}}function xxfNumDC(dataDoc, row, col) {var field = dataDoc.getColField(row, col);if (field.status == null || field.status == false) return field.value;if (field.value.length < 1) return "";var numParts = field.value.split(".");var digits = numParts[0];var regExp = /(\d+)(\d{3})/;while (regExp.test(digits)) {digits = digits.replace(regExp, '$1' + ',' + '$2');}return "$" + digits;}function xxfNumC(dataDoc, row, col) {try {var field = dataDoc.getColField(row, col);if (field.status == null || field.status == false) return field.value;if (field.value.length < 1) return "";var numParts = field.value.split(".");var digits = numParts[0];var regExp = /(\d+)(\d{3})/;while (regExp.test(digits)) {digits = digits.replace(regExp, '$1' + ',' + '$2');}return digits;} catch (e) {comExceptTrace("JJS00315 formatter exception " + e);try {return dataDoc.getColField(row, col).value;}catch (e) {return "";}}}function xxfBoolYesNo(dataDoc, row, col) {var field = dataDoc.getColField(row, col);if (field.status == null || field.status == false) return field.value;if (field.value.length < 1) return "";if (field.value == "true") return "Yes";if (field.value == "false") return "No";return field.value;}function xxfPhone(dataDoc, row, col) {var field = dataDoc.getColField(row, col);if (field.status == null || field.status == false) return field.value;var phoneVal = field.value;if (phoneVal.length < 1) return "";var digits = xxfldGetDigits(phoneVal);digits = digits.replace(/^[1]+/g,"");if (digits.length < 10) return phoneVal;var s1 = digits.substring(0,3);var s2 = digits.substring(3,6);var s3 = digits.substring(6,10);var s4 = "";if (digits.length > 10) s4 = digits.substring(10);var retVal = "(" + s1 + ") " + s2 + "-" + s3;if (s4.length > 0) retVal = retVal + " x" + s4;return retVal;}function xxiDate(dateVal) {var byear = 0;var bmonth = 1;var bday = 2;if (dateVal.length < 1) return "";var dateValUpper = dateVal.toUpperCase();if (dateValUpper == "T" || dateValUpper == "TO" || dateValUpper == "TOD" || dateValUpper == "TODA" || dateValUpper == "TODAY" ) {var tday = new Date();var baseDate = new Array(tday.getFullYear(), tday.getMonth() + 1, tday.getDate());return xxiDateReturn(baseDate);}if (dateValUpper.substr(0,3) == "TOM") {var tday = new Date();tday.setDate(tday.getDate() + 1);var baseDate = new Array(tday.getFullYear(), tday.getMonth() + 1, tday.getDate());return xxiDateReturn(baseDate);}if (dateValUpper == "Y" || dateValUpper == "YE" || dateValUpper.substr(0,3) == "YES") {var tday = new Date();tday.setDate(tday.getDate() - 1);var baseDate = new Array(tday.getFullYear(), tday.getMonth() + 1, tday.getDate());return xxiDateReturn(baseDate);}if (dateValUpper == "M" || dateValUpper == "MO" || dateValUpper == "MON") {var nextDayNameDate = xxiDateNextWeekDay(new Date(), 1);if (nextDayNameDate == null) return null;var baseDate = new Array(nextDayNameDate.getFullYear(), nextDayNameDate.getMonth() + 1, nextDayNameDate.getDate());return xxiDateReturn(baseDate);}if (dateValUpper == "TU" || dateValUpper == "TUE") {var nextDayNameDate = xxiDateNextWeekDay(new Date(), 2);if (nextDayNameDate == null) return null;var baseDate = new Array(nextDayNameDate.getFullYear(), nextDayNameDate.getMonth() + 1, nextDayNameDate.getDate());return xxiDateReturn(baseDate);}if (dateValUpper == "W" || dateValUpper == "WE" || dateValUpper == "WED") {var nextDayNameDate = xxiDateNextWeekDay(new Date(), 3);if (nextDayNameDate == null) return null;var baseDate = new Array(nextDayNameDate.getFullYear(), nextDayNameDate.getMonth() + 1, nextDayNameDate.getDate());return xxiDateReturn(baseDate);}if (dateValUpper == "TH" || dateValUpper == "THU") {var nextDayNameDate = xxiDateNextWeekDay(new Date(), 4);if (nextDayNameDate == null) return null;var baseDate = new Array(nextDayNameDate.getFullYear(), nextDayNameDate.getMonth() + 1, nextDayNameDate.getDate());return xxiDateReturn(baseDate);}if (dateValUpper == "F" || dateValUpper == "FR" || dateValUpper == "FRI") {var nextDayNameDate = xxiDateNextWeekDay(new Date(), 5);if (nextDayNameDate == null) return null;var baseDate = new Array(nextDayNameDate.getFullYear(), nextDayNameDate.getMonth() + 1, nextDayNameDate.getDate());return xxiDateReturn(baseDate);}if (dateValUpper == "S" || dateValUpper == "SA" || dateValUpper == "SAT") {var nextDayNameDate = xxiDateNextWeekDay(new Date(), 6);if (nextDayNameDate == null) return null;var baseDate = new Array(nextDayNameDate.getFullYear(), nextDayNameDate.getMonth() + 1, nextDayNameDate.getDate());return xxiDateReturn(baseDate);}if (dateValUpper == "SU" || dateValUpper == "SUN") {var nextDayNameDate = xxiDateNextWeekDay(new Date(), 0);if (nextDayNameDate == null) return null;var baseDate = new Array(nextDayNameDate.getFullYear(), nextDayNameDate.getMonth() + 1, nextDayNameDate.getDate());return xxiDateReturn(baseDate);}var dateParts = new Array();var part = "";for (var i=0; i<dateVal.length; i++) {var c = dateVal.charAt(i);if (((c < "0") || (c > "9"))) {if (part.length > 0) {dateParts.push(part);part = "";}} else {if (c == "0" && part.length < 1) continue;part = part + c;}}if (part.length > 0) {dateParts.push(part);}if (dateParts.length < 1) return null;if (dateParts.length == 1) {if (dateParts[0].length == 8) {var baseDate = new Array(dateParts[0].substr(0,4), dateParts[0].substr(4,2), dateParts[0].substr(6,2));return xxiDateReturn(baseDate);}if (dateParts[0] < 32) {var tday = new Date();var baseDate = new Array(tday.getFullYear(), tday.getMonth() + 1, dateParts[0]);if (baseDate[bday] < 1) baseDate[bday] = tday.getDate();if (baseDate[bday] > 28) {var dim = xxiDateDaysInMonth(baseDate[bmonth],baseDate[byear]);if (baseDate[bday] > dim) baseDate[bday] = dim;}if (baseDate[bday] < tday.getDate()) {if (baseDate[bmonth] == 12) {baseDate[bmonth] = 1;baseDate[byear] = baseDate[byear] + 1;} else {baseDate[bmonth] = baseDate[bmonth] + 1;}if (baseDate[bday] > 28) {var dim = xxiDateDaysInMonth(baseDate[bmonth],baseDate[byear]);if (baseDate[bday] > dim) baseDate[bday] = dim;}}return xxiDateReturn(baseDate);}return null;}if (dateParts.length == 2) {if (dateParts[0] < 1) return null;if (dateParts[0] < 13) {var tday = new Date();var baseDate = new Array(tday.getFullYear(), dateParts[0], dateParts[1]);if (baseDate[bday] < 1) baseDate[bday] = tday.getDate();if (baseDate[bday] > 28) {var dim = xxiDateDaysInMonth(baseDate[bmonth],baseDate[byear]);if (baseDate[bday] > dim) baseDate[bday] = dim;}if (tday.getMonth() == 11 && baseDate[bmonth] == 1) {baseDate[byear] = baseDate[byear] + 1;}return xxiDateReturn(baseDate);}if (dateParts[0] > 1900 && dateParts[0] < 3000) {var tday = new Date();var baseDate = new Array(dateParts[0], dateParts[1], 1);if (baseDate[bmonth] < 1) baseDate[bmonth] = tday.getMonth() + 1;if (baseDate[bmonth] > 12) return null;if (baseDate[bday] > 28) {var dim = xxiDateDaysInMonth(baseDate[bmonth],baseDate[byear]);if (baseDate[bday] > dim) baseDate[bday] = dim;}return xxiDateReturn(baseDate);}return null;}if (dateParts.length == 3) {if (dateParts[0] < 13) {var tday = new Date();var baseDate = new Array(dateParts[2], dateParts[0], dateParts[1]);if (baseDate[bday] > 28) {var dim = xxiDateDaysInMonth(baseDate[bmonth],baseDate[byear]);if (baseDate[bday] > dim) baseDate[bday] = dim;}if (baseDate[byear].length == 1) {var tdayYear = tday.getFullYear();var tdayCent = tdayYear.toString().substring(0,2);baseDate[byear] = tdayCent + "0" + baseDate[byear];return xxiDateReturn(baseDate);}if (baseDate[byear].length == 2) {var tdayYear = tday.getFullYear();var tdayCent = tdayYear.toString().substring(0,2);if (baseDate[byear] < 40) {baseDate[byear] = tdayCent + baseDate[byear];} else {tdayCent = tdayCent - 1;baseDate[byear] = tdayCent + baseDate[byear];}return xxiDateReturn(baseDate);}if (baseDate[byear].length == 3) {baseDate[byear] = baseDate[byear] + "0";return xxiDateReturn(baseDate);}if (baseDate[byear].length == 4) {return xxiDateReturn(baseDate);}return null;}var baseDate = new Array(dateParts[0], dateParts[1], dateParts[2]);return xxiDateReturn(baseDate);}return null;}function xxiDateReturn(baseDate) {var byear = 0;var bmonth = 1;var bday = 2;if (baseDate[byear] == null) return null;if (baseDate[bmonth] == null) return null;if (baseDate[bday] == null) return null;if (baseDate[byear] < 1900) return null;if (baseDate[byear] > 3000) return null;if (baseDate[bmonth] < 1) return null;if (baseDate[bmonth] > 12) return null;if (baseDate[bday] < 1) return null;if (baseDate[bday] > 28) {var dim = xxiDateDaysInMonth(baseDate[bmonth],baseDate[byear]);if (baseDate[bday] > dim) return null;}var mStr = baseDate[bmonth].toString();if (mStr.length < 2) mStr = "0" + mStr;var dStr = baseDate[bday].toString();if (dStr.length < 2) dStr = "0" + dStr;return baseDate[byear] +"-" + mStr + "-" + dStr;}function xxiDateDaysInMonth(month,year) {if (month == 1) return 31;if (month == 2) {var testDate = new Date(year, month, 0);return testDate.getDate();}if (month == 3) return 31;if (month == 4) return 30;if (month == 5) return 31;if (month == 6) return 30;if (month == 7) return 31;if (month == 8) return 31;if (month == 9) return 30;if (month == 10) return 31;if (month == 11) return 30;if (month == 12) return 31;return - 1;}function xxiDateNextWeekDay(fromDate, weekDay) {for (var i=0; i< 8; i++) {if (fromDate.getDay() == weekDay) {return fromDate;} else {fromDate.setDate(fromDate.getDate()+1);}}return null;}function xxiTime(timeVal) {if (timeVal == null || timeVal.length < 1) return "";var timeValUpper = timeVal.toUpperCase();if (timeValUpper == "N" || timeValUpper == "NO" || timeValUpper == "NOW") {var tday = new Date();var baseTime = new Array(tday.getHours(), tday.getMinutes());if (baseTime[0].length < 2) baseTime[0] = "0" + baseTime[0];if (baseTime[1].length < 2) baseTime[1] = "0" + baseTime[1];return baseTime[0] +":" + baseTime[1];}var apm = "MILITARY";if (timeValUpper.indexOf("A") > -1) {apm = "AM";} else if (timeValUpper.indexOf("P") > -1) {apm = "PM";}var timeParts = new Array();var part = "";for (var i=0; i<timeVal.length; i++) {var c = timeVal.charAt(i);if (((c < "0") || (c > "9"))) {if (part.length > 0) {timeParts.push(part);part = "";}} else {part = part + c;}}if (part.length > 0) {timeParts.push(part);}if (timeParts.length < 1) return null;if (timeParts.length == 1) {if (timeParts[0].length > 4) return null;if (timeParts[0].length < 3) {var baseTime = new Array(timeParts[0], "00");if (apm == "PM" && parseInt(baseTime[0]) > 0 && parseInt(baseTime[0]) < 12) baseTime[0] = parseInt(baseTime[0]) + 12;if (baseTime[0].length < 2) baseTime[0] = "0" + baseTime[0];if (baseTime[1].length < 2) baseTime[1] = "0" + baseTime[1];if (parseInt(baseTime[0]) > 23) return null;if (parseInt(baseTime[1]) > 59) return null;return baseTime[0] +":" + baseTime[1];}if (timeParts[0].length == 3) {var baseTime = new Array(timeParts[0].substr(0,2), timeParts[0].substr(2,1));if (apm == "PM" && parseInt(baseTime[0]) > 0 && parseInt(baseTime[0]) < 12) baseTime[0] = parseInt(baseTime[0]) + 12;if (baseTime[0].length < 2) baseTime[0] = "0" + baseTime[0];if (baseTime[1].length < 2) baseTime[1] = "0" + baseTime[1];if (parseInt(baseTime[0]) > 23) return null;if (parseInt(baseTime[1]) > 59) return null;return baseTime[0] +":" + baseTime[1];}if (timeParts[0].length == 4) {var baseTime = new Array(timeParts[0].substr(0,2), timeParts[0].substr(2,2));if (apm == "PM" && parseInt(baseTime[0]) > 0 && parseInt(baseTime[0]) < 12) baseTime[0] = parseInt(baseTime[0]) + 12;if (baseTime[0].length < 2) baseTime[0] = "0" + baseTime[0];if (baseTime[1].length < 2) baseTime[1] = "0" + baseTime[1];if (parseInt(baseTime[0]) > 23) return null;if (parseInt(baseTime[1]) > 59) return null;return baseTime[0] +":" + baseTime[1];}}if (timeParts.length == 2) {if (timeParts[0] > 23) return null;if (timeParts[1] > 59) return null;var baseTime = new Array(timeParts[0], timeParts[1]);if (apm == "PM" && parseInt(baseTime[0]) > 0 && parseInt(baseTime[0]) < 12) baseTime[0] = parseInt(baseTime[0]) + 12;if (baseTime[0].length < 2) baseTime[0] = "0" + baseTime[0];if (baseTime[1].length < 2) baseTime[1] = "0" + baseTime[1];if (parseInt(baseTime[0]) > 23) return null;if (parseInt(baseTime[1]) > 59) return null;return baseTime[0] +":" + baseTime[1];}return null;}function xxsDate(format) {var dateFormat = format;this.interpret = function(dateVal) {var interpVal = xxiDate(dateVal);if (interpVal == null) return null;return xxfDate(interpVal, dateFormat);};}function xxsTime(format) {var timeFormat = format;this.interpret = function(timeVal) {var interpVal = xxiTime(timeVal);if (interpVal == null) return null;return xxfTime(interpVal, timeFormat);};}function xxsValListSorter(a, b) {if (a[0] < b[0]) return -1;if (a[0] > b[0]) return 1;return 0;}function xxsValList(listValsIn) {var listVals = listValsIn;var workList = null;var listPos = -1;var ulMent = null;var ulMentHandle = null;var sugControlID = null;this.init = function(compID, sugCompID) {sugControlID = sugCompID;var pipeParts = null;var piped = false;if (listVals[0].indexOf("|") > -1) piped = true;workList = new Array();for (var i=0; i<listVals.length; i++) {if (piped) {pipeParts = listVals[i].split("|");workList.push(new Array(pipeParts[0].toUpperCase(), pipeParts[0], pipeParts[1]));} else {workList.push(new Array(listVals[i].toUpperCase(), listVals[i], listVals[i]));}}workList.sort(xxsValListSorter);ulMentHandle = "xxs" + comReplaceAll(compID,".","");ulMent = new Element('ul', {'id': ulMentHandle + '.ul'});var liMent = null;for (var i=0; i<workList.length; i++) {liMent = new Element('li', {'id': ulMentHandle + "." + i.toString(), 'class': 'deselected', 'tabindex': '-1'});liMent.onmousedown = function (evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "onclick", evt)};liMent.ondblclick = function (evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "ondblclick", evt)};liMent.update(workList[i][2]);ulMent.appendChild(liMent);}};this.getListElement = function() {return ulMent;};this.getListHandle = function() {return ulMentHandle;};this.getSelVal = function() {if (listPos < 0) return "";return workList[listPos][1];};this.interpret = function(inputVal) {var newPos = -1;var workVal = inputVal.toUpperCase();for (var i=0; i<workList.length; i++) {if (workVal <= workList[i][0]) {newPos = i;break;}}if (listPos > -1) $($(ulMentHandle + '.' + listPos.toString())).className = "on";listPos = newPos;if (listPos > -1) {$($(ulMentHandle + '.' + listPos.toString())).className = "selected";var spos = listPos * 15;$($(sugControlID)).scrollTop = spos;return workList[listPos][1];} else {listPos = workList.length - 1;$($(ulMentHandle + '.' + listPos.toString())).className = "selected";var spos = listPos * 15;$($(sugControlID)).scrollTop = spos;return workList[listPos][1];}};this.selectPos = function(pos) {try {if (listPos > -1) $($(ulMentHandle + '.' + listPos.toString())).className = "deselected";listPos = pos;$($(ulMentHandle + '.' + listPos.toString())).className = "selected";} catch (e) {comExceptTrace("JJS00925 Exception " + e);return;}};this.selectNav = function(direction) {try {if (listPos < 0) {$($(ulMentHandle + '.' + listPos.toString())).className = "on";$($(sugControlID)).scrollTop = 0;return;}if (direction == "DOWN") {if (listPos >= workList.length - 1) return;$($(ulMentHandle + '.' + listPos.toString())).className = "deselected";listPos = listPos + 1;$($(ulMentHandle + '.' + listPos.toString())).className = "selected";var spos = listPos * 15;$($(sugControlID)).scrollTop = spos;return;}if (direction == "UP") {if (listPos == 0) return;$($(ulMentHandle + '.' + listPos.toString())).className = "deselected";listPos = listPos - 1;$($(ulMentHandle + '.' + listPos.toString())).className = "selected";var spos = listPos * 15;$($(sugControlID)).scrollTop = spos;return;}return;} catch (e) {comExceptTrace("JJS00926 Exception " + e);return;}};}function xxsSuggesterList(winID, compID, sugCompID, interpFunc, pullTab) {try {interpFunc.init(compID, sugCompID);var sug = new xxsSuggestListControl(compID, sugCompID);sug.init();sug.setInterpreter(interpFunc);comWEQ.listen(winID, compID, "onfocus", "suggestOnFocus", sug, sug.sugOnFocus);comWEQ.listen(winID, compID, "onchange", "suggestOnBlur", sug, sug.sugOnChange);comWEQ.listen(winID, compID, "onblur", "suggestOnBlur", sug, sug.sugBlur);comWEQ.listen(winID, compID, "onkeyup", "suggestOnKeyUp", sug, sug.sugKeyUp);comWEQ.listen(winID, compID, "onkeypress", "suggestOnKeyPress", sug, sug.sugKeyPress);if (pullTab != null) {$($(pullTab)).onmousedown = function (evt) {return comWEQ.fireEvent(winID, pullTab, "onclick", evt)};comWEQ.listen(winID, pullTab, "onclick", "suggestOnPullTab", sug, sug.sugPullTab);}var listHandle = interpFunc.getListHandle();comWEQ.listen(listHandle, "*", "onclick", "xxsonclick." + listHandle, sug, sug.sugonclick);comWEQ.listen(listHandle, "*", "ondblclick", "xxsondblclick." + listHandle, sug, sug.sugondblclick);return sug;} catch (e) {comExceptTrace("xxsSuggesterList Exception " + e);}}function xxsSuggestListControl(srcID, sugCompID) {var suggestMent = $($(sugCompID));var srcNodeID = srcID;var holdVal = "";var interpreter = null;var sugHeight = null;var showSuggester = function() {suggestMent.down().remove();suggestMent.appendChild(interpreter.getListElement());suggestMent.className = "suggestList";var srcNode = $($(srcNodeID));suggestMent.clonePosition(srcNode, {setHeight: false});var h = srcNode.getHeight();var y = suggestMent.offsetTop;var newTop = y + h;suggestMent.setStyle({'top': newTop + "px"});if (sugHeight == null) sugHeight = xxfldGetDigits(suggestMent.getStyle('height'));suggestMent.setStyle({'height': sugHeight + "px"});return;};this.init = function() {};this.setDisplayRows = function(rows) {var h = rows * 16;sugHeight = h.toString();};this.setInterpreter = function(interpFunc) {interpreter = interpFunc;};this.setFormatter = function(formatterFunc) {formatter = formatterFunc;};this.sugOnFocus = function(evt) {try {var srcNode = $($(srcNodeID));holdVal = srcNode.value;} catch (e) {comExceptTrace("sugOnFocus Exception " + e);return;}};this.sugKeyPress = function(evt) {try {if (suggestMent.className == "off") return true;var keyName = comKeyName(evt);if (keyName == "KEY_ESC") return false;if (keyName == "KEY_DOWN") return false;if (keyName == "KEY_UP") return false;if (keyName == "KEY_RETURN") return false;return true;} catch (e) {comExceptTrace("sugKeyPress Exception " + e);return false;}};this.sugPullTab = function(evt) {try {var srcNode = $($(srcNodeID));if (suggestMent.className == "off") {srcNode.focus();showSuggester();holdVal = srcNode.value;interpreter.interpret(holdVal);return false;} else {suggestMent.className = "off";return false;}} catch (e) {comExceptTrace("sugPullTab Exception " + e);return false;}};this.sugKeyUp = function(evt) {try {var keyName = comKeyName(evt);var srcNode = $($(srcNodeID));if (suggestMent.className == "off") {if (keyName == "KEY_ESC") return true;if (keyName == "KEY_RETURN") return true;if (keyName == "KEY_DOWN") {showSuggester();holdVal = srcNode.value;interpreter.interpret(holdVal);return false;}if (srcNode.value == holdVal) return true;showSuggester();holdVal = srcNode.value;interpreter.interpret(holdVal);return false;}if (keyName == "KEY_ESC") {suggestMent.className = "off";srcNode.value = holdVal;return false;}if (keyName == "KEY_RETURN") {suggestMent.className = "off";srcNode.value = interpreter.getSelVal();return false;}if (keyName == "KEY_DOWN") {interpreter.selectNav("DOWN");return false;}if (keyName == "KEY_UP") {interpreter.selectNav("UP");return false;}holdVal = srcNode.value;interpreter.interpret(holdVal);return true;} catch (e) {comExceptTrace("sugKeyUp Exception " + e);return false;}};this.sugonclick = function(evt) {try {if (suggestMent.className == "suggestList") {var compID = xxeGetEventID(evt);var compParts = compID.split(".");var compRow = parseInt(compParts[1]);interpreter.selectPos(compRow);return false;}return true;} catch (e) {comExceptTrace("JJS00927 Exception " + e);return true;}};this.sugondblclick = function(evt) {try {if (suggestMent.className == "suggestList") {suggestMent.className = "off";var srcNode = $($(srcNodeID));srcNode.value = interpreter.getSelVal();return false;}return true;} catch (e) {comExceptTrace("JJS00928 Exception " + e);return true;}};this.sugOnChange = function(evt) {try {if (suggestMent.className == "suggestList") {suggestMent.className = "off";var srcNode = $($(srcNodeID));srcNode.value = interpreter.getSelVal();}} catch (e) {comExceptTrace("sugOnChange Exception " + e);return;}};this.sugBlur = function(evt) {try {if (suggestMent.className == "suggestList") {suggestMent.className = "off";var srcNode = $($(srcNodeID));srcNode.value = interpreter.getSelVal();}return true;} catch (e) {comExceptTrace("JJS00929 Exception " + e);return true;}};}function xxsSuggester(winID, compID, interpFunc) {try {var sug = new xxsSuggestControl(compID);sug.setInterpreter(interpFunc);comWEQ.listen(winID, compID, "onfocus", "suggestOnFocus", sug, sug.sugOnFocus);comWEQ.listen(winID, compID, "onchange", "suggestOnBlur", sug, sug.sugOnChange);comWEQ.listen(winID, compID, "onblur", "suggestOnBlur", sug, sug.sugBlur);comWEQ.listen(winID, compID, "onkeyup", "suggestOnKeyUp", sug, sug.sugKeyUp);comWEQ.listen(winID, compID, "onkeypress", "suggestOnKeyPress", sug, sug.sugKeyPress);} catch (e) {comExceptTrace("xxsSuggester Exception " + e);}}function xxsSuggestControl(srcID) {var suggestNode = document.getElementById("valSuggestControl");var suggestText = document.getElementById("valSuggestText");var srcNode = document.getElementById(srcID);var holdVal = "";var interpreter = null;var formatter = null;var show = function(srcID) {suggestNode.className = "on";$(suggestNode).clonePosition(document.getElementById(srcID));var h = $(suggestNode).getHeight();var y = $(suggestNode).offsetTop;var newTop = y +h;var newTopStr = newTop + "px";suggestNode.style.top = newTopStr;return;};this.setInterpreter = function(interpFunc) {interpreter = interpFunc;};this.setFormatter = function(formatterFunc) {formatter = formatterFunc;};this.sugOnFocus = function(e) {try {holdVal = srcNode.value;} catch (e) {comExceptTrace("sugOnFocus Exception " + e);return;}};this.sugKeyPress = function(e) {try {var keyName = comKeyName(e);if (keyName == "ESC") {if (suggestNode.className == "on") {suggestNode.className = "off";return false;}return true;}return true;} catch (e) {comExceptTrace("sugKeyPress Exception " + e);return false;}};this.sugKeyUp = function(e) {try {var keyName = comKeyName(e);if (keyName == "ENTER") {if (suggestNode.className == "on") {suggestNode.className = "off";var sugVal = suggestText.innerHTML;if (sugVal != "hmmm...") srcNode.value = suggestText.innerHTML;return false;}return true;}var curVal = srcNode.value;if (curVal == holdVal) return true;if (suggestNode.className == "off") {var eid = xxeGetEventID(e);show(eid);}holdVal = curVal;var interpVal = interpreter.interpret(curVal);if (interpVal == null) interpVal = "hmmm...";suggestText.innerHTML = interpVal;return true;} catch (e) {comExceptTrace("sugKeyUp Exception " + e);return false;}};this.sugOnChange = function(e) {try {if (suggestNode.className != "off") {suggestNode.className = "off";var sugVal = suggestText.innerHTML;if (sugVal != "hmmm...") {srcNode.value = suggestText.innerHTML;}}} catch (e) {comExceptTrace("sugOnChange Exception " + e);return;}};this.sugBlur = function(e) {try {if (suggestNode.className != "off") {suggestNode.className = "off";}} catch (e) {comExceptTrace("sugBlur Exception " + e);return;}};}function xxsSugListInterp(listValsIn) {var listVals = listValsIn;var workList = null;var listPos = -1;var sugWinID = null;var sugControlID = null;this.init = function(winID, compID, sugCompID) {sugWinID = winID;sugControlID = sugCompID;var pipeParts = null;var piped = false;if (listVals[0].indexOf("|") > -1) piped = true;workList = new Array();for (var i=0; i<listVals.length; i++) {if (piped) {pipeParts = listVals[i].split("|");workList.push(new Array(pipeParts[0].toUpperCase(), pipeParts[0], pipeParts[1]));} else {workList.push(new Array(listVals[i].toUpperCase(), listVals[i], listVals[i]));}}workList.sort(xxsValListSorter);var sugControl = document.getElementById(sugControlID);var ulMent = new Element('ul', {'id': sugControlID + '.ul', 'tabindex': '-1'});var liMent = null;for (var i=0; i<workList.length; i++) {liMent = new Element('li', {'id': sugControlID + "." + i.toString(), 'class': 'deselected', 'tabindex': '-1'});liMent.update(workList[i][2]);ulMent.appendChild(liMent);}ulMent.ondblclick = xxeFireDblClick;sugControl.appendChild(ulMent);sugControl.onmousedown = xxeFireMouseDown;document.onmouseup = xxeFireDocMouseUp;};this.trashMan = function() {var sugMent = document.getElementById(sugControlID);sugMent.onmousedown = null;sugMent = null;var ulMent = document.getElementById(sugControlID + '.ul');if (ulMent != null) {ulMent.ondblclick = null;ulMent = null;}listVals = null;workList = null;listPos = null;sugWinID = null;sugControlID = null;ulMent = null;};this.getSelVal = function() {if (listPos < 0) return "";return workList[listPos][1];};this.interpret = function(inputVal) {var newPos = -1;var workVal = inputVal.toUpperCase();for (var i=0; i<workList.length; i++) {if (workVal <= workList[i][0]) {newPos = i;break;}}if (listPos > -1) $($(sugControlID + '.' + listPos.toString())).className = "on";listPos = newPos;if (listPos > -1) {$($(sugControlID + '.' + listPos.toString())).className = "selected";var spos = listPos * 15;$($(sugControlID)).scrollTop = spos;return workList[listPos][1];} else {listPos = workList.length - 1;$($(sugControlID + '.' + listPos.toString())).className = "selected";var spos = listPos * 15;$($(sugControlID)).scrollTop = spos;return workList[listPos][1];}};this.selectPos = function(pos) {try {if (listPos > -1) $($(sugControlID + '.' + listPos.toString())).className = "deselected";listPos = pos;$($(sugControlID + '.' + listPos.toString())).className = "selected";} catch (e) {comExceptTrace("JJS00925 Exception " + e);return;}};this.selectNav = function(direction) {try {if (listPos < 0) {$($(sugControlID + '.' + listPos.toString())).className = "on";$($(sugControlID)).scrollTop = 0;return;}if (direction == "DOWN") {if (listPos >= workList.length - 1) return;$($(sugControlID + '.' + listPos.toString())).className = "deselected";listPos = listPos + 1;$($(sugControlID + '.' + listPos.toString())).className = "selected";var spos = listPos * 15;$($(sugControlID)).scrollTop = spos;return;}if (direction == "UP") {if (listPos == 0) return;$($(sugControlID + '.' + listPos.toString())).className = "deselected";listPos = listPos - 1;$($(sugControlID + '.' + listPos.toString())).className = "selected";var spos = listPos * 15;$($(sugControlID)).scrollTop = spos;return;}return;} catch (e) {comExceptTrace("JJS00926 Exception " + e);return;}};}function xxsSugList(winID, compID, sugCompID, interpFunc, pullTab) {try {interpFunc.init(winID, compID, sugCompID);var sug = new xxsSugListControl(compID, sugCompID);sug.init();sug.setInterpreter(interpFunc);comWEQ.listen(winID, compID, "onfocus", sugCompID + "suggestOnFocus", sug, sug.sugOnFocus);comWEQ.listen(winID, compID, "onchange", sugCompID + "suggestOnBlur", sug, sug.sugOnChange);comWEQ.listen(winID, compID, "onblur", sugCompID + "suggestOnBlur", sug, sug.sugBlur);comWEQ.listen(winID, compID, "onkeyup", sugCompID + "suggestOnKeyUp", sug, sug.sugKeyUp);comWEQ.listen(winID, compID, "onkeypress", sugCompID + "suggestOnKeyPress", sug, sug.sugKeyPress);comWEQ.listen(winID, sugCompID, "citycomplete", sugCompID + "citycomplete", sug, sug.cityComplete);comWEQ.listen("trashman", "trashman", "trashman", sugCompID + "trashman", sug, sug.trashMan);comWEQ.listen(sugCompID, "*", "onmousedown", sugCompID + "onmousedown", sug, sug.sugonmousedown);comWEQ.listen(sugCompID, "*", "ondblclick", sugCompID + "ondblclick", sug, sug.sugondblclick);comWEQ.listenFirst("DOCUMENT", "DOCUMENT", "onmouseup", sugCompID + "onmouseup", sug, sug.sugonmouseup);if (pullTab) {try {document.getElementById(compID + "Pull").onmousedown = xxeFireMouseDown;comWEQ.listen(winID, compID + "Pull", "onmousedown", winID + sugCompID + "PULL", sug, sug.sugPullTab);} catch (pe) {alert(pe);}}return sug;} catch (e) {comExceptTrace("xxsSugCity Exception " + e);}}function xxsSugListControl(srcID, sugCompID) {var suggestMent = $($(sugCompID));var srcNodeID = srcID;var holdVal = "";var interpreter = null;var formatter = null;var sugHeight = null;var ieSMA = false;var showSuggester = function() {var srcNode = $($(srcNodeID));suggestMent.className = "suggestList";suggestMent.clonePosition(srcNode, {setHeight: false});var h = srcNode.getHeight();var y = suggestMent.offsetTop;var newTop = y + h;suggestMent.setStyle({'top': newTop + "px"});if (sugHeight == null) sugHeight = xxfldGetDigits(suggestMent.getStyle('height'));suggestMent.setStyle({'height': sugHeight + "px"});return;};this.init = function() {return;};this.trashMan = function() {if (interpreter != null) {interpreter.trashMan();interpreter = null;}if (formatter != null) {formatter.trashMan();formatter = null;}suggestMent = null;srcNodeID = null;holdVal = null;sugHeight = null;ieSMA = null;showSuggester = null;return true;};this.setInterpreter = function(interpFunc) {interpreter = interpFunc;};this.setFormatter = function(formatterFunc) {formatter = formatterFunc;};this.setDisplayRows = function(rows) {var h = rows * 16;sugHeight = h.toString();};this.sugOnFocus = function(evt) {try {var srcNode = $($(srcNodeID));holdVal = srcNode.value;} catch (e) {comExceptTrace("sugOnFocus Exception " + e);return;}};this.sugPullTab = function(evt) {try {var srcNode = $($(srcNodeID));if (suggestMent.className == "off") {ieSMA = true;srcNode.focus();showSuggester();holdVal = srcNode.value;interpreter.interpret(holdVal);return false;} else {suggestMent.className = "off";return false;}} catch (e) {comExceptTrace("sugPullTab Exception " + e);return false;}};this.sugKeyPress = function(evt) {try {if (suggestMent.className == "off") return true;var keyName = comKeyName(evt);if (keyName == "KEY_ESC") return false;if (keyName == "KEY_DOWN") return false;if (keyName == "KEY_UP") return false;if (keyName == "KEY_RETURN") return false;return true;} catch (e) {comExceptTrace("sugKeyPress Exception " + e);return false;}};this.sugKeyUp = function(evt) {try {var keyName = comKeyName(evt);var srcNode = $($(srcNodeID));if (suggestMent.className == "off") {if (keyName == "KEY_ESC") return true;if (keyName == "KEY_RETURN") return true;if (srcNode.value.length < 1) return true;if (keyName == "KEY_DOWN") {showSuggester();holdVal = srcNode.value;interpreter.interpret(holdVal);return false;}if (srcNode.value == holdVal) return true;showSuggester();holdVal = srcNode.value;interpreter.interpret(holdVal);return false;}if (srcNode.value.length < 1) {suggestMent.className = "off";holdVal = srcNode.value;return false;}if (keyName == "KEY_ESC") {suggestMent.className = "off";srcNode.value = holdVal;return false;}if (keyName == "KEY_RETURN") {suggestMent.className = "off";var selVal = interpreter.getSelVal();if (selVal != "Hmmm...") srcNode.value = selVal;return false;}if (keyName == "KEY_DOWN") {interpreter.selectNav("DOWN");return false;}if (keyName == "KEY_UP") {interpreter.selectNav("UP");return false;}holdVal = srcNode.value;interpreter.interpret(holdVal);return true;} catch (e) {comExceptTrace("JJS00868 Exception " + e);return false;}};this.sugOnChange = function(evt) {try {if (ieSMA) {$($(srcNodeID)).focus();return false;}if (suggestMent.className == "suggestList") {suggestMent.className = "off";var srcNode = document.getElementById(srcNodeID);var selVal = interpreter.getSelVal();if (selVal != "Hmmm...") srcNode.value = selVal;}return true;} catch (e) {comExceptTrace("JJS00869 Exception " + e);return false;}};this.sugBlur = function(evt) {try {if (ieSMA) {$($(srcNodeID)).focus();return false;}if (suggestMent.className == "suggestList") {suggestMent.className = "off";var srcNode = $($(srcNodeID));var selVal = interpreter.getSelVal();if (selVal != "Hmmm...") srcNode.value = selVal;}return true;} catch (e) {comExceptTrace("JJS00870 Exception " + e);return true;}};this.sugonmousedown = function(evt) {try {ieSMA = true;if (suggestMent.className == "suggestList") {var compID = xxeGetEventID(evt);var compParts = compID.split(".");var compRow = parseInt(compParts[1]);interpreter.selectPos(compRow);return false;}return true;} catch (e) {comExceptTrace("JJS00871 Exception " + e);return true;}};this.sugonmouseup = function(evt) {try {ieSMA = false;return true;} catch (e) {return true;}};this.sugondblclick = function(evt) {try {if (suggestMent.className == "suggestList") {suggestMent.className = "off";var srcNode = $($(srcNodeID));var selVal = interpreter.getSelVal();if (selVal != "Hmmm...") srcNode.value = selVal;return false;}return true;} catch (e) {comExceptTrace("JJS00872 Exception " + e);return true;}};this.cityComplete = function(evt) {try {interpreter.setCities(evt);return true;} catch (e) {comExceptTrace("JJS00873 Exception " + e);return true;}};}function xxsdDate(format) {var dateFormat = format;this.interpret = function(dateVal) {var interpVal = xxiDate(dateVal);if (interpVal == null) return null;return xxfDate(interpVal, dateFormat);};}function xxsdTime(format) {var timeFormat = format;this.interpret = function(timeVal) {var interpVal = xxiTime(timeVal);if (interpVal == null) return null;return xxfTime(interpVal, timeFormat);};}function xxsdSuggester(winID, compID, suggesterID, suggesterTextID, interpFunc) {try {var sug = new xxsdSuggestControl(compID, suggesterID, suggesterTextID);sug.setInterpreter(interpFunc);comWEQ.listen(winID, compID, "onfocus", "suggestOnFocus", sug, sug.sugOnFocus);comWEQ.listen(winID, compID, "onchange", "suggestOnBlur", sug, sug.sugOnChange);comWEQ.listen(winID, compID, "onblur", "suggestOnBlur", sug, sug.sugBlur);comWEQ.listen(winID, compID, "onkeyup", "suggestOnKeyUp", sug, sug.sugKeyUp);comWEQ.listen(winID, compID, "onkeypress", "suggestOnKeyPress", sug, sug.sugKeyPress);} catch (e) {comExceptTrace("xxsdSuggester Exception " + e);}}function xxsdSuggestControl(srcID, suggesterID, suggesterTextID) {var suggestNode = document.getElementById(suggesterID);var suggestText = document.getElementById(suggesterTextID);var srcNodeID = srcID;var holdVal = "";var interpreter = null;var formatter = null;var show = function(srcID) {suggestNode.className = "suggestSingle";$(suggestNode).clonePosition(document.getElementById(srcID));var h = $(suggestNode).getHeight();var y = $(suggestNode).offsetTop;var newTop = y +h;var newTopStr = newTop + "px";suggestNode.style.top = newTopStr;return;};this.setInterpreter = function(interpFunc) {interpreter = interpFunc;};this.setFormatter = function(formatterFunc) {formatter = formatterFunc;};this.sugOnFocus = function(e) {try {holdVal = $(srcNodeID).value;} catch (e) {comExceptTrace("sugOnFocus Exception " + e);return;}};this.sugKeyPress = function(e) {try {var keyName = comKeyName(e);if (keyName == "KEY_ESC") {if (suggestNode.className != "off") {suggestNode.className = "off";return false;}return true;}return true;} catch (e) {comExceptTrace("sugKeyPress Exception " + e);return false;}};this.sugKeyUp = function(e) {try {var keyName = comKeyName(e);if (keyName == "ENTER") {if (suggestNode.className != "off") {suggestNode.className = "off";var sugVal = suggestText.innerHTML;if (sugVal != "hmmm...") $(srcNodeID).value = suggestText.innerHTML;return false;}return true;}var curVal = $(srcNodeID).value;if (curVal == holdVal) return true;if (suggestNode.className == "off") {var eid = xxeGetEventID(e);show(eid);}holdVal = curVal;var interpVal = interpreter.interpret(curVal);if (interpVal == null) interpVal = "hmmm...";suggestText.innerHTML = interpVal;return true;} catch (e) {comExceptTrace("sugKeyUp Exception " + e);return false;}};this.sugOnChange = function(e) {try {if (suggestNode.className != "off") {suggestNode.className = "off";var sugVal = suggestText.innerHTML;if (sugVal != "hmmm...") {$(srcNodeID).value = suggestText.innerHTML;}}} catch (e) {comExceptTrace("sugOnChange Exception " + e);return;}};this.sugBlur = function(e) {try {if (suggestNode.className != "off") {suggestNode.className = "off";}} catch (e) {comExceptTrace("sugBlur Exception " + e);return;}};}function xxsSugCityInterp() {var lastLookupOndeck = null;var lastLookupRequested = null;var lastLookupReceived = null;var workList = null;var listPos = -1;var sugWinID = null;var sugControlID = null;var timer = null;this.init = function(winID, compID, sugCompID) {sugWinID = winID;sugControlID = sugCompID;workList = new Array(11);for (var i=0; i< workList.length; i++) {workList[i] = "";}};this.trashMan = function() {var sugMent = document.getElementById(sugControlID);sugMent.onmousedown = null;sugMent = null;var ulMent = document.getElementById(sugControlID + '.ul');if (ulMent != null) {ulMent.ondblclick = null;ulMent = null;}lastLookupOndeck = null;lastLookupRequested = null;lastLookupReceived = null;workList = null;listPos = null;sugWinID = null;sugControlID = null;timer = null;};this.setCities = function(cityList) {var lookupList = cityList.split("|");for (var i=0; i<lookupList.length; i++) {workList[i] = lookupList[i];}if (lookupList.length < 11) {for (var j=lookupList.length; j<11; j++) {workList[j] = "";}}var sugControl = document.getElementById(sugControlID);var ulMent = document.getElementById(sugControlID + '.ul');if (ulMent == null) {ulMent = new Element('ul', {'id': sugControlID + '.ul', 'tabindex': '-1'});var liMent = null;for (var k=0; k<workList.length - 1; k++) {if (k == 0) {liMent = new Element('li', {'id': sugControlID + "." + k.toString(), 'class': 'selected', 'tabindex': '-1'});} else {liMent = new Element('li', {'id': sugControlID + "." + k.toString(), 'class': 'deselected', 'tabindex': '-1'});}liMent.innerHTML = workList[k + 1];ulMent.appendChild(liMent);}ulMent.ondblclick = xxeFireDblClick;sugControl.appendChild(ulMent);sugControl.onmousedown = xxeFireMouseDown;document.onmouseup = xxeFireDocMouseUp;} else {ulMent = sugControl.removeChild(ulMent);var liNodes = ulMent.getElementsByTagName("li");for (var l=0; l<liNodes.length; l++) {if (l == 0) {liNodes[l].className = "selected";if (workList[l + 1].length < 1) {liNodes[l].innerHTML = "Hmmm...";} else {liNodes[l].innerHTML = workList[l + 1];}} else {if (workList[l + 1].length < 1) {liNodes[l].className = "off";} else {liNodes[l].className = "deselected";}liNodes[l].innerHTML = workList[l + 1];}}sugControl.appendChild(ulMent);}if (lookupList.length < 2) {listPos = -1;} else {listPos = 0;}sugControl.scrollTop = 0;lastLookupReceived = workList[0];};this.lookupFlush = function() {if (lastLookupOndeck == lastLookupReceived) return true;return false;};this.getSelVal = function() {var ulMent = document.getElementById(sugControlID + '.ul');if (ulMent == null) return "";var liNodes = ulMent.getElementsByTagName("li");for (var i=0; i<liNodes.length; i++) {if (liNodes[i].className == "selected") return liNodes[i].innerHTML;}return "";};this.getCities = function() {var dataReq = new xxsCityRequest();lastLookupRequested = lastLookupOndeck;dataReq.doCustom(lastLookupRequested, sugWinID, sugControlID);};this.interpret = function(inputVal) {if (timer) clearTimeout(timer);if (inputVal == lastLookupRequested && inputVal == lastLookupReceived) return;if (workList[0].length > 0 && workList[1].length < 1) {if (inputVal.indexOf(workList[0]) == 0) {return;}}lastLookupOndeck = inputVal;timer=setTimeout(this.getCities,2);};this.selectPos = function(pos) {try {if (listPos > -1) $($(sugControlID + '.' + listPos.toString())).className = "deselected";listPos = pos;$($(sugControlID + '.' + listPos.toString())).className = "selected";} catch (e) {comExceptTrace("JJS00866 Exception " + e);return;}};this.selectNav = function(direction) {try {if (listPos < 0) {$($(sugControlID + '.' + listPos.toString())).className = "selected";$($(sugControlID)).scrollTop = 0;return;}if (direction == "DOWN") {if (listPos >= workList.length - 2) return;$($(sugControlID + '.' + listPos.toString())).className = "deselected";listPos = listPos + 1;$($(sugControlID + '.' + listPos.toString())).className = "selected";$($(sugControlID)).scrollTop = listPos * 15;return;}if (direction == "UP") {if (listPos == 0) return;$($(sugControlID + '.' + listPos.toString())).className = "deselected";listPos = listPos - 1;$($(sugControlID + '.' + listPos.toString())).className = "selected";$($(sugControlID)).scrollTop = listPos * 15;return;}return;} catch (e) {comExceptTrace("JJS00867 Exception " + e);return;}};}function xxsSugCity(winID, compID, sugCompID, interpFunc) {try {interpFunc.init(winID, compID, sugCompID);var sug = new xxsSugCityControl(compID, sugCompID);sug.init();sug.setInterpreter(interpFunc);comWEQ.listen(winID, compID, "onfocus", sugCompID + "suggestOnFocus", sug, sug.sugOnFocus);comWEQ.listen(winID, compID, "onchange", sugCompID + "suggestOnBlur", sug, sug.sugOnChange);comWEQ.listen(winID, compID, "onblur", sugCompID + "suggestOnBlur", sug, sug.sugBlur);comWEQ.listen(winID, compID, "onkeyup", sugCompID + "suggestOnKeyUp", sug, sug.sugKeyUp);comWEQ.listen(winID, compID, "onkeypress", sugCompID + "suggestOnKeyPress", sug, sug.sugKeyPress);comWEQ.listen(winID, sugCompID, "citycomplete", sugCompID + "citycomplete", sug, sug.cityComplete);comWEQ.listen("trashman", "trashman", "trashman", sugCompID + "trashman", sug, sug.trashMan);comWEQ.listen(sugCompID, "*", "onmousedown", sugCompID + "onmousedown", sug, sug.sugonmousedown);comWEQ.listen(sugCompID, "*", "ondblclick", sugCompID + "ondblclick", sug, sug.sugondblclick);comWEQ.listenFirst("DOCUMENT", "DOCUMENT", "onmouseup", sugCompID + "onmouseup", sug, sug.sugonmouseup);return sug;} catch (e) {comExceptTrace("xxsSugCity Exception " + e);}}function xxsSugCityControl(srcID, sugCompID) {var suggestMent = $($(sugCompID));var srcNodeID = srcID;var holdVal = "";var interpreter = null;var formatter = null;var sugHeight = null;var ieSMA = false;var showSuggester = function() {var srcNode = $($(srcNodeID));suggestMent.className = "suggestList";suggestMent.clonePosition(srcNode, {setHeight: false});var h = srcNode.getHeight();var y = suggestMent.offsetTop;var newTop = y + h;suggestMent.setStyle({'top': newTop + "px"});if (sugHeight == null) sugHeight = xxfldGetDigits(suggestMent.getStyle('height'));suggestMent.setStyle({'height': sugHeight + "px"});return;};this.init = function() {return;};this.trashMan = function() {if (interpreter != null) {interpreter.trashMan();interpreter = null;}if (formatter != null) {formatter.trashMan();formatter = null;}suggestMent = null;srcNodeID = null;holdVal = null;sugHeight = null;ieSMA = null;showSuggester = null;return true;};this.setInterpreter = function(interpFunc) {interpreter = interpFunc;};this.setFormatter = function(formatterFunc) {formatter = formatterFunc;};this.setDisplayRows = function(rows) {var h = rows * 16;sugHeight = h.toString();};this.sugOnFocus = function(evt) {try {var srcNode = $($(srcNodeID));holdVal = srcNode.value;} catch (e) {comExceptTrace("sugOnFocus Exception " + e);return;}};this.sugKeyPress = function(evt) {try {if (suggestMent.className == "off") return true;var keyName = comKeyName(evt);if (keyName == "KEY_ESC") return false;if (keyName == "KEY_DOWN") return false;if (keyName == "KEY_UP") return false;if (keyName == "KEY_RETURN") return false;return true;} catch (e) {comExceptTrace("sugKeyPress Exception " + e);return false;}};this.sugKeyUp = function(evt) {try {var keyName = comKeyName(evt);var srcNode = $($(srcNodeID));if (suggestMent.className == "off") {if (keyName == "KEY_ESC") return true;if (keyName == "KEY_RETURN") return true;if (srcNode.value.length < 3) return true;if (keyName == "KEY_DOWN") {showSuggester();holdVal = srcNode.value;interpreter.interpret(holdVal);return false;}if (srcNode.value == holdVal) return true;showSuggester();holdVal = srcNode.value;interpreter.interpret(holdVal);return false;}if (srcNode.value.length < 3) {suggestMent.className = "off";holdVal = srcNode.value;return false;}if (keyName == "KEY_ESC") {suggestMent.className = "off";srcNode.value = holdVal;return false;}if (keyName == "KEY_RETURN") {suggestMent.className = "off";var selVal = interpreter.getSelVal();if (selVal != "Hmmm...") srcNode.value = selVal;return false;}if (keyName == "KEY_DOWN") {interpreter.selectNav("DOWN");return false;}if (keyName == "KEY_UP") {interpreter.selectNav("UP");return false;}holdVal = srcNode.value;interpreter.interpret(holdVal);return true;} catch (e) {comExceptTrace("JJS00868 Exception " + e);return false;}};this.sugOnChange = function(evt) {try {if (ieSMA) {$($(srcNodeID)).focus();return false;}if (suggestMent.className == "suggestList") {suggestMent.className = "off";var srcNode = document.getElementById(srcNodeID);if (interpreter.lookupFlush()) {var selVal = interpreter.getSelVal();if (selVal != "Hmmm...") srcNode.value = selVal;}}return true;} catch (e) {comExceptTrace("JJS00869 Exception " + e);return false;}};this.sugBlur = function(evt) {try {if (ieSMA) {$($(srcNodeID)).focus();return false;}if (suggestMent.className == "suggestList") {suggestMent.className = "off";var srcNode = $($(srcNodeID));var selVal = interpreter.getSelVal();if (selVal != "Hmmm...") srcNode.value = selVal;}return true;} catch (e) {comExceptTrace("JJS00870 Exception " + e);return true;}};this.sugonmousedown = function(evt) {try {ieSMA = true;if (suggestMent.className == "suggestList") {var compID = xxeGetEventID(evt);var compParts = compID.split(".");var compRow = parseInt(compParts[1]);interpreter.selectPos(compRow);return false;}return true;} catch (e) {comExceptTrace("JJS00871 Exception " + e);return true;}};this.sugonmouseup = function(evt) {try {ieSMA = false;return true;} catch (e) {return true;}};this.sugondblclick = function(evt) {try {if (suggestMent.className == "suggestList") {suggestMent.className = "off";var srcNode = $($(srcNodeID));var selVal = interpreter.getSelVal();if (selVal != "Hmmm...") srcNode.value = selVal;return false;}return true;} catch (e) {comExceptTrace("JJS00872 Exception " + e);return true;}};this.cityComplete = function(evt) {try {interpreter.setCities(evt);return true;} catch (e) {comExceptTrace("JJS00873 Exception " + e);return true;}};}function xxsCityRequest() {var xxqHttpReq = null;var callbackWinID = null;var callbackCompID = null;this.doCustom = function(cityVal, winID, compID) {try {callbackWinID = winID;callbackCompID = compID;resetHttpReq();if (xxqHttpReq == null) return;xxqHttpReq.onreadystatechange=stateMonitor;var url = xxqWebApp + "/SuggestionService.php?city=" + cityVal;xxqHttpReq.open("POST",url,true);xxqHttpReq.setRequestHeader('Content-Type','text/xml');xxqHttpReq.send("city=" + cityVal);} catch(e) {comTrace(e);}};var resetHttpReq = function() {if (window.XMLHttpRequest) {xxqHttpReq = new XMLHttpRequest();} else if (window.ActiveXObject) {xxqHttpReq = new ActiveXObject("Microsoft.XMLHTTP");} else {}if (xxqHttpReq == null) {return;}};var stateMonitor = function() {try {if (xxqHttpReq.readyState==4) {if (xxqHttpReq.status != 200) {comTrace("xSugCity stateMonitor error: " + xxqHttpReq.status);return;}var respTxt = xxqHttpReq.responseText;comWEQ.fireEvent(callbackWinID, callbackCompID, "citycomplete", respTxt);xxqHttpReq = null;}} catch (e) {comTrace(e);}};}function xxvEmail(dataDoc, row, col) {try {var emailVal = dataDoc.getColValue(row, col);if (emailVal.length < 1) return comApprovedResp("JJS00239", "");var atPos=emailVal.indexOf("@");if (atPos < 1) return comDeniedResp("JJS00240", "Invalid email address");var dotPos=emailVal.lastIndexOf(".");if (dotPos-atPos<2) return comDeniedResp("JJS00241", "Invalid email address");return comApprovedResp("JJS00085", "");} catch (e) {throw "JJS00242 xxvEmail caught exception " + e;}}function xxvDateTime(dataDoc, row, col) {try {var dateVal = dataDoc.getColValue(row, col);if (dateVal.length < 1) return comApprovedResp("JJS00083", "");dateVal = dateVal.split(" ")[0];dateVal = xxiDate(dateVal);if (dateVal == null) return comDeniedResp("JJS00084", "Invalid date");dataDoc.setColValue(row, col, dateVal);return comApprovedResp("JJS00085", "");} catch (e) {throw "JJS00243 xxvDate caught exception " + e;}}function xxvDate(dataDoc, row, col) {try {var dateVal = dataDoc.getColValue(row, col);if (dateVal.length < 1) return comApprovedResp("JJS00083", "");dateVal = xxiDate(dateVal);if (dateVal == null) return comDeniedResp("JJS00084", "Invalid date");dataDoc.setColValue(row, col, dateVal);return comApprovedResp("JJS00085", "");} catch (e) {throw "JJS00243 xxvDate caught exception " + e;}}function xxvTime(dataDoc, row, col) {try {var timeVal = dataDoc.getColValue(row, col);if (timeVal.length < 1) return comApprovedResp("JJS00728", "");timeVal = xxiTime(timeVal);if (timeVal == null) return comDeniedResp("JJS00729", "Invalid time");dataDoc.setColValue(row, col, timeVal);return comApprovedResp("JJS00730", "");} catch (e) {throw "JJS00243 xxvDate caught exception " + e;}}function xxvNumber(dataDoc, row, col) {try {var numVal = dataDoc.getColValue(row, col);if (numVal.length < 1) return comApprovedResp("JJS00083", "");if (!xxfldContainsOnly(numVal, "0123456789$-(),.")) return comDeniedResp("JJS00084", "Invalid number.");var posVal = true;if (numVal.indexOf("-") > -1) posVal = false;if (numVal.indexOf("(") > -1) posVal = false;if (numVal.indexOf(".") == 0) {dataDoc.setColValue(row, col, "0");return comApprovedResp("JJS00085", "");}if (numVal.indexOf(".") > 0) numVal = numVal.split(".")[0];numVal = comReplaceAll(numVal, "-", "");numVal = comReplaceAll(numVal, "(", "");numVal = comReplaceAll(numVal, ")", "");numVal = numVal.replace(/^[0]+/g,"");if (numVal.length < 1) {dataDoc.setColValue(row, col, "0");return comApprovedResp("JJS00085", "");}if (!posVal) numVal = "-" + numVal;dataDoc.setColValue(row, col, numVal);return comApprovedResp("JJS00085", "");} catch (e) {throw "JJS00244 xxvNumber caught exception " + e;}}function xxvPhone(dataDoc, row, col) {try {var phoneVal = dataDoc.getColValue(row, col);if (phoneVal.length < 1) return comApprovedResp("JJS00083", "");var digits = xxfldGetDigits(phoneVal);digits = digits.replace(/^[1]+/g,"");if (digits.length < 10) return comDeniedResp("JJS00084", "Invalid phone number. Example 555-555-5555 x123");var s1 = digits.substring(0,3);var s2 = digits.substring(3,6);var s3 = digits.substring(6,10);var s4 = "";if (digits.length > 10) s4 = digits.substring(10);var retVal = s1 + "-" + s2 + "-" + s3;if (s4.length > 0) retVal = retVal + " x" + s4;dataDoc.setColValue(row, col, retVal);return comApprovedResp("JJS00085", "");} catch (e) {throw "JJS00245 xxvPhone caught exception " + e;}}function xxvBoolean(dataDoc, row, col) {try {var booVal = dataDoc.getColValue(row, col);if (booVal.length < 1) return comApprovedResp("JJS00083", "");booVal = booVal.toUpperCase();if (booVal == "TRUE" || booVal == "T" || booVal == "1" || booVal == "Y" || booVal == "YES" || booVal == "+") {dataDoc.setColValue(row, col, "true");return comApprovedResp("JJS00085", "");}if (booVal == "FALSE" || booVal == "F" || booVal == "0" || booVal == "N" || booVal == "NO" || booVal == "-") {dataDoc.setColValue(row, col, "false");return comApprovedResp("JJS00085", "");}return comDeniedResp("JJS00084", "Invalid boolean value. Example True or False");} catch (e) {throw "JJS00246 xxvBoolean caught exception " + e;}}function xxvPostalCode(dataDoc, row, col) {try {var zipVal = dataDoc.getColValue(row, col);if (zipVal.length < 1) return comApprovedResp("JJS00086", "Postal Code is valid");if (dataDoc.getColPos("country") < 0) return comApprovedResp("JJS00086", "Postal Code is valid");var country = dataDoc.getValue(row, "country");if (country == "USA" || country == "MEX") {var digits = xxfldGetDigits(zipVal);if (digits.length != 5 && digits.length != 9) return comDeniedResp("JJS00087", "Invalid US Postal Code. Example 58638 or 58638-1234");var retVal = digits.substring(0,5);var box = "";if (digits.length == 9) box = digits.substring(5);if (box.length > 0) retVal = retVal + "-" + box;dataDoc.setColValue(row, col, retVal);return comApprovedResp("JJS00088", "Postal Code is valid");}if (country == "CAN") {if (zipVal.length != 7) return comDeniedResp("JJS00087", "Invalid Canadian Postal Code. Example V3H 1Z7 or V3H-1Z7");zipVal = zipVal.toUpperCase();dataDoc.setColValue(row, col, zipVal);return comApprovedResp("JJS00088", "Postal Code is valid");}return comApprovedResp("JJS00088", "Postal Code is valid");} catch (e) {throw "JJS00247 xxvPostalCode caught exception " + e;}}function xxvStateCode(dataDoc, row, col) {var state = dataDoc.getColValue(row, col);if (state.length < 1) return comApprovedResp("JJS00089", "State is valid");if (state.length != 2) return comDeniedResp("JJS00090", "Invalid State Code");state = state.toUpperCase();if (!xxfldIsAlpha(state)) return comDeniedResp("JJS00091", "Invalid State Code");dataDoc.setColValue(row, col, state);return comApprovedResp("JJS00092", "State is valid");}function xxvCountryCode(dataDoc, row, col) {var code = dataDoc.getColValue(row, col);if (code.length < 1) return comApprovedResp("JJS00731", "Country is valid");if (code.length != 3) return comDeniedResp("JJS00732", "Invalid Country Code");code = code.toUpperCase();if (code != "USA" && code != "CAN" && code != "MEX") return comDeniedResp("JJS00733", "Invalid Country Code");return comApprovedResp("JJS00734", "Country is valid");}function xxvGetStates() {var states = ['AB|AB - ALBERTA','AG|AG - AGUASCALIENTES','AK|AK - ALASKA','AL|AL - ALABAMA','AR|AR - ARKANSAS','AZ|AZ - ARIZONA','BC|BC - BRITISH COLUMBIA','BC|BC - BAJA CALIFORNIA','BN|BN - BAJA CALIFORNIA NORTH','BS|BS - BAJA CALIFORNIA SOUTH','CA|CA - CALIFORNIA','CH|CH - CHIHUAHUA','CL|CL - COLIMA','CM|CM - CAMPECHE','CO|CO - COLORADO','CU|CU - COAHUILA','CS|CS - CHIAPAS','CT|CT - CONNECTICUT','DC|DC - DISTRICT OF COLUMBIA','DE|DE - DELAWARE','DF|DF - DISTRITO FEDERAL','DG|DG - DURANGO','FL|FL - FLORIDA','GA|GA - GEORGIA','GR|GR - GUERRERO','GT|GT - GUANAJUATO','GU|GU - GUAM','HG|HG - HIDALGO','HI|HI - HAWAII','IA|IA - IOWA','ID|ID - IDAHO','IL|IL - ILLINOIS','IN|IN - INDIANA','JA|JA - JALISCO','KS|KS - KANSAS','KY|KY - KENTUCKY','LA|LA - LOUISIANA','MA|MA - MASSACHUSETTS','MB|MB - MANITOBA','MD|MD - MARYLAND','ME|ME - MAINE','MI|MI - MICHIGAN','MI|MI - MICHOACAN','MN|MN - MINNESOTA','MO|MO - MISSOURI','MO|MO - MORELOS','MS|MS - MISSISSIPPI','MT|MT - MONTANA','MX|MX - MEXICO','NA|NA - NAYARIT','NB|NB - NEW BRUNSWICK','NC|NC - NORTH CAROLINA','ND|ND - NORTH DAKOTA','NE|NE - NEBRASKA','NH|NH - NEW HAMPSHIRE','NJ|NJ - NEW JERSEY','NL|NL - NEWFOUNDLAND','NL|NL - NUEVO LEON','NM|NM - NEW MEXICO','NS|NS - NOVA SCOTIA','NT|NT - NW TERRITORIES','NU|NU - NUNAVUT','NV|NV - NEVADA','NY|NY - NEW YORK','OA|OA - OAXACA','OH|OH - OHIO','OK|OK - OKLAHOMA','ON|ON - ONTARIO','OR|OR - OREGON','PA|PA - PENNSYLVANIA','PE|PE - PRINCE EDWARD ISLAND','PR|PR - PUERTO RICO','PU|PU - PUEBLA','QC|QC - QUEBEC','QR|QR - QUINTANA ROO','QT|QT - QUERETARO','RI|RI - RHODE ISLAND','SC|SC - SOUTH CAROLINA','SD|SD - SOUTH DAKOTA','SI|SI - SINALOA','SK|SK - SASKATCHEWAN','SL|SL - SAN LUIS POTOSI','SO|SO - SONORA','TB|TB - TABASCO','TL|TL - TLAXCALA','TM|TM - TAMAULIPAS','TN|TN - TENNESSEE','TX|TX - TEXAS','UT|UT - UTAH','VA|VA - VIRGINIA','VE|VE - VERACRUZ','VI|VI - VIRGIN ISLANDS','VT|VT - VERMONT','WA|WA - WASHINGTON','WI|WI - WISCONSIN','WV|WV - WEST VIRGINIA','WY|WY - WYOMING','YT|YT - YUKON TERRITORY','YU|YU - YUCATAN','ZA|ZA - ZACATECAS'];return states;}var xxWinWrench = null;function xxwwrWinDef() {var winDef = new xxWinDefEdit("xxwwr", "Window Wrench");winDef.addComp("xxwwr.fieldName", "textfield", "data", "fieldName", null, "none", null);winDef.addComp("xxwwr.displayNameOrig", "textfield", "data", "displayNameOrig", null, "none", null);winDef.addComp("xxwwr.displayNameUser", "textfield", "data", "displayNameUser", null, "default", null);winDef.addComp("xxwwr.MoveLeft", "button", "button", "", null, "default", xxwwrMoveLeft);winDef.addComp("xxwwr.MoveRight", "button", "button", "", null, "default", xxwwrMoveRight);winDef.addComp("xxwwr.closeX", "button", "button", "", null, "default", xxwwrCANCEL);winDef.addComp("xxwwr.SAVE", "button", "button", "", null, "default", xxwwrSAVE);winDef.addComp("xxwwr.CANCEL", "button", "button", "", null, "default", xxwwrCANCEL);return winDef;}function xxwwrDataDoc() {var doc = new xxDataDoc("xxwwrDO");doc.addField("fieldName", false, null);doc.addField("displayNameOrig", false, null);doc.addField("displayNameUser", false, null);doc.addField("widthMin", false, null);doc.addField("widthMax", false, null);return doc;}function xxWinWrenchInit() {if (xxWinWrench != null) return;xxWinWrench = new xxForm("xxWinWrench", false);var xxwwrDef = xxwwrWinDef();var xxwwrDoc = xxwwrDataDoc();xxwwrDoc.initOne();xxwwrDef.setDoc(xxwwrDoc);xxWinWrench.addWinDef(xxwwrDef);xxWinWrench.registerTriggers();xxWinWrench.registerListeners();$($('xxwwr.header')).onmousedown = xxwwrWinMove;$($('xxwwr.header')).setStyle({cursor: 'move'});xxwwrWinXSizer = new Control.Slider('xxwwr.winXSlideHandle', 'xxwwrWinXSlideTrack', {sliderValue: 0, range: $R(1,100)});xxwwrWinXSizer.options.onSlide = xxwwrWinXSizerSlide;xxwwrWinXSizer.options.onChange = xxwwrWinXSizerChange;xxwwrWinYSizer = new Control.Slider('xxwwr.winYSlideHandle', 'xxwwrWinYSlideTrack', {sliderValue: 0, range: $R(1,100)});xxwwrWinYSizer.options.onSlide = xxwwrWinYSizerSlide;xxwwrWinYSizer.options.onChange = xxwwrWinYSizerChange;xxwwrFieldSizer = new Control.Slider('xxwwr.slideHandle', 'xxwwrSlideTrack', {sliderValue: 0, range: $R(1,100)});xxwwrFieldSizer.options.onSlide = xxwwrSizerSlide;xxwwrFieldSizer.options.onChange = xxwwrSizerChange;comWEQ.listen("xxwwr", "*", "addfield", "xxwwrAddField", null, xxwwrAddField);comWEQ.listen("xxwwr", "*", "removefield", "xxwwrRemoveField", null, xxwwrRemoveField);comWEQ.listen("xxwwr", "*", "modifyfield", "xxwwrModifyField", null, xxwwrModifyField);comWEQ.listen("xxwwr", "xxwwr.displayNameUser", "onchange", xxwwrDisplayNameChange, null, xxwwrDisplayNameChange);return;}function xxWinWrenchOnLoad() {xxWinWrenchWinOpen(null);}function xxwwrGetTargetWinDef() {return xxWinWrench.getWinDef("xxwwr").getParm("TARGETWINDEF");}function xxwwrGetOrigUserDef() {return xxWinWrench.getWinDef("xxwwr").getParm("ORIGUSERDEF");}function xxWinWrenchOpen(openParms) {xxWinWrenchInit();if (openParms == null || openParms.getParm("WINDEF") == null) {comDefaultSysError("JJS00666", "xxWinWrenchOpen missing WINDEF");return;}var tWinDef = openParms.getParm("WINDEF");var uDef = tWinDef.getUserDef();var origUDef = uDef.copy();xxWinWrench.getWinDef("xxwwr").addParm("TARGETWINDEF", tWinDef);xxWinWrench.getWinDef("xxwwr").addParm("ORIGUSERDEF", origUDef);var winSizes = tWinDef.getParm("WINSIZE");var widthMin = parseInt(winSizes[0].split(',')[0]);var widthMax = parseInt(winSizes[0].split(',')[1]);var widthCurrent = parseInt(uDef.getUserWinDoc().getValue(0, "winWidth"));xxwwrWinXSizer.range = $R(widthMin, widthMax);xxwwrWinXSizer.maximum = xxwwrWinXSizer.range.end;xxwwrWinXSizer.minimum = xxwwrWinXSizer.range.start;xxwwrWinXSizer.setValue(widthCurrent);var heightMin = parseInt(winSizes[1].split(',')[0]);var heightMax = parseInt(winSizes[1].split(',')[1]);var heightCurrent = parseInt(uDef.getUserWinDoc().getValue(0, "winHeight"));xxwwrWinYSizer.range = $R(heightMin, heightMax);xxwwrWinYSizer.maximum = xxwwrWinYSizer.range.end;xxwwrWinYSizer.minimum = xxwwrWinYSizer.range.start;xxwwrWinYSizer.setValue(heightCurrent);xxwwrRefreshUsedList();xxwwrRefreshAvailList();xxWinWrench.showForm();}function xxwwrRefreshAvailList() {var tWinDef = xxwwrGetTargetWinDef();var uDef = tWinDef.getUserDef().getUserFldDoc();var uDefFieldNameCol = uDef.getColPos("fieldName");var ulMentAvail = $($('xxwwr.ul.FieldListAvail'));if (ulMentAvail != null) ulMentAvail.remove();ulMentAvail = new Element('ul', {'id': 'xxwwr.ul.FieldListAvail', 'class': 'avail'});for (var i=0; i< tWinDef.getCompCount(); i++) {var fieldName = tWinDef.getFieldName(i);var displayName = tWinDef.getDisplayName(i);if (uDef.findRow(uDefFieldNameCol, fieldName) > -1) continue;var liMent = xxwwrGenAvailLI(fieldName, displayName);ulMentAvail.appendChild(liMent);}$($('xxwwr.FieldListAvail')).appendChild(ulMentAvail);}function xxwwrGenAvailLI(fieldName, displayName) {var liMent = new Element('li', {'id': 'xxwwr.li.'+fieldName});var labelMent = new Element('span', {'class': 'item'});labelMent.update(displayName);var addMent = new Element('span', {'id': 'xxwwr.liadd.'+fieldName, 'class': 'add'});addMent.update("Add");addMent.onclick = function (evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "addfield", evt)};addMent.setStyle({cursor: 'pointer'});liMent.appendChild(labelMent);liMent.appendChild(addMent);return liMent;}function xxwwrRefreshUsedList() {var tWinDef = xxwwrGetTargetWinDef();var uDef = tWinDef.getUserDef().getUserFldDoc();var ulMentUsed = $($('xxwwr.ul.FieldListUsed'));if (ulMentUsed != null) ulMentUsed.remove();ulMentUsed = new Element('ul', {'id': 'xxwwr.ul.FieldListUsed', 'class': 'used'});for (var i=0; i< uDef.getRowCount(); i++) {var fieldName = uDef.getValue(i, "fieldName");var displayName = uDef.getValue(i, "displayName");var liMent = xxwwrGenUsedLI(fieldName, displayName);ulMentUsed.appendChild(liMent);}$($('xxwwr.FieldListUsed')).appendChild(ulMentUsed);}function xxwwrGenUsedLI(fieldName, displayName) {var liMent = new Element('li', {'id': 'xxwwr.li.'+fieldName});var labelMent = new Element('span', {'class': 'item'});labelMent.update(displayName);var modifyMent = new Element('span', {'id': 'xxwwr.limod.'+fieldName, 'class': 'mod'});modifyMent.update("Modify");modifyMent.onclick = function (evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "modifyfield", evt)};modifyMent.setStyle({cursor: 'pointer'});var removeMent = new Element('span', {'id': 'xxwwr.lirem.'+fieldName, 'class': 'rem'});removeMent.update("Remove");removeMent.onclick = function (evt) {return comWEQ.fireEvent("COMPWINID", "COMPID", "removefield", evt)};removeMent.setStyle({cursor: 'pointer'});liMent.appendChild(labelMent);liMent.appendChild(modifyMent);liMent.appendChild(removeMent);return liMent;}function xxwwrSAVE() {xxwwrGetTargetWinDef().getUserDef().saveToCookie();var tWinDef = xxwwrGetTargetWinDef();tWinDef.reInit();tWinDef.xwbDoc2Win();xxWinWrench.hideForm();comEQ.fireEvent("xxwwr", "xxwwrDO", "refreshwin", null);return false;}function xxwwrAddField(evt) {try {var compID = xxeGetEventID(evt);var fieldName = compID.split(".")[2];var tWinDef = xxwwrGetTargetWinDef();var tWinDefRow = tWinDef.getColbyFieldName(fieldName);var displayName = tWinDef.getDisplayName(tWinDefRow);var width = tWinDef.getWidth(tWinDefRow).split(",")[2];$($("xxwwr.li." + fieldName)).remove();tWinDef.getUserDef().addFldRow(fieldName, displayName, "-1", "-1", width.toString(), "-1");var liMent = xxwwrGenUsedLI(fieldName, displayName);$($('xxwwr.ul.FieldListUsed')).appendChild(liMent);tWinDef.addColumn(fieldName, displayName, width);xxwwrSetForModify(fieldName);return true;} catch (e) {comExceptTrace(e);return false;}}function xxwwrRemoveField(evt) {try {var compID = xxeGetEventID(evt);var fieldName = compID.split(".")[2];var tWinDef = xxwwrGetTargetWinDef();var tUserDef = tWinDef.getUserDef().getUserFldDoc();var fieldRow = tUserDef.findRow(tUserDef.getColPos("fieldName"), fieldName);tUserDef.removeRow(fieldRow);$($("xxwwr.li." + fieldName)).remove();var displayName = tWinDef.getDisplayName(tWinDef.getColbyFieldName(fieldName));var liMent = xxwwrGenAvailLI(fieldName, displayName);$($('xxwwr.ul.FieldListAvail')).appendChild(liMent);tWinDef.deleteColumn(fieldName, fieldRow);} catch (e) {comExceptTrace(e);}}function xxwwrModifyField(evt) {try {var compID = xxeGetEventID(evt);var fieldName = compID.split(".")[2];xxwwrSetForModify(fieldName);return true;} catch (e) {comExceptTrace(e);return false;}}function xxwwrSetForModify(fieldName) {var tWinDef = xxwwrGetTargetWinDef();tWinRow = tWinDef.getColbyFieldName(fieldName);var tUserDef = tWinDef.getUserDef().getUserFldDoc();var tUserRow = tUserDef.findRow(tUserDef.getColPos("fieldName"), fieldName);var xxwwrDO = xxWinWrench.getWinDoc("xxwwr");xxwwrDO.setValue(0, "fieldName", fieldName);xxwwrDO.setValue(0, "displayNameOrig", tWinDef.getDisplayName(tWinRow));xxwwrDO.setValue(0, "displayNameUser", tUserDef.getValue(tUserRow, "displayName"));var widthParm = tWinDef.getWidth(tWinRow).split(",");xxwwrDO.setValue(0, "widthMin", widthParm[0]);xxwwrDO.setValue(0, "widthMax", widthParm[1]);xxWinWrench.xwbDocs2Wins();var widthMin = parseInt(widthParm[0]);var widthMax = parseInt(widthParm[1]);var widthCurrent = parseInt(tUserDef.getValue(tUserRow, "fldWidth"));xxwwrFieldSizerName = fieldName;xxwwrFieldSizer.range = $R(widthMin, widthMax);xxwwrFieldSizer.maximum = xxwwrWinXSizer.range.end;xxwwrFieldSizer.minimum = xxwwrWinXSizer.range.start;xxwwrFieldSizer.setValue(widthCurrent);}function xxwwrDisplayNameChange(evt) {var xxwwrDO = xxWinWrench.getWinDoc("xxwwr");var fieldName = xxwwrDO.getValue(0, "fieldName");var displayName = xxwwrDO.getValue(0, "displayNameUser");var tWinDef = xxwwrGetTargetWinDef();tWinRow = tWinDef.getColbyFieldName(fieldName);var tUserDef = tWinDef.getUserDef().getUserFldDoc();var tUserRow = tUserDef.findRow(tUserDef.getColPos("fieldName"), fieldName);tUserDef.setValue(tUserRow, "displayName", displayName);tWinDef.setColumnName(fieldName, displayName);}function xxwwrMoveLeft() {try {var xxwwrDO = xxWinWrench.getWinDoc("xxwwr");var moveField = xxwwrDO.getValue(0, "fieldName");if (moveField == null || moveField.length < 1) {xxWinWrench.setFormResp(comDeniedResp("JJS00667", "Please select a field to modify first"));return true;}var tWinDef = xxwwrGetTargetWinDef();var tUserDef = tWinDef.getUserDef().getUserFldDoc();var tUserRow = tUserDef.findRow(tUserDef.getColPos("fieldName"), moveField);if (tUserRow < 0) {xxWinWrench.setFormResp(comDeniedResp("JJS00668", "Please select a field to modify first"));return true;}if (tUserRow < 1) return true;var moveRow = tUserDef.getRowFields(tUserRow);tUserDef.removeRow(tUserRow);tUserDef.insertRow(moveRow, tUserRow - 1);xxwwrRefreshUsedList();tWinDef.moveColumn(moveField, "LEFT");return true;} catch (e) {comExceptTrace("JJS00669 " + e);}}function xxwwrMoveRight() {try {var xxwwrDO = xxWinWrench.getWinDoc("xxwwr");var moveField = xxwwrDO.getValue(0, "fieldName");if (moveField == null || moveField.length < 1) {xxWinWrench.setFormResp(comDeniedResp("JJS00670", "Please select a field to modify first"));return true;}var tWinDef = xxwwrGetTargetWinDef();var tUserDef = tWinDef.getUserDef().getUserFldDoc();var tUserRow = tUserDef.findRow(tUserDef.getColPos("fieldName"), moveField);if (tUserRow < 0) {xxWinWrench.setFormResp(comDeniedResp("JJS00671", "Please select a field to modify first"));return true;}if (tUserRow >= tUserDef.getRowCount()) return true;var moveRow = tUserDef.getRowFields(tUserRow);tUserDef.removeRow(tUserRow);tUserDef.insertRow(moveRow, tUserRow + 1);xxwwrRefreshUsedList();tWinDef.moveColumn(moveField, "RIGHT");return true;} catch (e) {comExceptTrace("JJS00672 " + e);}}function xxwwrSaveHandler(dataReq) {try {var servResp = dataReq.getServResp();if (xxqCommonResp(servResp)) return;if (servResp.isApproved() == true) {comEQ.fireEvent("xxwwr", "xxwwrDO", "datachange", xxWinWrench.getWinDoc("xxwwr"));xxWinWrench.hideForm();} else if (servResp.isDenied() == true) {accountBillingEdit.setFormResp(servResp);} else {comServRespError("JJS00144", servResp);}} catch (e) {comExceptionCatch("JJS00145", e);}try {xxWinWrench.cmdResp = dataReq.getServResp();if (xxWinWrench.cmdResp.isApproved() == true) {xxWinWrench.hideForm();} else {xxWinWrench.setFormResp(servResp);}} catch (e) {comExceptTrace("JJS00673 " + e);}}function xxwwrCANCEL() {var tWinDef = xxwwrGetTargetWinDef();var oDef = xxwwrGetOrigUserDef();tWinDef.setUserDef(oDef);tWinDef.reInit();tWinDef.xwbDoc2Win();xxWinWrench.hideForm();comEQ.fireEvent("xxwwr", "xxwwrDO", "refreshwin", null);return false;}var xxwwrFieldSizer = null;var xxwwrFieldSizerName = null;function xxwwrSizerSlide(value) {var w = parseInt(value);xxwwrGetTargetWinDef().setColumnWidth(xxwwrFieldSizerName, w);return true;}function xxwwrSizerChange(value) {var w = parseInt(value);xxwwrGetTargetWinDef().setColumnWidth(xxwwrFieldSizerName, w);var tUserFldDoc =  xxwwrGetTargetWinDef().getUserDef().getUserFldDoc();var tRow = tUserFldDoc.findRow(tUserFldDoc.getColPos("fieldName"), xxwwrFieldSizerName);tUserFldDoc.setValue(tRow, "fldWidth", w.toString());return true;}var xxwwrWinXSizer = null;function xxwwrWinXSizerSlide(value) {var w = parseInt(value);xxwwrGetTargetWinDef().getUserDef().getWinSizer()(xxwwrGetTargetWinDef().getWinID(), w, -1);return true;}function xxwwrWinXSizerChange(value) {var w = parseInt(value);xxwwrGetTargetWinDef().getUserDef().getWinSizer()(xxwwrGetTargetWinDef().getWinID(), w, -1);xxwwrGetTargetWinDef().getUserDef().setWinWidth(w);return true;}var xxwwrWinYSizer = null;function xxwwrWinYSizerSlide(value) {var h = parseInt(value);xxwwrGetTargetWinDef().getUserDef().getWinSizer()(xxwwrGetTargetWinDef().getWinID(), -1, h);return true;}function xxwwrWinYSizerChange(value) {var h = parseInt(value);xxwwrGetTargetWinDef().getUserDef().getWinSizer()(xxwwrGetTargetWinDef().getWinID(), -1, h);xxwwrGetTargetWinDef().getUserDef().setWinHeight(h);return true;}var xxwwrmydrag = null;function xxwwrWinMove(evt) {try {var dragMent = $($("xxWinWrench")).down();xxwwrmydrag = new Draggable(dragMent, { revert: false, onEnd : xxwwrWinMoveEnd});} catch (e) {comExceptTrace(e);}}function xxwwrWinMoveEnd() {xxwwrmydrag.destroy();}