// last updated 08/15/08


function undisplayThis(id) {
    // SOURCE:  http://support.internetconnection.net/CODE_LIBRARY/Javascript_Show_Hide.shtml
	//undisplay data within this (id) tag

	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function displayThis(id) {
	//display data within this (id) tag
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'inline';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'inline';
		}
		else { // IE 4
			document.all.id.style.display = 'inline';
		}
	}
}


function displayThisAlso(id){	
	//execute the displayThis function -- see onclick attributes in body of html
	displayThis(id);
}




function resetNAcomort() {
    // SOURCE:  http://www.thescripts.com/forum/thread428376.html
    //clear all of the selected causes of death in the "Condition" and "Comortality" columns

	var datsetNA = document.main.datset;
	for(var i=0, n=datsetNA.length; i<n; ++i){
	datsetNA[i].checked = datsetNA[i].defaultChecked;
	}
}




function resetIOcauses() {
    //clear all of the selected causes of death in the "datset" checkboxes

	var datsetIO = document.io.datset;
	for(var i=0, n=datsetIO.length; i<n; ++i){
	datsetIO[i].checked = datsetIO[i].defaultChecked;
	}
}




function resetIOinds() {
    //clear all of the selected industries in the select boxes

	document.getElementById('S3ind').selectedIndex = -1;
	document.getElementById('S2ind').selectedIndex = -1;
}


function resetIOoccs() {
    //clear all of the selected occupations in the select boxes

	document.getElementById('S3occ').selectedIndex = -1;
	document.getElementById('S2occ').selectedIndex = -1;
}




