function addEvent(elm, evType, fn, useCapture)
// addEvent and removeEvent
// cross-browser event handling for IE5+,  NS6 and Mozilla
// By Scott Andrew
{
  if (elm.addEventListener){
    elm.addEventListener(evType, fn, useCapture);
    return true;
  } else if (elm.attachEvent){
    var r = elm.attachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be removed");
  }
} 

function add_event_handlers(){
	// Find all buttons/links with id numeric_only and make them work
	//alert("adding the events");
	if(document.forms[0]){
    	the_length=document.forms[0].elements.length;
    	
    	for(i=0;i<the_length;i++){
    		current_element=document.forms[0].elements[i];
    		if(((' '+current_element.className+' ').indexOf("numeric_only") != -1)){
    			addEvent(current_element, "keypress", checkInt);
    		}
    	}
    }
}
//this is just for interger fields
//this code originally by Justin Cook : http://www.justincook.sytes.net
function checkInt(e) {
	// <input type="text" name="age_required" onkeypress="return checkInt(event)" />
	e = (e) ? e : event;
	var charCode = (e.intCode) ? e.intCode : 
	((e.keyCode) ? e.keyCode : 
	((e.which) ? e.which : 0));
	if(charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 46) {
		alert("Numbers only please!.");
		return false;
	}else{
		
		return true;
	}

}
addEvent(window, "load", add_event_handlers);