document.oncontextmenu = returnFalse;
document.onkeydown = disablekeyboardnavigation;
document.onkeyup = disablekeyboardnavigation;
if (document.layers) {
    document.captureEvents(Event.KEYDOWN);
    document.captureEvents(Event.KEYUP);
}
document.keydown = disablekeyboardnavigation;
document.keyup = disablekeyboardnavigation;
var meta = document.createElement("meta");
meta.setAttribute("name", "format-detection");
meta.setAttribute("content", "telephone=no");
document.getElementsByTagName("head")[0].appendChild(meta);

function validateAndSet(p_form) {
    var obj = null;
    var tmpObj = null;
    var regObj = null;
    for (i = 0; i < p_form.elements.length; i++) {
        obj = p_form.elements[i];
        if ((!obj.disabled) && (obj.type == "select-one" || obj.type == "text")) {
            if (obj.id != "") {
                tmpObj = obj.id.split("#");
                if (tmpObj.length > 1) {
                    regObj = new RegExp(tmpObj[1]);
                    if (!regObj.test(obj.value)) {
                        alert("Please Enter " + tmpObj[0]);
                        obj.focus();
                        return false;
                    }
                }
            }
        }
        if ((!obj.disabled) && (obj.type == "select-one")) {
            if ((tmpObj = p_form.elements[obj.name + "text"]) != null) {
                tmpObj.value = obj.options[obj.selectedIndex].text;
            }
        }
    }
    return true;
}

function SendRequest(p_snbr) {
    if (!validateAndSet(document.frmmain)) {
        return false;
    }
    document.frmmain.fldSessionId.value = parent.idsession;
    document.frmmain.fldRequestId.value = "RR" + document.frmmain.fldServiceType.value + p_snbr;
    document.frmmain.submit();
    disableForm(document.frmmain);
    return true;
}

function SendTxnRequest(p_snbr, p_txnid) {
    if (!validateAndSet(document.frmmain)) {
        return false;
    }
    document.frmmain.fldSessionId.value = parent.idsession;
    document.frmmain.fldRequestId.value = "RR" + p_txnid + p_snbr;
    document.frmmain.submit();
    disableForm(document.frmmain);
    return true;
}

function SendFrmRequest(p_frm, p_request) {
    p_frm.fldSessionId.value = parent.idsession;
    p_frm.fldRequestId.value = "RR" + p_request;
    p_frm.submit();
    disableForm(p_frm);
    return true;
}

function disableForm(p_form) {
    var obj = null;
    var tmpObj = null;
    var regObj = null;
    var hasFormNameFld = false;
    for (i = 0; i < p_form.elements.length; i++) {
        if (p_form.elements[i].name == "__form_name__") {
            hasFormNameFld = true;
        }
        if (p_form.elements[i].type == "select-one" || p_form.elements[i].type == "button" || p_form.elements[i].type == "checkbox") {
            p_form.elements[i].disabled = true;
        }
    }
    if (!hasFormNameFld) {
        var element = document.createElement("input");
        element.type = "hidden";
        element.name = "__form_name__";
        element.value = p_form.name;
        p_form.appendChild(element);
    }
    return true;
}

function returnFalse() {
    return false;
}

