function checkTend()
	{
	var isNo = false;
	var aArr = new Array('expelled', 'detention_or_jail', 'convicted_of_crime', 'tobacco', 'alcohol', 'drugs', 'gangs', 'cult', 'sexually_abused', 'involvedPornography', 'suicideThoughts', 'sexually_active_xz', 'hypoglycemia', 'seizures', 'fainting', 'eating_disorder', 'breathing', 'cutting', 'psychiatric_care', 'depression_meds', 'pregnant', 'behavior_meds');
		for (var i = 0; i < 22; i++)
			{
				var dVal = eval("document.form1." + aArr[i] + "[0].checked")
				if (dVal == true)
				{
					if (document.form1.explain_xz.value.length == 0)
						{
							isNo = true;
							break;
						}
					//alert(aArr[i] + ' - ' + dVal);
				}
			}
		if (isNo == true)
			{
				alert('You must explain why you clicked "Yes" on the activities listed in the "Have You ever..." section');
				document.form1.explain_xz.focus();
				return false;
			}
		else
			{
				//alert('wrongo, boyo' + document.form1.explain_xz.value.length);
				//document.form1.save.value = 'Save and Continue >>';
				//alert(document.form1.save.value);
				//document.form1.submit();
				return true;
			}
	}



function reportSubmit(sValue)
	{
		if (sValue == 'location')
		{
			//document.reportForm.action.value = 'index.asp?switch=searchLocation';
			//alert(document.reportForm.action.value.toString());
			//reportForm.submit();
		}
	}
//====this function turns a div on and off
function toggleDiv(sField, sImg)
	{
		var theF = eval("document.all." + sField);
		if (theF.style.display == 'none')
			{
				theF.style.display = '';
				eval("document.images['" + sImg + "'].src = '../images/dsChildNew.gif'");
			}
		else
			{
				theF.style.display = 'none';
				eval("document.images['" + sImg + "'].src = '../images/dsParentNew.gif'");
			}
	}


function toggleDiv2(sField, sImg)
	{
		var theF = eval("document.all." + sField);
		if (theF.style.display == 'none')
			{
				theF.style.display = '';
				eval("document.images['" + sImg + "'].src = 'images/dsChildNew.gif'");
			}
		else
			{
				theF.style.display = 'none';
				eval("document.images['" + sImg + "'].src = 'images/dsParentNew.gif'");
			}
	}


//==This function enables a submit button when a radiobutton is clicked. Nothing else
function enableButton(sForm, sButton)
	{
	eval("document." + sForm + "." + sButton + ".disabled = false;");
	}

//==This function changes the style of the item fed to it from display:none to display and back again
/*
function showField(sValue, matchValue, itemName)
1/20/06
sValue = the actual selected value (I expect that this will be used most with select boxes)
matchValue = the value that triggers the item to be turned on
itemName = name of the item that is to be turned on or off
	{
	var sItem = eval("document.all." + itemName);
	alert(sItem.);
		if (sValue == matchValue)
			{
			sItem.style.display = '';
			}
		else
			{
			sItem.style.display = 'none';
			}
	}
*/


