form={_a:[],validate:function(n,fx,m,a,b,c){return this._a[n]=fx==null?fx:[fx,m,a,b,c]},element:function(n,v,c,l){var a,i=0,f=dom.itemById(n),r=[],d=f.selected!=null,s=f.type=='checkbox'||f.type=='radio'?'checked':d?'selected':null;if(f[0]!=null){for(;i<f.length;i++){if((a=form.element(f[i],v,i,f.length))>''&&(f[0].type=='checkbox'||f[i].checked||f[i].selected))r[r.length]={on:1,off:1}[f[i].value]?i:a}
return r.join(',')}
r=f.value;if(s){a=!d&&(r=='on'||r=='off'||r=='');if(d&&r=='')r=f.text;if(v!=null){if(a&&l>1){v=v.split(',');v=v.length>1?v[c]:c==v[0]?1:0}
f[s]=a?v==1||v=='on':InCsv(v,r)}
return f[s]?(a?1:r):(a?0:'')}
return v!=null?f.value=v:r},check:function(n){if(!Ini())return false;var i,e,g,m='',a=form._a,o,f=dom.itemById(n);for(i in a){if((o=f.elements[i])!=null){if((e=!a[i][0](form.element(i),a[i][2],a[i][3],a[i][4]))){if(m=='')try{o.focus()}catch(e){};m+=a[i][1]+'\n'}
if(g=dom.itemById('e_'+i))g.src=eval('g.src.replace('+(e?'/es.g/,"e.g")':'/e.g/,"es.g")'))}}
dom.ErrMsg=m;if(advise.fire('check'+f.name,f))return false;if((m=dom.ErrMsg)>'')alert(m);return m==''},elements:function(v){var i=0,c=v.split(',');for(;i<c.length;i++)c[i]+='='+encode(form.element(c[i]));return c.join('&')}}
is={integer:function(v){return is.only(v,'d-')},numeric:function(v){v=(v+'.0').split('.');return is.integer(v[0]+(v[1]))&&v.length<4},email:function(v){return(v=(v+'').split('@')).length==2&&v[0]!=''&&(v=v[1].split('.')).length>1&&v[v.length-1].length>1},notempty:function(v){return Trim(v||'')>''},only:function(v,r,e){return e!=null&&!is.notempty(v)?false:!eval('/[^'+r.replace(/a/,'A-Za-z').replace(/d/,'0-9')+']/').test(v+'')},range:function(v,l,h,t){return t=='n'?is.numeric(v)&&l<=parseFloat(v)&&h>=parseFloat(v):t=='d'?is.date(v)&&CDate(l)<=CDate(v)&&CDate(h)>=CDate(v):l<=v.length&&h>=v.length},pwd:function(v){return is.only(v,'ad')&&is.range(v,4,8)},date:function(v){v=(v+'').replace(/-/g,'/').split('/');return v.length==3&&is.integer(v.join(''))&&v[2].length==4&&v[1]>0&&v[1]<30+[2,0,2,1,2,1,2,2,1,2,1,2][v[0]-1]}}
if(window.attachEvent)window.attachEvent('onload',function(){ung('INPUT');ung('SELECT')});function ung(t){t=document.getElementsByTagName(t);for(var i=0;i<t.length;i++){t[i].attachEvent('onpropertychange',function(){var s=event.srcElement.style;if(s.backgroundColor!='')s.backgroundColor=''});t[i].style.backgroundColor=''}}
