<!--

//disable enter/return key
function stopRKey(evt) { 
  var evt = (evt) ? evt : ((event) ? event : null); 
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); 
  if ((evt.keyCode == 13))  {return false;}
  //if ((evt.keyCode == 13) && (node.type=="text"))  {return false;}
} 

document.onkeypress = stopRKey;

function checkDeelnemer(txtValue)
{
	if (txtValue != "")
	{
		document.getElementById("tdNaamDeelnemer").innerHTML = '-';
		document.getElementById("tdVoornaamDeelnemer").innerHTML = '-';
		document.getElementById("tdNaamDeelnemer").align = 'center';
		document.getElementById("tdVoornaamDeelnemer").align = 'center';
	}else if (document.getElementById("tdNaamDeelnemer").innerHTML == '-'){
		document.getElementById("tdNaamDeelnemer").innerHTML = '<input type="text" name="txtNaamDeelnemer" onkeyup="checkNaamDeelnemer(this.value)" tabindex=1 class="green" maxlength="50" />';
		document.getElementById("tdVoornaamDeelnemer").innerHTML = '<input type="text" name="txtVoornaamDeelnemer" onkeyup="checkNaamDeelnemer(this.value)" tabindex=2 class="green" maxlength="50" />	';
		document.getElementById("tdNaamDeelnemer").align = 'left';
		document.getElementById("tdVoornaamDeelnemer").align = 'left';
	}
}

function checkNaamDeelnemer(txtValue)
{
	if (txtValue != "")
	{
		document.getElementById("tdDeelnemer").innerHTML = '-';
		document.getElementById("tdDeelnemer").align = 'center';
	}else if (document.getElementById("txtNaamDeelnemer").value == "" && document.getElementById("txtVoornaamDeelnemer").value == ""){
		document.getElementById("tdDeelnemer").innerHTML = '<input type="text" name="txtDeelnemer" onkeyup="checkDeelnemer(this.value)" tabindex=1 class="green" maxlength="50" />';
		document.getElementById("tdDeelnemer").align = 'left';
	}
}

function init()
{
	legal = ""
	prive = ""
	amateur = ""
	trophies = ""
	publi = ""

	var el = document.getElementById("tdLegalPubli");
	if(el.currentStyle) {   // for msie
		el.style.backgroundColor = "";
		el.style.color = "";
	} else {   // for others
		el.style.setProperty("background-color", "");
	}

	var el = document.getElementById("tdPriveAmateurPubli");
	if(el.currentStyle) {   // for msie
		el.style.backgroundColor = "";
		el.style.color = "";
	} else {   // for others
		el.style.setProperty("background-color", "");
	}

	var el = document.getElementById("tdTrophiesPubli");
	if(el.currentStyle) {   // for msie
		el.style.backgroundColor = "";
		el.style.color = "";
	} else {   // for others
		el.style.setProperty("background-color", "");
	}

	var el = document.getElementById("tdLegalNormaal");
	if(el.currentStyle) {   // for msie
		el.style.backgroundColor = "";
		el.style.color = "";
	} else {   // for others
		el.style.setProperty("background-color", "");
	}

	var el = document.getElementById("tdPriveAmateurNormaal");
	if(el.currentStyle) {   // for msie
		el.style.backgroundColor = "";
		el.style.color = "";
	} else {   // for others
		el.style.setProperty("background-color", "");
	}

	var el = document.getElementById("tdTrophiesNormaal");
	if(el.currentStyle) {   // for msie
		el.style.backgroundColor = "";
		el.style.color = "";
	} else {   // for others
		el.style.setProperty("background-color", "");
	}
}

