// turn on function
function turnOn(DivID) {
	if (document.getElementById) { //gecko(NN6) & IE 5+
		document.getElementById(DivID).style.visibility = "visible";
		document.getElementById(DivID).style.display = "block";
	} else if (document.all) { // IE 4+
		document.all[DivID].style.visibility = "visible";
		document.all[DivID].style.display = "block";
	} else if (document.layers) { // NS4+
		document.layers[DivID].visibility = "show";
		document.layers[DivID].display = "block";
	} else {
		// nothing
	}
}

// turn off function
function turnOff(DivID) {
	if (document.getElementById) { //gecko(NN6) & IE 5+
		document.getElementById(DivID).style.visibility = "hidden";
		document.getElementById(DivID).style.display = "none";
	} else if (document.all) { // IE 4+
		document.all[DivID].style.visibility = "hidden";
		document.all[DivID].style.display = "none";
	} else if (document.layers) { // NS4+
		document.layers[DivID].visibility = "hide";
		document.layers[DivID].display = "none";
	} else {
		// nothing
	}
}

function checkRegistrationForm() {

	var ref = document.registration;
	var error = "";

	if (emptyText(ref.name)) error += "- Name\n";
	if (emptyText(ref.email)) error += "- e-Mail Address\n";
	if (emptyText(ref.dob)) error += "- Date Of Birth\n";
	if (emptyText(ref.height)) error += "- Height\n";
	if (emptyText(ref.weight)) error += "- Weight\n";

/*
	if (emptyText(ref.exercisew1) || emptyText(ref.exerciseh1)) error += "- Conconi exercise data\n";
	if (emptyText(ref.recoveryw1) || emptyText(ref.recoveryh1)) error += "- Conconi recovery data\n";
*/
	if (!emptyText(ref.email) && !validEmail(ref.email.value)) error += "- Enter a valid e-mail address\n";
	if (!emptyText(ref.dob) && !isDate(ref.dob.value)) error += "- Enter a valid date of birth mm/dd/yyyy\n";

	if (!emptyText(ref.weight) && !isInteger(ref.weight)) error += "- Weight should a whole number value\n";
	if (!emptyText(ref.height) && !isInteger(ref.height)) error += "- Height should a whole number value\n";

	//Validate that all conconi data is integars
/*
	var periods = new Array("exercise", "recovery")
	var conconiError = true;
	if($RF('regsitration', 'level') == 'conconi')
	{
	   for(var j=0; j<2; j++)
	   {
		var period = periods[j];
		var i=1;
		while(ref[period+"w"+i] && ref[period+"w"+i].value!="")
		{
			if(!isInteger(ref[period+"w"+i].value) || !isInteger(ref[period+"h"+i].value))
			{
				error += "- Conconi data must be whole number values\n";
				conconiError = true;
				break;
			}
			i++;
		}
		if(conconiError)
		{
			break;
		}
	   }
	}
*/


	if (error != "") {
		alert("Please ensure you fill in the following fields in the form:\n" + error);
		return false;
	}
	else {
		return true;
	}
}