/*----------------------------------------------------------------------------- This source is part of the FLEXCUBE@ Java App Server Software System and is copyrighted by i-flex Solutions Limited. All rights reserved. No part of this work may be reproduced, stored in a retrieval system, adopted or transmitted in any form or by any means, electronic, mechanical, photographic, graphic, optic recording or otherwise, translated in any language or computer language, without the prior written permission of i-flex Solutions Limited. i-flex Solutions Limited. 10-11, SDF I, SEEPZ, Andheri (East), Mumbai - 400 096. India Copyright 2004 i-flex Solutions Limited. Modification History Date Version Author Description __________ ___________ _______________ ________________________________________ 10/11/2006 1 Rupesh N Initial Version 01/03/2007 2 Rupesh N Added disablekeyboardnavigation 14/05/2008 3 Sagar P Added enableForm 20/5/2008 4 Tarun Added functions trim,validateInp 14/12/2008 5 Saroj K Nayak AddedsetVisibility to support closs browser style visibility 22/04/2009 6 Preeti C Added menu scroll buttons function 27/04/2009 7 Mona P Added textbox field highlight onfocus, Table resize and drag/drop functions 26-05-2009 8 Preeti C Changed menu scroll from quicklinks new function added 'displayMenuLevel1' 20-10-2009 9 Dipti Pai Added support for Auto Suggest. 16-06-2010 10 Madhumita D Disabled backspace for readonly(Input and textarea) fields. 08-07-2010 11 Suyog J Modified validateAndSet. 06-12-2011 12 Ankita Biswal Modified disablekeyboardnavigation() to disable refresh(f5) in chrome(issue no.13465137). ------------------------------------------------------------------------------*/ //---------------------------Onload code--------------------------------- 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; //---------------------------------------------------------------------- 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) { //alert(document.frmmain.getElementById('request1').style.display); 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.getElementById('requestdetails').style.display = "block"; 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) { //if (!validateAndSet(p_frm)) {return false}; p_frm.fldSessionId.value = parent.idsession; p_frm.fldRequestId.value = "RR"+p_request; p_frm.submit (); disableForm(document.frmmain); return true; } //---------------------------------------------------------------------- /* Currently only disables button & select box; Add Form controls that needs to be disabled */ function disableForm(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=true; } } return true; } //---------------------------------------------------------------------- function returnFalse () {return false} //---------------------------------------------------------------------- //Not FoolProof. Not all browser support this requirement. function disablekeyboardnavigation(e) { //alert ("key down"); //alert (event.keyCode); if (navigator.appName == 'Microsoft Internet Explorer') { if (event.keyCode == 8) { if ((event.keyCode == 8) && (event.srcElement.tagName != "INPUT")) { if (event.srcElement.tagName != "TEXTAREA") //alert("Keyboard Navigation Disabled"); //put an appropriate message in the alert, message for IE only return false; } } if ((event.keyCode == 13) && (event.srcElement.tagName == "INPUT")) { return false; } } else if (navigator.appName == 'Netscape') { //alert (e.which); if (e.which == 93 || e.which == 0 || e.which == 3 || ((e.which == 37 || e.which == 39) && e.altKey) || (e.which == 82 && e.ctrlKey )) { alert("Keyboard Navigation Disabled."); //can be removed return false; //code for netscape to be added here return false; } } if (navigator.appName == "Microsoft Internet Explorer") { //alert (event.srcElement.tagName); if ((event.altKey) && (event.srcElement.tagName == "INPUT")) { //alert ("not allowed"); //return false; } if ((event.keyCode == 96) || (event.keyCode == 97) || (event.keyCode == 98)) { //alert ("not allowed"); //return false; } if (event.keyCode == 93 || event.keyCode == 116 || 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 = 0; } if((event.keyCode != 93) || (event.keyCode == 93 && event.srcElement.tagName != "INPUT")) { alert("This operation is not allowed."); return false; } /*if ((event.keyCode == 8 && event.altKey && (event.srcElement.tagName == "BODY"))) { alert ("tag name : " + event.srcElement.tagName); alert("This operation is not allowed."); return true; }*/ } if (event.keyCode == 18 && event.keyCode == 8 && event.srcElement.tagName != "INPUT" && event.srcElement.tagName != "TEXTAREA") { alert("This operation is not allowed."); 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 === 116) { alert("This operation is not allowed."); 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(''+ 'Send Email'+ ''+ ''+ ''+ '
'+ ''+ ''+ ''+ ''+ '' + ''+ '
Send To:'+ ''+ ''+ ''+ ''+ '
'+ '
'); } } //----------------------------------------------------------------------------- //Function to restrict enter key on button and textbox 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; //----------------------------------------------------------------------------- /* Currently only enables button & select box */ 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; // Return immediately if an invalid value was passed in if ((str == undefined) || (str == null)) { return null; } // Make sure the argument is a string str += ""; if (str.length == 0) { resultStr = ""; } else { // Loop through string starting at the beginning as long as there // are spaces. len = str.length; while ( (i <= len) && (str.charAt(i) == " ") ) { i++; } // When the loop is done, we're sitting at the first non-space char, // so return that char plus the remaining chars of the string. resultStr = str.substring(i, len); } return resultStr; } // end trimLeft //------------------------------------------------------------------------------ function trimRight ( str ) { var resultStr = ""; var i = 0; // Return immediately if an invalid value was passed in if ((str == undefined) || (str == null)) { return null; } // Make sure the argument is a string str += ""; if (str.length == 0) { resultStr = ""; } else { // Loop through string starting at the end as long as there // are spaces. i = str.length - 1; while ( (i >= 0) && (str.charAt(i) == " ") ) { i--; } // When the loop is done, we're sitting at the last non-space char, // so return that char plus all previous chars of the string. 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; } } //44 indicates ',' is removed from desc. //46 indicates '.' is removed from desc. 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; } //----------------------------------------------------------------------------- //state can be block or nore function setVisibility(p_layer_ref,p_state) { if (document.all) { //IS IE 4 or 5 (or 6 beta) eval( "document.all." + p_layer_ref + ".style.display = '"+p_state+"'"); } if (document.layers) { //IS NETSCAPE 4 or below 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; } } //----------------------------------------------------------------------------- /* Table Resizing code */ /* Global constants to store elements that may be resized but we could probably place these into custom table attributes instead. */ var sResizableElement = "TH"; // This MUST be upper case var iResizeThreshold = 8; var iEdgeThreshold = 8; var iSizeThreshold = 20; var sVBarID = "VBar"; /* Global variables to store position and distance moved but we could probably place these into custom table attributes instead. */ var oResizeTarget = null; var iStartX = null; var iEndX = null; var iSizeX = null; var engagedCell; var objTable; //------------------ FUNCTIONS FOR SWAPPING COLIMNS ----------------------- 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 ) { //try{ 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); } } } //}catch(e){} } /* Helper Functions */ /* Creates the VBar on document load */ function TableResize_CreateVBar() { // Returns a reference to the resizer VBar for the table try{ var objItem = document.getElementById(sVBarID); // Check if the item doesn't yet exist if (!objItem) { // and Create the item if necessary objItem = document.createElement("SPAN"); // Setup the bar 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"; // Add the bar to the document 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){} } /* Returns a valid resizable element, even if it contains another element which was actually clicked otherwise it returns the top body element. */ 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){} // The TH wasn't found return null; } /* Find cell at column iCellIndex in the first row of the table needed because you can only resize a column from the first row. by using this, we can resize from any cell in the table if we want to. */ function TableResize_GetFirstColumnCell(objTable, iCellIndex) { try{ var oHeaderCell = objTable.rows[0].cells[iCellIndex];}catch(e){} return oHeaderCell; } /* Clean up - clears out the tracking information if we're not resizing. */ function TableResize_CleanUp() { // Void the Global variables and hide the resizer VBar. 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; } /* Main Functions */ /* MouseMove event. On resizable table This checks if you are in an allowable 'resize start' position. It also puts the vertical bar (visual feedback) directly under the mouse cursor. The vertical bar may NOT be currently visible, that depnds on if you're resizing. */ function TableResize_OnMouseMove(e) { // Change cursor and store cursor position for resize indicator on column 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;; } // Show the resize cursor if we are within the edge threshold. if ((offsetX >= (objTH.offsetWidth - iEdgeThreshold)) && (oAdjacentCell != null)) { objTH.style.cursor = "e-resize"; } else { objTH.style.cursor = "pointer"; releasefor (srcElement); } // We want to keep the right cursor if resizing and // don't want resizing to select any text elements... if (oVBar.style.display == "inline") { // We have to add the body.scrollLeft in case the table is wider than the view window // where the table is entirely within the screen this value should be zero... 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; } /*if (window.attachEvent) { window.attachEvent ("onmousemove", TableResize_OnMouseMove) } else { window.addEventListener ("onmousemove", TableResize_OnMouseMove, false); }*/ /* MouseDown event. This fills the globals with tracking information, and displays the vertical bar. This is only done if you are allowed to start resizing. */ function TableResize_OnMouseDown(e) { // Record start point and show vertical bar resize indicator 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); // alert (oHeaderCell.tagName); if (oHeaderCell != null) { if ((oHeaderCell.tagName.toUpperCase() == sResizableElement) && (oTargetCell.style.cursor == "e-resize")) { if (!e) { iStartX = event.screenX; } else { iStartX = e.clientX; } oResizeTarget = oHeaderCell; // Mark the table with the resize attribute and show the resizer VBar. // We also capture all events on the table we are resizing because Internet // Explorer sometimes forgets to bubble some events up. // Now all events will be fired on the table we are resizing. objTable.setAttribute("Resizing", "true"); // objTable.setCapture(); // Set up the VBar for display // We have to add the body.scrollLeft in case the table is wider than the view window // where the table is entriely within the screen this value should be zero... 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; } /* MouseUp event. This finishes the resize. */ function TableResize_OnMouseUp(e) { // Resize the column and its adjacent sibling if position and size are within threshold values 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; // Mark the table with the resize attribute for not resizing objTable.setAttribute("Resizing", "false"); if ((oResizeTarget.offsetWidth + iSizeX) >= iSizeThreshold) { //alert (Math.abs(iSizeX) + " " + iResizeThreshold); 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 { //alert (oResizeTarget.style.width); oResizeTarget.style.width = iSizeThreshold; } } else { release (srcElement); } // Clean up the VBar and release event capture. TableResize_CleanUp(); // objTable.releaseCapture(); }catch(e){} 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; } } /* Table Resizing code ends */ 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 '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'){ 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 displayMenuLevel1(a){ 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=5) return true; } else return false; } function setStylesheet(title){ //Main stylesheet switcher function. var i, cacheobj, altsheets=[""]; for(i=0; (cacheobj=document.getElementsByTagName("link")[i]); i++) { if(cacheobj.getAttribute("rel").toLowerCase()=="alternate stylesheet" && cacheobj.getAttribute("title")) { //if this is an alternate stylesheet with title cacheobj.disabled = true; altsheets.push(cacheobj) ;//store reference to alt stylesheets inside array if(cacheobj.getAttribute("title") == title){ //enable alternate stylesheet with title that matches parameter cacheobj.disabled = false ;//enable chosen style sheet } } } /*This part of code is only for firefox. Whenever theme is changed, padding border values are read from the current theme specific stylesheet. And if any screen which contains tabstrip is opened then the refresh the tabs with the newly calculated border/padding values.*/ return; } /** * exposed function for setting the selected theme. * @param styletitle selected theme title. */ function chooseStyle(styletitle){ //Interface function to switch style sheets plus save "title" attr of selected stylesheet to cookie 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; //selectedTheme = 'transaction' + selectedTheme; chooseStyle(selectedTheme); } }catch(e){ } } //------------------------------------Auto Suggest code starts-------------------------------------------------------------- function autoCompleteDB() { this.aNames=new Array(); } autoCompleteDB.prototype.assignArray=function(aList) { this.aNames=aList; }; autoCompleteDB.prototype.getMatches=function(str,aList,maxSize) { /* debug */ //alert(maxSize+"ok getmatches"); var ctr=0; for(var i in this.aNames) { if(this.aNames[i].toLowerCase().indexOf(str.toLowerCase())==0) /*looking for case insensitive matches */ { aList.push(this.aNames[i]); ctr++; } if(ctr==(maxSize-1)) /* counter to limit no of matches to maxSize */ 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) /* For IE */ { var oRange=this.oText.createTextRange(); oRange.moveStart("character",iStart); oRange.moveEnd("character",iEnd-this.oText.value.length); oRange.select(); } else if(this.oText.setSelectionRange) /* For Mozilla */ { 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: //up arrow this.autoComplete.moveUp(); break; case 40: //down arrow this.autoComplete.moveDown(); break; case 13: //return key 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;i0 && this.cur>0) { --this.cur; for(var i=0;i= 33 && iKeyCode <= 46) || (iKeyCode >= 112 && iKeyCode <= 123)) { //ignore } else { this.autoComplete.onTextChange(true); /* with autocomplete */ } }; autoComplete.prototype.positionSuggest=function() /* to calculate the appropriate position of the dropdown */ { 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"; } }; //------------------------------------Auto Suggest code Ends--------------------------------------------------------------