function attachcheckdisable(r,s,a) { var ha = new Function("handlerules(this)"); // r - run once // s - source object // a - arguments so = document.getElementById(s); if (!so._rules) so._rules = new Array(); if (so) { so._rules.push({name: 'checkdisable', args: a }); so.onclick = ha; if (r) eval('checkdisable(s,' + a + ');'); } } function handlerules(o) { l = o._rules.length; while (l--) eval(o._rules[l].name + '("' + o.id + '",' + o._rules[l].args + ');'); } function checkdisable(s,t,b) { // s - source element id (checkbox) // t - target element id to disable // b - boolean: true (disable t if s checked), false (disable t if s unchecked) so = document.getElementById(s); to = document.getElementById(t); if (so && to) { if (b == so.checked) { to.disabled = true; switch(to.type) { case 'text': case 'textarea': case 'password': to.className = 'dtext'; break; }; } else { to.disabled = false; switch(to.type) { case 'text': case 'textarea': case 'password': to.className = 'text'; break; }; } } }