function submitNA() {
	//Client-side form validation for National Database form	


	//determine which of the radio boxes with name=info is checked, and assign that value to a variable named "NAinfo"
	for (var i=0; i < document.main.info.length; i++)
	   {
	   if (document.main.info[i].checked)
	      {
	      var NAinfo = document.main.info[i].value;
	      }
	   }
	   
	//determine if any of the check boxes with name=datset are checked
    var datsetChecked = false;
	for (var i=0; i < document.main.datset.length; i++)
	   {
	   if (document.main.datset[i].checked)
	      {
	      var datsetChecked = true;
	      }
	   }

	//determine which radio button with name=view is checked, and assign that value to a variable named "NAview"
	//source:  http://www.webdevelopersnotes.com/tips/html/finding_the_value_of_a_radio_button.php3
	for (var i=0; i < document.main.view.length; i++)
	   {
	   if (document.main.view[i].checked)
	      {
	      var NAview = document.main.view[i].value;
	      }
	   }


	//determine which radio button with name=us_st is checked, and assign that value to a variable named "NAus_st"
	for (var i=0; i < document.main.us_st.length; i++)
	   {
	   if (document.main.us_st[i].checked)
	      {
	      var NAus_st = document.main.us_st[i].value;
	      }
	   }


	//determine which radio button with name=region is checked, and assign that value to a variable named "NAregion"
	for (var i=0; i < document.main.region.length; i++)
	   {
	   if (document.main.region[i].checked)
	      {
	      var NAregion = document.main.region[i].value;
	      }
	   }


	//determine which radio button with name=UStables is checked, and assign that value to a variable named "NAus_table"
	for (var i=0; i < document.main.UStables.length; i++)
	   {
	   if (document.main.UStables[i].checked)
	      {
	      var NAus_table = document.main.UStables[i].value;
	      }
	   }

	//determine which radio button with name=STtables is checked, and assign that value to a variable named "NAst_table"
	for (var i=0; i < document.main.STtables.length; i++)
	   {
	   if (document.main.STtables[i].checked)
	      {
	      var NAst_table = document.main.STtables[i].value;
	      }
	   }

	//determine which radio button with name=maptype is checked, and assign that value to a variable named "maptype"
	for (var i=0; i < document.main.maptype.length; i++)
	   {
	   if (document.main.maptype[i].checked)
	      {
	      var maptype = document.main.maptype[i].value;
	      }
	   }

	//determine which radio button with name=timeper is checked, and assign that value to a variable named "NAtimeper"
	for (var i=0; i < document.main.timeper.length; i++)
	   {
	   if (document.main.timeper[i].checked)
	      {
	      var NAtimeper = document.main.timeper[i].value;
	      }
	   }

	//determine which radio button with name=Ypll is checked, and assign that value to a variable named "NAypll"
	for (var i=0; i < document.main.Ypll.length; i++)
	   {
	   if (document.main.Ypll[i].checked)
	      {
	      var NAypll = document.main.Ypll[i].value;
	      }
	   }



	//determine if any check boxes with name=datset are checked, and assign the value to variable named "checkICD"
	// SOURCE:  http://www.javascriptkit.com/javatutors/radiocheck3.shtml
	var checkICDflag8 = false;
	var checkICDflag9 = false;
	var checkICD
	for (var i=0; i < document.main.datset.length; i++)
	   {
	   		if (document.main.datset[i].checked == true) {
				checkICD = document.main.datset[i].value;
				  //Change "checkICDflag8" to true if the iterative value of "checkICD" is equal to any of the following
                      if (checkICD == 'bys' || checkICD == 'hyp' || checkICD == 'mesob' || checkICD == 'mesoc' || checkICD == 'mesod' || checkICD == 'mesoe' || checkICD == 'plpl')
                        {
                         checkICDflag8 = true;
                        }
				  //Change "checkICDflag9" to true if the iterative value of "checkICD" is equal to any of the following
                      if (checkICD == 'mesob' || checkICD == 'mesoc' || checkICD == 'mesod' || checkICD == 'mesoe' || checkICD == 'plpl')
                        {
                         checkICDflag9 = true;
                        }
	      	}
	   }
	   
	   

    //Get index value of select boxes, convert to numeric "Number(string)", and adjust to actual value  
    //SOURCE:  http://www.quirksmode.org/js/select.html and Flanagan, page 165
		//var startYr = parseInt(document.main.year_in.options[document.main.year_in.selectedIndex].value);
		//var endYr = parseInt(document.main.year_out.options[document.main.year_out.selectedIndex].value);
	var startYr = Number(document.main.year_in.selectedIndex)+1968;
	var endYr = Number(document.main.year_out.selectedIndex)+1968;


	//determine which drop-down selection values are ok for county-level queries, and assign that value to a variable named "checkTimes"
    var checkTimes = false;
	   if ((startYr == 1970 && (endYr == 1979 || endYr == 1984 || endYr == 1989 || endYr == 1994 || endYr == 1999 || endYr == 2004)) ||
		   (startYr == 1975 && (endYr == 1984 || endYr == 1989 || endYr == 1994 || endYr == 1999 || endYr == 2004)) ||
		   (startYr == 1980 && (endYr == 1989 || endYr == 1994 || endYr == 1999 || endYr == 2004)) ||
		   (startYr == 1985 && (endYr == 1994 || endYr == 1999 || endYr == 2004)) ||
		   (startYr == 1990 && (endYr == 1999 || endYr == 2004)) ||
		   (startYr == 1995 && (endYr == 2004)) ||
		   (endYr == 1970 && (startYr == 1979 || startYr == 1984 || startYr == 1989 || startYr == 1994 || startYr == 1999 || startYr == 2004)) ||
		   (endYr == 1975 && (startYr == 1984 || startYr == 1989 || startYr == 1994 || startYr == 1999 || startYr == 2004)) ||
		   (endYr == 1980 && (startYr == 1989 || startYr == 1994 || startYr == 1999 || startYr == 2004)) ||
		   (endYr == 1985 && (startYr == 1994 || startYr == 1999 || startYr == 2004)) ||
		   (endYr == 1990 && (startYr == 1999 || startYr == 2004)) ||
		   (endYr == 1995 && (startYr == 2004))
	      ) 
		      {
		      var checkTimes = true;
	    	  }

    
	var ageMin = document.main.minage.selectedIndex;
	   		if (ageMin == 0) {
				minAge = 0;
	      	}
	   		else if (ageMin == 1) {
				minAge = 15;
	      	}
	   		else if (ageMin == 2) {
				minAge = 25;
	      	}
	   		else if (ageMin == 3) {
				minAge = 35;
	      	}
	   		else if (ageMin == 4) {
				minAge = 45;
	      	}
	   		else if (ageMin == 5) {
				minAge = 55;
	      	}
	   		else if (ageMin == 6) {
				minAge = 65;
	      	}
	   		else if (ageMin == 7) {
				minAge = 75;
	      	}
	   		else if (ageMin == 8) {
				minAge = 85;
	      	}


	var ageMax = document.main.maxage.selectedIndex;
	   		if (ageMax == 0) {
				maxAge = 14;
	      	}
	   		else if (ageMax == 1) {
				maxAge = 24;
	      	}
	   		else if (ageMax == 2) {
				maxAge = 34;
	      	}
	   		else if (ageMax == 3) {
				maxAge = 44;
	      	}
	   		else if (ageMax == 4) {
				maxAge = 54;
	      	}
	   		else if (ageMax == 5) {
				maxAge = 64;
	      	}
	   		else if (ageMax == 6) {
				maxAge = 74;
	      	}
	   		else if (ageMax == 7) {
				maxAge = 84;
	      	}
	   		else if (ageMax == 8) {
				maxAge = 130;
	      	}


  //***************** Following are if/thens with alert messages that STOP the SUBMIT **********************************  


	//Notify client if no "Condition" or "Comortality" causes are selected when info=1 and view=F
    // SOURCE:  http://www.netevolution.co.uk/scripts.asp?ID=25 (sort of)

	//Notify client if no "Condition" causes are selected
	if (datsetChecked == false) {
		alert ("Please select at least one cause of death.");
		return false;
	}
	
	
	//Notify client if county-level query is selected in conjunction with "meso" or "plpl"
    else if ( checkICDflag9 == true &&
		   		( (NAview == 'F' && NAus_st != 'ST' && NAus_table == 'CO') || 
		   		  (NAview == 'F' && NAus_st == 'ST' && NAst_table == 'CO') || 
	   			  (NAview == 'M' && maptype == 'C') || (NAview == 'M' && NAus_st == 'ST') || (NAview == 'M' && NAregion == 'N') ) 
	   	    ) {
				alert ("NORMS will not process any county-level query when you have selected Malignant Mesothelioma because these data are not yet available for a full 10-year time interval.  Please select any other respiratory diseases except Malignant Mesothelioma for county-level queries.");
				return false;
		 	  }
			
	//Notify client if state is not selected (when selectedIndex equals the first value in the list) and when us_st='ST'
	// SOURCE:  http://www.quirksmode.org/js/forms.html
	// for older browsers, may need to use "document.main.state2.options[document.main.state2.selectedIndex].value" instead of "document.main.state2.selectedIndex"
	else if (NAus_st == 'ST' && document.main.state2.selectedIndex == 0) {
				alert ("An individual state has not been selected.  Please select which state you want from the pull-down list.");
				return false;
			}
			
			
	//Notify client if "each sex" is selected (when selectedIndex equals the second value in the list) and when view^='F'
	else if (NAview != 'F' && document.main.sex2.selectedIndex == 1) {
				alert ('Please note that "Each Sex (separately)" is not a valid option for displaying a chart or a map.  Valid selection are "Both Sexes (combined)", "Male", or "Female".');
				return false;
			}
			
	//Notify client if "each race" is selected (when selectedIndex equals the second value in the list) and when view^='F'
	else if (NAview != 'F' && document.main.race2.selectedIndex == 1) {
				alert ('Please note that "Each Race (separately)" is not a valid option for displaying a chart or a map.  Valid selection are "All Races (combined)", "White", "Black", or "Other".');
				return false;
			}
			
	//Notify client if "each Hispanic group" is selected (when selectedIndex equals the second value in the list) and when view^='F'
	else if (NAview != 'F' && document.main.hispanic.selectedIndex == 1) {
				alert ('Please note that "Each Group (separately)" is not a valid option for displaying a chart or a map.  Valid selection are "Both Groups (combined)", "Hispanic", or "Non-Hispanic".');
				return false;
			}
			
	//Notify client if Alaska is selected (when selectedIndex equals the third value in the list) and when view='M'
	else if (NAview == 'M' && NAus_st == 'ST' && document.main.state2.selectedIndex == 2) {
				alert ("NORMS cannot generate a county-level map for Alaska.  Please select a different state.");
				return false;
			}
			
	//Notify client if DC is selected (when selectedIndex equals the 10th value in the list) and when view='M'
	else if (NAview == 'M' && NAus_st == 'ST' && document.main.state2.selectedIndex == 9) {
				alert ("NORMS cannot generate a county-level map for District of Columbia.  Please select a different state.");
				return false;
			}
			
	//Notify client that missing vlaues for age are invalid in this context
	else if (NAview == 'F' && NAinfo != '1' && (document.main.Nmiss.selectedIndex == 1 || document.main.Nmiss.selectedIndex == 2)) {
		alert ('Only "Number of Deaths" can be calculated for decedents with missing values for age.  Change the Missing Values option to "Do not include missing values in tabulation of counts" or select the "Number of Deaths" option.');
		return false;
	}

	//Notify client that at least two years of data are needed for charts
	else if (NAview == 'C' && (NAinfo == '2' || NAinfo == '4' || NAinfo == '7' || NAinfo == '8') &&  endYr == startYr)  {
		alert ('At least two years of data are needed for plotting this type of chart.  Please select a time-interval range of at least two years.');
		return false;
	}



  //***************** Following are separate IF statements with confirm messages ******************************************  


	//Notify client if hispanic is selected (when selectedIndex equals the second or third value in the list) and when year<1990
	// SOURCE:  http://www.quirksmode.org/js/forms.html  and  http://www.codeave.com/javascript/code.asp?u_log=7035
	if ((document.main.hispanic.selectedIndex == 1 || document.main.hispanic.selectedIndex == 2) &&
	    (startYr < 1990 || endYr < 1990) ) {
				checkHispanic = confirm ("NORMS does not include any data for Hispanic Origin prior to 1990.  Please note that the selected time interval will be changed.  Select 'OK' to continue, or 'Cancel' to change query options.");
				if (checkHispanic == false) {
					return false;
				}
			}


	//Notify client if check boxes with name=datset (bys, hyp, meso, or plpl) are checked for ICD-8 time period
	//or if check boxes with name=datset (meso or plpl) are checked for ICD-9 time period

    if ( checkICDflag8 == true && (startYr < 1979 || endYr < 1979) ) {
		confirmICD8 = confirm ("ICDA-8 data (1968-1978) for Byssinosis, Hypersensitivity Pneumonitis, and Malignant Mesothelioma [and ICD-9 data (1979-1998) for Malignant Mesothelioma] are not included in NORMS.  Please note that the selected time interval will be changed.   Select 'OK' to continue, or 'Cancel' to change query options.");
		if (confirmICD8 == false) {
			return false;
		}
	}
    else if ( checkICDflag9 == true && (startYr < 1999 || endYr < 1999) ) {
		confirmICD9 = confirm ("ICD-9 data (1979-1998) for Malignant Mesothelioma are not included in NORMS.  Please note that the selected time interval will be changed.   Select 'OK' to continue, or 'Cancel' to change query options.");
		if (confirmICD9 == false) {
			return false;
		}
	}


	//Notify client if county-level time interval will be changed
    if ( checkTimes == false &&
		   		( (NAview == 'F' && NAus_st != 'ST' && NAus_table == 'CO') || 
		   		  (NAview == 'F' && NAus_st == 'ST' && NAst_table == 'CO') || 
	   			  (NAview == 'M' && maptype == 'C') || (NAview == 'M' && NAus_st == 'ST') || (NAview == 'M' && NAregion == 'N') ) 
	   	    ) {
		confirmTime = confirm ("Please note that, due to health-information privacy regulations, NORMS will process county-level queries only for certain time intervals.  Therefore the selected time interval will be changed.   Select 'OK' to continue, or 'Cancel' to change query options.");
		if (confirmTime == false) {
			return false;
		}
	}

	//Notify client if time period will be changed for county-level tabular query
    if ( NAview == 'F' && NAtimeper == 'X' && 
    	( (NAus_st != 'ST' && NAus_table == 'CO') || (NAus_st == 'ST' && NAst_table == 'CO') )
      ) {
		confirmTime2 = confirm ("County-level queries will not be produced for individual years.  Please note that data will be generated for all selected years combined.  Select 'OK' to continue, or 'Cancel' to change query options.");
		if (confirmTime2 == false) {
			return false;
		}
	}


	//Notify client if the lower limit (name="minage") is greater than the upper limit (name="maxage")
	if (minAge > maxAge) {
		confirmAge = confirm ("Please note that the selected age interval is not valid, and will be automatically changed.  Select 'OK' to continue, or 'Cancel' to change query options.");
		if (confirmAge == false) {
			return false;
		}
	}

	//Notify client if YPLL65 is selected with maxage > 65
    if ( NAinfo == '5' && (NAypll == 'Y' || NAypll == 'Z') && maxAge > 65 ) {
		confirmYP65 = confirm ("For calculating YPLL to age 65, please note that the selected age interval will be adjusted to exclude decedents more than 65 years old.   Select 'OK' to continue, or 'Cancel' to change query options.");
		if (confirmYP65 == false) {
			return false;
		}
	}


	else {
		return true;
	}
}