//==================================== this checks a form for required items and colors them reddish
function reqFields(formName)
	{
	var newForm = eval("document." + formName);
	var isSubmit
	//alert(newForm.elements.length);
		for (var i = 0; i < newForm.elements.length; i++)
			{
				if ((newForm.elements[i].name.indexOf('_xz') < 1) && (newForm.elements[i].value == '') && (newForm.elements[i].type != 'hidden') && (newForm.elements[i].disabled == false) && (newForm.elements[i].name.indexOf('month') < 1) && (newForm.elements[i].name.indexOf('day') < 1) && (newForm.elements[i].name.indexOf('year') < 1))
					{
					if (newForm.elements[i].type == 'text')
						{
						newForm.elements[i].style.background = '#cccccc';
						}
					if (newForm.elements[i].type == 'select-one')
						{
						newForm.elements[i].style.background = '#cccccc';
						}
					if (newForm.elements[i].type == 'select-multiple')
						{
						newForm.elements[i].style.background = '#cccccc';
						}
					if (newForm.elements[i].type == 'password')
						{
						newForm.elements[i].style.background = '#cccccc';
						}
					if (newForm.elements[i].type == 'textarea')
						{
						newForm.elements[i].style.background = '#cccccc';
						}
					if (newForm.elements[i].type == 'checkbox')
						{
						newForm.elements[i].style.background = '#cccccc';
						}
					if (newForm.elements[i].type == 'radio')
						{
						newForm.elements[i].style.background = '#cccccc';
						}
    				}
    			if (newForm.elements[i].type == 'radio')
    			    {
        			    var newName = newForm.elements[i].name;
        			    var newLen = eval("newForm." + newName + ".length");
        			    var isTrue = false
    			        for (var x = 0; x < newLen; x++)
    			            {
                            if (eval("newForm." + newName + "[x].checked") == true)
                                {
                                isTrue = true;
                                }    			             
    			            }
    			            if (isTrue == false)
    			            {
    			            for (var x = 0; x < newLen; x++)
    			                {
                                //alert(eval("newForm." + newName + "[x].checked"));
    			                eval("newForm." + newName + "[x].style.background = '#cccccc'");
    			                }
    			            }
    			    }
    			if (newForm.elements[i].type == 'checkbox')
    			    {
        			    var newName = newForm.elements[i].name;
        			    var newLen = eval("newForm." + newName + ".length");
        			    var isTrue = false
    			        for (var x = 0; x < newLen; x++)
    			            {
                            if (eval("newForm." + newName + "[x].checked") == true)
                                {
                                isTrue = true;
                                }    			             
    			            }
    			            if (isTrue == false)
    			            {
    			            for (var x = 0; x < newLen; x++)
    			                {
                                //alert(eval("newForm." + newName + "[x].checked"));
    			                eval("newForm." + newName + "[x].style.background = '#cccccc'");
    			                }
    			            }
    			    }
			}
	}



//==================================== valid email address tester thingee
/*
Advanced Email Check
By Website Abstraction (http://www.wsabstract.com) and
Java-Scripts.net (http://www.java-scripts.net)
Over 200+ free scripts here!
*/

var testresults

function checkemail(formName, fieldName)
	{
 	var str = eval('document.' + formName + '.' + fieldName + '.value')
 	var filter=/^.+@.+\..{2,3}$/
	
 	if (filter.test(str))
    	testresults=true
 	else {
		if (str.length > 0)
			{
			alert("Please input a valid email address!");
			eval('document.' + formName + '.' + fieldName + '.select()');
			eval('document.' + formName + '.' + fieldName + '.focus()');
			testresults=false
			}
		}
	//alert('hey, mon');
	return (testresults)
	}


function checkbae(){
if (document.layers||document.all)
return checkemail()
else
return true
}


//===================================this changes the background color of a text box based on whether or not it is required and/or empty
function changeBackground(sName, sType)
    {
    var newForm = "form1";
    var newVal = eval("form1." + sName + ".value");
    var newLen = eval("form1." + sName + ".length");
    var newField = eval("form1." + sName);
    
    switch(sType)
        {
        case 'radio':
            for (var x = 0; x < newLen; x++)
                {
                eval("form1." + sName + "[x].style.background = ''");
                }
            break;
        case 'checkbox':
            var isTrue = false;
            var isOther = false;
            for (var x = 0; x < newLen; x++)
                {
                if (eval("form1." + sName + "[x].checked == true"))
                    {
                    //alert(eval("form1." + sName + "[x].checked == true"))
                    isTrue = true;
                    }
                }
            if (isTrue)
                {
                for (var x = 0; x < newLen; x++)
                    {
                    eval("form1." + sName + "[x].style.background = ''");
/*                    if (eval("form1." + sName + "[x].value == 'Other'") && (eval("form1." + sName + "[x].checked == true")))
                        {
                        isOther = true;
                        }
*/                    }
                }
              else
                {
                for (var x = 0; x < newLen; x++)
                    {
                    eval("form1." + sName + "[x].style.background = '#cccccc'");
                    }
                }
            break;
        default:
            if (newVal.length > 0)
                {
                newField.style.background = '#ffffff';
                //alert(newVal.length);
                }
            else
                {
                newField.style.background = '#cccccc';
                //alert(newVal.length);
                }
         }
    }