function disablekeyboardnavigation(e) {
    var rx = /INPUT|TEXTAREA/i;
    var regexChrome = /[.]*Chrome[.]*/i;
    var regexFireFox18 = /[.]*Firefox[.]*18[.]*/i;
    var regexFireFox = /[.]*Firefox[.]*[.]*/i;
    if (navigator.appName == "Microsoft Internet Explorer") {
        if (event.keyCode == 8) {
            if (rx.test(event.srcElement.tagName)) {
                if ((event.srcElement.type != "text" && event.srcElement.type != "password" && event.srcElement.type != "textarea") || event.srcElement.disabled || event.srcElement.readOnly || !event.srcElement.isContentEditable) {
                    return false;
                } else {
                    return true;
                }
            } else {
                return false;
            }
        }
    } else {
        if (navigator.appName == "Netscape") {
            if (regexFireFox18.test(navigator.userAgent)) {
                if (e.which == 8) {
                    e.preventDefault();
                    e.stopPropagation();
                    return false;
                }
            } else {
                if (regexChrome.test(navigator.userAgent) || regexFireFox.test(navigator.userAgent)) {
                    if (e.which == 8) {
                        if (rx.test(e.target.tagName)) {
                            if ((e.target.type != "text" && e.target.type != "password" && e.target.type != "textarea") || e.target.disabled || e.target.readOnly) {
                                e.preventDefault();
                                e.stopPropagation();
                                return false;
                            } else {
                                return true;
                            }
                        } else {
                            e.preventDefault();
                            e.stopPropagation();
                            return false;
                        }
                    }
                }
            }
        } else {
            if (event.keyCode == 8) {
                if (rx.test(event.srcElement.tagName)) {
                    if ((event.srcElement.type != "text" && event.srcElement.type != "password" && event.srcElement.type != "textarea") || event.srcElement.disabled || event.srcElement.readOnly) {
                        return false;
                    } else {
                        return true;
                    }
                } else {
                    return false;
                }
            }
        }
    }
    if (typeof window.event == "undefined") {
        if (e.which == 116 || e.which == 123) {
            return false;
        }
        if (e.which == 117) {
            return false;
        }
        if (e.which == 8) {
            var test_var = e.target.nodeName.toUpperCase();
            if (e.target.type) {
                var test_type = e.target.type.toUpperCase();
            }
            if ((test_var == "INPUT" && test_type == "TEXT") || test_var == "TEXTAREA" || (test_var == "INPUT" && test_type == "PASSWORD")) {
                return e.keyCode;
            } else {
                if (e.keyCode == 8) {
                    e.preventDefault();
                    return 0;
                }
            }
        }
    }
    if (navigator.appName == "Microsoft Internet Explorer") {
        if (event.keyCode == 8) {
            if ((event.keyCode == 8) && (event.srcElement.tagName != "INPUT")) {
                if (event.srcElement.tagName != "TEXTAREA") {
                    return false;
                }
            }
        }
        if ((event.keyCode == 13) && (event.srcElement.tagName == "INPUT")) {
            return false;
        }
    } else {
        if (navigator.appName == "Netscape") {
            if (e.which == 93 || e.which == 3 || ((e.which == 37 || e.which == 39) && e.altKey) || (e.which == 82 && e.ctrlKey)) {
                alert("Keyboard Navigation Disabled.");
                return false;
            }
        }
    }
    if (navigator.appName == "Microsoft Internet Explorer") {
        if ((event.altKey) && (event.srcElement.tagName == "INPUT")) {}
        if ((event.keyCode == 96) || (event.keyCode == 97) || (event.keyCode == 98)) {}
        if (event.keyCode == 93 || event.keyCode == 116 || event.keyCode == 123 || event.keyCode == 122 || (event.keyCode == 121 && event.shiftKey) || ((event.keyCode == 36 || event.keyCode == 37 || event.keyCode == 39) && event.altKey) || ((event.keyCode == 82 || event.keyCode == 78) && event.ctrlKey) || (event.keyCode == 122 && event.shiftKey)) {
            if (event.keyCode == 116 || event.keyCode == 121 || event.keyCode == 122 || event.keyCode == 123) {
                event.keyCode = 0;
            }
            if ((event.keyCode != 93) || (event.keyCode == 93 && event.srcElement.tagName != "INPUT")) {
                return false;
            }
        }
        if (event.keyCode == 18 && event.keyCode == 8 && event.srcElement.tagName != "INPUT" && event.srcElement.tagName != "TEXTAREA") {
            return false;
        }
        if (((event.srcElement.tagName == "TEXTAREA") || (event.srcElement.tagName == "INPUT" && event.srcElement.type == "text")) && (event.srcElement.disabled || event.srcElement.readOnly)) {
            if (event.keyCode == 8) {
                return false;
            }
            if (event.keyCode == 117) {
                return false;
            }
        }
    }
    var evt = (e) ? e : ((event) ? event : null);
    var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
    if ((evt.keyCode == 8) && ((node.type != "text") || (node.tagName != "TEXTAREA"))) {
        return true;
    }
    if (evt.keyCode == 116) {
        return false;
    }
    if (evt.keyCode == 117) {
        return false;
    }
    return true;
}

function displayResult(errmsgarr, warningmsgarr, successmsgarr, infomsgarr) {
    if (window.parent.frames["messageFrame"]) {
        window.parent.frames["messageFrame"].displayMessages(errmsgarr, warningmsgarr, infomsgarr, successmsgarr);
    }
}

function sendEmail(nbrScr, emaildesc) {
    winhandle = window.open("sendemail.html", "mywin", "width=300,height=20,dependant=0,directories=0,location=0,menubar=0,titlebar=0,toolbar=0,resizable=0,scrollbars=0,top=400,left=500");
    winhandle.focus();
    if (parseInt(nbrScr.length) == 1) {
        nbrScr = "0" + nbrScr;
    }
    if (winhandle) {
        winhandle.document.write("<html>" + '<head><META http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Send Email</title>' + '<link REL="STYLESHEET" TYPE="text/css" HREF="css/cmn/default.css"/><link type="text/css" href="stylesheet_content.css" rel="stylesheet"/>' + '<script language="JavaScript" type="text/JavaScript" src=\'jsdir/common.js\'><\/script>' + '<script language="javascript">' + 'var reqid = "' + nbrScr + '";' + "function sendmail()" + "{" + "document.frmmain.fldSessionId.value = window.opener.top.parent.idsession;" + "document.frmmain.fldServiceType.value =  window.opener.top.frames['frame_txn'].document.frmmain.fldServiceType.value;" + "document.frmmain.fldDataId.value =  window.opener.top.frames['frame_txn'].document.frmmain.fldDataId.value;" + "document.frmmain.fldSectionId.value =  window.opener.top.frames['frame_txn'].document.frmmain.fldSectionId.value;" + 'document.frmmain.fldRequestId.value = "RR"+document.frmmain.fldServiceType.value+reqid;' + "document.frmmain.submit ();" + "}" + "<\/script>" + '</head><body class="workarea"><form action="internet" method="post" name="frmmain">' + '<table cellspacing="0" cellpadding="0" border="0" width="90%" height="100%" align="center" id="MainTable">' + "<tr>" + '<td class="DataRightAligned" width="30%">Send To:</td>' + '<td class="DataRightAligned" width="35%">' + '<input type="text" name="fldemailaddress" maxlength="35" size="35"/>' + '<input type="hidden" name="fldemaildesc" value="' + emaildesc + '"/>' + "</td>" + "<td >" + '<input alt="submit" name="fldsubmit" value="Submit" class="buttons"  type="button" onclick="return sendmail()" />' + "</td>" + "</tr>" + '</table><input type="hidden" name="fldRequestId" value=""/><input type="hidden" name="fldSessionId" value=""/><input type="hidden" name="fldServiceType" value=""/>' + '<input type="hidden" name="fldSectionId" value=""/><input type="hidden" name="fldDataId" value=""/></form></body></html>');
    }
}