function submitIO(){	
	//Client-side form validation for Industry/Occuparion Database form	

	//determine if any of the check boxes with name=datset are checked
    var datsetChecked = false;
	for (var i=0; i < document.io.datset.length; i++)
	   {
	   if (document.io.datset[i].checked)
	      {
	      var datsetChecked = true;
	      }
	   }

	//determine which radio button with name=info is checked, and assign that value to a variable named "IOinfo"
	//source:  http://www.webdevelopersnotes.com/tips/html/finding_the_value_of_a_radio_button.php3
	for (var i=0; i < document.io.info.length; i++)
	   {
	   if (document.io.info[i].checked)
	      {
	      var IOinfo = document.io.info[i].value;
	      }
	   }
	   
	//determine which radio button with name=us_st is checked, and assign that value to a variable named "IOus_st"
	for (var i=0; i < document.io.us_st.length; i++)
	   {
	   if (document.io.us_st[i].checked)
	      {
	      var IOus_st = document.io.us_st[i].value;
	      }
	   }

	//determine which radio button with name=Ypll is checked, and assign that value to a variable named "IOypll"
	for (var i=0; i < document.io.Ypll.length; i++)
	   {
	   if (document.io.Ypll[i].checked)
	      {
	      var IOypll = document.io.Ypll[i].value;
	      }
	   }

	//determine if any check boxes with name=datset are checked, and assign the value to variable named "checkICD"
	// SOURCE:  http://www.javascriptkit.com/javatutors/radiocheck3.shtml
	var checkICDflag9 = false;
	var checkICD
	for (var i=0; i < document.io.datset.length; i++)
	   {
	   		if (document.io.datset[i].checked == true) {
				checkICD = document.io.datset[i].value;
				  //Change "checkICDflag9" to true if the iterative value of "checkICD" is equal to any of the following
                      if (checkICD == 'mesob' || checkICD == 'mesoc' || checkICD == 'mesod' || checkICD == 'mesoe' || checkICD == 'plpl')
                        {
                         checkICDflag9 = true;
                        }
	      	}
	   }

    //Get index value of select boxes, convert to numeric "Number(string)", and adjust to actual value  
	var startYr = Number(document.io.year_in.selectedIndex)+1985;
	var endYr = Number(document.io.year_out.selectedIndex)+1985;

	//determine which drop-down selection values are ok for PMR queries, and assign that value to a variable named "checkTimes"
    var checkTimes = false;
	   if ((startYr == 1985 && (endYr == 1994 || endYr == 1999)) ||
	   	   (startYr == 1990 && (endYr == 1999)) || 
		   (endYr == 1985 && (startYr == 1994 || startYr == 1999)) || 
		   (endYr == 1990 && (startYr == 1999)) 
	      ) 
		      {
		      var checkTimes = true;
	    	  }

	var ageMin = document.io.minage.selectedIndex;
	   		if (ageMin == 0) {
				minAge = 0;
	      	}
	   		else if (ageMin == 1) {
				minAge = 15;
	      	}
	   		else if (ageMin == 2) {
				minAge = 25;
	      	}
	   		else if (ageMin == 3) {
				minAge = 35;
	      	}
	   		else if (ageMin == 4) {
				minAge = 45;
	      	}
	   		else if (ageMin == 5) {
				minAge = 55;
	      	}
	   		else if (ageMin == 6) {
				minAge = 65;
	      	}
	   		else if (ageMin == 7) {
				minAge = 75;
	      	}
	   		else if (ageMin == 8) {
				minAge = 85;
	      	}

	var ageMax = document.io.maxage.selectedIndex;
	   		if (ageMax == 0) {
				maxAge = 14;
	      	}
	   		else if (ageMax == 1) {
				maxAge = 24;
	      	}
	   		else if (ageMax == 2) {
				maxAge = 34;
	      	}
	   		else if (ageMax == 3) {
				maxAge = 44;
	      	}
	   		else if (ageMax == 4) {
				maxAge = 54;
	      	}
	   		else if (ageMax == 5) {
				maxAge = 64;
	      	}
	   		else if (ageMax == 6) {
				maxAge = 74;
	      	}
	   		else if (ageMax == 7) {
				maxAge = 84;
	      	}
	   		else if (ageMax == 8) {
				maxAge = 130;
	      	}

  //***************** Following are if/thens with alert messages that STOP the SUBMIT **********************************  
  //***************** Note that many of the contingencies are in the "OtherWhatJobsIO function *************************  
	

	if (datsetChecked == false) {
		alert ("Please select at least one cause of death.");
		return false;
		}
		
	//Notify client if PMR query is selected in conjunction with "meso" or "plpl"
    else if ( checkICDflag9 == true && IOinfo == '6' ) {
				alert ("NORMS will not process any PMR query when you have selected Malignant Mesothelioma because these data are not yet available for a full 10-year time interval.  Please select any other respiratory diseases except Malignant Mesothelioma for PMR queries.");
				return false;
		 	  }

	//Notify client if state is not selected (when selectedIndex equals the first value in the list) and when us_st='ST'
	// SOURCE:  http://www.quirksmode.org/js/forms.html
	// for older browsers, may need to use "document.io.state2.options[document.io.state2.selectedIndex].value" instead of "document.io.state2.selectedIndex"
	else if (IOus_st == 'ST' && document.io.state2.selectedIndex == 0) {
				alert ("An individual state has not been selected.  Please select which state you want from the pull-down list.");
				return false;
			}


  //***************** Following are separate IF statements with confirm messages ******************************************  


	//Notify client if hispanic is selected (when selectedIndex equals the second or third value in the list) and when year<1990
	// SOURCE:  http://www.quirksmode.org/js/forms.html  and  http://www.codeave.com/javascript/code.asp?u_log=7035
	if ((document.io.hispanic.selectedIndex == 1 || document.io.hispanic.selectedIndex == 2) &&
	    (startYr < 1990 || endYr < 1990) ) {
				checkHispanic = confirm ("NORMS does not include any data for Hispanic Origin prior to 1990.  Please note that the selected time interval will be changed.   Select 'OK' to continue, or 'Cancel' to change query options.");
				if (checkHispanic == false) {
					return false;
				}
			}

	//Notify client if if check boxes with name=datset (meso or plpl) are checked for ICD-9 time period
	// SOURCE:  http://www.javascriptkit.com/javatutors/radiocheck3.shtml
    if ( checkICDflag9 == true && IOinfo != '6' && (startYr < 1999 || endYr < 1999) ) {
		confirmICD9 = confirm ("ICD-9 data (1979-1998) for Malignant Mesothelioma are not included in NORMS.  Please note that the selected time interval will be changed.   Select 'OK' to continue, or 'Cancel' to change query options.");
		if (confirmICD9 == false) {
			return false;
		}
	}

	//Notify client if PMR time interval will be changed
    if ( checkTimes == false && IOinfo == '6' && checkICDflag9 == false ) {
		confirmTime = confirm ("Please note that NORMS will process PMR queries only for certain time intervals.  Therefore the selected time interval will be changed.   Select 'OK' to continue, or 'Cancel' to change query options.");
		if (confirmTime == false) {
			return false;
		}
	}

	//Notify client if the lower limit (name="minage") is greater than the upper limit (name="maxage")
	if (minAge > maxAge) {
		confirmAge = confirm ("Please note that the selected age interval is not valid, and will be automatically changed.  Select 'OK' to continue, or 'Cancel' to change query options.");
		if (confirmAge == false) {
			return false;
		}
	}

	//Notify client if YPLL65 is selected with maxage > 65
    if ( IOinfo == '5' && (IOypll == 'Y' || IOypll == 'Z') && maxAge > 65 ) {
		confirmYP65 = confirm ("For calculating YPLL to age 65, please note that the selected age interval will be adjusted to exclude decedents more than 65 years old.   Select 'OK' to continue, or 'Cancel' to change query options.");
		if (confirmYP65 == false) {
			return false;
		}
	}


	return OtherWhatjobsIO();	

}







