	function paginalink(theURL,winName) 
	{ 
		//v2.0
		window.open(theURL,winName);
	}
	function paginalink_get(theURL,winName,oldprojectvar,oldmaandvar,oldjaarvar) 
	{ 
		var projectval = document.forms['form_mijnuren'].projecten.value;
		var maandval = document.forms['form_mijnuren'].pulldown_maand.value;
		var jaarval = document.forms['form_mijnuren'].pulldown_jaar.value;
		
		var theURL_new = theURL;
		
		if (theURL_new.search("projectid") > 1)
		{
			var theURL_new = theURL_new.replace('/'+oldprojectvar,'/'+projectval);
		}
		else
		{
			var theURL_new = theURL_new + '/'+projectval;
		}
		if (theURL_new.search("maand") > 1)
		{
			var theURL_new = theURL_new.replace('/'+oldmaandvar,'/'+maandval);
		}
		else
		{
			var theURL_new = theURL_new + '/'+maandval;
		}
		if (theURL_new.search("jaar") > 1)
		{
			var theURL_new = theURL_new.replace('/'+oldjaarvar,'/'+jaarval);
		}
		else
		{
			var theURL_new = theURL_new + '/'+jaarval+'/#kalender';
		}
		//alert (theURL_new);
		window.open(theURL_new,winName);
	}
	function doSubmit(url, form) 
	{
  		var theForm			=	document.getElementById(form);
  		theForm.action 		= 	url;
  		theForm.submit();
	}
	function t_to_t_pw(cont,elm)
	{
		tVal=elm.value;
		initvalue = document.forms['loginmedewerkers'].ww_initvalue.value;
		if (tVal == initvalue)
		{
			tVal_display = '';
		}
		else
		{
			tVal_display = tVal;
		}
		document.getElementById(cont).innerHTML='<input type="password" id="frontend_wachtwoord" name="frontend_wachtwoord" class="formelement_single1" value="'+tVal_display+'" onblur="t_to_t_txt(\'wwcontainer\',this)">';
		field = document.getElementById('frontend_wachtwoord');
		field.focus();
		field.focus();
	}
	function t_to_t_txt(cont,elm)
	{
		tVal=elm.value;
		initvalue = document.forms['loginmedewerkers'].ww_initvalue.value;
		if (tVal == '')
		{
			tVal_display = initvalue;
			input_type = 'text'
		}
		else
		{
			tVal_display = tVal;
			input_type = 'password'
		}
		document.getElementById(cont).innerHTML='<input type="'+input_type+'" id="frontend_wachtwoord" name="frontend_wachtwoord" class="formelement_single1" value="'+tVal_display+'" onfocus="t_to_t_pw(\'wwcontainer\',this)">';
	}
	
	
	
	
	function isNumberKey(evt)
    {
     	var charCode = (evt.which) ? evt.which : event.keyCode
        if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

        return true;
    }
	  
	function numberOfDays(nYear,nMonth) 
	{  
		return new Date(nYear,nMonth+1,0).getDate();
	}
	function validatenumber(event, obj)
  	{
		
		// ---------------------------------------------------------------------------------------------
		//
		// BLOKKEREN VAN BEPAALDE INPUTS ZOALS TEKSTEN OF KOMMA'S
		//
		// ---------------------------------------------------------------------------------------------
    	
		var code = (event.which) ? event.which : event.keyCode;
    	var character = String.fromCharCode(code);

    	if ((code >= 48 && code <= 57))
    	{ 
			
			// ---------------------------------------------------------------------------------------------
			//
			// INVOER VAN CIJFERS?
			//
			// ---------------------------------------------------------------------------------------------

        	var place_of_first_dot = obj.value.indexOf(".");
			
			tekens_voor 	= obj.value.substring(0);
			aantal_voor 	= tekens_voor.length;
				
			tekens_achter 	= obj.value.substring(place_of_first_dot+1);
			aantal_achter 	= tekens_achter.length;
				
			if (place_of_first_dot < 0) // cijfers voor de komma
			{
				if (aantal_voor >= 2) // mag niet meer dan 2 cijfers voor de komma
				{
					return false;
				}
				else
				{
					return true;
				}
			}
			if (place_of_first_dot > -1) // cijfers achter de komma
			{
				if (aantal_achter >= 2) // mag niet meer dan 2 cijfers na de komma
				{
					return false;
				}
				else
				{
					return true;
				}
			}
    	}
    	else if (code == 46)
    	{ 
			// punten toegestaan
      		if (obj.value.indexOf(".") < 0)
			{
				return true;
			}
		}
		else if (code == 8)
		{ 
			// backspace toegestaan
		  	return true;
		}
		else if (code == 110)
		{ 
			// delete toegestaan
		  	return true;
		}
		else if (code >=37 && code <= 40)
		{ 
			// gebruik van pijltjes toetsen toegestaan
		  	return true;
		}
		return false;
  	}
 	function in_array (needle, haystack, argStrict) 
	{
		// http://kevin.vanzonneveld.net
		// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
		// +   improved by: vlado houba
		// +   input by: Billy
		// +   bugfixed by: Brett Zamir (http://brett-zamir.me)
		// *     example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']);
		// *     returns 1: true
		// *     example 2: in_array('vlado', {0: 'Kevin', vlado: 'van', 1: 'Zonneveld'});
		// *     returns 2: false
		// *     example 3: in_array(1, ['1', '2', '3']);
		// *     returns 3: true
		// *     example 3: in_array(1, ['1', '2', '3'], false);
		// *     returns 3: true
		// *     example 4: in_array(1, ['1', '2', '3'], true);
		// *     returns 4: false
	
		var key = '', strict = !!argStrict;
	
		if (strict) 
		{
			for (key in haystack) 
			{
				if (haystack[key] === needle) 
				{
					return true;
				}
			}
		} 
		else 
		{
			for (key in haystack) 
			{
				if (haystack[key] == needle) 
				{
					return true;
				}
			}
		}
		return false;
	}

  	function validatefield(obj, error, uren_allowed)
  	{ 
		array_uren_allowed		= uren_allowed.split(",");
		
		// ---------------------------------------------------------------------------------------------
		//
		// UPDATE DE VELDEN BIJ HET VERLATEN VAN HET VELD
		//
		// ---------------------------------------------------------------------------------------------
		
		if (isNaN(obj.value))
		{
			alert (error)
			obj.value = "";
			obj.focus();
		}
		else
		{
			if (obj.value != '')
			{
				val = obj.value;
				val = Math.abs(val);
				val = val.toFixed(2);
				obj.value = val;	
			}
		}
		
		// ---------------------------------------------------------------------------------------------
		//
		// START UPDATE DE TOTALEN
		//
		// ---------------------------------------------------------------------------------------------
		
		str_totaal_id			= obj.id;
		str_split				= str_totaal_id.split("_");
		str_dag					= str_split[1];
		str_uurtype				= str_split[2];
		aantal_dagen			= str_split[3];
		totaal_uurtypes			= str_split[4];
		
		// ---------------------------------------------------------------------------------------------
		//
		// TOTAAL VAN ÉÉN DAG IN DE MAAND
		//
		// ---------------------------------------------------------------------------------------------
		
		var changed_style_bgcolor = '#f16729';
		var changed_style_fontcolor = '#ffffff';
		
		var new_dag_total = '0';
		var old_dag_total = document.getElementById('oldtotaal_dag_'+str_dag).value;
		old_dag_total = Math.abs(old_dag_total);
		
		for (var x_type = 1; x_type <= totaal_uurtypes; x_type++)
		{
			bestaat_het_veld_type = in_array(x_type, array_uren_allowed);
			if (bestaat_het_veld_type == true)
			{
				dag_waarde = document.getElementById('uur_' + str_dag + '_' + x_type + '_' + aantal_dagen + '_' + totaal_uurtypes).value;
				new_dag_total = Math.abs(new_dag_total) + Math.abs(dag_waarde);
			}
		}
		if (old_dag_total != new_dag_total)
		{
			document.getElementById('opmaak_totaal_dag_'+str_dag).style.backgroundColor = changed_style_bgcolor;
			document.getElementById('opmaak_totaal_dag_'+str_dag).style.color = changed_style_fontcolor;
		}
		else
		{
			document.getElementById('opmaak_totaal_dag_'+str_dag).style.backgroundColor = '';
			document.getElementById('opmaak_totaal_dag_'+str_dag).style.color = '';
		}
		new_dag_total = new_dag_total.toFixed(2);
		document.getElementById('totaal_dag_'+str_dag).innerHTML = new_dag_total;
		
		// ---------------------------------------------------------------------------------------------
		//
		// TOTAAL VAN EEN UURTYPE OVER ALLE DAGEN VAN DE MAAND
		//
		// ---------------------------------------------------------------------------------------------
		
		var new_type_total = '0';
		var old_type_total = document.getElementById('oldtotaal_type_'+str_uurtype).value;
		old_type_total = Math.abs(old_type_total);
		for (var x_dag = 1; x_dag <= aantal_dagen; x_dag++)
		{
			type_waarde = document.getElementById('uur_' + x_dag + '_' + str_uurtype + '_' + aantal_dagen + '_' + totaal_uurtypes).value;
			new_type_total = Math.abs(new_type_total) + Math.abs(type_waarde);
		}
		if (old_type_total != new_type_total)
		{
			document.getElementById('opmaak_totaal_type_'+str_uurtype).style.backgroundColor = changed_style_bgcolor;
			document.getElementById('opmaak_totaal_type_'+str_uurtype).style.color = changed_style_fontcolor;
		}
		else
		{
			document.getElementById('opmaak_totaal_type_'+str_uurtype).style.backgroundColor = '';
			document.getElementById('opmaak_totaal_type_'+str_uurtype).style.color = '';
		}
		new_type_total = new_type_total.toFixed(2);
		document.getElementById('totaal_type_'+str_uurtype).innerHTML = new_type_total;
		
		// ---------------------------------------------------------------------------------------------
		//
		// COMPLETE TOTAAL
		//
		// ---------------------------------------------------------------------------------------------
		
		var new_totaal = '0';
		for (var x_dag = 1; x_dag <= aantal_dagen; x_dag++)
		{
			for (var x_type = 1; x_type <= totaal_uurtypes; x_type++)
			{
				bestaat_het_veld_type = in_array(x_type, array_uren_allowed);
				if (bestaat_het_veld_type == true)
				{
					input_waarde = document.getElementById('uur_' + x_dag + '_' + x_type + '_' + aantal_dagen + '_' + totaal_uurtypes).value;
					new_totaal = Math.abs(new_totaal) + Math.abs(input_waarde);
				}
			}
		}
		new_totaal = new_totaal.toFixed(2);
		document.getElementById('totaal_compleet').innerHTML = new_totaal;
  	}

	  