function restrictEnterKey(evt) {
    var evt = (evt) ? evt : ((event) ? event : null);
    var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
    if ((evt.keyCode == 13) && (node.type == "text") || (evt.keyCode == 13) && (node.type == "button")) {
        return false;
    }
}
window.document.onkeypress = restrictEnterKey;

function enableForm(p_form) {
    var obj = null;
    var tmpObj = null;
    var regObj = null;
    for (i = 0; i < p_form.elements.length; i++) {
        if (p_form.elements[i].type == "select-one" || p_form.elements[i].type == "button" || p_form.elements[i].type == "checkbox") {
            p_form.elements[i].disabled = false;
        }
    }
    return true;
}

function trim(str) {
    var resultStr = "";
    resultStr = trimLeft(str);
    resultStr = trimRight(resultStr);
    return resultStr;
}

function trimLeft(str) {
    var resultStr = "";
    var i = len = 0;
    if ((str == undefined) || (str == null)) {
        return null;
    }
    str += "";
    if (str.length == 0) {
        resultStr = "";
    } else {
        len = str.length;
        while ((i <= len) && (str.charAt(i) == " ")) {
            i++;
        }
        resultStr = str.substring(i, len);
    }
    return resultStr;
}

function trimRight(str) {
    var resultStr = "";
    var i = 0;
    if ((str == undefined) || (str == null)) {
        return null;
    }
    str += "";
    if (str.length == 0) {
        resultStr = "";
    } else {
        i = str.length - 1;
        while ((i >= 0) && (str.charAt(i) == " ")) {
            i--;
        }
        resultStr = str.substring(0, i + 1);
    }
    return resultStr;
}

function validateInp(p_input, p_mode) {
    var l_length = p_input.length;
    for (var i = 0; i < l_length; i++) {
        if ((p_input.charCodeAt(i) < 44) || (p_input.charCodeAt(i) > 122) || ((p_input.charCodeAt(i) > 57) && (p_input.charCodeAt(i) < 65)) || ((p_input.charCodeAt(i) > 90) && (p_input.charCodeAt(i) < 97))) {
            if ((p_input.charCodeAt(i) != 32) && (p_input.charCodeAt(i) != 39) && (p_input.charCodeAt(i) != 38) && (p_input.charCodeAt(i) != 64) && (p_input.charCodeAt(i) != 95)) {
                return false;
            }
        }
        if (p_mode == "id") {
            if ((p_input.charCodeAt(i) == 32) || (p_input.charCodeAt(i) == 39) || (p_input.charCodeAt(i) == 64) || (p_input.charCodeAt(i) == 95)) {
                return false;
            }
            if ((p_input.charCodeAt(i) < 47)) {
                return false;
            }
        }
        if (p_mode == "userid") {
            if ((p_input.charCodeAt(i) == 32) || (p_input.charCodeAt(i) == 39) || (p_input.charCodeAt(i) == 95)) {
                return false;
            }
            if ((p_input.charCodeAt(i) < 47)) {
                return false;
            }
        }
        if (p_mode == "name") {
            if ((p_input.charCodeAt(i) == 38) || (p_input.charCodeAt(i) == 44) || (p_input.charCodeAt(i) == 45) || (p_input.charCodeAt(i) == 46) || (p_input.charCodeAt(i) == 47) || (p_input.charCodeAt(i) == 64) || (p_input.charCodeAt(i) == 95)) {
                return false;
            }
        }
        if (p_mode == "desc") {
            if ((p_input.charCodeAt(i) == 45) || (p_input.charCodeAt(i) == 47) || (p_input.charCodeAt(i) == 64)) {
                return false;
            }
        }
        if (p_mode == "email") {
            if ((p_input.charCodeAt(i) == 38) || (p_input.charCodeAt(i) == 45) || (p_input.charCodeAt(i) == 47) || (p_input.charCodeAt(i) == 44)) {
                return false;
            }
        }
    }
    return true;
}

function setVisibility(p_layer_ref, p_state) {
    if (document.all) {
        eval("document.all." + p_layer_ref + ".style.display = '" + p_state + "'");
    }
    if (document.layers) {
        document.layers[p_layer_ref].display = p_state;
    }
    if (document.getElementById && !document.all) {
        l_hza = document.getElementById(p_layer_ref);
        l_hza.style.display = p_state;
    }
}
var sResizableElement = "TH";
var iResizeThreshold = 8;
var iEdgeThreshold = 8;
var iSizeThreshold = 20;
var sVBarID = "VBar";
var oResizeTarget = null;
var iStartX = null;
var iEndX = null;
var iSizeX = null;
var engagedCell;
var objTable;
var selected_obj_index = "";
var relaesed_for_obj_index = "";
var enaged_obj = "";
var release_obj = "";

function release(obj) {
    if ((parseInt(selected_obj_index)) >= 0) {
        if ((parseInt(relaesed_for_obj_index)) >= 0) {
            swapColumns(selected_obj_index, relaesed_for_obj_index);
        }
    }
    selected_obj_index = "";
    relaesed_for_obj_index = "";
}

