// TODO this does not work on all pages in IE 7. see registration/step_two. Fix this and disable plugin that does the same.
var types_to_classes = ['radio', 'checkbox', 'text', 'password', 'file'];
function add_radio_checkbox_classes(el){
	if(el){
	}else{
		el = $('meat');
	}
	if(el.childElements()){
		total_kids = el.childElements().length;
		el.childElements().each(function(kid){
			if(kid.nodeName == 'INPUT'){
				if(types_to_classes.find(function(t){return (t == kid.readAttribute('type'))})){
					kid.addClassName(kid.readAttribute('type'));
				}
			}
			total_kids = total_kids + add_radio_checkbox_classes(kid);
		});
		return total_kids;
	}
	return 0;
}

function add_radio_checkbox_classes_handler(){
	add_radio_checkbox_classes();
}

Event.observe(window, 'load', add_radio_checkbox_classes_handler); 		// works, but after images load
//document.observe("dom:loaded", add_radio_checkbox_classes_handler); 	// doesn't work