/********************************************************* Set of JavaScript functions used throughout the database JavaScript Validation 2.0, 19/Mar/2001 Jake Howlett, http://www.codestore.org/ **********************************************************/ /*********************************************************** errorHandler() Used by Netscape to return the error message to the user. Best used only when debuggind in development. Turn on by adding the following line to a form: if (navigator.appName=="Netscape") window.onerror = errorHandler; ***********************************************************/ function errorHandler( e, f, l ) { alert("Error\nFile: " + f + "\nLine: " + l + "\nError:" + e); return true; } /*********************************************************** doDelete is used to delete the from the server The user is first asked to confirm that this is what they want to do. Giving them the chance to cancel the action. This works SIMPLY by changing the end of the URL from "?OpenDocument" to "?DeleteDocument" ************************************************************/ function doDelete() { if ( confirm('Are you sure you want to delete this document?') ){ location.search = "?DeleteDocument"; } } /*********************************************************** trim is a simple function to remove leading/trailing spaces ************************************************************/ function trim(aStr) { return aStr.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "") } /*********************************************************** following two functions call the date picking dialog box ************************************************************/ function myDateDialog(){ var retDay; var retMonth; var retYear; } function openDatePickerDialog(wnd, field, dateFormat) { myDateDialog.retDay=""; myDateDialog.retMonth=""; myDateDialog.retYear=""; var pathname = window.location.pathname; var dlgURL = pathname.substring(0,(pathname.lastIndexOf(".nsf") + 5))+'dlgDatePicker?OpenForm'; if(wnd.showModalDialog(dlgURL,myDateDialog,"dialogHeight:380px;dialogWidth:280px;center")==true){ field.value=dateFormat.replace(/yyyy/, myDateDialog.retYear).replace(/mm/, myDateDialog.retMonth).replace(/dd/, myDateDialog.retDay); }else{ return; } }