function releasefor(obj) {
    try {
        relaesed_for_obj_index = obj;
        for (l_m = 0; l_m <= obj.parentNode.cells.length - 1; l_m++) {
            if (obj == obj.parentNode.cells[l_m]) {
                relaesed_for_obj_index = l_m;
                release_obj = obj;
                break;
            }
        }
    } catch (e) {}
}

function engage(obj) {
    try {
        selected_obj_index = "";
        relaesed_for_obj_index = "";
        enaged_obj = "";
        for (l_k = 0; l_k <= obj.parentNode.cells.length - 1; l_k++) {
            if (obj == obj.parentNode.cells[l_k]) {
                selected_obj_index = l_k;
                enaged_obj = obj;
                break;
            }
        }
    } catch (e) {}
    return false;
}

function swapColumns(colIndex1, colIndex2) {
    var table = objTable;
    if (table.getElementsByTagName("TFOOT").length >= 1 && table.getElementsByTagName("TFOOT")[0].childNodes.length > 0) {
        alert("Cannot Move");
        return;
    }
    if (table && table.rows && table.insertBefore && colIndex1 != colIndex2) {
        colIndex1 = Number(colIndex1);
        colIndex2 = Number(colIndex2);
        if (colIndex1 == colIndex2 - 1 || colIndex1 == colIndex2 + 1) {
            if (colIndex1 > colIndex2) {
                var tempIndex = colIndex1;
                colIndex1 = colIndex2;
                colIndex2 = tempIndex;
            }
            for (var i = 0; i < table.rows.length; i++) {
                var row = table.rows[i];
                row.insertBefore(row.cells[colIndex2], row.cells[colIndex1]);
            }
        } else {
            for (var i = 0; i < table.rows.length; i++) {
                var row = table.rows[i];
                var cell1 = row.cells[colIndex1];
                var cell2 = row.cells[colIndex2];
                var siblingCell1 = row.cells[colIndex1 + 1];
                if (typeof siblingCell1 == "undefined") {
                    siblingCell1 = null;
                }
                row.insertBefore(cell1, cell2);
                row.insertBefore(cell2, siblingCell1);
            }
        }
    }
}

function TableResize_CreateVBar() {
    try {
        var objItem = document.getElementById(sVBarID);
        if (!objItem) {
            objItem = document.createElement("SPAN");
            objItem.id = sVBarID;
            objItem.style.position = "absolute";
            objItem.style.top = "0px";
            objItem.style.left = "0px";
            objItem.style.height = "0px";
            objItem.style.width = "2px";
            objItem.style.background = "silver";
            objItem.style.borderLeft = "1px dotted black";
            objItem.style.display = "none";
            document.body.appendChild(objItem);
        }
    } catch (e) {}
}
if (window.attachEvent) {
    try {
        window.attachEvent("onload", TableResize_CreateVBar);
    } catch (e) {}
} else {
    try {
        window.addEventListener("DOMContentLoaded", TableResize_CreateVBar, false);
    } catch (e) {}
}

function TableResize_GetOwnerHeader(objReference) {
    try {
        var oElement = objReference;
        while (oElement != null && oElement.tagName != null && oElement.tagName != "BODY") {
            if (oElement.tagName.toUpperCase() == sResizableElement) {
                return oElement;
            }
            oElement = oElement.parentnode;
        }
    } catch (e) {}
    return null;
}

function TableResize_GetFirstColumnCell(objTable, iCellIndex) {
    try {
        var oHeaderCell = objTable.rows[0].cells[iCellIndex];
    } catch (e) {}
    return oHeaderCell;
}

function TableResize_CleanUp() {
    try {
        var oVBar = document.getElementById(sVBarID);
        if (oVBar) {
            oVBar.style.display = "none";
        }
        iEndX = null;
        iSizeX = null;
        iStartX = null;
        oResizeTarget = null;
        oAdjacentCell = null;
    } catch (e) {}
    return true;
}

function TableResize_OnMouseMove(e) {
    try {
        var srcElement;
        var thisEvent;
        if (window.attachEvent) {
            thisEvent = event;
            srcElement = event.srcElement;
        } else {
            thisEvent = e;
            srcElement = e.target;
        }
        var objTH = TableResize_GetOwnerHeader(srcElement);
        if (!objTH) {
            return;
        }
        var oVBar = document.getElementById(sVBarID);
        if (!oVBar) {
            return;
        }
        var oAdjacentCell = objTH.nextSibling;
        var offsetX;
        if (thisEvent.offsetX) {
            offsetX = thisEvent.offsetX;
        } else {
            offsetX = thisEvent.layerX - objTH.offsetLeft;
        }
        if ((offsetX >= (objTH.offsetWidth - iEdgeThreshold)) && (oAdjacentCell != null)) {
            objTH.style.cursor = "e-resize";
        } else {
            objTH.style.cursor = "pointer";
            releasefor(srcElement);
        }
        if (oVBar.style.display == "inline") {
            if (e) {
                oVBar.style.left = e.clientX + document.body.scrollLeft;
            } else {
                oVBar.style.left = window.event.clientX + document.body.scrollLeft;
            }
            document.selection.empty();
        }
    } catch (e) {}
    return true;
}

