/*****************************/
/* Only allow integer inputs */
/*****************************/
function onlyIntegers(e)	{
	var keynum;
	var keychar;
	var numcheck;

	if (!e) var e = window.event;
	
	if (e.keyCode) { // IE
		keynum = e.keyCode;
	} else if(e.which) { // Netscape/Firefox/Opera
		keynum = e.which;
	} else {
		return true;
	}
	if (keynum == 8 || keynum ==9 || keynum == 13 || keynum == 32 || keynum == 46 || keynum == 37 || keynum == 39)
		return true;
	else
		{
		keychar = String.fromCharCode(keynum);
		numcheck = /\d/;
		return (numcheck.test(keychar));
		}
	}
	
function forms_setUp()
	{
	// Assign onlyNumbers(e) to all input.numeric
 	var i;
 	var inputs;
 	// loop through all inputs of the document
 	inputs = document.getElementsByTagName("input");
 	for(i=0;i<inputs.length;i++)
 		{
		// test if the class 'numeric' exists
  		if(inputs[i].className == "numeric")
  			{
  			// Add the function to block non-numeric input
			inputs[i].onkeypress = onlyIntegers;
			}
		}
		
	// Focus on #fname (contact form)
	var inputFirst = document.getElementById('fname');
	if (inputFirst) inputFirst.focus();
	}
	
	if (window.addEventListener) // DOM Level 2 API
	window.addEventListener("load", forms_setUp, 0);
else if (window.attachEvent) // IE workaround
	window.attachEvent("onload", forms_setUp);

