function validate(e)
{
    if (!e) var e = window.event;
    var code = e.charCode ? e.charCode : e.keyCode;
    if (e.shiftKey || e.ctrlKey){return false;}

	// create an associative array
	// store the character codes
	var allowableChars = new Array();

	allowableChars [8] = 'true';
	allowableChars [37] = 'true';
	allowableChars [39] = 'true';
	allowableChars [40] = 'true';
	allowableChars [46] = 'true';
	allowableChars [48] = 'true';
	allowableChars [49] = 'true';
	allowableChars [50] = 'true';
	allowableChars [51] = 'true';
	allowableChars [52] = 'true';
	allowableChars [53] = 'true';
	allowableChars [54] = 'true';
	allowableChars [55] = 'true';
	allowableChars [56] = 'true';
	allowableChars [57] = 'true';

	if (!allowableChars[code])
	{
	   return false;
	}

    var apostropheCode;
	// special case to prevent apostrophe
	// in FireFox, charCode value for apostrophe is 39, prevent it
	if (!window.event) {
		apostropheCode = e.charCode;
	}
	// in IE, keyCode value for apostrophe is 39, prevent it
	else
	{
	   apostropheCode = window.event.keyCode;
	}

	 if (apostropheCode == 39)
	   {
	       return false;
	   }
}

function addInput(divName){
     if (count == max)  {
          document.getElementById('add').disabled = "disabled";
		  document.getElementById('add').value = "Maximum reached";
     }
     else {
          var newdiv = document.createElement('div');
          newdiv.innerHTML = 
		"<br\><select name='inputs[]' id='"+count+"' onchange='post();return false;'> \
		<option value='Chicken Mince'>Chicken Mince RM6.00/pk</option>\
		<option value='Mutton Mince'>Mutton Mince RM9.00/pk</option>\
		<option value='Mixed Mince'>Mixed Mince RM7.50/pk</option>\
		<option value='Wild Boar Mince'>Wild Boar Mince RM8.00/pk</option>\
		<option value='Mackerel Mince'>Mackerel Mince RM10.00/pk</option>\
		<option value='Chicken Chunks'>Chicken Chunks RM6.00/pk</option>\
		<option value='Beef Chunks'>Beef Chunks RM7.50/pk</option>\
		<option value='Mutton Chunks'>Mutton Chunks RM8.50/pk</option>\
		<option value='Mixed Chunks'>Mixed Chunks RM7.50/pk</option>\
		<option value='Quail Chunks'>Quail Chunks RM10.00/pk</option>\
		<option value='Veg Blend'>Vegetable Blend RM6.00/kg</option>\
		</select> \
		<input name='amount[]' type='text' id='amount' size='3' onkeypress='return validate(event);' onkeyup='post();return false;' /> \
		*</td>";
          document.getElementById(divName).appendChild(newdiv);
          count++;
     }
}