//id names used for DIV elements in National Database --- Display the results of this query... 
var NAresults=new Array('NAtables','NAtablesFill','NAmaps','NAcolorBlind','NAageMissing');

function displayNAresults(id){	
	//execute the undisplay function, then display this (id) tag -- see onclick attributes in body of html
	undisplayNAresults();
	displayThis(id);
}

function undisplayNAresults(){
	//undisplay data within all DIVs listed in the NAresults array
	for (var i=0;i<NAresults.length;i++){
		undisplayThis(NAresults[i]);
	}		  
}




//id names used for DIV elements in National Database --- Statistical Reporting Criteria 
var StatNA=new Array('CensusNote','StandardPop','NAypll');

function displayStatNA(id){	
	//execute the undisplay function, then display this (id) tag -- see onclick attributes in body of html
	undisplayStatNA();
	displayThis(id);
}

function undisplayStatNA(){
	//undisplay data within all DIVs listed in the StatNA array
	for (var i=0;i<StatNA.length;i++){
		undisplayThis(StatNA[i]);
	}		  
}





//id names used for DIV elements in Industry-Occupation Database --- Statistical Reporting Criteria 
var StatIO=new Array('IOypll','IOpmr');

function displayStatIO(id){	
	//execute the undisplay function, then display this (id) tag -- see onclick attributes in body of html
	undisplayStatIO();
	displayThis(id);
}