function TableResize_OnMouseDown(e) {
    try {
        var srcElement;
        var thisEvent;
        if (!e) {
            thisEvent = event;
            srcElement = event.srcElement;
        } else {
            thisEvent = e;
            srcElement = e.target;
        }
        objTable = srcElement.parentNode.parentNode.parentNode;
        if (objTable == null) {
            return;
        }
        var oTargetCell = srcElement;
        if (!oTargetCell) {
            return;
        }
        var oVBar = document.getElementById(sVBarID);
        if (!oVBar) {
            return;
        }
        if (oTargetCell.parentNode.tagName.toUpperCase() == sResizableElement) {
            oTargetCell = oTargetCell.parentNode;
        }
        var oHeaderCell = TableResize_GetFirstColumnCell(objTable, oTargetCell.cellIndex);
        if (oHeaderCell != null) {
            if ((oHeaderCell.tagName.toUpperCase() == sResizableElement) && (oTargetCell.style.cursor == "e-resize")) {
                if (!e) {
                    iStartX = event.screenX;
                } else {
                    iStartX = e.clientX;
                }
                oResizeTarget = oHeaderCell;
                objTable.setAttribute("Resizing", "true");
                if (e) {
                    oVBar.style.left = e.clientX + document.body.scrollLeft;
                } else {
                    oVBar.style.left = window.event.clientX + document.body.scrollLeft;
                }
                oVBar.style.top = objTable.parentNode.clientHeight;
                oVBar.style.height = objTable.parentNode.clientHeight;
                oVBar.style.display = "inline";
            } else {
                engage(oHeaderCell);
                engagedCell = oHeaderCell;
            }
        }
    } catch (e) {}
    if (srcElement.tagName == sResizableElement) {
        return false;
    } else {
        return true;
    }
}

function TableResize_OnMouseUp(e) {
    try {
        var oAdjacentCell = null;
        var iAdjCellOldWidth = 0;
        var iResizeOldWidth = 0;
        var srcElement;
        var thisEvent;
        if (!e) {
            thisEvent = event;
            srcElement = event.srcElement;
        } else {
            thisEvent = e;
            srcElement = e.target;
        }
        if (iStartX != null && oResizeTarget != null) {
            if (!e) {
                iEndX = event.screenX;
            } else {
                iEndX = e.clientX;
            }
            iSizeX = iEndX - iStartX;
            objTable.setAttribute("Resizing", "false");
            if ((oResizeTarget.offsetWidth + iSizeX) >= iSizeThreshold) {
                if (Math.abs(iSizeX) >= iResizeThreshold) {
                    if (oResizeTarget.nextSibling != null) {
                        oAdjacentCell = oResizeTarget.nextSibling;
                        iAdjCellOldWidth = (oAdjacentCell.offsetWidth);
                    } else {
                        oAdjacentCell = null;
                    }
                    iResizeOldWidth = (oResizeTarget.offsetWidth);
                    oResizeTarget.style.width = iResizeOldWidth + iSizeX;
                    if ((oAdjacentCell != null) && (oAdjacentCell.tagName.toUpperCase() == sResizableElement)) {
                        oAdjacentCell.style.width = (((iAdjCellOldWidth - iSizeX) >= iSizeThreshold) ? (iAdjCellOldWidth - iSizeX) : (oAdjacentCell.style.width = iSizeThreshold));
                    }
                }
            } else {
                oResizeTarget.style.width = iSizeThreshold;
            }
        } else {
            release(srcElement);
        }
    } catch (e) {}
    TableResize_CleanUp();
    return true;
}
document.onselectstart = function(e) {
    var srcElement;
    if (!e) {
        srcElement = event.srcElement;
    } else {
        srcElement = e.target;
    }
    if (srcElement.tagName == "TH") {
        return false;
    } else {
        return true;
    }
};

function highlight() {
    try {
        var form = document.forms[0];
        var inputTxt = form.getElementsByTagName("INPUT");
        var selectTxt = form.getElementsByTagName("select");
        var textArea = form.getElementsByTagName("textarea");
        for (var i = 0; i < inputTxt.length; i++) {
            if (inputTxt[i].type == "text" || inputTxt[i].type == "password") {
                var inputT = inputTxt[i];
                inputT.onfocus = function() {
                    this.className = "highLight";
                };
                inputT.onblur = function() {
                    this.className = "";
                };
            }
        }
        for (var i = 0; i < textArea.length; i++) {
            var textareaT = textArea[i];
            textareaT.onfocus = function() {
                this.className = "highLight";
            };
            textareaT.onblur = function() {
                this.className = "";
            };
        }
    } catch (e) {}
}
document.onmousemove = TableResize_OnMouseMove;
document.onmousedown = TableResize_OnMouseDown;
document.onmouseup = TableResize_OnMouseUp;
var menuType = parent.menuType;
if (menuType == "T") {
    var mcontent = "menu1";
} else {
    if (menuType == "TL") {
        var mcontent = "menu3";
    } else {
        if (menuType == "L") {
            var mcontent = "menu2";
        }
    }
}

function ButtonLevel1() {
    var liLength = document.getElementById(mcontent).childNodes;
    var lastTop = document.getElementById(mcontent).childNodes[liLength.length - 1].offsetTop;
    var chkdisplay = "block";
    DisplayButton(lastTop, 1, chkdisplay);
}