//===================================this function checks the string and selects the item if the string value = true
function selectCheckBox(sStr, sName)
    {
    /*
    9/28/04 mal
    Because I am using only numeric values, I am doing vb replace(sVar, " ", "") when this function is called to get rid of 
    the spaces that are in the string.
    */
    var aArr = sStr.split(',')
    var z = eval("document.form1." + sName + ".length")
    var sVal = eval("document.form1." + sName)
    for (var x = 0; x < z; x++)
        {
        for (var y = 0; y < aArr.length; y++)
            {
            if (sVal[x].value == aArr[y])
                {
                //alert(aArr[y]);
                sVal[x].checked = true;
                }
             }
        }
    }

//==================================== this function submits the current nextStep form and sets a page number value
function sPage(pageNum)
    {
    var s = form1;
    if (s.thisPage.value == 0)
        {
        if (s.Email_Address1.value == '')
            {
                alert('You must type an email address');
                s.Email_Address1.focus();
            }
        else if (s.Password.value == '')
            {
                alert('You must type a password');
                s.Password.focus();
            }
        else if (checkemail())
            {
            //if (confirm("This will save all of your changes.\n\Are you sure you want to do this?"))
              //  {
                s.nextPage.value = pageNum;
                s.submit();
              //  }
            }
         }
      else
        {
            s.nextPage.value = pageNum;
            if ((pageNum == 7))
                {
                    s.action = "https://www.adventures.org/a/nextstep/apply/_pay_app_fee.asp"
                }

            s.submit();
        }
    }



//===================================== this function is used for the admin drop downs to make them automatically activate the choice that is selected
function leapTo (link)
   {
   var new_url=link;
   if (  (new_url != "")  &&  (new_url != null)  )
      window.location=new_url;
   else
      alert("\nYou must make a selection.");
   }

//===================================== this function is called when using isNumber(a, b) and gives the alert
//===================================== is also uses the next function, isNumber, to do its business...
function numAlert(myStr)
	{
		if (myStr.value.length > 0)
		{
			if (isNumber(myStr) == false)
				{
					alert("You have entered an item that is not at number. Please correct " + myStr.value);
					myStr.focus();
					myStr.select();
					return false;
				}
		}
	}
	
//===================================== this function is supposed to test a string to see if it is a number, but I have had trouble with it.
function isNumber(fvalue) 
	{
	var anum = /\d/;
	var m = true;
	if ((fvalue == null) || (fvalue == ""))
		m = false;
	else
		for (var d = 0; d < fvalue.length; d++) {
			var c = fvalue.charAt(d);
			//alert(c + ' -- ' + anum.test(c));
			if (!anum.test(c))
				m = false;
		}
	return m;
} //isNumber(fvalue)

//===================================== this function tests a string to see if it is a number
//===================================== The thing I like about this one is that it is simple and works - if only because js allows you to make any string into a number
function formatNum(theNum)
	{
	var newNum;
	newNum = Number(theNum.value);
	if ((newNum * 0 == 0))
		return newNum;
	else if (newNum * 0 != 0)
		alert("This is not a number");
		theNum.focus();
		theNum.select();
		return theNum.value;
	}

//===================================== this function tests a string (theStr) for the length fed to it (theNum)
function testLength(theStr, theNum)
	{
	if (theStr.value.length > theNum)
		{
		alert("The max character length of this field is " + theNum + ". You are using " + theStr.value.length + " characters.");
		theStr.focus();
		theStr.select();
		}
	else
		return false;
	}

//===== this function forces a certain length - it is intended for phone numbers, 
//but could be use for more
function forceLength(theStr, theNum)
	{
	if (theStr.value.length != theNum)
		{
		alert("You must enter " + theNum + " numbers");
		theStr.focus();
		theStr.select();
		}
	else
		return false;
	}

//==this function does the window open thing, but allows users to feed the dimensions of the window	
function OpenMe(newin, theWidth, theHeight)
	{
		flyout = window.open(newin, "flyout", "resizable=yes, scrollbars=yes, width=" + theWidth + ", height=" + theHeight + ", top=100, left=100");
	}
	
	
//==this is the new, improved function that does the window open thing, 
//but allows users to feed the dimensions of the window AND the top and left positions
function OpenMe2(newin, theWidth, theHeight, theTop, theLeft)
	{
		flyout = window.open(newin, "flyout", "resizable=yes, scrollbars=yes, width=" + theWidth + ", height=" + theHeight + ", top=" + theTop + ", left=" + theLeft);
	}
	
	
