/* Function to go to a specified URL on Button click. Generated by Dreamweaver*/ function MM_goToURL() { //v3.0 var i, args=MM_goToURL.arguments; document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'"); } /* Function to open a popup. Generated by Dreamweaver*/ function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //Sorting for single selection box function sortSingle(box) {//alert(box.id); if(box.id != 'cmbLocation' && box.id != 'selPost') { var temp_opts = new Array(); var temp = new Object(); var selText; var selValue; var asIndex=0; var temp=""; if(box != null) for(var i=0; i temp_opts[y].text.toUpperCase() && temp_opts[x].value!="") { temp = temp_opts[x].text; temp_opts[x].text = temp_opts[y].text; temp_opts[y].text = temp; temp = temp_opts[x].value; temp_opts[x].value = temp_opts[y].value; temp_opts[y].value = temp; } } } } if(box != null) { eval(box).innerHTML=""; box.options[0]=new Option(selText,selValue); for(var i=1; i field value (document.formname.textboxname.value //ignoreWhiteSpace -> 'true' or 'false' function isNumeric(string, ignoreWhiteSpace) { if (string.search) { if ((ignoreWhiteSpace && string.search(/[^\d\s]/) != -1) || (!ignoreWhiteSpace && string.search(/\D/) != -1)) return false; } return true; } //For Dual Box // Automatically sort items within lists? (1 or 0) cmbctr=0; sortitems = 1; // Automatically sort items within lists? (1 or 0) function move(fbox,tbox) { for(var i=0; i temp_opts[y].text.toUpperCase()) { temp = temp_opts[x].text; temp_opts[x].text = temp_opts[y].text; temp_opts[y].text = temp; temp = temp_opts[x].value; temp_opts[x].value = temp_opts[y].value; temp_opts[y].value = temp; } } } for(var i=0; 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= 0) return false; return true; } function collapseAllRows() { var rows = document.getElementsByTagName("TR"); for (var j = 0; j < rows.length; j++) { var r = rows[j]; if (r.id.indexOf("-") >= 0) { r.style.display = "none"; } } } /**DROP DOWN MENU**/ /**Right Click disable**/ /*var message="Function Disabled!"; /////////////////////////////////// function clickIE() {if (document.all) {alert(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {alert(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") */ /**Swap up and down images**/ var refer=true; function swapImages() { if (refer) { document.arrow.src='/images/sublinks-uparrow.jpg'; refer=false; } else { document.arrow.src='/images/sublinks-dnarrow.jpg'; refer=true; } } var refer1=true; function swapImages1() { if (refer1) { document.arrow1.src='/images/sublinks-uparrow.jpg'; refer1=false; } else { document.arrow1.src='/images/sublinks-dnarrow.jpg'; refer1=true; } } var refer2=true; function swapImages2() { if (refer2) { document.arrow2.src='/images/sublinks-uparrow.jpg'; refer2=false; } else { document.arrow2.src='/images/sublinks-dnarrow.jpg'; refer2=true; } } /**Function For Toggling of Basic and Advance**/ function showhide1() { var args=showhide.arguments; for (var i=0; i<(args.length); i=i+2) { eval(args[i]+".style.display='"+args[i+1]+"'"); } } /**Function to change the ACTION_MODE used to decide what action to call, * prior to submitting the form. Call this function on button click, passing the new mode * as argument. The form_name and the action_mode is taken automatically */ function setActionMode(theMode) { var ACTION_VARIABLE = "c_strActionMode"; var theForm = formName; var expression = formName + ACTION_VARIABLE + ".value=" + theMode; eval(expression); //Below statement is commented by Lomesh // If you have any problem with it, let me know. //eval(formName + "submit()"); } /******************************************************* To use this you will have to call one function in your jsp: setParameters(); Example: javascript: setParameters("UniId"); html: ******************************************************* function CheckSelected() will return true if one/more checkbox is selected, false otherwise. function getCheckedValue() will return checked check box value if only one checkbox is selcted, -1 otherwise *******************************************************/ function Toggle(e,tableId,i,flag) { if(e.checked) eval(formName + "toggleAll").checked = AllChecked(); else eval(formName + "toggleAll").checked = false; changeRowColor(tableId,i,flag); } function ToggleAll(e,tableId) { if(e.checked) CheckAll(tableId); else ClearAll(tableId); } function Check(e) { e.checked = true; } function Clear(e) { e.checked = false; } function CheckAll(tableId) { var ml = eval("document." + formNamePassed); var len = ml.elements.length; var j = 0; for (var i = 0; i < len; i++) { var e = ml.elements[i]; if(e.name == checkboxName || e.id == checkboxName) { Check(e); changeRowColor(tableId,j+1,true); j++; } } ml.toggleAll.checked = true; } function ClearAll(tableId) { var ml = eval("document." + formNamePassed); var len = ml.elements.length; var j = 0; for(var i = 0; i < len; i++) { var e = ml.elements[i]; if(e.name == checkboxName || e.id == checkboxName) { Clear(e); changeRowColor(tableId,j+1,false); j++; } } ml.toggleAll.checked = false; } function AllChecked() { ml = eval("document." + formNamePassed); len = ml.elements.length; for(var i = 0 ; i < len ; i++) { if((ml.elements[i].name == checkboxName || ml.elements[i].id == checkboxName) && !ml.elements[i].checked) return false; } return true; } //function CheckSelected() will return true if one/more checkbox is selected, //false otherwise. function CheckSelected() { ml = eval("document." + formNamePassed); len = ml.elements.length; var retVal = false; for(var i = 0 ; i < len ; i++) { if((ml.elements[i].name == checkboxName || ml.elements[i].id == checkboxName) && ml.elements[i].checked) { retVal = true; break; } } return retVal; } //function getCheckedValue() will return checked check box value if only one checkbox is selcted, //-1 otherwise function getCheckedValue() { ml = eval("document." + formNamePassed); len = ml.elements.length; var retValue = -1; var count = 0; for(var i = 0 ; i < len ; i++) { if((ml.elements[i].name == checkboxName || ml.elements[i].id == checkboxName) && ml.elements[i].checked) { count++; if(count > 1) { retValue = -1; break; } else retValue = ml[i].value; } } return retValue; } /** * Function to change the color of the row when selected.Sets grey back ground color * when selected else white background.Syntax to call the function * * if required to be call explictly */ function changeRowColor(tableId,rowId,flag) { var oTable = document.getElementById(tableId); if(flag) { oTable.rows[rowId].className="selected-row"; } else { oTable.rows[rowId].className="defualt-row"; } } function makeAllSelected(id) { var obj=document.getElementById(id); var count=obj.options.length; var i=0; while(i= 0 ) { //alert( alertMsg ); //alert( flds[i] ); alertMsg = replaceStringWithParam( alertMsg, "%", "'" + flds[i] + "'" ); i += 1; if( i > flds.length ) { break; } } //alert( alertMsg ); return alertMsg; } // replace searchString with replaceString function replaceStringWithParam(mainStr,searchStr,replaceStr) { var front = getFrontStr(mainStr,searchStr) var end = getEndStr(mainStr,searchStr) if (front != null && end != null) { return front + replaceStr + end } return null } // extract front part of string prior to searchString function getFrontStr(mainStr,searchStr) { foundOffset = mainStr.indexOf(searchStr) if (foundOffset == -1) { return null } return mainStr.substring(0,foundOffset) } // extract back end of string after searchString function getEndStr(mainStr,searchStr) { foundOffset = mainStr.indexOf(searchStr) if (foundOffset == -1) { return null } return mainStr.substring(foundOffset+searchStr.length,mainStr.length) } /** *Function for selecting Default value; */ function selectSelection(selectBoxId, defaultValue) { if(document.getElementById(selectBoxId) != null) { var lstLength = document.getElementById(selectBoxId).options.length; for(var dynCounter = 0; dynCounter < lstLength; dynCounter++) { if(document.getElementById(selectBoxId).options[dynCounter].value == defaultValue) { document.getElementById(selectBoxId).options[dynCounter].selected = "true"; break; } } } } function isName(contName) { camprEn=/^[A-Za-z ]*$/; camprGu=/^[\u0A80-\u0AFF \t]*$/; flag=true; if(!(camprEn.test(contName.value))) { flag=false; if(camprGu.test(contName.value)) { flag=true; } } if(!flag) { alert(cmnLblArray[7]); contName.focus(); contName.select(); } return (flag); } function findPosY(obj) { var curtop = 0; if(obj.offsetParent) while(1) { curtop += obj.offsetTop; if(!obj.offsetParent) break; obj = obj.offsetParent; } else if(obj.y) curtop += obj.y; return curtop; } function findPosX(obj) { var curleft = 0; if(obj.offsetParent) while(1) { curleft += obj.offsetLeft; if(!obj.offsetParent) break; obj = obj.offsetParent; } else if(obj.x) curleft += obj.x; return curleft; } function addLeftMenuDiv() { try{ var navDiv = document.getElementById("verticalnav"); navDiv.style.display = ''; navDiv.style.top = topPos_Div+'px'; if(document.getElementById('mnucntntdiv') == null || document.getElementById('mnucntntdiv') == undefined) { document.getElementById('vMenuTableID').style.display = 'none'; } else { document.getElementById('mnucntntdiv').style.display = 'none'; } }catch(e){/*alert('addLeftMenuDiv: '+e.message);*/} } function addRightInfoDiv() { try { var navRightDiv = document.getElementById("rightInfo"); navRightDiv.style.top = topPos_Div+'px'; navRightDiv.style.display = 'none'; } catch(e){/*alert('addRightInfoDiv: '+e.message);*/} } /* Added by Dharmendrasinh Mahida [ 603222] * for multipal contact of a person * Strat */ function ckPhoneNumbers() { var num = window.event.keyCode; if ((eval(num)<48||eval(num)>57) && eval(num)!=44) { return false; } else { return true; } } /** * * @version 0.1.1 * @author Dharmendrasinh Mahida [603222] * @date 05 March 2009 * @param objTxt jsp field name * @param msg Stringmsg if validation faild * @param type String Type of validation * * @return boolean true/false base on value inserted */ function MultiContactValuesValidate(objTxt,msg,type) { strValueTxt=objTxt.value; strat=/^,+/; end=/,+$/; btween=/,,+/g; if(strat.test(strValueTxt) || btween.test(strValueTxt) ||end.test(strValueTxt)) { alert(msg); objTxt.focus(); } else { inputArray = strValueTxt.split(','); for(i=0;i"; span.innerHTML+=str; } try{ document.saveRequestFORM[0].action = url; document.saveRequestFORM.submit(); }catch(e) { alert(e.message); } } function changeTheme(url,theme) { document.getElementById("theme").value = theme; for(var x=0;x"; span.innerHTML+=str; } try{ document.saveRequestFORM[0].action = url ; document.saveRequestFORM.submit(); }catch(e) { alert(e.message); } } function blank(){} // Added By Hardik To Open Help Menu Page function openHelpPage() { var helpActionFlag = document.getElementById("helpActionFlag"); var helpViewName=document.getElementById("helpViewName"); var helpHtml=document.getElementById("helpHtml"); if(helpActionFlag!=null) { helpActionFlag = document.getElementById("helpActionFlag").value; if(helpActionFlag!=null && helpActionFlag!="") { helpActionFlag = helpActionFlag.trim(); var href='ifms.htm?actionFlag='+helpActionFlag; var win=window.open(href,'Help', 'width=840,height=630,toolbar=yes,minimize=yes,status=yes,memubar=yes,location=no,scrollbars=yes,top=50,left=100'); } else { alert(_cmnMsgCFHelpPage); } } else if(helpViewName!=null) { helpViewName = document.getElementById("helpViewName").value; if(helpViewName!=null && helpViewName!="") { helpViewName = helpViewName.trim(); var href='ifms.htm?viewName='+helpViewName; var win=window.open(href,'Help', 'width=840,height=630,toolbar=no,minimize=yes,status=yes,memubar=no,location=no,scrollbars=yes,top=50,left=100'); } else { alert(_cmnMsgCFHelpPage); } } else if(helpHtml!=null) { helpHtml = document.getElementById("helpHtml").value; if(helpHtml!=null && helpHtml!="") { helpHtml ='help/'+ helpHtml.trim(); var href=helpHtml; var win=window.open(href,'Help', 'width=840,height=630,toolbar=no,minimize=yes,status=yes,memubar=no,location=no,scrollbars=yes,top=50,left=100'); } else { alert(_cmnMsgCFHelpPage); } } else { alert(_cmnMsgCFHelpPage); } } //Added By Tarak ---Ajax function to check whether a record is //already updated and not approved(draft or pending in Work-flow). function checkPendingDraftUpdatedRecord(tableName,columnName,columnValue,radioBtnName,hdIdName) { //alert(tableName + "==" + columnName + "==" + columnValue); if (tableName != null && tableName != '' && columnName != null && columnName != '' && columnValue != null) { //alert("Inside If"); var url = "./ifms.htm?actionFlag=checkPendingDraftUpdatedRecord"; var parameter="tableName="+tableName+"&columnName="+columnName+"&columnValue="+columnValue; var myAjax = new Ajax.Request(url, { method: 'post', parameters: parameter, onSuccess: function(data) { var response = data.responseText; if(response=="true") { alert(_cmnMsgUpdatedDraftPndingRecord); if(radioBtnName != null && radioBtnName != '') { var allRadios = document.getElementsByName(radioBtnName); for(x = 0; x < allRadios.length; x++) { allRadios[x].checked = false; } } if(hdIdName != null && hdIdName != '') { document.getElementById(hdIdName).value = ''; } } } } ); } } //Added By Tarak ---Ajax function to check whether a record is //already updated and not approved(draft or pending in Work-flow). var returnval=true; function checkPendingDraftUpdatedCodeRecord(tableName,columnName,columnValue,radioBtnName,hdIdName) { //alert(tableName + "==" + columnName + "==" + columnValue); if (tableName != null && tableName != '' && columnName != null && columnName != '' && columnValue != null) { //alert("Inside If"); var url = "./ifms.htm?actionFlag=checkPendingDraftUpdatedCodeRecord"; var parameter="tableName="+tableName+"&columnName="+columnName+"&columnValue="+columnValue; var myAjax = new Ajax.Request(url, { method: 'post', parameters: parameter, asynchronous:false, onSuccess:function(data) { var response = data.responseText; if(response=="true") { alert(_cmnMsgUpdatedDraftPndingRecord); if(radioBtnName != null && radioBtnName != '') { var allRadios = document.getElementsByName(radioBtnName); for(x = 0; x < allRadios.length; x++) { allRadios[x].checked = false; } } if(hdIdName != null && hdIdName != '') { document.getElementById(hdIdName).value = ''; } returnval=false; } } } ); return returnval; } } function openSpellChecker(inputTypeId) { var inputType = document.getElementById(inputTypeId); if(typeof inputType != 'undefined' && inputType != null && inputType.value != '') { var hdSentence = document.getElementById("hdSpellCheckerTxt"); hdSentence.value = inputType.value; var href= 'ifms.htm?viewName=spellchecker'; var x = screen.width/2 - 500/2; var y = screen.height/2 - 120/2; var child=window.open(href,'SpellChecker','width=500,height=400,toolbar=no,minimize=yes,status=yes,memubar=no,location=no,scrollbars=no,resizable=no,top='+y+',left='+x); var timer = setInterval(function() { if (child.closed) { inputType.value = hdSentence.value; clearInterval(timer); } }, 100); } else { alert("No text found for Spell Check."); } } function checkListSuggestion(UrlofChklistWindow) { window.opener.parent.location.href = UrlofChklistWindow; window.close(this); } //Added By Tarak To Open Help Menu Page function openHelpPageNew() { //alert("in OpenHelpPage()"); var anchorId = document.getElementById("helpHtml").value; var actvElement = document.activeElement.name; var parameter; if(actvElement != null && actvElement != undefined && actvElement != "") { //keyword = keyword + "_" + actvElement; var url="ifms.htm?actionFlag=getHelpPage"; parameter="anchorId="+anchorId+"&fieldName="+actvElement; var result; var myAjax = new Ajax.Request(url, { method: 'post', parameters: parameter, asynchronous:false, onSuccess: function(data){ result = data.responseText; } } ); document.getElementById("hdHelpResult").value = result; } else { document.getElementById("hdHelpResult").value = anchorId + "~"; } var href= 'help/HelpNew/index.html'; var win=window.open(href,'Help', 'resizable=yes, width=1200, height=650, toolbar=no,minimize=yes,status=yes,memubar=no,location=no,scrollbars=yes,top=0,left=0'); /* //var flag=false; var url="ifms.htm?actionFlag=getHelpPage"; var result; //var htmlPath,anchorId; var myAjax = new Ajax.Request(url, { method: 'post', parameters: parameter, asynchronous:false, onSuccess: function(data){ result = data.responseText; } } ); //anchorId = result.split('~')[0]; htmlPath = result.split('~')[1]; document.getElementById("hdHelpResult").value = result; var href= 'help/HelpNew/index.html'; var win=window.open(href,'Help', 'resizable=yes, width=1200, height=650, toolbar=no,minimize=yes,status=yes,memubar=no,location=no,scrollbars=yes,top=0,left=0'); //win=window.open('','Help', 'resizable=yes, width=1000, height=650, toolbar=no,minimize=yes,status=yes,memubar=no,location=no,scrollbars=yes,top=0,left=0'); //var newDoc = win.document; //alert("newDoc-->"+newDoc.innerHTML()); //var contentFrame = newDoc.getElementById("content"); //contentFrame.contentWindow.location.reload(true); //contentFrame.src = htmlPath; //newDoc.location.reload(false); */ } /*Added For Hindi Typing - Jessica - 18th August,2015 - Sstart*/ function generateHindiHelp() { var newWindow = null; var baseUrl = "ifms.htm?viewName=hindihelp"; newWindow=window.open (baseUrl, "mywindow","status=0,toolbar=0,menubar=0,scrollbars=yes, resizable=no,width=900, height=500,top=20,left=50"); } /*Added For Hindi Typing - Jessica - 18th August,2015 - End*/