/********************************************************** COPYRIGHT © 1999-2002 IDX Group, Inc. *********************************************************** Listing of functions function errorHandler () function trim (aStr) function OpenContactSelection (vfield) function UpdateContactSelection(vfield, vSelection) function OpenCreateNewContact() **********************************************************/ /*********************************************************** 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; } /*********************************************************** trim is a simple function to remove leading/trailing spaces ************************************************************/ function trim(aStr) { return aStr.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "") } /********************************************************************* onLoadFunctions. Used to load function in the onLoad event. *********************************************************************/ function BrowseronLoadFunctions() { //browser status bar window.defaultStatus = '::: ' + document.forms[0].AppCompanyName.value + ' (' + document.forms[0].AppCompanyShortName.value + ') ::: ' + document.forms[0].AppCompanyMessage.value; } function PopUpCalendaronLoadFunctions() { //Calendar Popup new Calendar(new Date()); if (browser.ns4){ if (typeof document.NSfix == 'undefined'){ document.NSfix = new Object(); document.NSfix.initWidth=window.innerWidth; document.NSfix.initHeight=window.innerHeight; } } } function CartIDonLoadFunctions() { initializepage(); } function onLoadFunctions() { BrowseronLoadFunctions(); CartIDonLoadFunctions(); PopUpCalendaronLoadFunctions(); } /********************************************************************* OpenContactSelection. Used to open a Selection window for Contacts *********************************************************************/ function OpenContactSelection(vfield) { winwidth = 600; winheight = 380; vform=document.forms[0]; urltoopen = '/' + vform.ContactsDB.value + '/ContactsSelection?OpenForm&FieldToUpdate=' + vfield; winname = 'SelectionWindow'; parameters = 'scrollbars=yes,status=no,toolbar=no,resizable=yes,dependent=yes'; obj = AutoReszWindow(urltoopen, winname, winwidth, winheight, parameters); obj.focus(); // obj.moveTo(1, 1); } /********************************************************************* UpdateContactSelection. Used to update the main form with the Selection. *********************************************************************/ function UpdateContactSelection(vfield, vSelection) { pos = vSelection.indexOf("~~"); IDNO = vSelection.substring(0, pos) FullName = vSelection.substring(pos+2, vSelection.length); formtoupdate = window.opener.document.forms[0]; obj = eval("formtoupdate." + vfield); obj.value = FullName; obj = eval("formtoupdate." + "Contact" + "LinkIDNO"); obj.value = IDNO; window.close(); } /********************************************************************* OpenCreateNewContact. Used to open a new window for creation of a new contact *********************************************************************/ function OpenCreateNewContact() { vform=document.forms[0]; obj = window.open('/' + vform.ThisDB.value + '/Contact?OpenForm&SubWindow=Yes', 'NewContactWindow', 'scrollbars=yes,status=no,width=590,height=420,toolbar=no,resizable=yes,screenX=420,screenY=1,dependent=yes'); obj.focus(); obj.moveTo(420, 1); } /********************************************************************* OpenCreateNewContactQuickEntry. Used to open a new window for creation of a new contact using the Quick Entry form *********************************************************************/ function OpenCreateNewContactQuickEntry() { vform=document.forms[0]; obj = window.open('/' + vform.ThisDB.value + '/ContactQuickEntry?OpenForm&SubWindow=Yes', 'NewContactWindow', 'scrollbars=yes,status=no,width=590,height=420,toolbar=no,resizable=yes,screenX=420,screenY=1,dependent=yes'); obj.focus(); obj.moveTo(420, 1); } /********************************************************************* OpenEventSelection. Used to open a Selection window for Events *********************************************************************/ function OpenEventSelection(vfield) { winwidth = 600; winheight = 380; vform=document.forms[0]; urltoopen = '/' + vform.EventsDB.value + '/EventsSelection?OpenForm&FieldToUpdate=' + vfield; winname = 'SelectionWindow'; parameters = 'scrollbars=yes,status=no,toolbar=no,resizable=yes,dependent=yes'; obj = AutoReszWindow(urltoopen, winname, winwidth, winheight, parameters); obj.focus(); // obj.moveTo(1, 1); } /********************************************************************* UpdateEventSelection. Used to update the main form with the Selection. *********************************************************************/ function UpdateEventSelection(vfield, vSelection) { pos = vSelection.indexOf("~~"); IDNO = vSelection.substring(0, pos) FullName = vSelection.substring(pos+2, vSelection.length); formtoupdate = window.opener.document.forms[0]; obj = eval("formtoupdate." + vfield); obj.value = FullName; obj = eval("formtoupdate." + "LinkIDNO"); obj.value = IDNO; window.close(); } /********************************************************************* OpenCreateNewEvent. Used to open a new window for creation of a new Event *********************************************************************/ function OpenCreateNewEvent() { vform=document.forms[0]; obj = window.open('/' + vform.ThisDB.value + '/Event?OpenForm&SubWindow=Yes', 'NewEventWindow', 'scrollbars=yes,status=no,width=590,height=420,toolbar=no,resizable=yes,screenX=420,screenY=1,dependent=yes'); obj.focus(); obj.moveTo(420, 1); } /********************************************************************* OpenMembershipItemSelection. Used to open a Selection window for Membership Items *********************************************************************/ function OpenMembershipItemSelection(vfield) { winwidth = 600; winheight = 380; vform=document.forms[0]; urltoopen = '/' + vform.MembershipsDB.value + '/MembershipItemsSelection?OpenForm&FieldToUpdate=' + vfield; winname = 'SelectionWindow'; parameters = 'scrollbars=yes,status=no,toolbar=no,resizable=yes,dependent=yes'; obj = AutoReszWindow(urltoopen, winname, winwidth, winheight, parameters); obj.focus(); // obj.moveTo(1, 1); } /********************************************************************* UpdateMembershipItemSelection. Used to update the main form with the Selection. *********************************************************************/ function UpdateMembershipItemSelection(vfield, vSelection) { pos = vSelection.indexOf("~~"); IDNO = vSelection.substring(0, pos) FullName = vSelection.substring(pos+2, vSelection.length); formtoupdate = window.opener.document.forms[0]; obj = eval("formtoupdate." + vfield); obj.value = FullName; obj = eval("formtoupdate." + "LinkIDNO"); obj.value = IDNO; window.close(); } /********************************************************************* OpenCreateNewMembershipItem. Used to open a new window for creation of a new Membership Item *********************************************************************/ function OpenCreateNewMembershipItem() { vform=document.forms[0]; obj = window.open('/' + vform.ThisDB.value + '/MembershipItem?OpenForm&SubWindow=Yes', 'NewMembershipItemWindow', 'scrollbars=yes,status=no,width=590,height=420,toolbar=no,resizable=yes,screenX=420,screenY=1,dependent=yes'); obj.focus(); obj.moveTo(420, 1); } /********************************************************************* OpenWebPageSelection. Used to open a Selection window for WebPages *********************************************************************/ function OpenWebPageSelection(vfield) { winwidth = 600; winheight = 380; vform=document.forms[0]; urltoopen = '/' + vform.WebSiteDB.value + '/WebPagesSelection?OpenForm&FieldToUpdate=' + vfield; winname = 'SelectionWindow'; parameters = 'scrollbars=yes,status=no,toolbar=no,resizable=yes,dependent=yes'; obj = AutoReszWindow(urltoopen, winname, winwidth, winheight, parameters); obj.focus(); // obj.moveTo(1, 1); } /********************************************************************* UpdateWebPageSelection. Used to update the main from with the Selection. *********************************************************************/ function UpdateWebPageSelection(vfield, vSelection) { pos = vSelection.indexOf("~~"); IDNO = vSelection.substring(0, pos) Title = vSelection.substring(pos+2, vSelection.length); formtoupdate = window.opener.document.forms[0]; obj = eval("formtoupdate." + vfield); obj.value = Title; obj = eval("formtoupdate." + "WebPage" + "LinkIDNO"); obj.value = IDNO; window.close(); } /********************************************************************* OpenRecipientSelection. Used to open a Selection window for WebPages *********************************************************************/ function OpenRecipientSelection(vfield) { winwidth = 600; winheight = 380; vform=document.forms[0]; urltoopen = '/' + vform.ThisDB.value + '/Recipient?OpenForm&FieldToUpdate=' + vfield; winname = 'SelectionWindow'; parameters = 'scrollbars=yes,status=no,toolbar=no,resizable=yes,dependent=yes'; obj = AutoReszWindow(urltoopen, winname, winwidth, winheight, parameters); obj.focus(); // obj.moveTo(1, 1); } /********************************************************************* UpdateRecipientSelection. Used to update the main from with the Selection. *********************************************************************/ function UpdateRecipientSelection(vfield, vSelection) { pos = vSelection.indexOf("~~"); IDNO = vSelection.substring(0, pos) Title = vSelection.substring(pos+2, vSelection.length); formtoupdate = window.opener.document.forms[0]; obj = eval("formtoupdate." + vfield); obj.value = Title; obj = eval("formtoupdate." + "WebPage" + "LinkIDNO"); obj.value = IDNO; window.close(); } /********************************************************************* OpenCreateNewWebPage. Used to open a new window for creation of a new WebPage *********************************************************************/ function OpenCreateNewWebPage() { vform=document.forms[0]; obj = window.open('/' + vform.ThisDB.value + '/WebPage?OpenForm&SubWindow=Yes', 'NewWebPageWindow', 'scrollbars=yes,status=no,width=590,height=420,toolbar=no,resizable=yes,screenX=420,screenY=1,dependent=yes'); obj.focus(); obj.moveTo(420, 1); } /********************************************************************* OpenCompanySelection. Used to open a Selection window for Companies *********************************************************************/ function OpenCompanySelection(vfield) { vform=document.forms[0]; obj = window.open('/' + vform.ThisDB.value + '/CompaniesSelection?OpenForm&FieldToUpdate=' + vfield, 'SelectionWindow', 'scrollbars=yes,status=no,width=400,height=420,toolbar=no,resizable=yes,screenX=1,screenY=1,dependent=yes'); obj.focus(); obj.moveTo(1, 1); } /********************************************************************* UpdateCompanySelection. Used to update the main from with the Selection. *********************************************************************/ function UpdateCompanySelection(vfield, vSelection) { pos = vSelection.indexOf("~~"); IDNO = vSelection.substring(0, pos) CompanyName = vSelection.substring(pos+2, vSelection.length); formtoupdate = window.opener.document.forms[0]; obj = eval("formtoupdate." + vfield); obj.value = CompanyName; obj = eval("formtoupdate.LinkIDNO" + vfield); obj.value = IDNO; window.close(); } /********************************************************************* OpenCreateNewCompany. Used to open a new window for creation of a new company *********************************************************************/ function OpenCreateNewCompany() { vform=document.forms[0]; obj = window.open('/' + vform.ThisDB.value + '/Company?OpenForm&SubWindow=Yes', 'NewCompanyWindow', 'scrollbars=yes,status=no,width=590,height=420,toolbar=no,resizable=yes,screenX=420,screenY=1,dependent=yes'); obj.focus(); obj.moveTo(420, 1); } /******************************************************************** OpenSubRecord. Used to open a new Window for subrecord entry *********************************************************************/ function OpenSubRecord(vtype, vaction, vfield, vcurrentselection, vextraqs) { vform=document.forms[0]; if (vform.IDNO.value == "") { vLinkIDNO = vform.InitialDocUNID.value; } else { vLinkIDNO = vform.IDNO.value; } //Set defaults winheight=200; winwidth=400; urldb = vform.ThisDB.value; if (vextraqs) { extraqs = vextraqs; } else { extraqs = ""; } if ((vtype=='Phone') || (vtype=='WebSite')) { winheight=220; winwidth=450; } if (vtype=='EMailAddress') { winheight=240; winwidth=460; } if (vtype=='Address') { winheight=350; winwidth=450; } if (vtype=='FamilyConnection') { winwidth=450; winheight=250; } if (vtype=='Membership') { winwidth=500; winheight=410; urldb = vform.MembershipsDB.value; } if (vtype=='Payment') { winwidth=500; winheight=350; urldb = vform.OrdersDB.value; } if (vtype=='Attachment') { winwidth=450; winheight=200; } if (vtype=='PurchaseItem') { winwidth=550; winheight=500; } if (vtype=='Discount') { winwidth=520; winheight=380; } if (vtype=='Group') { winwidth=600; winheight=450; } if (vtype=='Session') { winwidth=650; winheight=350; } if (vtype=='WebContent') { winheight=410; winwidth=700; } if (vtype=='Recipient') { winheight=400; winwidth=500; } if (vaction=='Add') { urltoopen = '/' + urldb + '/' + vtype + '?OpenForm&SubRecord=Yes&FieldToUpdate=' + vfield + '&Action=' + vaction + '&LinkIDNO=' + vLinkIDNO + '&DocType=' + vtype + extraqs; winname = vtype + 'Window'; parameters = 'scrollbars=yes,status=no,toolbar=no,resizable=yes,dependent=yes'; } if (vaction=='Edit') { urltoopen = '/' + urldb + '/' + '(SubRecordOpenForEdit)' + '?OpenAgent&SubRecord=Yes&FieldToUpdate=' + vfield + '&Action=' + vaction + '&LinkIDNO=' + vLinkIDNO + '&SubRecordIDNO=' + vcurrentselection + extraqs; winname = vtype + 'Window'; parameters = 'scrollbars=yes,status=no,toolbar=no,resizable=yes,dependent=yes'; } if (vaction=='Delete') { urltoopen = '/' + urldb + '/' + '(SubRecordOpenForDelete)' + '?OpenAgent&SubRecord=Yes&FieldToUpdate=' + vfield + '&Action=' + vaction + '&LinkIDNO=' + vLinkIDNO + '&SubRecordIDNO=' + vcurrentselection + extraqs; winname = vtype + 'Window'; parameters = 'scrollbars=yes,status=no,toolbar=no,resizable=yes,dependent=yes'; } obj = AutoReszWindow(urltoopen, winname, winwidth, winheight, parameters); obj.focus(); // obj.moveTo(1, 1); } /********************************************************************* UpdateParentFromSubRecord. Used to update the main from with the SubRecord. *********************************************************************/ function UpdateParentFromSubRecord(vaction, vfield, vSelection) { pos = vSelection.indexOf("~~"); ID = vSelection.substring(0, pos) Txt = vSelection.substring(pos+2, vSelection.length); selopttxt = Txt; seloptval = ID; formtoupdate = document.forms[0]; obj = eval('formtoupdate.' + vfield); var newOpt = new Option(selopttxt, seloptval); if (obj.length == 0) { var newIndex = 0; } else { if (obj.options[0].value == "") { var newIndex = 0; } else { // Check SubRecordIDNO Exist in list idxtoupdate = null; for(var i = 0; i < obj.length; i ++) { if (obj.options[i].value == ID) { idxtoupdate = i; } } if (idxtoupdate==null) { var newIndex = obj.length; } else { var newIndex = idxtoupdate; } } } if ((vaction=='Delete') && (selopttxt =="")) { newOpt = null; } obj.options[newIndex] = newOpt; } /********************************************************************* CreateEMailMessage. Opens a new window for send correspondencewindow. *********************************************************************/ function CreateEMailMessage(contactlinkidno) { vform=document.forms[0]; urltoopen='/' + vform.CorrespondenceDB.value + '/EMailMessage?OpenForm&linkidno=' + contactlinkidno; winname='EMailMessage' + 'Window'; parameters='scrollbars=yes,status=no,toolbar=no,resizable=yes,dependent=yes'; winwidth='400'; winheight='300'; obj = AutoReszWindow(urltoopen, winname, winwidth, winheight, parameters); obj.focus(); } /********************************************************************* AttachmentPreview. Used to open an attachment in a new window for preview. *********************************************************************/ function AttachmentPreview(objectname) { vform=document.forms[0]; attachmentpath=eval("vform." + objectname + ".value"); if (attachmentpath!=="") { urltoopen="file:///" + attachmentpath; winName='AttachmentPreview'; width='200'; height='200'; parameters = 'scrollbars=yes,status=no,toolbar=no,resizable=yes,dependent=yes'; winobj=AutoReszWindow(urltoopen,winName,width,height,parameters); } } /******************************************************************** SoftDeleteRecord. Used to soft delete a record ********************************************************************/ function SoftDeleteRecord(vunid) { if (confirm("You are deleting a document. Are you sure ?")) { vform=document.forms[0]; location.href="/" + vform.ThisDB.value + "/(SoftDeleteRecord)?OpenAgent&docunid=" + vunid } } /******************************************************************** RemoveCartItem. Used to remove a cart item ********************************************************************/ function RemoveCartItem(vunid) { vform=document.forms[0]; location.href="/" + vform.ThisDB.value + "/(RemoveCartItem)?OpenAgent&cartitemunid=" + vunid + "&cartid=" + vform.CartID.value } /******************************************************************** OpenMembershipItemWindow. Used to open a new window with a membeship item description ********************************************************************/ function OpenMembershipItemWindow(vunid) { vform=document.forms[0]; urltoopen="/" + vform.MembershipsDB.value + "/" + "_AllMembershipItemsByLevel/" + vunid + "?OpenDocument&SubWindow=Yes"; winname="MembershipItemWindow"; winwidth="400"; winheight="300"; parameters = 'scrollbars=yes,status=no,toolbar=no,resizable=yes,dependent=yes'; obj=AutoReszWindow(urltoopen, winname, winwidth, winheight, parameters); } /******************************************************************** OpenRTEditorWindow. Used to open a new window with the RTEditor ********************************************************************/ function OpenRTEditorWindow(vrtfield) { vform = document.forms[0]; urltoopen = "/" + vform.ThisDB.value + "/RTEditor?OpenForm&RTField="+vrtfield; winname="RTEditorWindow"; winwidth="705"; winheight="425"; parameters = 'scrollbars=yes,status=no,toolbar=no,resizable=yes,dependent=yes'; obj=AutoReszWindow(urltoopen, winname, winwidth, winheight, parameters); } /********************************************************************* AutoReszWindow. Used to open and center new window. *********************************************************************/ function AutoReszWindow(theURL,winName,width,height,features){ if(window.screen){ per_ancho=(width/800)*100; per_alto=(height/width)*100; win_ancho=(screen.width*per_ancho)/100; win_alto=(win_ancho*per_alto)/100; x=(screen.width-win_ancho)/2;//center x y=(screen.height-win_alto)/2;//center y } else{ x=0; y=0; win_ancho=w; win_alto=y; } winfeatures=("top="+y+",left="+x+",width="+win_ancho+",height="+win_alto+","+features); obj = window.open(theURL,winName,winfeatures); return obj; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(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 section function ExpandCollapse(spanId) { if (eval('document.all[\'' + spanId + '\'].style.display') == "") { Collapse(spanId); } else { Expand(spanId); } } //Expands a section function Expand(spanId) { eval('document.all[\'' + spanId + '\'].style.display  = "";'); } //Collapses a section function Collapse(spanId) { eval('document.all[\'' + spanId + '\'].style.display  = "none";'); }