//===================================== this function tests for blanks
function testBlank(theForm)
	{
	if ((theForm.SearchBy.value != '') && (theForm.Employee.value.length == 0))
		{
		alert('You cannot select a criteria and not enter an employee number');
		theForm.Employee.focus();
		return false;
		}
	else if ((theForm.SearchBy.value == '') && (theForm.Employee.value.length > 0))
		{
		alert('You cannot enter an employee number and not select a criteria');
		theForm.Employee.focus();
		theForm.Employee.select();
		return false;
		}
	else
		{
		return true;
		}
	}


//===================================== this function is used for the js pop up on search results - currently not used
var iCount = iCount++;
var sWhich
var the_Name = ''
	function theClick(sName, sName2, sName3)
	{
		if (the_Name.indexOf(sName) < 0)
		{
//		alert(the_Name.indexOf(sName.value));
			the_Name = the_Name + "|" + sName + "|"
			eval("document.all."+sName+".style.display='';");
			eval("document.all."+sName2+".style.display='none';");
			eval("document.all."+sName3+".style.display='';");
		}
		else
		{
			the_Name = the_Name.replace("|" + sName + "|", "")
			eval("document.all."+sName+".style.display='none';");
			eval("document.all."+sName2+".style.display='';");
			eval("document.all."+sName3+".style.display='none';");
		}
//		alert(the_Name);
	}


//=== this function tests the search box for ''
//=== there is now another, better, faster, more advanced version of this function called checkForm(formname) in this file
	function TestMe( formObj )
		{
		if (((formObj.SearchStr.value.length == 0)) && ((formObj.ClosedBy.value == '') && (formObj.SubmittedBy.value == '')) && (formObj.wfNum.value.length == 0))
			{
			alert( 'You must type in or select something to search for.');
			formObj.ClosedBy.focus();
			return false;
			}
		if (((formObj.SearchStr.value.length == 0)) && ((formObj.ClosedBy.value == '') && (formObj.SubmittedBy.value == '')) && (formObj.wfNum.value.length > 0))
			{
//			alert( 'You must type in something to search for.');
			if (confirm("Are you sure you want to search for everything in the given date range? This could take a while."))
				{
				formObj.submit();
				}
			else
				{
				formObj.SearchStr.focus();
				return false;
				}
			}
		else if ((formObj.FAQ.checked == false) && (formObj.SR.checked == false) && (formObj.WFOpen.checked == false) && (formObj.WFClosed.checked == false))
			{
			alert( 'You select at least one search area.');
			formObj.FAQ.checked = true;
			return false;
			}
	}
	
	
//======================================= this function turns the advanced search on and off
var isNone;isNone=parseInt(isNone);
if (isNone != 0)
	{
	isNone = 0;
	}
	function changeDisplay()
	{
	if (document.all.Advanced.style.display == '')
		{
		document.all.Advanced.style.display = 'none';
		}
	else
		{
		document.all.Advanced.style.display = '';
		}
	}
	
//==============================================this function clears the values from the 'advanced' fields if the display = 'none'
	function clearFields(theForm)
	{
	if (document.all.Advanced.style.display == 'none')
		{
		theForm.ClosedBy.value = '';
		theForm.SubmittedBy.value = '';
		}
	}
//=============================================this function allows the user to click on the paragraph text of a checkbox and execute the action that one normally expects from a computer...turn the checkbox off/on What a radical.
//============================================put this into the onclick event of whatever you want and feed it the name of the form and the field and watch it work it's magic.
//side note, the kaClick is a tribute to Bun Bun...
	function checkTheBox(formName, fieldName)
	{
	var kaClick = eval(formName + "." + fieldName);
		if (kaClick.type == 'checkbox')
		{
			switch(kaClick.checked)
			{
			case false:
				kaClick.checked = true;
				break;
			case true:
				kaClick.checked = false;
				break;
			default:
				kaClick.checked = true;
			}
		}
	}

//==============================================this function will clear a field of whatever value is fed to it
	function clearValue(theValue) //not to be confused with true value
		{
		if (theValue.defaultValue == theValue.value)
			{
			theValue.value = '';
			}
		}
		
