/* ----- BEGIN LICENSE BLOCK ----- Version: MPL 1.1/GPL 2.0/LGPL 2.1 The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is the JSP Web Survey Library. The Initial Developer of the Original Code is Aaron Powers. Portions created by the Initial Developer are Copyright (C) 2003 the Initial Developer. All Rights Reserved. Contributor(s): Alternatively, the contents of this file may be used under the terms of either of the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of either the GPL or the LGPL, and not to allow others to use your version of this file under the terms of the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL or the LGPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. ----- END LICENSE BLOCK ----- */ function doSubmit(){ var theForm = getAnObject('form1'); if (theForm==null) { alert("You can only submit this in a newer browser. JavaScript on this browser is implemented wrong."); return false; } var action = getAnObjectNoErrorMessage('Action'); if (action!=null) action.value=""; theForm.submit('submit'); return true; } function confirmDeleteAndSubmit(){ var theForm = getAnObject('form1'); //alert("form: "+theForm); if (theForm==null) { alert("You can only delete this in a newer browser. "); return false; } if (window.confirm("Are you sure you want to delete this?")) { getAnObject('Action').value="Delete"; theForm.submit('submitDelete'); return true; } else { getAnObject('Action').value=""; return false; } } function flipTo(imgName, newImage) { if (document.images) document[imgName].src = newImage; } // Use these two functions to get form/image objects from any browser. // They are used extensively in the scripts below. function getAnObjectNoErrorMessage(objectName) { var actualObject = null; // Mostly for old versions of IE: if (document.all) { actualObject = document.all[objectName]; if (actualObject!=null) return actualObject; } // For DOM Level 1 browsers: if (document.getElementById) { actualObject = document.getElementById(objectName); if (actualObject!=null) return actualObject; } // Netscape 4: if (document && document.layers) { actualObject=document.layers[objectName]; if (actualObject!=null) return actualObject; } if (objectName=='form1') { actualObject = eval('document.'+objectName); if (actualObject!=null) return actualObject; actualObject=document.forms[0]; // this assumes form1 is the first form on the page -- a custom we have been using to make thing more standard and easier to deal with here. if (actualObject!=null) return actualObject; } // Works in most browsers, assuming you have the object inside a form named form1... ( tags can be in there too) actualObject = eval('document.form1.'+objectName); // Can't do this 'cause when it fails, IE emits an error message. /*if (actualObject==null) { alert('evaling2'); actualObject = eval(objectName); alert("after="+actualObject); }*/ return actualObject; } function getAnObject(objectName) { var actualObject = getAnObjectNoErrorMessage(objectName); if (actualObject==null) { alert("Your browser is too nonstandard to work on this webpage. Please upgrade to a recent version of Netscape, Mozilla, Internet Explorer, or a comparable browser. Technical reason: The browser could not find '"+objectName+"' in the page"); return null; } return actualObject; } // Parts of this script taken from http://www.projectcool.com/developer/dynamic/hide&zeek.html ie4 = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )); // The next three functions are for hiding and showing divisions of text. function show( targetId ) { target = document.all( targetId ); target.style.display = ""; } function hide( targetId ) { target = document.all( targetId ); target.style.display = "none"; } function toggle( targetId ){ if (ie4){ target = document.all( targetId ); if (target.style.display == "none"){ target.style.display = ""; } else { target.style.display = "none"; } } } // This filter will only work in IE because window.event is undefined in Netscape... // If a non-number is entered into a text field, it will complain. function checkInputForNumbersOnly( targetId ) { // Integers are ASCII 48-57 return !(window.event && window.event.keyCode!=13 && (window.event.keyCode<48 || window.event.keyCode>57)); } // Parts of the following script were found at: // The JavaScript Source!! http://javascript.internet.com // Original: trs2005@yahoo.com // Modified by: Ronnie T. Moore, Editor // Modified by: Avi Kehat (avik@iname.com) // Modified by: Aaron Powers (added radio button checking) function changeBox(cbox) { box = eval(cbox); box.checked = !box.checked; } function changeRadio(cradio) { radio = eval(cradio); radio.checked = true; } // Currently Unused: function flipRadio(cradio) { i=0; for (i=0; i < cradio.length; i++) { radio = eval(cradio[i]); if (radio.checked==true) break; } if (i