function img_act(img, img_src) { document.images[img].src = img_src; } function img_inact(img,srcs) { document.images[img].src = srcs; } function submit_form(form_name) { var frm = document.getElementById(form_name); frm.submit(); } function clear_form(form_name) { var frm = document.getElementById(form_name).elements; var cnt = frm.length; for(a = 0; a < cnt; a++) { if(frm[a].type == "checkbox" ) frm[a].checked = false; if(frm[a].type == "select-one") frm[a].selectedIndex = 0; if(frm[a].type == "select-multiple") { opt_cnt = frm[a].options.length; for(b = 0; b < opt_cnt; b++) frm[a].options[b].selected = false; } //if (frm[a].type == "radio") frm[a].defaultChecked= true; if (frm[a].type == "radio") frm[a].checked = false; if (frm[a].type == "text") frm[a].value = ""; } } function assign_value(obj, new_val) { if (!obj) return; if (obj.type == "select-one") { for (var i=0; i < obj.options.length; i++) { if (obj.options[i].value == new_val) { obj.options[i].selected = true; break; } } } } // Removes leading and ending whitespaces function trim(value){ return value.replace(/^\s+|\s+$/g, ""); } // Allow numbers only function isNum(value){ if(value.match(/^[0-9]+$/i)){ return true; }else{ return false; } } function validate(form1) { conf = confirm("Are you sure you want to reset?"); if (conf==true) form1.reset(); }