function on(it){it.style.color="#666666";}
function off(it){it.style.color="#222222";}
function imover(im){im.filters.Glow.Enabled=true;}
function imout(im){im.filters.Glow.Enabled=false;}
function sol(n){top.changeloc('/builds.php?room='+n);}
function Down(){top.CtrlPress=window.event.ctrlKey;}
function view_hide(it){if(it.style.display=='none'){it.style.display='';}else{it.style.display='none';}}
function dis(o){o.disabled=true;}

function qw(title,txt,dx,dy){
 ml2.innerHTML='<table style="background-color:#D4AD86;BORDER-BOTTOM:#666666 1px solid;BORDER-TOP: #666666 1px solid;BORDER-LEFT:#666666 1px solid;BORDER-RIGHT: #666666 1px solid;cursor:default" border=0 cellspacing=0 cellpadding=2><thead style="background-color:#E58433;font-weight:bold;vertical-align:middle;"><tr><td align=center><B>'+title+'</td><td width=40 align=right><BIG style="cursor:pointer;" onclick="qwclose();">x</BIG></td></tr></thead><tbody><tr><td>'+
 '<table align=center width=100%><tr><td style="FONT-FAMILY: Verdana;">'+txt+'</td></tr></table>'+
 '</td></tr></tbody></table>';
 ml2.style.visibility='visible';
 ml2.style.left=document.body.scrollLeft+dx;
 ml2.style.top=document.body.scrollTop+dy;
}

function qwclose(){
 ml2.style.visibility='hidden';
}

function spl(s){
 var z=s.split("<BR>");
 var x=80;
 for(j=0;j<z.length;j++){
  var line=z[j];
  var a=line.split(" ");
  for(i=0;i<a.length;i++){
   r=""; w=a[i];
   l=Math.floor(w.length/x)+1;
   if(w.length>x){
    for(t=0;t<l;t++){
     q=w.substring(x*t,x*t+x);
     if(q.length>x) r+=q.substring(0,x)+" "+q.substring(x,q.length);
      else r+=q+" ";
    }
   }
   else r+=w;
   a[i]=r;
  }
  z[j]=a.join(" ");
 }
 document.write(z.join("<BR>"));
}

function replace_string(str,cstr,pstr){
 var reg = new RegExp(cstr,"gi");
 return str.replace(reg,pstr);
}

//

var move=null;

function set_move(t){
 var s="";
 move=t;
 if(move) s="<font color=green><b>Ñåé÷àñ ìîæíî äâèãàòüñÿ!</b></font>";
  else s="<font color=red><b>Ñåé÷àñ íåëüçÿ äâèãàòüñÿ!</b></font>";

 document.getElementById("moveid").innerHTML=s;
}

function dis_en(t){
 set_move(!t);
 document.getElementById("navtbl").disabled=t;
}

var go_timer_id = null;
var go_timer_interval = 0;
var go_timer_times = 0;
var go_timer_obj;

function go_timer_on(full,w){
 if(go_timer_id==null){
  dis_en(true);

  go_timer_times=w/20-1;
  go_timer_interval=full*1000/go_timer_times;

  document.write("<table class=base2 style='margin: 0px;' cellspacing=0 cellpadding=0><tr><td id='go_timer_progress' style='border:#999999 1px solid;background:#DEDEDE;width:"+w+"px;padding: 0 0 0 0;'><img height=15 width=20 src='http://imgs.neverfate.ru/i/progress2.gif'></td><td style='width:1px;padding: 0 0 0 0;visibility:hidden;'><img height=15 width=0></td></tr></table>");

  go_timer_obj=document.getElementById("go_timer_progress");

  if(go_timer_interval>0){
   go_timer_id=setInterval("go_timer_refresh()",go_timer_interval);
  }
  else{
   while(--go_timer_times>0){
   	go_timer_obj.innerHTML+="<img height=15 width=20 src='http://imgs.neverfate.ru/i/progress2.gif'>";
   }
   go_timer_obj.innerHTML+="<img height=15 width=20 src='http://imgs.neverfate.ru/i/progress3.gif'>";
   go_timer_off(w);
  }
 }
}

