function emailvalidation(entered, alertbox)
{
// E-mail Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
apos=value.indexOf("@"); 
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>4 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
} 

function emptyvalidation(entered, alertbox)
{
// Emptyfield Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}

function getCheckedButton(group,form,alertbox) {
if (typeof group == 'string') group = form.elements[group];
for (var i = 0, n = group.length; i < n; ++i)
if (group[i].checked) return true;
alert(alertbox);
return false;
}

function quizValidation(thisform)
{
	with (thisform)
		{
			if (getCheckedButton('q1',thisform,"Please answer question no. 1")==false) {return false;};
			if (getCheckedButton('q2',thisform,"Please answer question no. 2")==false) {return false;};
			if (getCheckedButton('q3',thisform,"Please answer question no. 3")==false) {return false;};
			if (getCheckedButton('q4',thisform,"Please answer question no. 4")==false) {return false;};
			if (getCheckedButton('q5',thisform,"Please answer question no. 5")==false) {return false;};
			if (getCheckedButton('q6',thisform,"Please answer question no. 6")==false) {return false;};
			if (getCheckedButton('q7',thisform,"Please answer question no. 7")==false) {return false;};
			if (getCheckedButton('q8',thisform,"Please answer question no. 8")==false) {return false;};
			if (getCheckedButton('q9',thisform,"Please answer question no. 9")==false) {return false;};
			if (getCheckedButton('q10',thisform,"Please answer question no. 10")==false) {return false;};
			if (getCheckedButton('q11',thisform,"Please answer question no. 11")==false) {return false;};
			if (getCheckedButton('q12',thisform,"Please answer question no. 12")==false) {return false;};
			if (getCheckedButton('q13',thisform,"Please answer question no. 13")==false) {return false;};
			if (getCheckedButton('q14',thisform,"Please answer question no. 14")==false) {return false;};
			if (getCheckedButton('q15',thisform,"Please answer question no. 15")==false) {return false;};
			if (getCheckedButton('q16',thisform,"Please answer question no. 16")==false) {return false;};
			if (getCheckedButton('q17',thisform,"Please answer question no. 17")==false) {return false;};
			if (getCheckedButton('q18',thisform,"Please answer question no. 18")==false) {return false;};
			if (getCheckedButton('q19',thisform,"Please answer question no. 19")==false) {return false;};
			if (getCheckedButton('q20',thisform,"Please answer question no. 20")==false) {return false;};
			if (emptyvalidation(first_name,"Please type your first name.")==false) {first_name.focus(); return false;};
			if (emptyvalidation(last_name,"Please type your last name.")==false) {last_name.focus(); return false;};
			if (emailvalidation(email,"The email address you entered isn't valid. Please retype the address.")==false) {email.focus(); return false;};
		}
	return true;
}

function selectAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
}