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 IE:
	if (document.all) {
		actualObject = document.all[objectName];
	}
	if (actualObject!=null)
		return actualObject;

	// Mostly for Netscape:
	if  (document.getElementById) {
		actualObject = document.getElementById(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...  (<img> 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, 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<cradio.length+1)
		cradio[i+1]=true;
	else
		cradio[0]=true;
}

// The following script was written by Aaron Powers.

var startTime = new Date();

function set_elapsed_time(control) {
	target = eval( control );
  	target.value = (new Date()).getTime()-startTime.getTime();
}
//document.form1.number_easyToUse_timeSpent.value = diffSeconds;
//setTimeout ( "function_name()", 100);

// The ideas for this script were based on stuff from http://javascript.internet.com, written by Evaldo Nunes (woodstock@globo.com)
// It's now been majorly majorly modified.

/* Temporarily kept in case we need to go back.
function ClickRadio(title, num, total) {
	var theHiddenField = getAnObject('number_'+title);
	if (theHiddenField==null)
		return;
	var theValue = theHiddenField.value;

	var theImage = getAnObjectNoErrorMessage(title+theValue);
	
	if (theImage!=null) {
		theImage.src = "images/RadioButtonEmpty.gif";
	}
	
	var theNewImage = getAnObjectNoErrorMessage(title+num);
	if (theNewImage!=null) {
		theNewImage.src="images/RadioButtonFilled.gif";
	}
	theHiddenField.value = num;
}*/

function ClickRadio(fieldType, title, newValue) {
	var theHiddenField = getAnObject(fieldType+'_'+title);
	if (theHiddenField==null)
		return;
	var theValue = theHiddenField.value;

	ClearRadio(title, theValue);
	/*var theImage = getAnObjectNoErrorMessage(title+theValue);
	if (theImage!=null) {
		theImage.src = "images/RadioButtonEmpty.gif";
	}*/
	
	var theNewImage = getAnObjectNoErrorMessage(title+newValue);
	if (theNewImage!=null) {
		theNewImage.src="images/RadioButtonFilled.gif";
	}
	theHiddenField.value = newValue;
}

function ClearRadio(title, theValue) {
	var theImage = getAnObjectNoErrorMessage(title+theValue);
	if (theImage!=null) {
		theImage.src = "images/RadioButtonEmpty.gif";
	}
}



function ClickCheckbox(title) {
	var theImage = getAnObject(title);
	var theHiddenField = getAnObject('number_'+title);

	if (theImage==null || theHiddenField==null) {
		return;
	}

	if (theHiddenField.value==1) {
		theHiddenField.value=2;
		theImage.src="images/CheckboxEmpty.gif";
	} else {
		theHiddenField.value=1;
		theImage.src="images/CheckboxFilled.gif";
	}
// alternative possibility if theImage.src or theHiddenField.value doesn't work: 	setAttribute and getAttribute, as in:		document.getElementById(title).setAttribute("src", "images/CheckboxFilled.gif");
}