/*
		xAddEventListener(window, 'load',
		  function(){
		    new xMenu6('ul_main', 'main_ul', 'sub_ul', 'lbl_li', 'itm_li', 'lbl_a', 'itm_a',
		               '', '',
		               'xmImg', '', false, 'a<?php echo $_SESSION['page'].'_'.$_SESSION['article_group_id']; ?>');
		  }, false
		);
		xAddEventListener(window, 'load',
		  function(){
		    new xMenu6('bestellijst', 'main_ul', 'sub_ul', 'lbl_li', 'itm_li', 'lbl_a', 'itm_a',
		               '', '',
		               'xmImg', '', false, 'a<?php echo $_SESSION['page']; ?>');
		  }, false
		);
		*/

		function toggleDisplay(tableid,x,toggle)
		{
			var myTable = document.getElementById(tableid);
			if(document.getElementsByTagName)
			{
				var rows = myTable.getElementsByTagName('tr');
				for (var i=0; i<rows.length; i++)
				{
					var cols = rows[i].getElementsByTagName('th');
					for (var c=0; c<cols.length; c++)
					if(cols[c].className == x)
					    if(toggle == 'none')
							cols[c].style.display = 'none';
						else
							cols[c].style.display = (cols[c].style.display == 'none') ? '' : 'none';
					var cols = rows[i].getElementsByTagName('td');
					for (var c=0; c<cols.length; c++)
					if(cols[c].className == x)
					{
					    if(toggle == 'none')
							cols[c].style.display = 'none';
						else
							cols[c].style.display = (cols[c].style.display == 'none') ? '' : 'none';
						if(cols[c].id.substr(0,5) == 'elder')
							toggleDisplay(tableid,cols[c].id, 'none');
					}
				}
			}
		}

		function calc_price(tableid, elder, what, price, amount)
		{
		    tot = (price * amount);
		    if(tot == 0)
				document.getElementById(what).innerHTML = '';
			else
				document.getElementById(what).innerHTML = '€ '+number_format(tot, 2, ',', '.');
			calc_total(tableid, elder);
		}

		function calc_total(tableid, what)
		{
		if(!what) return;
			var tot = 0;
			var myTable = document.getElementById(tableid);
			if(document.getElementsByTagName)
			{
				var rows = myTable.getElementsByTagName('tr');
				for (var i=0; i<rows.length; i++)
				{
					var cols = rows[i].getElementsByTagName('td');
					for (var c=0; c<cols.length; c++)
					if(	cols[c].className == what &&
						cols[c].id.substr(0,5) == 'elder' &&
						IsNumeric(parseFloat(cols[c].innerHTML.substr(2))) &&
						parseFloat(cols[c].innerHTML.substr(2))>0)
					{
					    var tmp = cols[c].innerHTML;
					    tmp = tmp.replace(' ', '');
					    tmp = tmp.replace("€", "");
					    tmp = tmp.replace(".", "");
					    tmp = tmp.replace(",", ".");
						tot += parseFloat(tmp);
					}
				}
			}
			if(tot == 0)
				document.getElementById(what).innerHTML = '';
			else
				document.getElementById(what).innerHTML = '€ '+number_format(tot, 2, ',', '.');
			calc_total(tableid, document.getElementById(what).className);
		}

		function number_format (number, decimals, dec_point, thousands_sep)
		{
		var exponent = "";
		var numberstr = number.toString ();
		var eindex = numberstr.indexOf ("e");
		if (eindex > -1)
		{
		exponent = numberstr.substring (eindex);
		number = parseFloat (numberstr.substring (0, eindex));
		}

		if (decimals != null)
		{
		var temp = Math.pow (10, decimals);
		number = Math.round (number * temp) / temp;
		}
		var sign = number < 0 ? "-" : "";
		var integer = (number > 0 ?
		  Math.floor (number) : Math.abs (Math.ceil (number))).toString ();

		var fractional = number.toString ().substring (integer.length + sign.length);
		dec_point = dec_point != null ? dec_point : ".";
		fractional = decimals != null && decimals > 0 || fractional.length > 1 ?
		           (dec_point + fractional.substring (1)) : "";
		if (decimals != null && decimals > 0)
		{
		for (i = fractional.length - 1, z = decimals; i < z; ++i)
		  fractional += "0";
		}

		thousands_sep = (thousands_sep != dec_point || fractional.length == 0) ?
		              thousands_sep : null;
		if (thousands_sep != null && thousands_sep != "")
		{
		for (i = integer.length - 3; i > 0; i -= 3)
		  integer = integer.substring (0 , i) + thousands_sep + integer.substring (i);
		}

		return sign + integer + fractional + exponent;
}

		function IsNumeric(strString)
		//  check for valid numeric strings
		{
		var strValidChars = "0123456789.-";
		var strChar;
		var blnResult = true;

		if (strString.length == 0) return false;

		//  test strString consists of valid characters listed above
		for (i = 0; i < strString.length && blnResult == true; i++)
		  {
		  strChar = strString.charAt(i);
		  if (strValidChars.indexOf(strChar) == -1)
		     {
		     blnResult = false;
		     }
		  }
		return blnResult;
		}

		function CheckNumeric(e)
		{
			if(window.event) // IE coding
			{
			//	Get ASCII value of key that user pressed
				var key = window.event.keyCode;

			//	Was key that was pressed an allowed character?
				//if	( key == 44 )				return; // ,
				//if	( key == 46 )   			return; // . AND del .... yeah right ...
				if	( key > 47 && key < 58 )	return; // numeric character (0-9)

			//  properly permit the key being entered
				window.event.returnValue = null;
			}
			else
			{
			//	Get ASCII value of key that user pressed
				var key = e.which

			//	Was key that was pressed an allowed character?
				if	( key == 0)					return; // function keys (F1 - F12, arrows, etc.)
				if  ( key == 8 )                return; // backspace
				//if	( key == 44 )				return; // ,
				//if	( key == 46 )   			return; // . AND del .... yeah right ...
				if	( key > 47 && key < 58 )	return; // numeric character (0-9)

			//  properly permit the key being entered
				e.preventDefault();
		 	}
		}
		<!--
		var time = null
		function move() {
		window.location = '?page=1321'
		}
		//-->