function ButtonLevel2(actObj) {
    var aObject = document.getElementById("slevel" + actObj);
    var objLength = document.getElementById("slevel" + actObj).childNodes.length - 1;
    var lastTop = document.getElementById("slevel" + actObj).childNodes[objLength].offsetTop;
    var chkdisplay = document.getElementById("slevel" + actObj).childNodes[0].childNodes[0].style.display;
    DisplayButton(lastTop, 2, chkdisplay);
}

function DisplayButton(lastTop, level, chkdisplay) {
    if ((lastTop > "10") || (chkdisplay == "none")) {
        var disStatus = "visible";
    } else {
        var disStatus = "hidden";
    }
    if (menuType == "T") {
        document.getElementById("scrollLeft" + level).style.visibility = disStatus;
        document.getElementById("scrollRight" + level).style.visibility = disStatus;
    } else {
        if (menuType == "TL" && level != 2) {
            document.getElementById("scrollTLeft1").style.visibility = disStatus;
            document.getElementById("scrollTRight1").style.visibility = disStatus;
        }
    }
}

function scrollL(level) {
    if (level == "1") {
        var liLength = document.getElementById(mcontent).childNodes;
        var menuLength = liLength.length;
    } else {
        var actObj = parent.frame_top.document.frmMenu.level1Id.value;
        var liLength = document.getElementById("slevel" + actObj).childNodes;
        var menuLength = liLength.length;
    }
    if (menuLength > 4) {
        menuLength = menuLength - 2;
    } else {
        menuLength = menuLength - 1;
    }
    for (i = (menuLength); i >= 0; i--) {
        if (liLength[i].tagName == "LI") {
            if ((liLength[i].childNodes[0].style.display == "none")) {
                liLength[i].childNodes[0].style.display = "inline";
                liLength[i].style.marginLeft = "0px";
                liLength[i].style.width = "auto";
                liLength[i].style.overflow = "";
                break;
            }
        }
    }
}

function scrollR(level) {
    if (level == "1") {
        var liLength = document.getElementById(mcontent).childNodes;
        var menuLength = liLength.length;
    } else {
        var actObj = parent.frame_top.document.frmMenu.level1Id.value;
        var liLength = document.getElementById("slevel" + actObj).childNodes;
        var menuLength = liLength.length;
    }
    if (menuLength >= 4) {
        menuLength = menuLength - 2;
    } else {
        menuLength = menuLength - 1;
    }
    for (i = 0; i <= (menuLength); i++) {
        if (liLength[i].tagName == "LI") {
            if ((liLength[i].childNodes[0].style.display != "none")) {
                liLength[i].childNodes[0].style.display = "none";
                liLength[i].style.marginLeft = "0px";
                liLength[i].style.width = "0px";
                liLength[i].style.overflow = "hidden";
                break;
            }
        }
    }
}

function calculateMaxMenuTabWidth() {
    var liLength = document.getElementById(mcontent).childNodes;
    var menuLength = liLength.length;
    curr = 0;
    containerSize = document.getElementById("menuContainer1").offsetWidth;
    maxTabsToBeDisplayed = 0;
    totalSizeOfMenu = 0;
    if (menuLength > 1) {
        menuLength = menuLength - 1;
    } else {
        menuLength = menuLength;
    }
    for (k = menuLength; k >= 0; k--) {
        if (liLength[k].tagName == "LI") {
            curr = document.getElementById("menutab" + k).offsetWidth;
            totalSizeOfMenu += curr;
            maxTabsToBeDisplayed++;
            if (totalSizeOfMenu > containerSize) {
                totalSizeOfMenu -= curr;
                maxTabsToBeDisplayed--;
                break;
            }
        }
    }
}

function displayMenuLevel1(a) {
    calculateMaxMenuTabWidth();
    var setFlag = "none";
    var oldActiveTab = document.frmMenu.level1Id.value;
    if (a != 1) {
        a = a - 1;
    }
    var liLength = document.getElementById(mcontent).childNodes;
    var menuLength = liLength.length;
    if (menuLength > 1) {
        menuLength = menuLength - 1;
    } else {
        menuLength = menuLength;
    }
    for (i = 0; i < menuLength; i++) {
        if (liLength[i].tagName == "LI") {
            if ((i != a) && (setFlag != "block")) {
                setFlag = "none";
            } else {
                setFlag = "block";
            }
            liLength[i].getElementsByTagName("UL")[0].className = "level1";
            if (setFlag == "none") {
                if (i > (menuLength - maxTabsToBeDisplayed)) {
                    continue;
                }
                liLength[i].childNodes[0].style.display = "none";
                liLength[i].style.marginLeft = "0px";
                liLength[i].style.overflow = "hidden";
            } else {
                liLength[i].childNodes[0].style.display = "inline";
                liLength[i].style.marginLeft = "0px";
                liLength[i].style.overflow = "";
            }
        }
        liLength[a].getElementsByTagName("UL")[0].className = "current";
    }
}

function isIE() {
    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
        var ieversion = new Number(RegExp.$1);
        if (ieversion >= 5) {
            return true;
        }
    } else {
        return false;
    }
}

function setStylesheet(title) {
    var i, cacheobj, altsheets = [""];
    for (i = 0;
        (cacheobj = document.getElementsByTagName("link")[i]); i++) {
        if (cacheobj.getAttribute("rel").toLowerCase() == "alternate stylesheet" && cacheobj.getAttribute("title")) {
            cacheobj.disabled = true;
            altsheets.push(cacheobj);
            if (cacheobj.getAttribute("title") == title) {
                cacheobj.disabled = false;
            }
        }
    }
    return;
}