//well, this was a good idea...but it didn't work as is. I was trying to erase the value of a field 
//while the display is set to hide. It did weird things and made the request thingee lose the value. 
//Maybe next time
//Side note. I accomplished this same thing by putting in a javascript string directly into the onSubmit of the form. It is as follows: javascript:if (document.all.Advanced.style.display == ""none""){SearchSR.ClosedBy.value="""";SearchSR.SubmittedBy.value=""""}
//nother side note - could the field be set to disable? form.field.disabled = true?
//yes, 10/16/02
	function isHide()
	{
		if (document.all.Advanced.style.display = 'none')
			{
			SearchSR.ClosedBy.value = '';
			SearchSR.SubmittedBy.value = '';
			return true;
			}
	}



	function checkTheFields()
	{
		if ((SearchSR.ClosedBy.value != '') || (SearchSR.SubmittedBy.value != ''))
			{
			checkFields = true;
			}
	}


//===========================this function selects a radio button when the text of the button is clicked
		//First, must do <p style='cursor:hand' onClick='return selectMe(formName, value)'><input type=radio name=phred value=no>Choose Phred</p>
		//This can be used two different ways:
		//1. if the values of the radio buttons are all the same, as in the example above, you must feed a number into iMe that corresponds 
		//with z. (If the radio buttons are in an array, just use the array index) Then, you must compare the value of z to the value of iMe
		//	a. if the values are integers, it will assign it to the first available item that meets the criteria
		//		- this means, if the value of the item is 1 and the index is 2, it will select item 1 in the index
		//		- it might be better to just have a switch for whichever one you want. More later.
		//		- how scary, the comments are longer than the function...
		//2. If the values of the radio buttons are different, compare the selected value with iMe (if (theForm.theField[z].value == iMe))
		//selectMe(1, 2) is the first version of this function and has a specific field name in it, topic
		//selectRadio(myForm, theField, iMe) is the real version
function selectMe(myForm, aMe, rdoName)
	{
	//alert(eval(myForm + "." + rdoName + ".length"));
	for (var z = 0; z < eval(myForm + '.' + rdoName + '.length'); z++)
		{
		if ((z == aMe) || (aMe == eval(myForm + '.' + rdoName + '[z].value')))
			{
			if (eval(myForm + '.' + rdoName + '[z].checked') == false)
				{
					eval(myForm + '.' + rdoName + '[z].checked = true');
					break;
				}
			else
				{
					eval(myForm + '.' + rdoName + '[z].checked = false');
					break;
				}
			}
		}
	}
	
	
function selectRadio(myForm, theField, iMe)
	{
	var newForm
	newForm = eval(myForm + "." + theField)
//	alert(iMe);
//	alert(newForm.length);
	for (var z = 0; z < newForm.length; z++)
		{
		if (newForm[z].value == iMe)
			{
//			alert(z);
			newForm[z].checked = true;
			break;
			}
		}
	}
	

function selectBox(myForm, sMe)
	{
		var newForm
		newForm = eval(myForm + '.' + sMe)
		if (newForm.checked == true)
			{
				newForm.checked = false;
			}
		else
			{
				newForm.checked = true;
			}
	}


//====================================this function checks a string to see if it is blank
//	it does assume the field name, but this could be easily adapted to any field
function checkStr(theForm)
	{
//	alert(theForm.SubOrder.length)
	for (var z = 0; z < theForm.SubOrder.length; z++)
		{
		if (theForm.SubOrder[z].length = 0)
			{
			alert("One of the order fields is empty");
			theForm.SubOrder[z].focus();
			break;
			}
		}
	return false;
	}

	

