turing=1;cX=2;cY=2;ats=0;

if(typeof window.external=='object' && typeof document.all=='object'){
frm_obj='<iframe src="incl/colors.htm" style="margin:0px;padding:0px;border-width:0px;width:100%;height:110px;overflow:hidden"></iframe>';}
else{frm_obj='<object data="incl/colors.htm" type="text/html" style="margin:0px;padding:0px;border-width:0px;width:100%;height:100px;overflow:hidden"></object>'}

function op(m,n){if(typeof window.external=='object' && typeof document.all=='object'){m.style.filter='alpha(opacity='+n*10+')';}else{m.style.opacity=n/10;}return false}

function turing_number(){
ff=document.forms.fms
if(turing==0||(turing==1&&ff.turnum.value.length==6&&!isNaN(ff.turnum.value))){return true}
else{ff.turnum.value='';ff.turnum.focus();return false}}

function check_login(x){
ff=document.forms.fms
a=ff.name;b=ff.pass
n=turing_number()
if(b.value.length<3){b.value='';b.focus()}
if(a.value.length<3){a.value='';a.focus()}
if(a.value!=''&&b.value!=''&&n==true){return true}
else{alert(x);return false}}

function go(w){
a=/&amp;/g;w=w.replace(a,'&');
window.location=w;return false}

function check_download(x){
oo=1;ff=document.forms.fms
if(ff.type.value=='a'){ff.type.focus();oo=0}
if(ff.section.value<1){ff.section.focus();oo=0}
if(ff.the_file.value.length<3){ff.the_file.focus();oo=0}
if(oo==1){
document.getElementById('du1').style.display='none';
document.getElementById('du2').style.display='block';

return true}else{alert(x);return false}}

function check_chpass(x){
ff=document.forms.fms
o=ff.opass;n=ff.npass;r=ff.rpass
if(o.value.length<3){o.value='';o.focus()}
if(n.value.length<3||n.value!=r.value){n.value='';r.value='';n.focus()}
if(o.value==n.value){o.value='';n.value='';r.value='';o.focus()}
if(o.value!=''&&n.value!=''){return true}
else{alert(x);return false}}

function check_mail(x){
ff=document.forms.fms
q=ff.mail
if(q.value.length<7){q.value=''}
if(q.value.indexOf('@')==-1){q.value='';q.focus()}
if(q.value.indexOf('.')==-1){q.value='';q.focus()}
if(q.value.indexOf(' ')!=-1){q.value='';q.focus()}
if(q.value!=''){return true}
else{if(x!=0){alert(x)};return false}}

function check_new_user(x){
ff=document.forms.fms
a=ff.name;b=ff.pass
c=ff.mail;d=ff.confirm_pass
n=turing_number()
m=check_mail(0)
if(b.value.length<3){b.value='';b.focus()}
if(a.value.length<3){a.value='';a.focus()}
if(b.value!=d.value){b.value='';d.value='';b.focus()}
if(a.value!=''&&b.value!=''&&d.value!=''&&m==true&&n==true){return true}
else{alert(x);return false}}

function check_chmail(x){
ff=document.forms.fms
a=ff.pass;b=ff.mail;c=ff.oldm
b.value=b.value.toLowerCase()
if(a.value.length<3){a.value='';a.focus()}
if(b.value==c.value){b.value='';b.focus()}
m=check_mail(0)
if(a.value!=''&&m==true){return true}
else{alert(x);return false}}

function check_fpass(x){
n=turing_number()
m=check_mail(0)
if(m==true&&n==true){return true}
else{alert(x);return false}}

function check_verify(x){
ff=document.forms.fms
n=turing_number()
a=ff.vid
if(a.value.length!=8){a.value='';a.focus()}
if(a.value.indexOf(' ')!=-1){a.value=''}
if(a.value!=''&&n==true){return true}
else{alert(x);return false}}

function count(a,b,c){
c=Math.floor(c/2)
lng1=a.value.length
if(lng1>c){a.value=a.value.substr(0,c)}
if(b!=0){lng2=a.value.length;b.value=lng2}}