function chooseStyle(styletitle) {
    if (document.getElementById) {
        this.setStylesheet(styletitle);
        document.cookie = "mysheet" + "=" + styletitle + "; path=/";
    }
}

function changeTheme(selectedTheme, flgOverrideDefaultTheme) {
    document.getElementById("themeList").style.display = "none";
    try {
        if (selectedTheme != this.currentTheme || flgOverrideDefaultTheme) {
            this.currentTheme = selectedTheme;
            chooseStyle(selectedTheme);
        }
    } catch (e) {}
}

function autoCompleteDB() {
    this.aNames = new Array();
}
autoCompleteDB.prototype.assignArray = function(aList) {
    this.aNames = aList;
};
autoCompleteDB.prototype.getMatches = function(str, aList, maxSize) {
    var ctr = 0;
    for (var i in this.aNames) {
        if (this.aNames[i].toLowerCase().indexOf(str.toLowerCase()) == 0) {
            aList.push(this.aNames[i]);
            ctr++;
        }
        if (ctr == (maxSize - 1)) {
            break;
        }
    }
};

function autoComplete(aNames, oText, oDiv, maxSize) {
    this.oText = oText;
    this.oDiv = oDiv;
    this.maxSize = maxSize;
    this.cur = -1;
    this.db = new autoCompleteDB();
    this.db.assignArray(aNames);
    oText.onkeyup = this.keyUp;
    oText.onkeydown = this.keyDown;
    oText.autoComplete = this;
    oText.onblur = this.hideSuggest;
    oDiv.onclick = function() {
        oDiv.style.display = "none";
    };
}
autoComplete.prototype.hideSuggest = function() {
    this.autoComplete.oDiv.style.display = "none";
};
autoComplete.prototype.selectText = function(iStart, iEnd) {
    if (this.oText.createTextRange) {
        var oRange = this.oText.createTextRange();
        oRange.moveStart("character", iStart);
        oRange.moveEnd("character", iEnd - this.oText.value.length);
        oRange.select();
    } else {
        if (this.oText.setSelectionRange) {
            this.oText.setSelectionRange(iStart, iEnd);
        }
    }
    this.oText.focus();
};
autoComplete.prototype.textComplete = function(sFirstMatch) {
    if (this.oText.createTextRange || this.oText.setSelectionRange) {
        var iStart = this.oText.value.length;
        this.oText.value = sFirstMatch;
        this.selectText(iStart, sFirstMatch.length);
    }
};
autoComplete.prototype.keyDown = function(oEvent) {
    oEvent = window.event || oEvent;
    iKeyCode = oEvent.keyCode;
    switch (iKeyCode) {
        case 38:
            this.autoComplete.moveUp();
            break;
        case 40:
            this.autoComplete.moveDown();
            break;
        case 13:
            window.focus();
            break;
    }
};
autoComplete.prototype.moveDown = function() {
    if (this.oDiv.childNodes.length > 0 && this.cur < (this.oDiv.childNodes.length - 1)) {
        ++this.cur;
        for (var i = 0; i < this.oDiv.childNodes.length; i++) {
            if (i == this.cur) {
                this.oDiv.childNodes[i].className = "over";
                this.oText.value = this.oDiv.childNodes[i].innerHTML;
            } else {
                this.oDiv.childNodes[i].className = "";
            }
        }
    }
};
autoComplete.prototype.moveUp = function() {
    if (this.oDiv.childNodes.length > 0 && this.cur > 0) {
        --this.cur;
        for (var i = 0; i < this.oDiv.childNodes.length; i++) {
            if (i == this.cur) {
                this.oDiv.childNodes[i].className = "over";
                this.oText.value = this.oDiv.childNodes[i].innerHTML;
            } else {
                this.oDiv.childNodes[i].className = "";
            }
        }
    }
};
autoComplete.prototype.keyUp = function(oEvent) {
    oEvent = oEvent || window.event;
    var iKeyCode = oEvent.keyCode;
    if (iKeyCode == 8 || iKeyCode == 46) {
        this.autoComplete.onTextChange(false);
    } else {
        if (iKeyCode < 32 || (iKeyCode >= 33 && iKeyCode <= 46) || (iKeyCode >= 112 && iKeyCode <= 123)) {} else {
            this.autoComplete.onTextChange(true);
        }
    }
};
autoComplete.prototype.positionSuggest = function() {
    var oNode = this.oText;
    var x = 0,
        y = oNode.offsetHeight;
    while (oNode.offsetParent && oNode.offsetParent.tagName.toUpperCase() != "BODY") {
        x += oNode.offsetLeft;
        y += oNode.offsetTop;
        oNode = oNode.offsetParent;
    }
    x += oNode.offsetLeft;
    y += oNode.offsetTop;
    this.oDiv.style.top = y + "px";
    this.oDiv.style.left = x + "px";
};
autoComplete.prototype.onTextChange = function(bTextComplete) {
    var txt = this.oText.value;
    var oThis = this;
    this.cur = -1;
    if (txt.length > 0) {
        while (this.oDiv.hasChildNodes()) {
            this.oDiv.removeChild(this.oDiv.firstChild);
        }
        var aStr = new Array();
        this.db.getMatches(txt, aStr, this.maxSize);
        if (!aStr.length) {
            this.hideSuggest;
            return;
        }
        if (bTextComplete) {
            this.textComplete(aStr[0]);
        }
        this.positionSuggest();
        for (i in aStr) {
            var oNew = document.createElement("div");
            this.oDiv.appendChild(oNew);
            oNew.onmouseover = oNew.onmouseout = oNew.onmousedown = function(oEvent) {
                oEvent = window.event || oEvent;
                oSrcDiv = oEvent.target || oEvent.srcElement;
                if (oEvent.type == "mousedown") {
                    oThis.oText.value = this.innerHTML;
                } else {
                    if (oEvent.type == "mouseover") {
                        this.className = "over";
                    } else {
                        if (oEvent.type == "mouseout") {
                            this.className = "";
                        } else {
                            this.oText.focus();
                        }
                    }
                }
            };
            oNew.innerHTML = aStr[i];
        }
        this.oDiv.style.display = "block";
    } else {
        this.oDiv.innerHTML = "";
        this.oDiv.style.display = "none";
    }
};