//====================================this function will focus the cursor on the first selectable item in the given form - (formName)
//IMPORTANT!!!!! you must call this function AFTER the form loads.
function doFocus(formName)
	{
	if (eval("document.forms." + formName))
	var newForm = eval("document.forms." + formName + ".name");
	var dobreak
		for (var i = 0; i < eval(newForm + ".elements.length"); i++)
			{
				if (((eval(newForm + ".elements[i].value") == '') || (eval(newForm + ".elements[i].value") == 0)) && (eval(newForm + ".elements[i].name") != 'Header1:LoginSearch1:txbSearch') && (eval(newForm + ".elements[i].type") != 'hidden') && (eval(newForm + ".elements[i].disabled") != true))
					{
					if (document.all.tags("div") && document.all.tags("div").length > 0)
						{
//						alert(document.all.tags("div").length);
//						alert(eval(newForm + ".elements[i].name"));
						for (var q = 0; q < document.all.tags("div").length; q++)
							{
							if ((document.all.tags("div")[q].style.display == ''))
								{
//								alert(eval(newForm + ".elements[i].name"));
								eval(newForm + ".elements[i].focus()");
								dobreak = true;
								break;
								}
							}
						}
					else
						{
//						alert(eval(newForm + ".elements[i].name"));
						eval(newForm + ".elements[i].focus()");
						dobreak = true;
						}
					if (dobreak = true)
						{
						break;
						}
					}
			}
	}


//===================================this does the fancy css button rollover thing. You know, the thing...	
function buttonChange(obj, new_Class)
	{
		obj.className = new_Class;
	}

//==============================this checks the form fed to it for any empty fields that need to be filled in.
//It doesn't check fields that have the following criteria:
// 1 - hidden fields
// 2 - disabled fields
// 3 - fields that have '_xz' in the name - this is how to "turn off" the checker
// 4 - I also turned off fields with the word 'Date' in them in the original code. 
//		I was using Vinh's dateDrop.js and was getting some weird errors if I checked them. 
//		Here is the condition that was taken out -  && (newForm.elements[i].name.indexOf('Date') < 1)
function checkForm(formName)
	{
	var newForm = eval("document." + formName);
	var isSubmit
		for (var i = 0; i < newForm.elements.length; i++)
			{
				if ((newForm.elements[i].name.indexOf('_xz') < 1) && (newForm.elements[i].value == '') && (newForm.elements[i].type != 'hidden') && (newForm.elements[i].disabled == false) && (newForm.elements[i].name.indexOf('month') < 1) && (newForm.elements[i].name.indexOf('day') < 1) && (newForm.elements[i].name.indexOf('year') < 1))
					{
					if (newForm.elements[i].type == 'text')
						{
						alert("You cannot leave this field blank.");
						}
					if (newForm.elements[i].type == 'select-one')
						{
						alert("You must select something.");
						}
					if (newForm.elements[i].type == 'select-multiple')
						{
						alert("You must select something.");
						}
					if (newForm.elements[i].type == 'password')
						{
						alert("You must enter a password.");
						}
					if (newForm.elements[i].type == 'textarea')
						{
						alert("You must enter some text.");
						}
					if (newForm.elements[i].type == 'file')
						{
						alert("You must select a file.");
						}
					newForm.elements[i].focus();
					isSubmit = false;
					return false;
					break;
					}
				if ((newForm.elements[i].type == 'radio') || (newForm.elements[i].type == 'checkbox') && (newForm.elements[i].name.indexOf('_xz') < 1))
					{
					var theName = newForm.elements[i].name
					var radioCheck = false
					//alert(eval('newForm.' + theName + '.length'));
					for (var y = 0; y < eval('newForm.' + theName + '.length'); y++)
						{
							//alert(eval('newForm.' + theName + '[y].checked'));
							if (eval('newForm.' + theName + '[y].checked') == true)
							{
								radioCheck = true;
								isSubmit = true;
							}
						}
					if (radioCheck == false)
						{
							alert("You must choose an option.");
							isSubmit = false;
							return false;
							break;
						}
					}
			}
	if (isSubmit != false)
			{
			if (newForm.theButton)
				{
				newForm.theButton.disabled = true;
				}
			newForm.submit();
			}
	}

	
//========================this will select the given value of a form.select when loaded after the select
function doSelect(sForm, sField, sValue)
	{
	var myForm = eval(sForm + "." + sField)
	//alert(sField);
	if (sValue.length != 0)
		{
		if (sValue.indexOf(',') < 0)
			{
			for (var z = 0; z < myForm.length; z++)
				{
				//alert(sValue);
				if (myForm[z].value == sValue)
					{
					myForm[z].selected = true;
					break;
					}
				}
			}
		else
			{
	//==this particularly brilliant move allows for a multiple select to be fed to this function and have all the selected items highlighted
	//==it must be comma delimited
	//==must remove the spaces between the commas - ex. 1,2,3,4 or My,Name,is,Mark Lindberg,hi
	//==it is ok to have spaces inside the value, just not between the commas
				//alert(sValue);
			var theSplit = sValue.split(',');
			for (var z = 0; z < myForm.length; z++)
				{
				for (var x = 0; x < theSplit.length; x++)
					{
					if (myForm[z].value == theSplit[x])
						{
//					alert(theSplit[x]);
						myForm[z].selected = true;
						}
					}
				}
			}
		}
	}

