function errorHandler( e, f, l ) { alert("Error\nFile: " + f + "\nLine: " + l + "\nError:" + e); return true; } ; function doDelete() { if ( confirm('Are you sure you want to delete this document?') ){ location.search = "!DeleteDocument"; } } ; function trim(aStr) { return aStr.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "") } ; 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; } } ; function checkSubmitted(f) { if (isSubmitted =="NO") { isSubmitted = "YES"; f.submit(); } else { alert("You have already submitted this document, just waiting for response from the server. Please click 'OK' to continue.") } } ; function doSubmit(f, v){ // alert(f.name) ; switch (f.name) { case "_Contact" : if ( doContactSubmit(f, v) ) {return true;} else {return false;} break case "_Contact2" : if ( doContact2Submit(f, v) ) {return true;} else {return false;} break case "_MailList" : if ( doMailListSubmit(f, v) ) {return true;} else {return false;} break case "_PressMailList" : if ( doPressMailListSubmit(f, v) ) {return true;} else {return false;} break case "_News" : if ( doNewsSubmit(f, v) ) {return true;} else {return false;} break case "_Resource" : if ( doResourceSubmit(f, v) ) {return true;} else {return false;} break case "_Club" : if ( doClubSubmit(f, v) ) {return true;} else {return false;} break case "_NORight" : if ( doNORightSubmit(f, v) ) {return true;} else {return false;} break case "_Message" : if ( doMessageSubmit(f, v) ) {return true;} else {return false;} break default : return true; } } ; function doDefaultSubmit(f, v) { if ( v ){ var a = new Array(); if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doMessageSubmit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.Message, 'You must enter a message!']; if ( f.Broadcast.checked == false ) { a[a.length] = [f.MessageTo, 'You must choose someone to send the message to!']; } if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doLetterSubmit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.LetterPersonName, 'You must enter an adressee for your letter.']; a[a.length] = [f.LetterHello, 'Dear...? You must enter something.']; a[a.length] = [f.LetterHeadline, 'You must give your letter a heading.']; a[a.length] = [f.Body, 'You must include some text in your letter.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doFAXSubmit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.FaxPersonName, 'You must enter the name of the person to send this FAX to.']; a[a.length] = [f.FaxCustomerName, 'You must enter a company / organisation name.']; a[a.length] = [f.FaxHeadline, 'You must enter a reference for your FAX.']; a[a.length] = [f.FaxFaxNo, 'You must enter a FAX number']; a[a.length] = [f.FaxFaxNo, 'The FAX number contains illegal characters!', ['badchar']]; a[a.length] = [f.FaxBody, 'You must enter some text in the Body of your fax.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doNewsSubmit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.Heading, 'You must enter a headline.']; a[a.length] = [f.Body, 'You must enter some text for this news item.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doResourceSubmit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.Heading, 'You must enter a headline.']; a[a.length] = [f.Body, 'You must enter some descriptive text for this resource.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doContactSubmit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.ContactWho, 'You must choose a recipient.']; a[a.length] = [f.ContactBody, 'You must enter some text for this e-mail.']; a[a.length] = [f.EMailAddress, 'You must enter your e-mail address.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doContact2Submit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.ContactWho, 'You must choose a recipient.']; a[a.length] = [f.ContactBody, 'You must enter some text for this e-mail.']; a[a.length] = [f.EMailAddress, 'You must enter your e-mail address.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doClubSubmit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.ClubName, 'You must enter the Club name.']; a[a.length] = [f.ClubAddress, 'You must enter the address.']; a[a.length] = [f.ClubPhone, 'You must enter a phone number.']; a[a.length] = [f.ClubColours, 'You must give brief details of Club Colours.']; a[a.length] = [f.ClubCounty, 'You must select a County.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doNORightSubmit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.Username, 'You must enter your user name.']; a[a.length] = [f.Password, 'You must enter your password.']; a[a.length] = [f.Verification, 'You must enter your verification code.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doMailListSubmit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.First, 'You must enter your first name.']; a[a.length] = [f.Last, 'You must enter your last name.']; a[a.length] = [f.EMailAddress, 'You must enter your e-mail address.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doPressMailListSubmit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.First, 'You must enter the publication name.']; a[a.length] = [f.EMailAddress, 'You must enter the e-mail address.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doCustContactsSubmit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.CustContactFirstName, 'You must enter a first name or initial on the basics tab.']; a[a.length] = [f.CustContactSurname, 'You must enter a surname on the basics tab.']; a[a.length] = [f.CustContactPosition, 'You must select or enter a job title for this person on the basics tab. If you don\'t know their job title enter Unknown !']; a[a.length] = [f.CustTechnicalContact, 'You must select at least one category on the categorisation tab for this person !']; q = f.CustContactFastPath switch (q.type) { case "hidden" : var temp = f.CustContactFastPath.value ; if ( (temp.indexOf('FAX') == 0) ) { fn = f.CustContactMainPhoneNo ; if ((fn.value == "" ) || (fn.value == null) || isblank(fn.value)) { a[a.length] = [f.CustContactDirectFaxNo, 'The chosen Fast Path is FAX. Therefore you must enter a valid Fax Number on the phone tab.'] ; } } else if ( (temp.indexOf('E-Mail') == 0) ) { a[a.length] = [f.CustContactEMailAddress, 'The chosen Fast Path is E-Mail. Therefore you must enter a valid e-mail address on the basics tab.', ['email']]; } break default: var temp = f.CustContactFastPath ; if ( temp.options[temp.selectedIndex].text == 'FAX' ) { fn = f.CustContactMainPhoneNo ; if ((fn.value == "" ) || (fn.value == null) || isblank(fn.value)) { a[a.length] = [f.CustContactDirectFaxNo, 'The chosen Fast Path is FAX. Therefore you must enter a valid Fax Number on the phone tab.'] ; } } else if ( temp.options[temp.selectedIndex].text == 'E-Mail' ) { a[a.length] = [f.CustContactEMailAddress, 'The chosen Fast Path is E-Mail. Therefore you must enter a valid e-mail address on the basics tab.', ['email']]; } break } if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doVisitSubmit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.VisitDateVisit, 'You must enter a date for the Visit.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doInternalNoteSubmit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.TeleconSubject, 'You must enter a topic for this note.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doCallSubmit(f, v) { if ( v ){ var a = new Array(); a[a.length] = [f.TeleconInitiator, 'You must specify the party that initiated the call']; a[a.length] = [f.TeleconOurRepName, 'You must enter the name of someone at our company who was involved in the call.']; a[a.length] = [f.TeleconCompanyRepName , 'You must select someone at the customer who was involved in the call.']; a[a.length] = [f.TeleconCallDate, 'You must enter the date of the phone call.', ['date', null, null, f.DateFormat.value]]; a[a.length] = [f.TeleconSubject, 'You must select a topic for the phone call.']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } }; function doProfileSubmit(f, v){ if ( v ){ var a = new Array(); a[a.length] = [f.CustomerCommonName, 'You must enter a name in the Indexing field on the Basics Tab. This is the name under which all entries for this company will appear in the database. it cannot be changed later except by the Database Administrator.']; a[a.length] = [f.BasicStatus, 'You must choose at least one item in the type field within the basics section']; q = f.Private switch (q.type) { case "hidden" : var temp = f.Private.value ; if ( (temp.indexOf('No') == -1) ) { //True if a private individual a[a.length] = [f.CustContactFirstName, 'You must enter the First Name for this private individual in the individual section'] ; } else { a[a.length] = [f.CustomerName, 'You must enter a customer name in the basics section']; } break default: if ( f.Private[0].checked == true ) { a[a.length] = [f.CustContactFirstName, 'You must enter the First Name for this private individual in the individual section'] ; } else { a[a.length] = [f.CustomerName, 'You must enter a customer name in the basics section']; } break } e = f.BasicStatus switch (e.type) { case "hidden" : var temp = f.BasicStatus.value ; if ( !(temp.indexOf('Customer') == -1) ) a[a.length] = [f.CustomerStatus, 'You must enter the Customer Status within the customer section'] ; if ( !(temp.indexOf('Supplier') == -1) ) a[a.length] = [f.SupplierStatus, 'You must enter the Supplier Status within the supplier section'] ; break default: if ( f.BasicStatus[0].checked == true ) a[a.length] = [f.CustomerStatus, 'You must enter the Customer Status within the customer section'] ; if ( f.BasicStatus[1].checked == true ) a[a.length] = [f.SupplierStatus, 'You must enter the Supplier Status within the supplier section'] ; break } y = f.CustomerStatus switch (y.type) { case "hidden" : var temp = f.CustomerStatus.value ; if ( !(temp.indexOf('Current') == -1) ) a[a.length] = [f.CustomerCategory, 'You must enter the Customer Category within the customer section'] ; break default: if ( f.CustomerStatus[1].checked == true ) a[a.length] = [f.CustomerCategory, 'You must enter the Customer Category within the customer section'] ; break } z = f.SupplierStatus switch (z.type) { case "hidden" : var temp = f.SupplierStatus.value ; if ( !(temp.indexOf('Current') == -1) ) a[a.length] = [f.SupplierCategory, 'You must enter the Supplier Category within the supplier section'] ; break default: if ( f.SupplierStatus[1].checked == true ) a[a.length] = [f.SupplierCategory, 'You must enter the Supplier Category within the supplier section'] ; break } a[a.length] = [f.CustomerAddress1, 'You must enter the first line of the address within the address section']; if ( validateRequiredFields( f, a ) ){ return true; }else{ return false; } } else { return true; } };