	var form;
	
	//checks text boxes
	function check(thing, str)
	{
		thing = eval("form." + thing);
		if (thing.value != "") return true;
		else {
			alert(str);
			thing.focus();
			return false;
			}
	}


	//checks radio buttons
	function check_radio(thing, str)
	{
		numChecked = 0;
		thing = eval("form." + thing);
		for (i=0, n=thing.length; i<n; i++) {
			if (thing[i].checked) {
				numChecked = 1;
			}
		}

		if (numChecked == 1) return true;
		else { 
			alert(str);
			thing[0].focus();
			return false;
		}
	}


	//checks check boxes
	function check_box(thing, str)
	{
		numChecked = 0;
		thing = eval("form." + thing);
		for (i=0, n=thing.length; i<n; i++) {
			if (thing[i].checked) {
				numChecked++;
			}
		}

		if (numChecked > 0) return true;
		else { 
			alert(str);
			thing[0].focus();
			return false;
		}
	}


	//checks emails
	function check_email(thing, str)
	{
		thing = eval("form." + thing);
		if (thing.value.indexOf("@")!=-1 && thing.value.indexOf(".")!=-1 && thing.value.indexOf(" ")==-1 && thing.value.length>6) return true;
		else {
			alert(str);
			thing.focus();
			return false;
		}
	}

	
	//checks for all numbers - you supply the number of digits
	function check_num(thing, amount, str)
	{
		thing = eval("form." + thing);
	
		var digits="0123456789";
		var nums = "yes";

		  if (thing.value.length != amount)
			{
				nums = "no";

			} else {

				for(i=0; i<amount; i++)
				{if (digits.indexOf(thing.value.charAt(i))<0)
				{nums = "no";
				break}
				  }	
			}

		if (nums == "yes") return true;
		else {
			alert(str);
			thing.focus();
			return false;
			}
	}

	//checks for all numbers
	function check_num_all(thing, str)
	{
		thing = eval("form." + thing);
		
		if (thing.value != ""){
		
			var digits="0123456789";
			var nums = "yes";
			
			  for (i=0; i<thing.value.length; i++)
					{
					if (digits.indexOf(thing.value.charAt(i))<0)
					{	
						nums = "no";
						break
					}
				}	
				

			if (nums == "yes") return true;
			else {
				alert(str);
				thing.focus();
				return false;
				}
		} else {
			alert(str);
			thing.focus();
			return false;
			}
	}


	//checks for past dates
	function check_date(thing_month, thing_day, thing_year, str)
	{
				
		thing_month = eval("form." + thing_month);
		thing_day = eval("form." + thing_day);
		thing_year = eval("form." + thing_year);

		now = new Date();
		current_year = now.getFullYear();
		current_month = now.getMonth() +1;
		current_day = now.getDate();
						
		if (thing_year.value > current_year){
			return true;
		} else if (thing_year.value == current_year) {
			if (thing_month.value > current_month){
				return true;
			} else if (thing_month.value == current_month){
				if (thing_day.value >= current_day){
					return true;
				}
			}
		}
				
		alert(str);
		thing_month.focus();
		return false;

	}

	//checks for from and to times
	function check_time(thing_hour_start, thing_min_start, thing_section_start, thing_hour_end, thing_min_end, thing_section_end, str)
	{
				
		thing_hour_start = eval("form." + thing_hour_start);
		thing_min_start = eval("form." + thing_min_start);
		thing_section_start = eval("form." + thing_section_start);

		thing_hour_end = eval("form." + thing_hour_end);
		thing_min_end = eval("form." + thing_min_end);
		thing_section_end = eval("form." + thing_section_end);

		
		if ((thing_hour_start.value == thing_hour_end.value) && (thing_min_start.value == thing_min_end.value) && (thing_section_start.value == thing_section_end.value) )
		{
			//skips to bottom

		} else {

			if (thing_section_start.value != thing_section_end.value) {
				return true;
			} else if (thing_hour_end.value > thing_hour_start.value){
				return true;
			} else if (thing_hour_end.value == thing_hour_start.value) {
				if (thing_min_end.value > thing_min_start.value){
					return true;
				} 
			}
		} 
				
		alert(str);
		thing_hour_start.focus();
		return false;

	}


	