function callNewPopUp(p_title, p_id_txn, p_id_request, p_params) {
    if ($("#dialog-form").get(0)) {
        $("#dialog-form").remove();
    }
    var l_div = document.createElement("div");
    l_div.title = p_title;
    l_div.id = "dialog-form";
    document.frmmain.appendChild(l_div);
    $("#dialog-form").html(l_img);
    $("#dialog-form").dialog({
        autoOpen: false,
        height: 200,
        width: 325,
        modal: true
    });
    $("#dialog-form").dialog("open");
    l_reqArray = new Array();
    l_reqArray.push("fldSectionId=" + document.frmmain.fldSectionId.value);
    l_reqArray.push("fldSessionId=" + document.frmmain.fldSessionId.value);
    l_reqArray.push("fldServiceType=" + p_id_txn);
    if (p_params != null) {
        for (l_i = 0; l_i < p_params.length; l_i++) {
            l_reqArray.push(p_params[l_i]);
        }
    }
    SendAjaxRequest(l_reqArray, p_id_request, onReturnSuccess, onReturnError, onReturnWarning);
}

function onReturnSuccess(p_xml, p_text) {
    $("#dialog-form").html(p_text);
}

function onReturnError(p_xml, p_text) {
    $("#dialog-form").html(p_text);
}

function onReturnWarning(p_xml, p_text) {
    $("#dialog-form").html(p_text);
}

function closeNewPopUp() {
    $("#dialog-form").dialog("close");
    $("#dialog-form").remove();
}

function getIndicator(selector, indicator, indicatorID, count) {
    if (count < 10) {
        $(selector).html($(selector).html() + '<div class="' + indicator + '" id="' + indicatorID + '" style="border-radius: 50%;width:18px;height:18px;text-align:center;line-height:18px;">' + count + "</div>");
    } else {
        if (count >= 10 && count < 100) {
            $(selector).html($(selector).html() + '<div class="' + indicator + '" id="' + indicatorID + '" style="border-bottom-left-radius: 8px;border-bottom-right-radius: 8px;border-top-left-radius: 8px;border-top-right-radius: 8px;width:26px;height:15px;text-align:center;line-height:15px;">' + count + "</div>");
        } else {
            if (count > 99) {
                $(selector).html($(selector).html() + '<div class="' + indicator + '" id="' + indicatorID + '" style="border-bottom-left-radius: 8px;border-bottom-right-radius: 8px;border-top-left-radius: 8px;border-top-right-radius: 8px;width:26px;height:15px;text-align:center;line-height:15px;">99+</div>');
            }
        }
    }
}

function formatFavourite(thisvalue) {
    if (thisvalue.text.indexOf("*") != -1) {
        return thisvalue.text.replace("*", "") + '<div style="display:inline-block" class="fav_select"/>';
    } else {
        return thisvalue.text;
    }
}
document.onkeydown = function(event) {
    event = (event || window.event);
    if (event.keyCode == 123 || ((event.keyCode == 85) && event.ctrlKey) || event.keyCode == 116 || event.keyCode == 117) {
        return false;
    }
};
$(document).unbind("keydown").bind("keydown", function(event) {
    var doPrevent = false;
    if (event.keyCode === 8) {
        var d = event.srcElement || event.target;
        if ((d.tagName.toUpperCase() === "INPUT" && (d.type.toUpperCase() === "TEXT" || d.type.toUpperCase() === "PASSWORD" || d.type.toUpperCase() === "FILE" || d.type.toUpperCase() === "EMAIL" || d.type.toUpperCase() === "SEARCH" || d.type.toUpperCase() === "DATE")) || d.tagName.toUpperCase() === "TEXTAREA") {
            doPrevent = d.readOnly || d.disabled;
        } else {
            doPrevent = true;
        }
    }
    if (doPrevent) {
        event.preventDefault();
    }
});
if (window.parent.dataid != undefined || window.parent.dataid != null) {
	if (window.parent.callStartTimer() != "undefined"
			&& window.parent.callStartTimer() != null) {
		document.onload = window.parent.callStartTimer();
	}
}
if (window.opener != null) {
	if (window.opener.top.dataid != undefined
			|| window.opener.top.dataid != null) {
		if (window.opener.top.callStartTimer() != undefined
				&& window.opener.top.callStartTimer() != null) {
			document.onload = window.opener.top.callStartTimer();
		}
	}
}
