function roll_over2(visi,invis){
document.getElementById(visi).style.visibility='hidden';document.getElementById(invis).style.visibility='visible'
}
function roll_out2(invis,visi){
document.getElementById(invis).style.visibility='hidden';document.getElementById(visi).style.visibility='visible'
}
function roll_over(vis,inv,vis2,inv2){
document.getElementById(vis).style.visibility='hidden';document.getElementById(inv).style.visibility='visible';document.getElementById(vis2).style.visibility='hidden';document.getElementById(inv2).style.visibility='visible';
}
function roll_out(invis,visi,invis2,visi2){
document.getElementById(invis).style.visibility='hidden';document.getElementById(visi).style.visibility='visible';document.getElementById(invis2).style.visibility='hidden';document.getElementById(visi2).style.visibility='visible';
}
var pr= new Array();
pr[1]="1 - 4";
pr[2]="5 - 8";
pr[3]="9 - 12";
pr[4]="13 - 16";
pr[5]="17 - 20";
pr[6]="21 - 24";
pr[7]="25 - 28";
pr[8]="29 - 32";
pr[9]="33 - 36";
pr[10]="37 - 40";
pr[11]="41 - 44";
pr[12]="45";

function nav_roll_1(ks,nav,ender){
for (nn=1;nn<=ender;nn++){
if (nn!=nav){document.write(' <a href="tak'+ks+'-'+nn+'.cfm" onMouseover="this.style.color=\'red\'" onMouseout="this.style.color=\'black\'" border="0"><span id="black">'+pr[nn]+'</span></a> |');
}
else{document.write('&nbsp;<span id="green">'+pr[nn]+'</span>&nbsp;|');
}
}
}
function misser(){alert('Coming soon!');
}

function Form1_Validator(theForm)
{
// check to see if the field is blank
if (theForm.TCHR_FNAME.value == "")
{
alert("You must enter a First Name.");
theForm.TCHR_FNAME.focus();
return (false);
}

// check to see if the field is blank
if (theForm.TCHR_SNAME.value == "")
{
alert("You must enter a Surname.");
theForm.TCHR_SNAME.focus();
return (false);
}


// test if valid email address, must have @ and .
var checkEmail = "@.";
var checkStr = theForm.Email.value;
var EmailValid = false;
var EmailAt = false;
var EmailPeriod = false;
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkEmail.length;  j++)
{
if (ch == checkEmail.charAt(j) && ch == "@")
EmailAt = true;
if (ch == checkEmail.charAt(j) && ch == ".")
EmailPeriod = true;
	  if (EmailAt && EmailPeriod)
		break;
	  if (j == checkEmail.length)
		break;
	}
	// if both the @ and . were in the string
if (EmailAt && EmailPeriod)
{
		EmailValid = true
		break;
	}
}
if (!EmailValid)
{
alert("The \"email\" field must be of the form yourname@yourdomain.com");
theForm.Email.focus();
return (false);
}
// require at least 5 characters in the password field
if (theForm.Password.value.length < 5)
{
alert("Please enter at least 5 characters in the \"Password\" field.");
theForm.Password.focus();
return (false);
}

// check if both password fields are the same
if (theForm.Password.value != theForm.Password2.value)
{
	alert("The two passwords are not the same.");
	theForm.Password2.focus();
	return (false);
}
}
function isEmailAddr(email)
{
  var result = false;
  var theStr = new String(email);
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function validRequired(formField,fieldLabel)
{
	var result = true;
	
	if (formField.value == "")
	{
		alert('Please enter a value for the "' + fieldLabel +'" field.');
		formField.focus();
		result = false;
	}
	
	return result;
}


function validEmail(formField,fieldLabel,required)
{
	var result = true;
	
	if (required && !validRequired(formField,fieldLabel))
		result = false;

	if (result && ((formField.value.length < 3) || !isEmailAddr(formField.value)) )
	{
		alert("Please enter a complete email address in the form: yourname@yourdomain.com");
		formField.focus();
		result = false;
	}
   
  return result;

}

function validNum(formField,fieldLabel,required)
{
	var result = true;

	if (required && !validRequired(formField,fieldLabel))
		result = false;
  
 	if (result)
 	{
 		if (!allDigits(formField.value))
 		{
 			alert('Please enter a number for the "' + fieldLabel +'" field.');
			formField.focus();		
			result = false;
		}
	} 
	
	return result;
}


function validInt(formField,fieldLabel,required)
{
	var result = true;

	if (required && !validRequired(formField,fieldLabel))
		result = false;
  
 	if (result)
 	{
 		var num = parseInt(formField.value,10);
 		if (isNaN(num))
 		{
 			alert('Please enter a number for the "' + fieldLabel +'" field.');
			formField.focus();		
			result = false;
		}
	} 
	
	return result;
}



function validateForm(theForm)
{
	// Customize these calls for your form

	// Start ------->
	if (!validRequired(theForm.TCHR_FNAME,"First Name"))
		return false;
		if (!validRequired(theForm.TCHR_SNAME,"Surname"))
		return false;
		if (!validRequired(theForm.PASSWORD,"Password"))
		return false;
		if (!validEmail(theForm.email,"Email Address",true))
		return false;
	
	// <--------- End
	
	return true;
}