function adj_usrs(){
ff=document.forms.fms
if(ff.src.value.length<2||ff.where.value==0){
ff.src.value='';ff.where.value=0}}

function adj_tickets(){
ff=document.forms.fms
o=ff.src;p=ff.where
r=Math.floor(o.value)
if(p.value==4){ff.department.value=0;ff.status.value=0;ff.priority.value=0;ff.order.value=0}
if(isNaN(r)&&p.value==3){o.value='';p.value=0}
else if(!isNaN(r)&&o.value.length<2&&p.value==3){o.value='0'+o.value}
if(o.value.length<2||p.value==0){
o.value='';p.value=0}}

function adj_arts(){
ff=document.forms.fms
o=ff.src;p=ff.where
if(o.value.length<2||p.value==0){
o.value='';p.value=0}}

function repl_bb(a,b,c){
ff=document.forms.fms
n=navigator.userAgent;txt_sel=null
txt_arr=ff.txt
txt_val=txt_arr.value;txt_arr.focus()
if(document.selection && n.indexOf('MSIE 4')==-1){
txt_sel=document.selection.createRange()
if(txt_sel.text.length>0){c=txt_sel.text}
txt_sel.text=a+c+b;txt_arr.focus()}
else if(document.getSelection){
txt_cur=txt_arr.selectionEnd
txt_sel=txt_val.substring(txt_arr.selectionStart,txt_arr.selectionEnd)
if(txt_sel.length>0){c=txt_sel}
txt_arr.value=txt_val.substring(0,txt_arr.selectionStart)+a+c+b+txt_val.substr(txt_arr.selectionEnd)
txt_lng=a+b;txt_lng=txt_lng.length;txt_arr.selectionEnd=txt_cur+txt_lng}
else{txt_arr.value=txt_val+a+b}}

function check_ticket(x){
ff=document.forms.fms
a=ff.subject;b=ff.txt
c=parseInt(ff.department.value)
n=turing_number();m=true
m=check_mail(0)
if(b.value.length<3){b.value='';b.focus()}
if(n!=true){ff.turnum.focus()}
if(c<1){ff.department.focus()}
if(m!=true){ff.mail.focus()}
if(a.value.length<3){a.value='';a.focus()}
if(a.value!=''&&b.value!=''&&n==true&&m==true&&c>0){return true}
else{alert(x);return false}}

function check_reply(x){
a=document.forms.fms.tstts
if(a.value<4){return true}
else{a.focus();alert(x);return false}}


function check_art(x){
ff=document.forms.fms
a=ff.title;b=ff.txt
c=parseInt(ff.category.value)
if(b.value.length<3){b.value='';b.focus()}
if(c<1){ff.category.focus()}
if(a.value.length<3){a.value='';a.focus()}
if(a.value!=''&&b.value!=''&&c>0){return true}
else{alert(x);return false}}

/* --- */

if(typeof window.external!='object'&&typeof XMLHttpRequest!='object'&&typeof XMLHttpRequest!='function'){
ajx=0}else{ajx=1}

function hobj(){
if(ajx==1){
if(typeof window.external=='object' && typeof document.all=='object'){
r=new ActiveXObject("Microsoft.XMLHTTP")}
else{r=new XMLHttpRequest()}return r}}

if(ajx==1){hlpe=hobj();}

function load_info(evt,q){if(ajx==1&&ats==0){
set_pos(evt,30,20)
url='hla.php?q='+q;hlpe.open('get',url);
hlpe.onreadystatechange=ansr;hlpe.send(q);
ats=1;rr=setTimeout('ats=0',20000)}
return false}

function set_pos(evt,cx,cy){
if(typeof window.external=='object' && typeof document.all=='object'){
msof=document.body.scrollTop
if(msof==0){msof=document.documentElement.scrollTop}
cX=parseInt(evt.clientX-cx);cY=parseInt(evt.clientY+msof-cy)}
else{cX=evt.pageX-cx;cY=evt.pageY-cy}
}