function undisplayStatIO(){
	//undisplay data within all DIVs listed in the StatIO array
	for (var i=0;i<StatIO.length;i++){
		undisplayThis(StatIO[i]);
	}		  
}



//id names used for DIV elements in National Database --- Spatial Geographical Criteria 
var GeogNA=new Array('NAusa','NAgeogSort','NAregion','NAstate','NAstate2');

function displayGeogNA(id){	
	//execute the undisplay function, then display this (id) tag -- see onclick attributes in body of html
	undisplayGeogNA();
	displayThis(id);
}

function undisplayGeogNA(){
	//undisplay data within all DIVs listed in the GeogNA array
	for (var i=0;i<GeogNA.length;i++){
		undisplayThis(GeogNA[i]);
	}		  
}



function OtherGeogNA() {

	//determine which radio button with name=view is checked, and assign that value to a variable named "NAview"
	//source:  http://www.webdevelopersnotes.com/tips/html/finding_the_value_of_a_radio_button.php3
	for (var i=0; i < document.main.view.length; i++)
	   {
	   if (document.main.view[i].checked)
	      {
	      var NAview = document.main.view[i].value;
	      }
	   }

	//determine which radio button with name=us_st is checked, and assign that value to a variable named "NAus_st"
	for (var i=0; i < document.main.us_st.length; i++)
	   {
	   if (document.main.us_st[i].checked)
	      {
	      var NAus_st = document.main.us_st[i].value;
	      }
	   }

	
	//determine which radio button with name=UStables is checked, and assign that value to a variable named "NAus_table"
	for (var i=0; i < document.main.UStables.length; i++)
	   {
	   if (document.main.UStables[i].checked)
	      {
	      var NAus_table = document.main.UStables[i].value;
	      }
	   }

	//determine which radio button with name=STtables is checked, and assign that value to a variable named "NAst_table"
	for (var i=0; i < document.main.STtables.length; i++)
	   {
	   if (document.main.STtables[i].checked)
	      {
	      var NAst_table = document.main.STtables[i].value;
	      }
	   }

	//determine which radio button with name=timeper is checked, and assign that value to a variable named "NAtimeper"
	for (var i=0; i < document.main.timeper.length; i++)
	   {
	   if (document.main.timeper[i].checked)
	      {
	      var NAtimeper = document.main.timeper[i].value;
	      }
	   }

	
	//redisplay or undisplay the following DIVs
	if (NAview == 'F')  {
		displayNAresults('NAtables');
		displayThisAlso('NAtablesFill');
		displayThisAlso('NAageMissing');
			if (NAus_st == 'US')  {
		   		displayGeogNA('NAusa');
			    	if (NAus_table == 'US')  {
			   			undisplayThis('NAgeogSort');
					    	if (NAtimeper == 'X')  {
					   			displayThis('NAyearSort');
			   				}		
					    	else if (NAtimeper == 'T')  {
					   			undisplayThis('NAyearSort');
			   				}		
					}	
			    	else if (NAus_table != 'US')  {
			   			displayThis('NAgeogSort');
			   			undisplayThis('NAyearSort');
					}	
			}
			else if (NAus_st == 'ST')  {
		    	displayGeogNA('NAstate');
		    	displayThisAlso('NAstate2');
			    	if (NAst_table == 'ST')  {
			   			undisplayThis('NAgeogSort');
					    	if (NAtimeper == 'X')  {
					   			displayThis('NAyearSort');
			   				}		
					    	else if (NAtimeper == 'T')  {
					   			undisplayThis('NAyearSort');
			   				}		
					}	
			    	else if (NAst_table == 'CO')  {
			   			displayThis('NAgeogSort');
			   			undisplayThis('NAyearSort');
					}	
			}
			else if (NAus_st == 'RE')  {
		   		displayGeogNA('NAusa');
		   		displayThisAlso('NAregion');
			    	if (NAus_table == 'US')  {
			   			undisplayThis('NAgeogSort');
					    	if (NAtimeper == 'X')  {
					   			displayThis('NAyearSort');
			   				}		
					    	else if (NAtimeper == 'T')  {
					   			undisplayThis('NAyearSort');
			   				}		
					}	
			    	else if (NAus_table != 'US')  {
			   			displayThis('NAgeogSort');
			   			undisplayThis('NAyearSort');
					}	
			}
	}
	else if (NAview == 'C')  {
		undisplayNAresults();
		undisplayThis('NAageMissing');
    		undisplayThis('NAyearSort');
   		undisplayGeogNA();
			if (NAus_st == 'ST')  {
		    	displayGeogNA('NAstate2');
			}
			else if (NAus_st == 'RE')  {
		    	displayGeogNA('NAregion');
			}
	}
	else if (NAview == 'M')  {
		undisplayThis('NAageMissing');
    		undisplayThis('NAyearSort');
		undisplayGeogNA();
			if (NAus_st == 'US')  {
				displayNAresults('NAmaps');
			}
			else if (NAus_st == 'ST')  {
		    	displayGeogNA('NAstate2');
				undisplayNAresults();
			}
			else if (NAus_st == 'RE')  {
		    	displayGeogNA('NAregion');
				displayNAresults('NAmaps');
			}
		displayThis('NAcolorBlind');
	}
}


//id names used for DIV elements in Industry-Occupation Database --- Geographical Criteria 
var GeogIO=new Array('IOusa','IOstate');

function displayGeogIO(id){	
	//execute the undisplay function, then display this (id) tag -- see onclick attributes in body of html
	undisplayGeogIO();
	displayThis(id);
}

function undisplayGeogIO(){
	//undisplay data within all DIVs listed in the GeogIO array
	for (var i=0;i<GeogIO.length;i++){
		undisplayThis(GeogIO[i]);
	}		  
}




//id names used for DIV elements in Industry-Occupation Database --- Geographical Criteria 

