//*************************************************** // all code and functions copyright 2002-2004 Ray Cauchi // created by Ray Cauchi - dev@raycauchi.com - February 2004 // //*************************************************** // frame buster if (window != top) top.location.href = location.href; // custom error handler onerror = handleErrors; var msg = null; function handleErrors(errorMessage, url, line) { msg = "There was an error on this page.\n\n"; msg += "An internal programming error may keep\n"; msg += "this page from displaying properly.\n"; msg += "Click OK to continue.\n\n"; msg += "Error message: " + errorMessage + "\n"; msg += "URL: " + url + "\n"; msg += "Line #: " + line; alert(msg); return true; } // function to 'cancel' from a selected admin area page function rc_do_cancel(twk_t,extra) { if (twk_t == 1) { document.location.href = 'https://www.touchingbase.org/rdb/admin/testimonials/view.php'; } else if (twk_t == 2) { document.location.href = 'https://www.touchingbase.org/rdb/admin/mail/email.php'; } else if (twk_t == 3) { document.location.href = 'https://www.touchingbase.org/rdb/admin/users/email.php'; } else if (twk_t == 4) { document.location.href = 'https://www.touchingbase.org/rdb/admin/products/active.php'; } else if (twk_t == 5) { document.location.href = 'https://www.touchingbase.org/rdb/admin/content/view.php?id='+extra; } else if (twk_t == 6) { document.location.href = 'https://www.touchingbase.org/rdb/admin/wholesalers/active.php'; } else if (twk_t == 7) { document.location.href = 'https://www.touchingbase.org/rdb/admin/users/active.php'; } else if (twk_t == 8) { document.location.href = 'https://www.touchingbase.org/rdb/admin/specials/active.php'; } else if (twk_t == 9) { document.location.href = 'https://www.touchingbase.org/rdb/admin/referral/active.php'; } else if (twk_t == 10) { document.location.href = 'https://www.touchingbase.org/rdb/admin/referral/inactive.php'; } else if (twk_t == 11) { document.location.href = 'https://www.touchingbase.org/rdb/admin/referral/rejected.php'; } else if (twk_t == 12) { document.location.href = 'https://www.touchingbase.org/rdb/admin/home.php'; } else if (twk_t == 13) { document.location.href = 'https://www.touchingbase.org/rdb/'; } else { document.location.href = 'https://www.touchingbase.org/rdb/admin/home.php'; } } // function to display popup window function rc_popup(twk_url, twk_ptype, twk_width, twk_height) { var twk_options = ''; var twk_win = ''; if (twk_ptype == 'console') twk_options = 'resizable,height='+twk_height+',width='+twk_width; if (twk_ptype == 'fixed') twk_options = 'status,scrollbars,height='+twk_height+',width='+twk_width; if (twk_ptype == 'elastic') twk_options = 'toolbar,menubar,scrollbars,resizable,location,height='+twk_height+',width='+twk_width; twk_options = twk_options + 'screenX=66,screenY=66,left=66,top=66' twk_win = window.open(twk_url, 'twkwin', twk_options); if (window.focus) twk_win.focus(); return false; } // function to select first form element function rc_put_focus(twk_f_ct, twk_e_ct) { if (document.forms.length > 0) { if (!(document.forms[twk_f_ct].elements[twk_e_ct].options)) { document.forms[twk_f_ct].elements[twk_e_ct].focus(); document.forms[twk_f_ct].elements[twk_e_ct].select(); } else { document.forms[twk_f_ct].elements[twk_e_ct].focus(); } } } // function to go back one page function rc_do_goback() { history.back(); } // function to either select or deselect a checkbox // @param string twk_uc_form The name of the form containing the checkbox // @param string twk_uc_field The name of the checkbox field // @param int twk_mode 1 | 0 - do we CHECK (1) or UNCHECK (0) // @param int twk_array 1 | 0 - array of fields (1) or single field (0) function rc_check(twk_uc_form, twk_uc_field, twk_mode, twk_array) { if (twk_array == 0) { // create the document.form.field string var twk_thisbox = eval("document." + twk_uc_form + "." + twk_uc_field); // which mode do we use? if (twk_mode == 1) { // check the box if (twk_thisbox.checked == false) twk_thisbox.checked = true; } else { // uncheck the box if (twk_thisbox.checked == true) twk_thisbox.checked = false; } } else { // create the document.form.field string var twk_thisbox = eval("document." + twk_uc_form + "[\"" + twk_uc_field + "\"]"); for (c = 0; c < twk_thisbox.length; c++) { if (twk_mode == 1) { // check each box if (twk_thisbox[c].checked == false) twk_thisbox[c].checked = true; } else { // uncheck each box if (twk_thisbox[c].checked == true) twk_thisbox[c].checked = false; } } } } // function to deselect a droplist // @param int twk_array 1 | 0 - array of fields (1) or single field (0) function rc_unselect(twk_us_form, twk_us_field) { for (var i = 1; i < rc_unselect.arguments.length; i++) { var twk_thisselect = eval("document." + twk_us_form + "." + rc_unselect.arguments[i]); twk_thisselect.selectedIndex = 0; } } // function to deselect a multi-select droplist function rc_multi_unselect(twk_mus_form, twk_mus_field) { var twk_thismselect = eval("document." + twk_mus_form + "[\"" + twk_mus_field + "\"]"); for (var zCnt = 0; zCnt < twk_thismselect.options.length; zCnt++) { // check to see if each item is selected if (twk_thismselect.options[zCnt].selected) { twk_thismselect.options[zCnt].selected = 0; } } } // function to clear a textfield function rc_clearfield(twk_cf_form, twk_cf_field, twk_cf_call) { var twk_thistext = eval("document." + twk_cf_form + "." + twk_cf_field); if (twk_cf_call.checked == true) { twk_thistext.focus(); } else { twk_thistext.value = ''; } } // function to limit text in textarea function rc_limit_textarea(twk_lt_field,twk_lt_limit) { var twk_result = true; if (twk_lt_field.value.length >= twk_lt_limit) twk_result = false; if (window.event) window.event.returnValue = twk_result; return twk_result; } // function to submit form once only function rc_submitone(twk_s_form) { //if IE 4+ or NS 6+ if (document.all || document.getElementById) { //screen thru every element in the form, and hunt down "submit" and "reset" for (i = 0; i < twk_s_form.length; i++) { var tempobj=twk_s_form.elements[i]; if (tempobj.type && (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset" || tempobj.type.toLowerCase() == "button")) tempobj.disabled=true } } } // function to insert Recpient Name into FCKEditor function InsertNAME(IDofEditor) { cke = eval("CKEDITOR.instances." + IDofEditor); cke.insertText('#name#'); } // function to check user wishes to empty mailqueue function rc_check_queue() { if (confirm('Are you sure you want to empty the mailqueue') == true) { document.empty.submit(); return true; } }