function load_help(evt,q){if(ajx==1&&ats==0){
set_pos(evt,130,20)
url='hlp.php?q='+q;hlpe.open('get',url);
hlpe.onreadystatechange=ansr;hlpe.send(q);
ats=1;rr=setTimeout('ats=0',20000)}
return false}

function ansr(){if(ajx==1){
if(hlpe.readyState==4){
response=hlpe.responseText.toString()
document.getElementById('hlp').style.left=cX+'px'
document.getElementById('hlp').style.top=cY+'px'
window.status=cX+'-'+cY
document.getElementById('hlp').style.display='block'
document.getElementById('hlp').innerHTML=response
ats=0;if(typeof rr=='number'){clearTimeout(rr)}}}}

function ip2cq(ip){if(ajx==1&&ats==0){
document.getElementById('ipd').innerHTML=''
url='ip2c.php?ip='+ip;hlpe.open('get',url);
hlpe.onreadystatechange=ip2ca;hlpe.send(ip);
ats=1;rr=setTimeout('ats=0',20000)}}

function ip2ca(){if(ajx==1){
if(hlpe.readyState==4){
response=hlpe.responseText.toString()
document.getElementById('ipd').innerHTML=response
ats=0;if(typeof rr=='number'){clearTimeout(rr)}}}}

function clst(){
document.getElementById('hlp').style.display='none'
return false}

function tktinv(c){
c=parseInt(c)
a=document.getElementById('invb')
b=document.getElementById('paus')
setTimeout("b.style.display='none';a.style.display='block'",c*1000);}

function spell_suggest(a,b,evt,r){
n='';b=b.split('|')
x=escape(a);n=a+': ';
for(i=0;i<b.length;i++){
y=escape(b[i])
n+='<a href="#" onclick="spell_repl(\''+x+'\',\''+y+'\','+r+');return false">'+b[i]+'</a> '}
set_pos(evt,130,20)
document.getElementById('suggs').style.left=cX+'px'
document.getElementById('suggs').style.top=cY+'px'
window.status=cX+'-'+cY
document.getElementById('suggs').style.display='block'
document.getElementById('suggs').innerHTML='<div class="sm1">'+n+'</div>';
}

function spell_repl(a,b,r){
a=unescape(a);b=unescape(b);
c=document.forms.fms.txt.value
s=c.replace(a,b);
document.forms.fms.txt.value=s
document.getElementById(r).style.textDecoration='none'
document.getElementById(r).style.color=spell
document.getElementById(r).style.cursor='default'
document.getElementById(r).innerHTML=b}

function spell_send(e){if(ats==0&&ajx==1){
a=document.forms.fms.txt.value
if(a.length>2){
if(e==1){url='spellcheck.php';a=document.forms.fms.dtt.value+'|:|'+a}else{url='preview.php'}
document.getElementById('spell').style.visibility='hidden'
document.getElementById('splld').style.visibility='visible'
document.getElementById('suggs').style.display='none'
amp=/&/g;a=a.replace(amp,'%26');
a=a.split('\n');a=a.join('[br]');
a='q='+a;hlpe.open('post',url);
hlpe.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
hlpe.onreadystatechange=spell_receive;hlpe.send(a);
ats=1;rr=setTimeout('ats=0',20000)}}}

function spell_receive(){if(ajx==1){
if(hlpe.readyState==4&&ats==1){
response=hlpe.responseText.toString()
document.getElementById('spell').style.display='block'
document.getElementById('spell').style.visibility='visible'
document.getElementById('splld').style.visibility='hidden'
document.getElementById('spell').innerHTML=response
ats=0;if(typeof rr=='number'){clearTimeout(rr)}}}}

function spell_cancel(){
ats=0;if(typeof rr=='number'){clearTimeout(rr)}
document.getElementById('splld').style.visibility='hidden'}

function attach(a,b){
if(typeof window.opener.document.forms.fms.txt=='object'){
document.write('<br /><br />')
document.write('[<a href="#" onclick=\"window.opener.document.forms.fms.txt.value+=\' '+a+' \';self.close();return false">')
document.write(b+'</a>]')}
}