function doSelectRadio(sForm, sField, sValue)
	{
	var newVar = eval(sForm + "." + sField);
	for (var x = 0; x < newVar.length; x++)
		{
		if (newVar[x].value == sValue)
			{
			newVar[x].checked = true;
	/*		if (newVar[x].value == 'Other')
				document.all.otherRow.style.display = '';
	*/
			}
		}
	}

//========================this writes a cookie. 1 or 0, depending on what it is now... and returns true if 1 and false if 0
//=========ok, this was a really good idea, but, as it exists, doesn't really do me much good.
//=========I think I need to separate out the boolean and the 1/0 stuff and make them different functions. That way, if it's false, I can write the number, if not, I can leave it alone
	function writeCookie()
		{
		var iVisit
		if (document.cookie.indexOf("visit=1;") > -1)
			{
			iVisit = 0;
			}
		else
			{
			iVisit = 1;
			}
		document.cookie = "visit=" + iVisit
		}


//=====================this clears the original value of a field onfocus. It should be put into onfocus...
//=====================this is so you can label a field with its contents. For instance, zip, city, etc.
function clearField(firstName, sOriginalValue)
	{
	var newName = eval(firstName)
	if (newName.value == sOriginalValue)
		{
		newName.value = '';
		}
	}


//=======================this function allows you to feed a value and have the item selected or checked
//=======================I did this rather than do multiple if/then statements in a dead select list. I get the value in a db hit, then feed it to this function after the select has loaded. Voila!
function selectList(theForm, theField, theValue)
	{
	var	newForm = eval("document." + theForm + "." + theField);
	if (newForm)
		{
		for (var d = 0; d < newForm.length; d++)
			{
			if (newForm[d].value == theValue)
				{
				if (newForm.type == 'select-one')
					{
					newForm[d].selected = true;
					}
				//there are two different types of if/then for checkboxes. I am assuming that some will have the same name, and some will not
				if (newForm.type == 'checkbox')
					{
					newForm[d].selected = true;
					}
				if (newForm[d].type == 'checkbox')
					{
					newForm[d].selected = true;
					}
				if (newForm[d].type == 'radio')
					{
					newForm[d].checked = true;
					}
				}
			}
		}
	}
	

	
//this function selects the first item of the list for the select 1418 in the 600 wf.
//the reason it appears to be so complicated is that the select name is a number - a no no in javascript
//I am using the for loop to write what I need and not using the name outside of the indexOf function
//woo hoo
function selectTheItem()
	{	
	var theName
		if (document.all.myform)
			{
			for (var d = 0; d < myform.length; d++)
				{
				theName = myform.elements[d].name;
				if ((theName.indexOf(1418) == 0) || (theName.indexOf(1420) == 0))
					{
					myform.elements[d].options[0].selected = true;
					myform.choiceTaken[0].checked = true;
					}
				}
			}
		}

		
//this function builds an array for the fiscal month (or period), which, for some bizarre reason known only to accountants, starts in October
function dotheMonths(daMonth)
	{
	var theMonths = new Array('October', 'November', 'December', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September');
		document.writeln('<select name=' + daMonth + 'Month class=tiny>');
		for (var d = 0; d < 12; d++)
			{
			document.writeln('<option value=' + (d + 1) + '>' + (d+1) + ' - ' + theMonths[d]);
			}
		document.writeln('</select>');
	}

//html color selector writer thingee
	function CloseSubmit(ColorNum)
		{
	//	alert(EmpNum)
		opener.document.Page.pageColor.value = ColorNum;
		opener.document.Page.submit()
		window.close()
		}


function openRow(rowID)
	{
	if (eval("document.all." + rowID + ".style.display == ''"))
		{
		eval("document.all." + rowID + ".style.display = 'none'");
		}
	else
		{
		eval("document.all." + rowID + ".style.display = ''");
		}
	}
	


