<!--
//============================== this function will uncheck all checkboxes in a collection except for the 'none of the above checkbox
function uncheckAll(strCode) 
	{
	var theForm = document.forms[0];
	for (counter = 0; counter < theForm.elements.length; counter++) 
		{
		var element
		element = theForm.elements[counter];
		if ((element.name.substring(0,11) == strCode.substring(0,11)) && (element.value.substring(8,11) != "999"))  
			{
			element.checked = false;
			}
		}
	}
//============================== this function checks to see if the 'none of the above was checked or unchecked before uncheaking all of the checkboxes
function clickedNoneOfAbove(noneOfAbove, strCode) 
	{
	if (noneOfAbove.checked)
		{
		uncheckAll(strCode);
		} 
	} 
//============================== this function will uncheck the 'none fo the above' checkbox when a different object is clicked in the collection
function uncheckNone(strCode)
	{
		var theForm = document.forms[0];
		var tempElement;
		var NoneChecked = true;
		for (counter = 0; counter < theForm.elements.length; counter++)
			{
			tempElement = theForm.elements[counter];
			if ((tempElement.name.substring(0,11) == strCode.substring(0,11)) && (tempElement.value.substring(8,11) == "999") && (tempElement.checked == true))
				{
					tempElement.checked = false;
				}			
			}
		
		for (counter = 0; counter < theForm.elements.length; counter++)
			{
			tempElement = theForm.elements[counter];
			if ((tempElement.name.substring(0,11) == strCode.substring(0,11)) && (tempElement.checked == true))
				{
					NoneChecked = false;

				}			
			}
		
		if(NoneChecked)
			{
			for (counter = 0; counter < theForm.elements.length; counter++)
				{
				tempElement = theForm.elements[counter];
				if ((tempElement.name.substring(0,11) == strCode.substring(0,11)) && (tempElement.value.substring(8,11) == "999"))
					{
						tempElement.checked = true;
					}			
				}
			}
	
	}
//============================== this function will make sure the field has numeric value in it
function ISNUMERIC(code)
	{
	if (eval(document.forms[0].elements[code]))
		{
		return (document.forms[0].elements[code].value.length == 0 || !isNaN(document.forms[0].elements[code].value));
		}
	}
//============================== this function will make sure that every character in the string is a letter
function ISLETTER(code)
	{
	if (eval(document.forms[0].elements[code]))
		{
		var i = document.forms[0].elements[code].value.length;
			while (i)
			{
			var c = document.forms[0].elements[code].value.charAt(--i);
			if (!(("a" <= c && c <= "z") || ("A" <= c && c <= "Z")))
				{
				return false;
				}
			}
		}
		return true;
	}
//============================== this cheks to make sure the string is in a valid zip code format
function ISZIP(code)
	{
	if (eval(document.forms[0].elements[code]))
		{
		var i = document.forms[0].elements[code].value.length;

		if (i > 0 && i != 3)
			{
			return false;
			}
		while (i)
			{
			if (isNaN(document.forms[0].elements[code].value.charAt(--i)))
				{
				return false;
				}
			}
			return true;
		}
	}
//============================== this checks to make sure the question was answered
function ISANSWERED(item)
	{
	var frm = document.forms[0];
	var found = false;
	for (var i = 0; i <= frm.length - 1; i++)
		{
		if (frm.elements[i].name == item)
			{
			found = true;
			if (frm.elements[i].type == "text" || frm.elements[i].type == "textarea")
				{
				var x = frm.elements[i].value.length;
				while (x)
					{
					var c = frm.elements[i].value.charAt(--x);
					if (c != " ")
						{
						return true;
						}
					}
				return false;
				}
			if (frm.elements[i].type == "select-multiple" || frm.elements[i].type == "select-one")
				{
				if (frm.elements[i].selectedIndex > 0)
					{
					return true;
					}
				return false;
				}
			if (frm.elements[i].type == "radio")
				{
				if (frm.elements[i].checked)
					{
					return true;
					}
				}
			if (frm.elements[i].type == "checkbox")
				{
				if (frm.elements[i].checked)
					{
					return true;
					}
				}
			} 
		}
	if (found)
		{
		return false;
		}
	}
//============================== this checks for a valid date between 1900 and 2100 using /-\. as valid seperators 
function ISDATE(code, future)
{
	if (ISCODE(code)){
		if (eval(document.forms[0].elements[code])){
		   code=document.forms[0].elements[code].value;  //if object exists
		}
	}
	code = yearFix(code);	        
	var re = new RegExp("^((\\d{2}|\\d{1})([ \\/.-])(\\d{2}|\\d{1})\\3(\\d{4}|\\d{2}))$");
	if (re.test(code)){
		re = new RegExp("[ \\/.-]");
		var a = code.split(re);
		var ndate = new Date(a[2], a[0] - 1, a[1]);
		if (!(a[0] != ndate.getMonth() + 1 || isNaN(ndate) || ndate.getFullYear() < 1900 || ndate.getYear() > 2100)){
			if (!(future && ndate > new Date())){
				return true;
			}
		}
	}
	return !(code.length);
}

//returns the diffrence between 2 dates (the second date is optional and assumes today if it is not passed in) 
//in strPer valid values for strPer are: M(onth), D(ay), or Y(ear)
function DATEDIFF(strPer, strDate1, strDate2)
{
   if(strDate2==null){
      var dt = new Date();
      strDate2=dt.getUTCMonth() + '/' + dt.getUTCDay() + '/' + dt.getFullYear();
   }
   if (ISDATE(strDate1,false) && ISDATE(strDate2,false))
   {
      if (ISCODE(strDate1))
             strDate1=document.forms[0].elements[strDate1].value;
      if (ISCODE(strDate2))
             strDate2=document.forms[0].elements[strDate2].value;
   }
   else return -1
   strDate1 = yearFix(strDate1);
   //strDate2 = yearFix(strDate2);
   var dtDate1 = new Date(strDate1);
   var dtDate2 = new Date(strDate2);
   var intDiff = Math.abs(dtDate1.valueOf() - dtDate2.valueOf());
   switch (strPer.toLowerCase()){
      case "d" :
          return(intDiff / (1000 * 60 * 60 * 24))
          break;
      case "m" :
          return(intDiff / (1000 * 60 * 60 * 24 * 365.25/12))
          break;
      case "y" :
          return(intDiff / (1000 * 60 * 60 * 24 * 365.25))
          break;
   }
   return -1;
}

function ISCODE(code)
{
        var re = /\d{3}_\d{3}_\d{3}/;
        return(re.test(code));
}

function yearFix(fixDate){
	var tempStr = "", tempSubStr ="";
	if(fixDate.length == 8){
		tempSubStr = fixDate.substr(4,4);
		if(tempSubStr.search('/') != -1){
			tempStr = fixDate.substr(6,2);
			if(tempStr <= 50){
				tempStr = "20" + tempStr;
			}else{
				tempStr = "19" + tempStr;
			};
		};
		fixDate = fixDate.substr(0,6) + tempStr;
	};
	return fixDate;
}

// -->
