<!--
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);

ns3up = (browserName == "Netscape" && browserVer >= 3);
ie4up = (browserName.indexOf("Microsoft") >= 0 && browserVer >= 4);
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; 
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
  	x.src=x.oSrc;
}

function bookmarkUs()
{
	window.external.AddFavorite('http://www.trafficsigns.co.za', 'Traffic Signs - The easiest way to master your traffic signs');
}

function recommendUs(p)
{
	window.open(p+'recommend.php', '', 'width=450,height=300,scrollable=yes,resizeable=yes')
}

function right(e) {
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
		return false;
	else if (navigator.appName == 'Microsoft Internet Explorer' && 	(event.button == 2 || event.button == 3)) {
		alert("Copyright TrafficSigns.co.za - All Rights Reserved.\nCopying of content and / or images is strictly prohibited!");
		return false;
	}
	return true;
}

function checkAllQuestionsAnswered(numQs)
{
	fv = new formValidator();
	for (n = 1; n <= (numQs); n++)
	{
		switch (n)
		{
			case 1:
				if (!fv.isCheckedRadio("chkQuestion1"))
					fv.raiseError("The first question has not been answered.");
				break;
			case 2:
				if (!fv.isCheckedRadio("chkQuestion2"))
					fv.raiseError("The second question has not been answered.");
				break;
			case 3:
				if (!fv.isCheckedRadio("chkQuestion3"))
					fv.raiseError("The third question has not been answered.");
				break;
			case 4:
				if (!fv.isCheckedRadio("chkQuestion4"))
					fv.raiseError("The fourth question has not been answered.");
				break;
		}
	}

	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
		return true;
}

function AllQuestionsAnswered(numQs)
{
	fv = new formValidator();

	switch (numQs)
	{
		case '1':
			if (fv.isCheckedRadio("chkQuestion1"))
				return true;
			else
				return false;
		break;
		case '2':
			if (fv.isCheckedRadio("chkQuestion1") && fv.isCheckedRadio("chkQuestion2"))
				return true;
			else
				return false;
		break;
		case '3':
			if (fv.isCheckedRadio("chkQuestion1") && fv.isCheckedRadio("chkQuestion2") && fv.isCheckedRadio("chkQuestion3"))
				return true;
			else
				return false;
		break;
		case '4':
			if (fv.isCheckedRadio("chkQuestion1") && fv.isCheckedRadio("chkQuestion2") && fv.isCheckedRadio("chkQuestion3") && fv.isCheckedRadio("chkQuestion4"))
			{
				return true;
			}
			else
				return false;
		break;
	}
}

function confirmExit()
{
	return confirm("You have not completed the 4 questions currently displayed.\nClick CANCEL to continue completing the 4 questions displayed.\nClick OK to exit from the testing area without saving.");
}

function goSaveAndExit()
{
	fv = new formValidator();
	fv.findObj("go").value = "exit";
	document.frmTestArea.submit();
}

function goRevision()
{
	fv = new formValidator();
	fv.findObj("go").value = "revision";
	document.frmTestArea.submit();
}

function checkStartTest()
{
	fv = new formValidator();
	
	if (!fv.isSelected("testtype"))
		fv.raiseError("Please specify what licence test you would like to do.");
		
	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
		return true;
}

function validateForgottenPassword()
{
	fv = new formValidator();
	
	if (fv.isEmpty("your_email"))
		fv.raiseError("Please specify your email address.");
	else
	{
		if (!fv.isEmailAddress("your_email"))
			fv.raiseError("Please specify a valid email address.");
	}
	
	
	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
		return true;
}

function validateRecommend()
{
	fv = new formValidator();
	
	if (fv.isEmpty("your_name"))
		fv.raiseError("Please specify your name.");
	
	if (fv.isEmpty("your_email"))
		fv.raiseError("Please specify your email.");
	else
	{
		if (!fv.isEmailAddress("your_email"))
			fv.raiseError("Please specify a valid email address.");
	}
		
	if (fv.isEmpty("friend_name"))
		fv.raiseError("Please specify your friend's name.");

	if (fv.isEmpty("friend_email"))
		fv.raiseError("Please specify your friend's email address.");
	else
	{
		if (!fv.isEmailAddress("friend_email"))
			fv.raiseError("Please specify a valid email address for your friend.");
	}

	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
		return true;
}