function OtherGeogIO() {	

	//determine which radio button with name=info is checked, and assign that value to a variable named "IOinfo"
	//source:  http://www.webdevelopersnotes.com/tips/html/finding_the_value_of_a_radio_button.php3
	for (var i=0; i < document.io.info.length; i++)
	   {
	   if (document.io.info[i].checked)
	      {
	      var IOinfo = document.io.info[i].value;
	      }
	   }
	   
	//determine which radio button with name=us_st is checked, and assign that value to a variable named "IOus_st"
	for (var i=0; i < document.io.us_st.length; i++)
	   {
	   if (document.io.us_st[i].checked)
	      {
	      var IOus_st = document.io.us_st[i].value;
	      }
	   }
	   

	//redisplay or undisplay the following DIVs

		displayThis('IOstRes');
   		displayThis('IOyears');
	   
	if (IOinfo == '1' && IOus_st == 'US')  {
   		undisplayStatIO();
   		displayGeogIO('IOusa');
   	}
	else if (IOinfo == '1' && IOus_st == 'ST')  {
   		undisplayStatIO();
   		displayGeogIO('IOstate');
   	}
	else if (IOinfo == '5' && IOus_st == 'US')  {
   		displayStatIO('IOypll');
   		displayGeogIO('IOusa');
	}
	else if (IOinfo == '5' && IOus_st == 'ST')  {
   		displayStatIO('IOypll');
   		displayGeogIO('IOstate');
	}
	else if (IOinfo == '6')  {
		displayStatIO('IOpmr');
		undisplayThis('IOyears');
		undisplayThis('IOusa');
		undisplayThis('IOstate');
		undisplayThis('IOstRes');
	//reset the values of the radio box with name="timeper" to All Selected Years (combined)
		document.getElementById('JallYr').checked = true;
	//reset the values of the radio box with name="us_st" to Residents of All Participating States
		document.getElementById('Jus').checked = true;
	//reset the values of the radio box with name="UStables" to All States (combined)
		document.getElementById('JusTab_all').checked = true;
	}
}







//id names used for DIV elements in Industry-Occupation Database --- "whatjobs" Criteria 
var IOwhatjobs=new Array('IOwhatjobsA','IOwhatjobsC');

function displayIOwhatjobs(){
	//display data within all DIVs listed in the IOwhatjobs array
	for (var i=0;i<IOwhatjobs.length;i++){
		displayThis(IOwhatjobs[i]);
	}		  
}

function undisplayIOwhatjobs(){
	//undisplay data within all DIVs listed in the IOwhatjobs array
	for (var i=0;i<IOwhatjobs.length;i++){
		undisplayThis(IOwhatjobs[i]);
	}		  
}




//id names used for DIV elements in Industry-Occupation Database --- Industrial and Occupational Criteria 
var IOjobs=new Array('IOinds3','IOinds2','IndsTop','IndsBottom','IOoccs3','IOoccs2','OccsTop','OccsBottom');

function displayIO(){
	//display data within all DIVs listed in the IOjobs array
	for (var i=0;i<IOjobs.length;i++){
		displayThis(IOjobs[i]);
	}		  
}

function undisplayIO(){
	//undisplay data within all DIVs listed in the IOjobs array
	for (var i=0;i<IOjobs.length;i++){
		undisplayThis(IOjobs[i]);
	}		  
}




function OtherWhatjobsIO() {

	//determine which radio button with name=digits is checked, and assign that value to a variable named "DigitsIO"
	//source:  http://www.webdevelopersnotes.com/tips/html/finding_the_value_of_a_radio_button.php3
	for (var i=0; i < document.io.digits.length; i++)
	   {
	   if (document.io.digits[i].checked)
	      {
	      var DigitsIO = document.io.digits[i].value;
	      }
	   }

	//determine which radio button with name=whatjobs is checked, and assign that value to a variable named "WhatjobsIO"
	//source:  http://www.webdevelopersnotes.com/tips/html/finding_the_value_of_a_radio_button.php3
	for (var i=0; i < document.io.whatjobs.length; i++)
	   {
	   if (document.io.whatjobs[i].checked)
	      {
	      var WhatjobsIO = document.io.whatjobs[i].value;
	      }
	   }

	//determine which radio button with name=socio2 is checked, and assign that value to a variable named "SocIO"
	//source:  http://www.webdevelopersnotes.com/tips/html/finding_the_value_of_a_radio_button.php3
	for (var i=0; i < document.io.socio2.length; i++)
	   {
	   if (document.io.socio2[i].checked)
	      {
	      var SocIO = document.io.socio2[i].value;
	      }
	   }


	if (WhatjobsIO == 'A') {

		//execute these functions for "socio2" and "Digits"
   		undisplayIO();
		if (SocIO == 'None') {
	    	undisplayThis('IOdigits');
		}
		else  {
	    	displayThis('IOdigits');
		}
	}

	else if (WhatjobsIO == 'C') {
	

		//execute these functions for "socio2" and "Digits"
		if (SocIO == 'None') {
	    	undisplayThis('IOdigits');
    		undisplayIO();
		}
		else if (SocIO == 'Inds' && DigitsIO == '3') {
	    	displayThis('IOdigits');
    		undisplayIO();
	    	displayThis('IndsTop');
    		displayThis('IOinds3');
	    	displayThis('IndsBottom');
		}
		else if (SocIO == 'Inds' && DigitsIO == '2')  {
	    	displayThis('IOdigits');
    		undisplayIO();
	    	displayThis('IndsTop');
    		displayThis('IOinds2');
	    	displayThis('IndsBottom');
		}
		else if (SocIO == 'Occs' && DigitsIO == '3') {
	    	displayThis('IOdigits');
    		undisplayIO();
	    	displayThis('OccsTop');
    		displayThis('IOoccs3');
	    	displayThis('OccsBottom');
		}
		else if (SocIO == 'Occs' && DigitsIO == '2')  {
	    	displayThis('IOdigits');
    		undisplayIO();
	    	displayThis('OccsTop');
    		displayThis('IOoccs2');
	    	displayThis('OccsBottom');
		}
		else if (SocIO == 'Oall' && DigitsIO == '3') {
	    	displayThis('IOdigits');
	    	displayIO();
    		undisplayThis('IOinds2');
    		undisplayThis('IOoccs2');
		}
		else if (SocIO == 'Oall' && DigitsIO == '2')  {
	    	displayThis('IOdigits');
	    	displayIO();
    		undisplayThis('IOinds3');
    		undisplayThis('IOoccs3');
		}
	}
	
	//determine how many of the select boxes with are selected
	//http://tutorial177.easycfm.com/ or http://www.elated.com/articles/form-validation-with-javascript/  (sort of)
	//http://www.mredkj.com/tutorials/tutorial002.html
	if (document.getElementById) { // DOM3 = IE5, NS6
		var num_cic = document.getElementById('S3ind').selectedIndex;
		var num_cic51 = document.getElementById('S2ind').selectedIndex;
		var num_coc = document.getElementById('S3occ').selectedIndex;
		var num_coc59 = document.getElementById('S2occ').selectedIndex;
	}
	else {
		if (document.layers) { // Netscape 4
			var num_cic = document.S3ind.selectedIndex;
			var num_cic51 = document.S2ind.selectedIndex;
			var num_coc = document.S3occ.selectedIndex;
			var num_coc59 = document.S2occ.selectedIndex;
		}
		else { // IE 4
			var num_cic = document.all.S3ind.selectedIndex;
			var num_cic51 = document.all.S2ind.selectedIndex;
			var num_coc = document.all.S3occ.selectedIndex;
			var num_coc59 = document.all.S2occ.selectedIndex;
		}
	}
    

	     if (WhatjobsIO == 'C' && SocIO == 'Inds' && DigitsIO == '3' && num_cic == '-1') {
		alert ("Please select at least one 3-digit Industry from the list.")
		return false;
		}
	else if (WhatjobsIO == 'C' && SocIO == 'Occs' && DigitsIO == '3' && num_coc == '-1') {
		alert ("Please select at least one 3-digit Occupation from the list.")
		return false;
		}
	else if (WhatjobsIO == 'C' && SocIO == 'Oall' && DigitsIO == '3' && num_coc == '-1' && num_cic == '-1') {
		alert ("Please select at least one 3-digit Industry or 3-digit Occupation from the list.")
		return false;
		}
	else if (WhatjobsIO == 'C' && SocIO == 'Inds' && DigitsIO == '2' && num_cic51 == '-1') {
		alert ("Please select at least one 2-digit Industry from the list.")
		return false;
		}
	else if (WhatjobsIO == 'C' && SocIO == 'Occs' && DigitsIO == '2' && num_coc59 == '-1') {
		alert ("Please select at least one 2-digit Occupation from the list.")
		return false;
		}
	else if (WhatjobsIO == 'C' && SocIO == 'Oall' && DigitsIO == '2' && num_cic51 == '-1' && num_coc59 == '-1') {
		alert ("Please select at least one 2-digit Industry or 2-digit Occupation from the list.")
		return false;
		}
	else {
		return true;
	}
}



