function getNetUIElement(id, tag) { elementId = getNetuiTagName(id, tag); return document.getElementById(elementId); } function showPrintPage() { var headerPart = document.getElementById("DSE_HEADER"); var bannerPart = document.getElementById("DSE_BANNER"); var userPart = document.getElementById("DSE_USER_PANEL"); var printPart = document.getElementById("DSE_PRINT"); var cancelPrintPart = document.getElementById("DSE_CANCEL_PRINT"); var leftMenuPart = document.getElementById("DSE_LEFT_MENU"); headerPart.style.display = "none"; headerPart.style.visibility = "hidden"; bannerPart.style.display = "none"; bannerPart.style.visibility = "hidden"; userPart.style.display = "none"; userPart.style.visibility = "hidden"; printPart.style.display = "none"; printPart.style.visibility = "hidden"; cancelPrintPart.style.display = ""; cancelPrintPart.style.visibility = "visible"; leftMenuPart.style.display = "none"; leftMenuPart.style.visibility = "hidden"; } function cancelPrintPage() { var headerPart = document.getElementById("DSE_HEADER"); var bannerPart = document.getElementById("DSE_BANNER"); var userPart = document.getElementById("DSE_USER_PANEL"); var printPart = document.getElementById("DSE_PRINT"); var cancelPrintPart = document.getElementById("DSE_CANCEL_PRINT"); var leftMenuPart = document.getElementById("DSE_LEFT_MENU"); headerPart.style.display = ""; headerPart.style.visibility = "visible"; bannerPart.style.display = ""; bannerPart.style.visibility = "visible"; userPart.style.display = ""; userPart.style.visibility = "visible"; printPart.style.display = ""; printPart.style.visibility = "visible"; cancelPrintPart.style.display = "none"; cancelPrintPart.style.visibility = "hidden"; leftMenuPart.style.display = ""; leftMenuPart.style.visibility = "visible"; } // ------------------------------------------------ // Registration Functions // ------------------------------------------------ function onSelectIDPlaceOfIssue(idType, f) { if ("IDT0002" == idType.value || "IDT0008" == idType.value) { changeIDPlaceOfIssue(f, "MO"); } else if ("IDT0007" == idType.value) { changeIDPlaceOfIssue(f, "CN"); } else if ("IDT0004" == idType.value) { changeIDPlaceOfIssue(f, "HK"); } else { changeIDPlaceOfIssue(f, "---"); } } function changeIDPlaceOfIssue(f, place) { var idPlace = f[getNetuiTagName("idPlaceOfIssue", this)]; var i = 0; for (i=0; i 0) { x = document.documentElement.offsetWidth; y = document.documentElement.offsetHeight; } else { x = document.body.offsetWidth; y = document.body.offsetHeight; } } else { x = top.innerWidth; y = top.innerHeight; } obj.style.left = Math.floor((x-obj.offsetWidth) / 2) + "px"; obj.style.top = Math.floor((y-obj.offsetHeight) / 2) + "px"; ShowDiv(layerID); } // ----------------------------------------------------------------------------- // Move the layer to a specified position. // layerName : The layer name. // x : The x-coordinate. // y : The y-coordinate. // ----------------------------------------------------------------------------- function MoveLayerTo(layerName, x, y) { var lyr = FindObj(layerName); var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 && parseFloat(navigator.appVersion) >= 4) ? 1 : 0; var isMinIE4 = (document.all) ? 1 : 0; if (isMinNS4) { if (lyr.style) { if (lyr.style.left) { lyr.style.left = x; lyr.style.top = y; } else { lyr.moveTo(x, y); } } else { lyr.moveTo(x, y); } } else if (isMinIE4) { lyr.style.left = x; lyr.style.top = y; } } // ----------------------------------------------------------------------------- // Dynamic change the content of a layer. // divName : The name of layer. // content : The content. // ----------------------------------------------------------------------------- function ChangeDivContent(divName, content) { if (document.getElementById) { if(document.getElementById(divName)) { document.getElementById(divName).innerHTML = content; } } else if (document.all) { var divLayer = eval("document.all." + divName); divLayer.innerHTML = content; } else if (document.layers) { var divLayer = eval("document.layers." + divName + ".document"); divLayer.open(); divLayer.write(content); divLayer.close(); } return(false); } // ----------------------------------------------------------------------------- // Get the content of a layer. // divName : The name of layer. // RETURN : The content. // ----------------------------------------------------------------------------- function GetDivContent(divName) { if (document.getElementById) { return document.getElementById(divName).innerHTML; } else if (document.all) { var divLayer = eval("document.all." + divName); return divLayer.innerHTML; } else if (document.layers) { var divLayer = eval("document.layers." + divName + ".document"); return(""); } } // ----------------------------------------------------------------------------- // Show a layer. // divName : The name of layer. // ----------------------------------------------------------------------------- function ShowDiv(divName) { var divObj = FindObj(divName); if (document.getElementById) { divObj.style.display= ""; } else if (document.all) { divObj.style.display= ""; } else if (document.layers) { divObj.style.display= ""; } } function ShowElement(elementName) { var eleObj = FindObj(elementName); if (document.getElementById) { eleObj.style.display = ""; } else if (document.all) { eleObj.style.display = ""; } else if (document.layers) { eleObj.style.display = ""; } } // ----------------------------------------------------------------------------- // Hide a layer. // divName : The name of layer. // ----------------------------------------------------------------------------- function HideDiv(divName) { var divObj = FindObj(divName); if (document.getElementById) { divObj.style.display = "none"; } else if (document.all) { divObj.style.display = "none"; } else if (document.layers) { divObj.style.display = "none"; } } function HideElement(elementName) { var eleObj = FindObj(elementName); if (document.getElementById) { eleObj.style.display = "none"; } else if (document.all) { eleObj.style.display = "none"; } else if (document.layers) { eleObj.style.display = "none"; } } // ----------------------------------------------------------------------------- // Get the visibility of a layer // layerName : The name of layer. // RETURN : The visibility of the layer in "visible" or "hidden". // ----------------------------------------------------------------------------- function GetDivVisibility(layerName) { var layer = FindObj(layerName); var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 && parseFloat(navigator.appVersion) >= 4) ? 1 : 0; var isMinIE4 = (document.all) ? 1 : 0; if (isMinNS4) { if (layer.visibility == "show") return "visible"; if (layer.visibility == "hide") return "hidden"; if (layer.style) { return layer.style.visibility; } return layer.visibility; } if (isMinIE4) return layer.style.visibility; return ""; } // ----------------------------------------------------------------------------- // Open a popup window which position is at the central. // url : The URL of that window going to load. // name : The window name. // popW : The width of window. // popH : The height of window. // feature : The additional features of that window. // ----------------------------------------------------------------------------- function OpenCenteredPopup(url, name, popW, popH, feature) { var w = 1024; var h = 768; if (document.all || document.layers) { w = screen.availWidth; h = screen.availHeight; } var leftPos = (w-popW)/2; var topPos = (h-popH)/2; var popupWin = window.open(url,name,(feature ? (feature + ',') : '') + 'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos); popupWin.focus(); return(false); } // ----------------------------------------------------------------------------- // Create a cookie entry. // Name : The cookie name. // Value : The cookie value. // Expiry : The specified expiry date. // Path : The specified path. // Domain : The specified domain. // Secure : Whether is secure or not. // ----------------------------------------------------------------------------- function MakeCookie(Name, Value, Expiry, Path, Domain, Secure) { if (Expiry != null && !isNaN(Expiry)) { var datenow = new Date(); datenow.setTime(datenow.getTime() + Math.round(86400000 * Expiry)); Expiry = datenow.toGMTString(); } Expiry = (Expiry) ? '; expires='+Expiry : ''; Path = (Path)?'; path='+Path:''; Domain = (Domain) ? '; domain='+Domain : ''; Secure = (Secure) ? '; secure' : ''; document.cookie = Name + '=' + escape(Value) + Expiry + Path + Domain + Secure; } // ----------------------------------------------------------------------------- // Read a cookie entry. // name : The cookie name. // RETURN : The cookie value. // ----------------------------------------------------------------------------- function ReadCookie(name) { var cookies = ' ' + document.cookie; if (cookies.indexOf(' ' + name + '=') == -1) return null; var start = cookies.indexOf(' ' + name + '=') + (name.length + 2); var finish = cookies.substring(start,cookies.length); finish = (finish.indexOf(';') == -1) ? cookies.length : start + finish.indexOf(';'); return unescape(cookies.substring(start, finish)); } // ----------------------------------------------------------------------------- // Find the inner height within the browser window. // RETURN : The inner height within the browser window. // ----------------------------------------------------------------------------- function GetInnerHeight() { if (window.innerHeight) { return(window.innerHeight); } else if (document.body && document.body.clientHeight) { return(document.body.clientHeight); } else { return(700); } } // ----------------------------------------------------------------------------- // Find the inner width within the browser window. // RETURN : The inner width within the browser window. // ----------------------------------------------------------------------------- function GetInnerWidth() { if (window.innerWidth) { return(window.innerWidth); } else if (document.body && document.body.clientWidth) { return(document.body.clientWidth); } else { return(1000); } } // ----------------------------------------------------------------------------- // Remove all options from a select list. // from : The select object which going to remove all options. // ----------------------------------------------------------------------------- function RemoveAllOptions(from) { for (var i=(from.options.length-1); i>=0; i--) { from.options[i] = null; } from.selectedIndex = -1; } // ----------------------------------------------------------------------------- // Add an option to a select list. // obj : The select object which going to add an option. // text : The text label of that option. // value : The value of that option. // selected : Whether it is pre-selected or not. // ----------------------------------------------------------------------------- function AddOption(obj, text, value, selected) { if (obj!=null && obj.options!=null) { obj.options[obj.options.length] = new Option(text, value, false, selected); } } // ----------------------------------------------------------------------------- // Remove an array element at a given index // ary : The array. // idx : The index of element in array going to be removed. // ----------------------------------------------------------------------------- function RemoveArrayElement(ary, idx) { var length = ary.length; if (idx>=length || idx<0) { return; } for (var i=idx; i0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i exits if ((thePointerColor == '' && theMarkColor == '') || typeof(theRow.style) == 'undefined') { return false; } // 2. Gets the current row and exits if the browser can't get it if (typeof(document.getElementsByTagName) != 'undefined') { theCells = theRow.getElementsByTagName('td'); } else if (typeof(theRow.cells) != 'undefined') { theCells = theRow.cells; } else { return false; } // 3. Gets the current color... var rowCellsCnt = theCells.length; var domDetect = null; var currentColor = null; var newColor = null; // 3.1 ... with DOM compatible browsers except Opera that does not return // valid values with "getAttribute" if (typeof(window.opera) == 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') { currentColor = theCells[0].getAttribute('bgcolor'); domDetect = true; } // 3.2 ... with other browsers else { currentColor = theCells[0].style.backgroundColor; domDetect = false; } // end 3 // 4. Defines the new color // 4.1 Current color is the default one if (!currentColor || currentColor == '' || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) { if (theAction == 'over' && thePointerColor != '') { newColor = thePointerColor; } else if (theAction == 'click' && theMarkColor != '') { newColor = theMarkColor; g_marked_row[theRowNum] = true; ToggleDefaultCheckbox(theRecordID); } } // 4.1.2 Current color is the pointer one else if (currentColor.toLowerCase() == thePointerColor.toLowerCase() && (typeof(g_marked_row[theRowNum]) == 'undefined' || !g_marked_row[theRowNum])) { if (theAction == 'out') { newColor = theDefaultColor; } else if (theAction == 'click' && theMarkColor != '') { newColor = theMarkColor; g_marked_row[theRowNum] = true; ToggleDefaultCheckbox(theRecordID); } } // 4.1.3 Current color is the marker one else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) { if (theAction == 'click') { newColor = (thePointerColor != '') ? thePointerColor : theDefaultColor; g_marked_row[theRowNum] = (typeof(g_marked_row[theRowNum]) == 'undefined' || !g_marked_row[theRowNum]) ? true : null; ToggleDefaultCheckbox(theRecordID); } } // end 4 // 5. Sets the new color... if (newColor) { var c = null; // 5.1 ... with DOM compatible browsers except Opera if (domDetect) { for (c = 0; c < rowCellsCnt; c++) { theCells[c].setAttribute('bgcolor', newColor, 0); } // end for } // 5.2 ... with other browsers else { for (c = 0; c < rowCellsCnt; c++) { theCells[c].style.backgroundColor = newColor; } } } // end 5 return true; } // end of the 'SetTableRowColor()' function // -------------------- // Table manipulation // used with tbody // -------------------- function addTableRow(tableElement, cellFuncs, rowID, bgColor) { var tbody = document.getElementById(tableElement).tBodies[0]; var tr = document.createElement("TR"); tr.id = rowID; tr.style.background = bgColor; for (var j = 0; j < cellFuncs.length; j++) { var func = cellFuncs[j]; var td; if (typeof func == "string") { td = document.createElement("td"); var text = document.createTextNode(func); td.appendChild(text); } else { var reply = func(j); if (isHtmlElement(reply, "td")) { td = reply; } else if (isHtmlElement(reply)) { td = document.createElement("td"); td.appendChild(reply); } else { td = document.createElement("td"); td.innerHTML = reply; } } tr.appendChild(td); } tbody.appendChild(tr); } function addTableRow1(tableElement, cellFuncs, rowID, rowClass) { var tbody = document.getElementById(tableElement).tBodies[0]; var tr = document.createElement("TR"); tr.id = rowID; tr.className = rowClass; for (var j = 0; j < cellFuncs.length; j++) { var func = cellFuncs[j]; var td; if (typeof func == "string") { td = document.createElement("td"); var text = document.createTextNode(func); td.appendChild(text); } else { var reply = func(j); if (isHtmlElement(reply, "td")) { td = reply; } else if (isHtmlElement(reply)) { td = document.createElement("td"); td.appendChild(reply); } else { td = document.createElement("td"); td.innerHTML = reply; } } tr.appendChild(td); } tbody.appendChild(tr); } function removeTableRow(tableElement, rowID) { var row = document.getElementById(rowID); var table = document.getElementById(tableElement); var tbody = table.getElementsByTagName('tbody')[0]; //tbody.removeChild(row); table.removeChild(row); } function removeTableRows(tableElement) { var t = document.getElementById(tableElement); var tbody = t.getElementsByTagName('tbody')[0]; while (tbody.childNodes.length > 0) { tbody.removeChild(tbody.firstChild); } } function deleteCurrentRow(obj) { var delRow = obj.parentNode.parentNode; var tbl = delRow.parentNode.parentNode; var rIndex = delRow.sectionRowIndex; var rowArray = new Array(delRow); deleteRows(rowArray); } function deleteRows(rowObjArray) { for (var i=0; i