	var state;
	function showhide(id)
	{
		var obj = document.getElementById(id);
		state = obj.style.display;
		if( state == 'none')	state = 'block';
		else					state = 'none';
		obj.style.display = state;
	}

	function chkFields(command)
	{
		document.forms[0].action.value = command;

		if( document.forms[0].incorrectextended )
		{
			alert('Selecteer het juiste (extended) aantal kubieke meters voor deze huurder!');
		} else if 	(
			document.forms[0].customer_phone.value == ""
			)
		{
			alert('Velden met een * zijn verplicht!');
		} else {
			document.forms[0].submit();
		}
	}

	function printpdf(boxid)
	{
		var boxid;
		if ( boxid == 'all' )
			doAction('printall');
		else {
			document.forms[0].box.value = boxid;
			doAction('print');
		}
	}

	 function endRental(command,boxid){
		Editor = document.getElementById('idContentoEdit1').contentWindow.document;
		var text = document.getElementById('emailContractEnd');
		text.value = Editor.body.innerHTML;
		doBoxAction(command,boxid);
	 }


	function doBoxAction(command,boxid)
	{
		var command;
		var boxid;
		document.forms[0].action.value 	= command;
		document.forms[0].boxid.value 	= boxid;

		document.forms[0].submit();
	}

	function doRental(command,boxid,rentalid)
	{
		var command;
		var boxid;
		var rentalid;
		document.forms[0].rentalid.value 	= rentalid;
		doBoxAction(command,boxid);
	}

	function doAction(command,onsubmit)
	{
		var command;
		document.forms[0].action.value = command;
		if(onsubmit)
			document.forms[0].onsubmit();
		document.forms[0].submit();
	}

	function doConfirmAction(command)
	{
		var command;
		var agree=confirm("Weet je zeker, dat je pdf wilt verwijderen?");

		if (agree)
		{
			doAction(command);
			return true ;
		}
		else
		{
			return false ;
		}
	}


	function confirmSubmit(command,boxid,text)
	{
		var command;
		var boxid;
		if(text)
		{
			var agree=confirm("Weet je zeker, dat je voor de geselecteerde huurders een factuur wilt genereren?");
		}
		else
		{
			var agree=confirm("Weet je zeker, dat je de huur van deze box wilt opzeggen?");
		}

		if (agree)
		{
			doBoxAction(command,boxid);
			return true ;
		}
		else
		{
			return false ;
		}
	}

	var checkflag = "true";
	function check(field)
	{
		if (checkflag == "false")
		{
			for (i = 0; i < field.length; i++)
			{
				if(field[i])
					field[i].checked = true;
			}
			checkflag = "true";

			return "Selecteer Niks";
		}
		else
		{
			for (i = 0; i < field.length; i++)
  			{
				if(field[i])
					field[i].checked = false;
			}
			checkflag = "false";
			return "Selecteer Alles";
		}
	}

	function popUp(URL)
	{
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=800,height=500,left = 200,top = 150');");
	}

	function specialAction(command,fieldname,fieldvalue)
	{
		var command;
		document.forms[0].action.value = command;
		if(document.forms[0].elements[fieldname])
			document.forms[0].elements[fieldname].value = fieldvalue;

		document.forms[0].submit();
	}


	function specialRentalAction(command,fieldname,fieldvalue,rentalid)
	{
		var command;
		document.forms[0].action.value = command;
		if(document.forms[0].elements[fieldname])
			document.forms[0].elements[fieldname].value = fieldvalue;
		document.forms[0].submit();
		document.forms[0].rentalid.value = rentalid;
	}

	function highlight_on()
	{
		window.event.srcElement.style.color='#c33829';
		window.event.srcElement.style.background='#ffffff';
		return true;
	}


	function highlight_off()
	{
		window.event.srcElement.style.color='#ffffff';
		window.event.srcElement.style.background='#c33829';
		return true;
	}