function check_numeric(which) {
	var cornum = which.value.replace(/[^\d]/g,'');

	if (cornum != which.value)
		return false;

	return true;
}

function check_fields() {

	errMsg = false;
	errTxt = "";
	emailerr = false;

	ai=0;
	di=0;

	if ( document.reg.name.value == "" ) {
		errMsg = true;
		errTxt += "You must supply a registration name.\n\nThe registration name is matched to the registration key. The name you enter here will also\nneed to be entered into the i-Catcher software.\n\n";
	}

	if ( document.reg.name.value.length <6 ) {
		errMsg = true;
		errTxt += "You must supply a registration name longer than six characters.\n\n";
	}

	ai=document.reg.email.value.indexOf('@');
	di=document.reg.email.value.lastIndexOf('.');

	if ( document.reg.email.value == "" ) {
		emailerr = true;
	}

	if ((ai<0) || (di<ai) || (ai==0)) {
		emailerr = true;
        }

 	if (emailerr) {
		errMsg = true;
		errTxt += "You must supply a valid email address.\n\n Registration keys are ONLY sent by email. If a valid email address is not entered you will\nNOT be able to receive your registration key.\n\n";
	}

	if ( errMsg == true ) {
		alert("One or more of the mandatory registration fields has not been completed correctly. Please\nCorrect the following errors:\n\n"+ errTxt);
		return false;
	}

	if ( errMsg == false ) {
		return true;
	}

	return false;
}

function do_click() {

	if (( check_fields() == true) && (submitted == false)) {
		submitted = true;

		document.reg.submit();
	}
}

var submitted = false;


