function addEvent(b,d,c){if(!b){return false}if(typeof c=="string"){c=new Function(c)}if(b.addEventListener){b.addEventListener(d.replace(/on/,""),c,false)}else{if(b.attachEvent){b.attachEvent(d,c)}else{if(b.onload!=null){var a=b[d];newCode=Function(e);a(e);c();b[d]=newCode}else{b[d]=c}}}return true}function toNumber(a){if(isNaN(a)){return 0}else{return Number(a)}}function checkEnabled(){if(arguments.length>2){objSrc=arguments[0];objTarget=objSrc.form.elements[arguments[1]];enabled=arguments[2];toggle=false;var a,b;if(objTarget){switch(objSrc.type.toLowerCase()){case"select-one":b=objSrc.options[objSrc.selectedIndex].value;break;case"select-multiple":b=[];count=0;for(a=0;a<objSrc.length;++a){if(objSrc.options[a].selected){b[count]=objSrc.options[a].value}}break;case"checkbox":if(objSrc.checked){b=objSrc.value;toggle=true}break;default:b=objSrc.value}for(a=3;a<arguments.length;++a){if(typeof(b)=="object"&&(arguments[a]in b)){toggle=true;break}else{if(arguments[a]==b){toggle=true;break}}}objTarget.disabled=toggle?!enabled:enabled;if(!objTarget.disabled){objTarget.focus()}}}}function sumFields(){if(arguments.length>2){objFrm=arguments[0];objTarget=objFrm.elements[arguments[1]];var c=0;if(objTarget){for(var b=2;b<arguments.length;++b){objSrc=objFrm.elements[arguments[b]];if(objSrc){switch(objSrc.type.toLowerCase()){case"select-one":c+=toNumber(objSrc.options[objSrc.selectedIndex].value);break;case"select-multiple":for(var a=0;a<objSrc.length;++a){c+=toNumber(objSrc.options[a].value)}break;case"checkbox":if(objSrc.checked){c+=toNumber(objSrc.value)}break;default:c+=toNumber(objSrc.value)}}}objTarget.value=c}}}function form_setCursorPosition(d,c){var b=document.getElementById(d);if(!b){return}if(b.setSelectionRange){b.focus();b.setSelectionRange(c,c)}else{if(b.createTextRange){var a=b.createTextRange();a.collapse(true);a.moveStart("character",c);a.moveEnd("character",0);a.select();a.scrollIntoView(true)}}};