function OtherWhatjobsIOviewRefresh() {

	//determine which radio button with name=digits is checked, and assign that value to a variable named "DigitsIO"
	//source:  http://www.webdevelopersnotes.com/tips/html/finding_the_value_of_a_radio_button.php3
	for (var i=0; i < document.io.digits.length; i++)
	   {
	   if (document.io.digits[i].checked)
	      {
	      var DigitsIO = document.io.digits[i].value;
	      }
	   }

	//determine which radio button with name=whatjobs is checked, and assign that value to a variable named "WhatjobsIO"
	//source:  http://www.webdevelopersnotes.com/tips/html/finding_the_value_of_a_radio_button.php3
	for (var i=0; i < document.io.whatjobs.length; i++)
	   {
	   if (document.io.whatjobs[i].checked)
	      {
	      var WhatjobsIO = document.io.whatjobs[i].value;
	      }
	   }


	//determine which radio button with name=socio2 is checked, and assign that value to a variable named "SocIO"
	//source:  http://www.webdevelopersnotes.com/tips/html/finding_the_value_of_a_radio_button.php3
	for (var i=0; i < document.io.socio2.length; i++)
	   {
	   if (document.io.socio2[i].checked)
	      {
	      var SocIO = document.io.socio2[i].value;
	      }
	   }


	if (WhatjobsIO == 'A') {

		//execute these functions for "socio2" and "Digits"
   		undisplayIO();
		if (SocIO == 'None') {
	    	undisplayThis('IOdigits');
		}
		else  {
	    	displayThis('IOdigits');
		}
	}


	else if (WhatjobsIO == 'C') {
	
		//execute these functions for "socio2" and "Digits"
		if (SocIO == 'None') {
	    	undisplayThis('IOdigits');
    		undisplayIO();
		}
		else if (SocIO == 'Inds' && DigitsIO == '3') {
	    	displayThis('IOdigits');
    		undisplayIO();
	    	displayThis('IndsTop');
    		displayThis('IOinds3');
	    	displayThis('IndsBottom');
		}
		else if (SocIO == 'Inds' && DigitsIO == '2')  {
	    	displayThis('IOdigits');
    		undisplayIO();
	    	displayThis('IndsTop');
    		displayThis('IOinds2');
	    	displayThis('IndsBottom');
		}
		else if (SocIO == 'Occs' && DigitsIO == '3') {
	    	displayThis('IOdigits');
    		undisplayIO();
	    	displayThis('OccsTop');
    		displayThis('IOoccs3');
	    	displayThis('OccsBottom');
		}
		else if (SocIO == 'Occs' && DigitsIO == '2')  {
	    	displayThis('IOdigits');
    		undisplayIO();
	    	displayThis('OccsTop');
    		displayThis('IOoccs2');
	    	displayThis('OccsBottom');
		}
		else if (SocIO == 'Oall' && DigitsIO == '3') {
	    	displayThis('IOdigits');
	    	displayIO();
    		undisplayThis('IOinds2');
    		undisplayThis('IOoccs2');
		}
		else if (SocIO == 'Oall' && DigitsIO == '2')  {
	    	displayThis('IOdigits');
	    	displayIO();
    		undisplayThis('IOinds3');
    		undisplayThis('IOoccs3');
		}
	}
}