function go_timer_refresh(){
 if(go_timer_id){
  if(--go_timer_times) w="2";
   else{
    w="3";
    go_timer_off();
   }

  go_timer_obj.innerHTML+="<img height=15 width=20 src='http://imgs.neverfate.ru/i/progress"+w+".gif'>";
 }
}

function go_timer_off(){
 if(go_timer_id){
  clearInterval(go_timer_id);
 }
 dis_en(false);
}

function go(p){if(move){top.changeloc("/locations.php?go="+p);}}
function gom(loc,p){if(move){top.changeloc("/"+loc+".php?go="+p);}}

// opts = [img• width• height• left• top• onclick• hint• other]
function framedraw(opts,txt){
 var p = 'http://imgs.neverfate.ru/i/r/';
 var b = 'http://imgs.neverfate.ru/i/l/';

 var st = opts.split('•');
 var cnt = st.length;
 var bg = '';

 for(i=0;i<cnt;i++){
  bg+='<img class="img_png" src="'+b+st[i]+'" style="position:absolute;width:'+st[++i]+'px;height:'+st[++i]+'px;left:'+st[++i]+'px;top:'+st[++i]+'px;'+((st[++i]!='')?'cursor:pointer;':'')+'"'+((st[i]!='')?' onclick="'+st[i]+'"':'')+((st[++i]!='')?' title="'+st[i]+'"':'')+((st[++i]!='')?' '+st[i]:'')+'>';
 }

 var s = '<table align=center cellpadding=0 cellspacing=0 width=450>'+
'<tr><td colspan=3 valign=top style="height:299px;background-color:#000000;">'+
'<div style="position:relative;left:0px;top:0px;width:450px;">'+bg+'<img class=img_png style="position:absolute;left:0px;top:0px;width:42px;height:42px;" src="'+p+'c1.png"><img class=img_png style="position:absolute;left:407px;top:0px;width:43px;height:42px;" src="'+p+'c2.png"><img class=img_png style="position:absolute;left:0px;top:256px;width:42px;height:43px;" src="'+p+'c3.png"><img class=img_png style="position:absolute;left:407px;top:256px;width:43px;height:43px;" src="'+p+'c4.png"><img class=img_png style="position:absolute;left:42px;top:0px;width:365px;height:24px;" src="'+p+'b1.png"><img class=img_png style="position:absolute;left:0px;top:42px;width:24px;height:79px;" src="'+p+'b2.png"><img class=img_png style="position:absolute;left:425px;top:42px;width:25px;height:79px;" src="'+p+'b5.png"><img class=img_png style="position:absolute;left:0px;top:121px;width:36px;height:66px;" src="'+p+'b3.png"><img class=img_png style="position:absolute;left:410px;top:121px;width:40px;height:66px;" src="'+p+'b6.png"><img class=img_png style="position:absolute;left:0px;top:187px;width:24px;height:69px;" src="'+p+'b4.png"><img class=img_png style="position:absolute;left:425px;top:187px;width:25px;height:69px;" src="'+p+'b7.png"><img class=img_png style="position:absolute;left:42px;top:274px;width:365px;height:25px;" src="'+p+'b8.png"></div>'+
'</td></tr>'+
 ((txt!='')?'<tr><td style="background-color:#E4BD96;background-image:url('+p+'b10.gif);background-repeat:repeat;"></td>'+
'<td style="background-color:#E4BD96;padding-top:5px;text-align:justify;FONT-FAMILY:Verdana;FONT-SIZE:10pt;" valign=top>'+
txt+
'</td><td style="background-color:#E4BD96;background-image:url('+p+'b11.gif);background-repeat:repeat;"></td>'+
'</tr><tr>'+
'<td><img class=img_png style="background-color:#E4BD96;width:42px;height:43px;" src="'+p+'c3.png"></td>'+
'<td valign=bottom style="background-color:#E4BD96;"><img class=img_png style="width:365px;height:25px;" src="'+p+'b9.png"></td>'+
'<td><img class=img_png style="background-color:#E4BD96;width:43px;height:43px;" src="'+p+'c4.png"></td>'+
'</tr>':'')+
'</table>';

 document.write(s);
}