function checkInschrijving()
{
	init();

	// LEGAL
	for (i=0; i < document.all.rdoTI1.length; i++) {
		if (document.getElementById("rdoTI1" + i).checked == true){
			legal = i
		}
	}
	// PRIVE
	for (i=0; i < document.all.rdoTI2.length; i++) {
		if (document.getElementById("rdoTI2" + i).checked == true){
			prive = i
		}
	}
	// AMATEUR
	for (i=0; i < document.all.rdoTI3.length; i++) {
		if (document.getElementById("rdoTI3" + i).checked == true){
			amateur = i
		}
	}
	// TROPHIES
	for (i=0; i < document.all.rdoTI4.length; i++) {
		if (document.getElementById("rdoTI4" + i).checked == true){
			trophies = i
		}
	}
	// PUBLICITEIT
	for (i=0; i < document.all.rdoTI5.length; i++) {
		if (document.getElementById("rdoTI5" + i).checked == true){
			publi = i
		}
	}
	
	/*
	if (legal == 0 && amateur == 0 && prive == 0 && trophies == 0) {
		alert('Remark: Please fill in at least one "YES" with either Légal/Privé/Amateur/Trophies. Or your entry will not be submitted!');
	}
	*/

	if (legal == 1 && publi == 1) {
		var el = document.getElementById("tdLegalPubli");
		if(el.currentStyle) {   // for msie
			el.style.backgroundColor = "maroon";
			el.style.color = "white";
		} else {   // for others
			el.style.setProperty("background-color", "maroon");
		}
	}

	if ((prive == 1 || amateur == 1) && publi == 1) {
		var el = document.getElementById("tdPriveAmateurPubli");
		if(el.currentStyle) {   // for msie
			el.style.backgroundColor = "maroon";
			el.style.color = "white";
		} else {   // for others
			el.style.setProperty("background-color", "maroon");
		}
	}

	if ((trophies == 1) && publi == 1) {
		var el = document.getElementById("tdTrophiesPubli");
		if(el.currentStyle) {   // for msie
			el.style.backgroundColor = "maroon";
			el.style.color = "white";
		} else {   // for others
			el.style.setProperty("background-color", "maroon");
		}
	}

	if (legal == 1 && publi == 0) {
		var el = document.getElementById("tdLegalNormaal");
		if(el.currentStyle) {   // for msie
			el.style.backgroundColor = "maroon";
			el.style.color = "white";
		} else {   // for others
			el.style.setProperty("background-color", "maroon");
		}
	}

	if ((prive == 1 || amateur == 1) && publi == 0) {
		var el = document.getElementById("tdPriveAmateurNormaal");
		if(el.currentStyle) {   // for msie
			el.style.backgroundColor = "maroon";
			el.style.color = "white";
		} else {   // for others
			el.style.setProperty("background-color", "maroon");
		}
	}

	if ((trophies == 1) && publi == 0) {
		var el = document.getElementById("tdTrophiesNormaal");
		if(el.currentStyle) {   // for msie
			el.style.backgroundColor = "maroon";
			el.style.color = "white";
		} else {   // for others
			el.style.setProperty("background-color", "maroon");
		}
	}
}

function setToNo(type1, type2, type3)
{
	document.getElementById(type1 + '0').checked = true;
	document.getElementById(type2 + '0').checked = true;
	document.getElementById(type3 + '0').checked = true;

	document.getElementById(type1).value = "nee";
	document.getElementById(type2).value = "nee";
	document.getElementById(type3).value = "nee";
}

function seedingInfoCheck(type1)
{
	document.getElementById(type1 + '0').checked = true;

	document.getElementById(type1).value = "nee";
}

var keybNumeric = new keybEdit('01234567890','Numeric input only.');
var keybDate =  new keybEdit('01234567890/','Date input only (dd/mm/yyyy)');
var keybNumericNM = new keybEdit('01234567890');
var keybDateNM = new keybEdit('01234567890/');
var keybPhone = new keybEdit('01234567890+','Numeric input only or "+" sign');

function keybEdit(strValid, strMsg) {
	/*	The purpose of this function is to be a constructor for the keybEdit object.
		keybEdit objects are used by the function editKeyBoard to determine which keystrokes are valid for form objects.
		In addition, if an error occurs, they provide the error message.
						
		Please note that the strValid is converted to both upper and lower case by this constructor.  Also, that the error message is prefixed with 'Error:'.
						
		The properties for this object are the following:
			valid	=	Valid input characters
			message	=	Error message
			
		The methods for this object are the following:
			getValid()	=	Returns a string containing valid
							characters.
			getMessage()=	Returns a string containing the
							error message.
	*/

	//	Variables
	var reWork = new RegExp('[a-z]','gi');		//	Regular expression\

	//	Properties
	if(reWork.test(strValid))
		this.valid = strValid.toLowerCase() + strValid.toUpperCase();
	else
		this.valid = strValid;

	if((strMsg == null) || (typeof(strMsg) == 'undefined'))
		this.message = '';
	else
		this.message = strMsg;

	//	Methods
	this.getValid = keybEditGetValid;
	this.getMessage = keybEditGetMessage;
	
	function keybEditGetValid() {
	/*	The purpose of this function act as the getValid method for the keybEdit object.  Please note that most of the following logic is for handling numeric keypad input. */
		return this.valid.toString();
	}
	
	function keybEditGetMessage() {
	/*	The purpose of this function act as the getMessage method for the keybEdit object. */
		return this.message;
	}
}

