function addslashes(str)
{
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\0/g,'\\0');
	return str;
}

function stripslashes(str)
{
	str=str.replace(/\\'/g,'\'');
	str=str.replace(/\\"/g,'"');
	str=str.replace(/\\0/g,'\0');
	str=str.replace(/\\\\/g,'\\');
	return str;
}

function onFocusSelect (obj)
	{
		obj.select ();
	}
	
	function onChangeNumber (obj, length)
	{
		if (obj)
		{
			if (obj.value.length > 0)
			{
				for (iI = 0; iI < length - obj.value.length; iI++)
				{
					obj.value = '0' + obj.value;
				}
			}
		}
	}

	function onChangeYear (obj)
	{
		if (obj)
		{
			if (obj.value.length > 0)
			{
				iJaar = Number (obj.value, 10);
			
				if (iJaar < 1000)
				{
					if (iJaar > 50 && iJaar < 100)
					{
						iJaar += 1900;
					}
					else
					{
						iJaar += 2000;
					}
				}

				obj.value = iJaar;
			}
		}
	}
	
	function toDatum (objDag, objMaand, objJaar, objDatum, bOk)
	{
		objDatum.value = '';
		onChangeNumber (objDag, 2);
		onChangeNumber (objMaand, 2);
		onChangeYear (objJaar);

		sDag = objDag.value;
		sMaand = objMaand.value;
		sJaar = objJaar.value;

		if (sDag == '' && sMaand == '' && sJaar == '')
		{
			objDatum.value = '';
		}
		else
		{
			objDatum.value = objDag.value + '/' + objMaand.value + '/' + objJaar.value;
		}
		
		//DatumBestaat(objDag, objMaand, objJaar, bOk);
	}
	

	function getParentChildren (obj, strTagname)
	{
		for (var objParent = obj.parentElement; objParent != null && objParent.tagName != strTagname; objParent = objParent.parentElement);
		return objParent ? objParent.children : null;
	}
	
	function onKeyPressMulti (obj, e, toObj, length, bText, bNoDate) {
	var iCount = 0;
	var aDatum = new Array ();

	if (bNoDate != true) {
		var sTag = obj.name.substr (0, obj.name.indexOf ('_'));
		var arrParentChildren = getParentChildren (obj, 'TD');

		for (var iI = 0; iI < arrParentChildren.length; iI++) {
			var sElement = arrParentChildren [iI].name;

			if (sElement) if (sElement.indexOf (sTag) != -1) aDatum[iCount++] = arrParentChildren [iI];
		}
	}

	var charCode = (navigator.appName == "Netscape") ? e.which : e.keyCode;

	if (charCode > 31 && (!bText && (charCode < 48 || charCode > 57) 
			|| bText && (charCode < 48 || (charCode > 57 && charCode < 65) 
			|| charCode > 122 || (charCode > 90 && charCode < 97)))) {

		return false;
	}
	else {
		if (charCode > 31 && obj.value.length == length - 1) {
			if (toObj != null) {
				obj.value = obj.value + String.fromCharCode (charCode);

				toObj.focus();

				if (bNoDate != true) {
					if (iCount == 4) {
						toDatum (aDatum[1], aDatum[2], aDatum[3], aDatum[0]);
					}
					else if (iCount == 3) {
						toTijd (aDatum[1], aDatum[2], aDatum[0]);
					}
				}

				return false;
			}
		}

		return true;
	}
}

		function onKeyPressFloat (obj, e, bFloat, bNegative) {
			var charCode = (navigator.appName == "Netscape") ? e.which : e.keyCode;
	
			if (charCode == 44) charCode = e.keyCode = 46;

			if (charCode > 31 && (charCode < 48 || charCode > 57)) {
				// als eerste '.' ingedrukt en als het om een getal met decimalen gaat
				if (String.fromCharCode (charCode) == '.' && bFloat && obj.value.lastIndexOf  ('.') == -1) {
					return true;		
				}

				// als het getal negatief mag zijn
				if (String.fromCharCode (charCode) == '-' && bNegative && obj.value.lastIndexOf  ('-') == -1) {
					return true;
				}


				return false;
			}
			else {
				return true;
			}
		}
		
		function ToevoegenTrekkingSR()
		{
			var strGetal1 = document.getElementById('V002_Getal1').value;
			var strGetal2 = document.getElementById('V003_Getal2').value;
			var strGetal3 = document.getElementById('V004_Getal3').value;
			var strGetal4 = document.getElementById('V005_Getal4').value;
			
			var lCorrect = CheckInvoerTrekkingSR(strGetal1, strGetal2, strGetal3, strGetal4);
			
			if(lCorrect) 
			{
				addRowTrekkingenSR(trim(strGetal1), trim(strGetal2), trim(strGetal3), trim(strGetal4));
			
				document.getElementById('V002_Getal1').value = '';
				document.getElementById('V003_Getal2').value = '';
				document.getElementById('V004_Getal3').value = '';
				document.getElementById('V005_Getal4').value = '';
			}
		}
		
		function GetSectionRowIndex (obj)
		{
			for (objParent = obj.parentElement; objParent != null && objParent.tagName != 'TR'; objParent = objParent.parentElement);
			return objParent.sectionRowIndex;
		}
		
		function DeleteRow (obj)
		{
			objTable = document.getElementById('Uitslagen');
			objTable.deleteRow (GetSectionRowIndex (obj));
		}
		
		function trim(value)
		{
  			value = value.replace(/^\s+/,''); 
  			value = value.replace(/\s+$/,'');
  			return value;
		}
		
		function CheckInvoer(strThuis, strUit, strVoor, strTegen, strSortering)
		{
			var intFouten = 0;
			if(trim(strThuis)=='') { alert("Thuisploeg is niet ingevuld!"); intFouten++; }
			if(trim(strUit)=='') { alert("Uitploeg is niet ingevuld!"); intFouten++; }
			if(trim(strVoor)=='') { alert("Doelpunten thuisploeg zijn niet ingevuld!"); intFouten++; }
			if(trim(strTegen)=='') { alert("Doelpunten uitploeg zijn niet ingevuld!"); intFouten++; }
			if(trim(strSortering)=='') { alert("Sortering is niet ingevuld!"); intFouten++; }
			
			if(intFouten>0) { return false; } else { return true; }
		}
		
		function CheckInvoerTrekkingenSR(strGetal1, strGetal2, strGetal3, strGetal4)
		{
			var intFouten = 0;
			if(trim(strThuis)=='') { alert("Thuisploeg is niet ingevuld!"); intFouten++; }
			if(trim(strUit)=='') { alert("Uitploeg is niet ingevuld!"); intFouten++; }
			if(trim(strVoor)=='') { alert("Doelpunten thuisploeg zijn niet ingevuld!"); intFouten++; }
			if(trim(strTegen)=='') { alert("Doelpunten uitploeg zijn niet ingevuld!"); intFouten++; }
			
			if(intFouten>0) { return false; } else { return true; }
		}

function movein(which){ 
which.style.background='green'
} 

function moveout(which){ 
which.style.background='#FFFFFF'
} 

function moveout1(which){ 
which.style.background='#010181' 
} 

function moveout2(which){ 
which.style.background='#FFFF00' 
} 
