var submitClickCount = 0; // Begin Auto Tab var isNN = (navigator.appName.indexOf("Netscape")!=-1); function autoTab(input,len, e) { var keyCode = (isNN) ? e.which : e.keyCode; var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46]; if(input.value.length >= len && !containsElement(filter,keyCode)) { input.value = input.value.slice(0, len); input.form[(getIndex(input)+1) % input.form.length].focus(); } function containsElement(arr, ele) { var found = false, index = 0; while(!found && index < arr.length) if(arr[index] == ele) found = true; else index++; return found; } function getIndex(input) { var index = -1, i = 0, found = false; while (i < input.form.length && index == -1) if (input.form[i] == input)index = i; else i++; return index; } return true; } // End Auto Tab--> function submitForm(formName) { //submits the form given a formname eval("document."+formName+".submit()"); } function resetForm(formName) { //resets a form given a formName eval("document."+formName+".reset()"); } function submitFormAction (formName, formAction, submitForm, newURL){ // All form submitting functions have been consolidated into this function // Simply pass false as any parameter that is not needed // formName and formAction are REQUIRED! //add double click validation submitClickCount++; if(submitClickCount>1) { return false; } var myForm = (formName != null)?formName:'forms[0]'; var myAction = (formAction != null)?formAction:' '; var doSubmit = (submitForm == true)?true:false; var newPage = (newURL != null && newURL != false)?newURL:false; eval("window.document."+formName+".action.value = '"+formAction+"'"); if(doSubmit){ eval("window.document."+formName+".submit()"); } if(newPage){ document.location.href = ''+newURL; } } // function to submit the form on pressing the enter in textfield function enterFormAction(event,formName, formAction, submitForm, newURL) { NS4 = (document.layers) ? true : false; var code = 0; if (NS4) code = event.which; else code = event.keyCode; if (code==13) submitFormAction(formName, formAction, submitForm, newURL); } // function to submit the form only once // Used in input=image type forms , function being called in onClick submitHandler // Usage onClick = "return checkImageButtonSubmitAction();" function checkImageButtonSubmitAction() { singleClickCount++; if(singleClickCount>1) { return false; } else { return true; } } function order(formName,fieldName){ var orderValue = eval("document." + formName + "." + fieldName + ".value"); if (orderValue == "descending") { eval("document." + formName + "." + fieldName + ".value='ascending'"); } else { eval("document." + formName + "." +fieldName + ".value='descending'"); } } function submitSortingOrderForm (formName, sortByValue) { eval("document." + formName + ".sortBy.value = '" + sortByValue + "';"); eval("document." + formName + ".submit();"); } function popup(url,name,toolbar,location,directories,status,menubar,scrollbars,resizable,width,height,top,left) { this[name] = window.open(url,name,"toolbar="+toolbar+",location="+location+",directories="+directories+",status="+status+",menubar="+menubar+",scrollbars="+scrollbars+",resizable="+resizable+",width="+width+",height="+height+",top="+top+",left="+left+""); window[name].focus(); } /*****************************************************************************/ function popup_a(url) { popup(url,'general','no','no','no','yes','no','no','no',390,276,0,0); } function popup_b(url) { popup(url,'general','no','no','no','yes','no','yes','yes',475,550,0,0); } function popup_c(url) { popup(url,'general','no','no','no','yes','no','yes','yes',800,400,0,0); } function pastBills() { window.open('/viewPastBills.do', '_blank', 'height=350,innerHeight=350,width=228,innerWidth=228,left=0,top=0,scrollbars=yes,resizable=yes'); return; } function listPastLetters() { window.open('/viewLetterHistory.do', '_blank', 'height=350,innerHeight=350,width=228,innerWidth=228,left=0,top=0,scrollbars=yes,resizable=yes'); return; } /*****************************************************************************/ //toggle function for use with dynamic form display fields; To use, call the function onClick in the form object(s) and set the targetID and toggle, such as onClick="toggle('someName',this.checked); then add a corresponding id and default style to the field that you want to toggle such as, id="someName" style="display:none" function toggle( targetId, toggle) { target = document.getElementById( targetId ); if (toggle) { target.style.display = "inline"; } else { target.style.display = "none"; } }