function validateContact()
{
	
	fv = new formValidator();
	
	if (fv.isEmpty("first_name"))
		fv.raiseError("Please specify your first name.");

	if (fv.isEmpty("last_name"))
		fv.raiseError("Please specify your surname name.");
		
	if (fv.isEmpty("telephone_number"))
		fv.raiseError("Please specify your telephone number.");
	
	if (fv.isEmpty("your_email"))
		fv.raiseError("Please specify your email.");
	else
	{
		if (!fv.isEmailAddress("your_email"))
			fv.raiseError("Please specify a your valid email address.");
	}
		
	if (!fv.isSelected("subject"))
		fv.raiseError("Please specify a subject for your email.");
	
	if (fv.isEmpty("your_comments"))
		fv.raiseError("Please specify your comment / query.");
		
	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
		return true;	
}

function validateLogin()
{
	fv = new formValidator();
	
	if (fv.isEmpty("user_email"))
		fv.raiseError("Please specify your email address to log in")
		
	if (fv.isEmpty("user_password"))
		fv.raiseError("Please specify your password to log in.")

	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
		return true;	
}

function validateTesterDetails()
{
	fv = new formValidator();
	
	if (fv.isEmpty("firstname"))
		fv.raiseError("Please specify your first name.");
		
	if (fv.isEmpty("surname"))
		fv.raiseError("Please specify your surname.");
		
	if (fv.isEmpty("email"))
		fv.raiseError("Please specify your email address.");
	else
	{
		if (!fv.isEmailAddress("email"))
			fv.raiseError("Please specify a valid email address.");
	}
	
	if (fv.isEmpty("dob"))
		fv.raiseError("Please specify your date of birth.");
		
	if (fv.findObj("dob").value == "YYYY-MM-DD")
		fv.raiseError("Please specify your date of birth.");
		
	if (!fv.isSelected("sex"))
		fv.raiseError("Please specify your sex.");
		
	if (!fv.isSelected("province"))
		fv.raiseError("Please specify in which province you reside.");
		
	
	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
		return true;	
}


function validateRegistration()
{
	fv = new formValidator();
	
	if (fv.isEmpty("firstname"))
		fv.raiseError("Please specify your first name.");
		
	if (fv.isEmpty("surname"))
		fv.raiseError("Please specify your surname.");

	if (!fv.isEmpty("dob"))
	{
		if (fv.findObj("dob").value == "YYYY-MM-DD")
		{
			fv.raiseError("Please specify your date of birth.");
		}
		else
		{
			dateOfBirth = fv.findObj("dob").value;
			dobYear = dateOfBirth.substr(0, 4);
			dobMonth = dateOfBirth.substr(5, 2);
			dobDay = dateOfBirth.substr(8, 2);
			
			d = new Date();
			latestYear = d.getFullYear()-10;
	
/*			if ( (dobYear < 1945) || (dobYear >= latestYear) )
				fv.raiseError("Please specify a valid Year for your date of birth,\n -- you must be at least 10 years old"); */
		
			if (dobMonth > 12)
				fv.raiseError("Please specify a valid Month for your date of birth");
			
			if (dobDay > 31)
				fv.raiseError("Please specify a valid Day for your date of birth");
		
		}
				
	}
	else
		fv.raiseError("Please specify your date of birth.");
	
	if (!fv.isSelected("sex"))
		fv.raiseError("Please specify your sex.");
		
	if (!fv.isSelected("province"))
		fv.raiseError("Please specify in which province you reside.");
		
	if (fv.isEmpty("email"))
		fv.raiseError("Please specify your email address.");
	else
	{
		if (!fv.isEmailAddress("email"))
			fv.raiseError("Please specify a valid email address.");
	}
	
	if (fv.isEmpty("password"))
		fv.raiseError("Please specify your password.");
	
	if (fv.isEmpty("confirm_password"))
		fv.raiseError("Please confirm your password.");
		
	if ((!fv.isEmpty("password")) && (!fv.isEmpty("confirm_password")))
	{
		if (fv.findObj("password").value != fv.findObj("confirm_password").value)
			fv.raiseError("The passwords specified do not match.");
	}

	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
		return true;	
}

function displayLightMotorControls()
{
	window.open('light-motor-vehicle.php', '', 'width=350,height=520,scrollable=yes,resizeable=yes')
}

function displayHeavyMotorControls()
{
	window.open('heavy-motor-vehicle.php', '', 'width=350,height=510,scrollable=yes,resizeable=yes')
}

function displayLightMotorAutomaticControls()
{
	window.open('light-vehicle-automatic.php', '', 'width=350,height=520,scrollable=yes,resizeable=yes')
}

function displayMotorCycles()
{
	window.open('motor-cycle.php', '', 'width=350,height=480,scrollable=yes,resizeable=yes')
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;

-->