function viewRefresh() {   
	//This redisplays or undisplays DIVs in both forms, based on client's currently selected options
	//See onLoad attribute in body tag
  
	//
	// List of National Database refresh options 
	//

	//determine which radio button with name=view is checked, and assign that value to a variable named "NAview"
	//source:  http://www.webdevelopersnotes.com/tips/html/finding_the_value_of_a_radio_button.php3
	for (var i=0; i < document.main.view.length; i++)
	   {
	   if (document.main.view[i].checked)
	      {
	      var NAview = document.main.view[i].value;
	      }
	   }

	//determine which radio button with name=us_st is checked, and assign that value to a variable named "NAus_st"
	for (var i=0; i < document.main.us_st.length; i++)
	   {
	   if (document.main.us_st[i].checked)
	      {
	      var NAus_st = document.main.us_st[i].value;
	      }
	   }

	//determine which radio button with name=UStables is checked, and assign that value to a variable named "NAus_table"
	for (var i=0; i < document.main.UStables.length; i++)
	   {
	   if (document.main.UStables[i].checked)
	      {
	      var NAus_table = document.main.UStables[i].value;
	      }
	   }

	//determine which radio button with name=STtables is checked, and assign that value to a variable named "NAst_table"
	for (var i=0; i < document.main.STtables.length; i++)
	   {
	   if (document.main.STtables[i].checked)
	      {
	      var NAst_table = document.main.STtables[i].value;
	      }
	   }

	//determine which radio button with name=timeper is checked, and assign that value to a variable named "NAtimeper"
	for (var i=0; i < document.main.timeper.length; i++)
	   {
	   if (document.main.timeper[i].checked)
	      {
	      var NAtimeper = document.main.timeper[i].value;
	      }
	   }

	//redisplay or undisplay the following DIVs
	if (NAview == 'F')  {
		displayNAresults('NAtables');
		displayThisAlso('NAtablesFill');
		displayThisAlso('NAageMissing');
			if (NAus_st == 'US')  {
		   		displayGeogNA('NAusa');
			    	if (NAus_table == 'US')  {
			   			undisplayThis('NAgeogSort');
					    	if (NAtimeper == 'X')  {
					   			displayThis('NAyearSort');
			   				}		
					    	else if (NAtimeper == 'T')  {
					   			undisplayThis('NAyearSort');
			   				}		
					}	
			    	else if (NAus_table != 'US')  {
			   			displayThis('NAgeogSort');
			   			undisplayThis('NAyearSort');
					}	
			}
			else if (NAus_st == 'ST')  {
		    	displayGeogNA('NAstate');
		    	displayThisAlso('NAstate2');
			    	if (NAst_table == 'ST')  {
			   			undisplayThis('NAgeogSort');
					    	if (NAtimeper == 'X')  {
					   			displayThis('NAyearSort');
			   				}		
					    	else if (NAtimeper == 'T')  {
					   			undisplayThis('NAyearSort');
			   				}		
					}	
			    	else if (NAst_table == 'CO')  {
			   			displayThis('NAgeogSort');
			   			undisplayThis('NAyearSort');
					}	
			}
			else if (NAus_st == 'RE')  {
		   		displayGeogNA('NAusa');
		   		displayThisAlso('NAregion');
			    	if (NAus_table == 'US')  {
			   			undisplayThis('NAgeogSort');
					    	if (NAtimeper == 'X')  {
					   			displayThis('NAyearSort');
			   				}		
					    	else if (NAtimeper == 'T')  {
					   			undisplayThis('NAyearSort');
			   				}		
					}	
			    	else if (NAus_table != 'US')  {
			   			displayThis('NAgeogSort');
			   			undisplayThis('NAyearSort');
					}	
			}
	}
	else if (NAview == 'C')  {
		undisplayNAresults();
		undisplayThis('NAageMissing');
    		undisplayThis('NAyearSort');
   		undisplayGeogNA();
			if (NAus_st == 'ST')  {
		    	displayGeogNA('NAstate2');
			}
			else if (NAus_st == 'RE')  {
		    	displayGeogNA('NAregion');
			}
	}
	else if (NAview == 'M')  {
		undisplayThis('NAageMissing');
    		undisplayThis('NAyearSort');
   		undisplayGeogNA();
			if (NAus_st == 'US')  {
				displayNAresults('NAmaps');
			}
			else if (NAus_st == 'ST')  {
		    	displayGeogNA('NAstate2');
				undisplayNAresults();
			}
			else if (NAus_st == 'RE')  {
		    	displayGeogNA('NAregion');
				displayNAresults('NAmaps');
			}
		displayThis('NAcolorBlind');
	}



	//determine which radio button with name=info is checked, and assign that value to a variable named "NAinfo"
	//source:  http://www.webdevelopersnotes.com/tips/html/finding_the_value_of_a_radio_button.php3
	for (var i=0; i < document.main.info.length; i++)
	   {
	   if (document.main.info[i].checked)
	      {
	      var NAinfo = document.main.info[i].value;
	      }
	   }
	   
	//redisplay or undisplay the following DIVs
	if (NAinfo == '2')  {
   		displayThis('CensusNote');
	}
	else if (NAinfo == '4')  {
   		displayThis('CensusNote');
   		displayThis('StandardPop');
	}
	else if (NAinfo == '5')  {
   		displayThis('NAypll');
	}


	//
	// List of Industry/Occupation refresh options 
	//
	

	//determine which radio button with name=whatjobs is checked, and assign that value to a variable named "IOwhatjobs"
	for (var i=0; i < document.io.whatjobs.length; i++)
	   {
	   if (document.io.whatjobs[i].checked)
	      {
	      var IOwhatjobs = document.io.whatjobs[i].value;
	      }
	   }

	//redisplay or undisplay the following DIVs
	if (IOwhatjobs == 'A')  {
		undisplayIOwhatjobs();
   	}
	else if (IOwhatjobs == 'C')  {
		displayIOwhatjobs();
	}

    OtherGeogIO();
	OtherWhatjobsIOviewRefresh();
}





function resetNA() {   
	//This resets DIVs in the National Database form to their default values after the Reset button is clicked. 
	//The selected options are reset by the reset button.
	//See onClick attribute on the reset button, and onReset attribute in the form tag.

	//reset the DIVs associated with radio button with name=view when view='F'
		displayNAresults('NAtables');
		displayThis('NAtablesFill');
		displayThis('NAageMissing');
   		displayGeogNA('NAusa');

	//reset the DIVs associated with radio button with name=info when info='1'
		undisplayStatNA();
		undisplayThis('NAyearSort');
}
  


function resetIO() {   
	//This resets DIVs in the Industry/Occupation Database form to their default values after the Reset button is clicked. 
	//The selected options are reset by the reset button.
	//See onClick attribute on the reset button, and onReset attribute in the form tag.

	//reset the DIVs associated with radio button with name=info when info='1'
   		undisplayStatIO();
   		displayThis('IOyears');

	//reset the DIVs associated with radio button with name=us_st when us_st='US'
		displayThis('IOusa');
		displayThis('IOstRes');
		undisplayThis('IOstate');

	//reset the DIVs associated with radio button with name=whatjobs when whatjobs='A'
		undisplayIOwhatjobs();

	//reset the DIVs associated with radio button with name=socio2 when socio2='None'
    	undisplayThis('IOdigits');
		undisplayIO();
}