void function editKeyBoard(objForm, objKeyb) {
	/*	The purpose of this function is to edit edit keyboard input to determine if the keystrokes are valid. */

	strWork = objKeyb.getValid();
	strMsg = '';							// Error message
	blnValidChar = false;					// Valid character flag

	// Validate input
	if(!blnValidChar)
		for(i=0;i < strWork.length;i++)
			if(window.event.keyCode == strWork.charCodeAt(i)) {
				blnValidChar = true;

				break;
			}

	// Build error message
	if(!blnValidChar) {
		if(objKeyb.getMessage().toString().length != 0)
			alert('Error: ' + objKeyb.getMessage());

		window.event.returnValue = false;		// Clear invalid character
		objForm.focus();						// Set focus
	}
}

function fillGroup(klasse)
{
	strDdn = '<select name="txtDivisieWagen" id="txtDivisieWagen" style="width:240px;" class="green"  onchange="var w = document.frmEntry.txtDivisieWagen.selectedIndex;var selected_text = document.frmEntry.txtDivisieWagen.options[w].text;document.getElementById(\'txtPPGroep\').value=selected_text;">';
	strDdn += '<option value=""> - please select - </option>';
	switch (klasse)
	{
	case '1':
		strDdn += '<option value="S2000-Rally: 1.6 T engine">S2000-Rally: 1.6 T engine</option>';
		break;
	case '2':
		strDdn += '<option value="S2000-Rally: 2.0 Atmospheric">S2000-Rally: 2.0 Atmospheric</option>';
		strDdn += '<option value="Group R4">Group R4</option>';
		break;
	case '3':
		strDdn += '<option value="Group N car over 2000cc (current N4)">Group N car over 2000cc (current N4)</option>';
		break;
	case '4':
		strDdn += '<option value="RGT Cars">RGT Cars</option>';
		break;
	case '5':
		strDdn += '<option value="Group A car over 1600cc and up to 2000cc">Group A car over 1600cc and up to 2000cc</option>';
		strDdn += '<option value="Super 1600">Super 1600</option>';
		strDdn += '<option value="R2C (over 1600cc and up to 2000cc)">R2C (over 1600cc and up to 2000cc)</option>';
		strDdn += '<option value="R3C (over 1600cc and up to 2000cc)">R3C (over 1600cc and up to 2000cc)</option>';
		strDdn += '<option value="R3T (up to 1600cc / nominal)">R3T (up to 1600cc / nominal)</option>';
		strDdn += '<option value="R3D (up to 2000cc / nominal)">R3D (up to 2000cc / nominal)</option>';
		break;
	case '6':
		strDdn += '<option value="Group A car over 1400cc and up to 1600cc">Group A car over 1400cc and up to 1600cc</option>';
		strDdn += '<option value="R2B (over 1400cc and up to 1600cc)">R2B (over 1400cc and up to 1600cc)</option>';
		strDdn += '<option value="kit-car over 1400cc and up to 1600cc">kit-car over 1400cc and up to 1600cc</option>';
		break;
	case '7':
		strDdn += '<option value="Group A car up to 1400cc">Group A car up to 1400cc</option>';
		strDdn += '<option value="kit-car up to 1400cc">kit-car up to 1400cc</option>';
		break;
	case '8':
		strDdn += '<option value="Group N car over 1600cc and up to 2000cc">Group N car over 1600cc and up to 2000cc</option>';
		break;
	case '9':
		strDdn += '<option value="Group N car over 1400cc and up to 1600cc">Group N car over 1400cc and up to 1600cc</option>';
		strDdn += '<option value="R1B (over 1400cc and up to 1600cc)">R1B (over 1400cc and up to 1600cc)</option>';
		break;
	case '10':
		strDdn += '<option value="Group N car up to 1400cc">Group N car up to 1400cc</option>';
		strDdn += '<option value="R1A (up to 1400cc)">R1A (up to 1400cc)</option>';
		break;
	case 'Klasse 4 BRC':
        strDdn += '<option value="Group NGT21">Group NGT21</option>';
	    strDdn += '<option value="Group NGT22">Group NGT22</option>';
		strDdn += '<option value="Group NGT23">Group NGT23</option>';
		strDdn += '<option value="Group GTP24">Group GTP24</option>';
		break;
	}
	strDdn += '</select>';

	document.getElementById('divDivisieWagen').innerHTML = strDdn;
}

//-->
