s_h=(screen.availHeight-125)-120; 
s_w=(screen.availWidth-125)-30;
//s_h=document.clientHeight-125; 
//s_w=document.clientWidth-125;
 
s_h = s_h > 500 ? s_h: 500;
s_w = s_w > 600 ? s_w: 600;

//==============================================================
l_ct   = 0;
l_cmt  = 0;
l_idx  = -1;
ltimer = true;
//==============================================================
function resize()
{
  Top.style.width=s_w;
  Tref.style.width=s_w;
  Left.style.height=s_h;
  Lef.style.height=s_h;
  Page.style.height=s_h;
  if (Left.style.visibility == "visible")
  { 
    Page.style.left=126;
    Page.style.width=s_w;
    arrow.src="image/arr_left.gif";
    arrow.alt="Скрыть содержание";
  }
  else
  {
    Page.style.left=11;
    Page.style.width=s_w+115;
    arrow.src="image/arr_right.gif";
    arrow.alt="Показать содержание";
  }
}
function leftover()
{ var x, y;
  leh.style.top = event.y;
  leh.style.visibility = "visible";
}
function vleft()
{
  Left.style.visibility = Left.style.visibility == "visible"? "hidden": "visible";
  resize();
}

function maxpage()
{ if (Left.style.visibility == "visible") vleft(); else;
}
function filidx(x, y)
{ if (x*10+(y-1)) return (x*10+(y-1))+".htm";
  else return "index.html";
}

function hlhide(idx) 
{ if (l_idx >= 0)
  { if (ltimer) 
    { l_idx=-1; clearTimeout (l_cmt); l_cmt=0;
	  document.all["h_"+idx].style.visibility="hidden";
	}   
	else SetTimer(idx);
  } else;	
}

function SetTimer (idx) {
	l_cmt = setTimeout ("hlhide("+idx+")", 1500);
}

function hlshow(idx) {
  if (l_idx >= 0) { hlhide(l_idx); } else;
  l_idx=idx;
  document.all["h_"+idx].style.top=125+eval("lp"+idx+".offsetTop");	//event.y
  document.all["h_"+idx].style.visibility="visible";

  clear_Timeout();
}

function hldef() {
for (n=i=0; i<n_v; i++)
{ document.write('<div id="h_');
  document.write(i);
  document.write('" style="position:absolute; left:110px; top:87px; width:150px; height:10px; z-index:4; background-color:#E1E1E1; layer-background-color:#E1E1E1; border: 1px; visibility:hidden; overflow:visible" onmouseout="ltimer=true;" onmouseover="ltimer=false;">');
  document.write('<font size="2"><b>');

  for (j=0; j<nitem[i]; j++)
  {
    if (item[j+n] != "") 
    { document.write('<table width="100%" border="1" cellpadding="0" cellspacing="0"><tr><td width="100%" height="18" bgcolor="#E1E1E1"><font size="2"><b><a href="');
	  document.write(filidx(i,j+1)+'" title="');
	  document.write(header[j+n]+'">');
	  document.write(item[j+n]);
	  document.write('</a></b></font></td></tr></table>'); }
  }
  document.write('</b></font>');
  document.write('</div>');
  n+=nitem[i];
}
}

function htshow(idx) {
  for (x=125, i=0; i<tb1.cells.length-1 && i<idx; i++)
  {
    x+=tb1.cells[i].clientWidth;
  } 
  document.all["t_"+idx].style.left=x+200>s_w+125?s_w+125-200:x;	//event.x
  document.all["t_"+idx].style.visibility="visible";
}

function hthide(idx) { document.all["t_"+idx].style.visibility="hidden"; }

function htdef(v) {
for (n=i=0; i<v; i++)
{ n+=nitem[i];
}
for (i=0; i<nitem[v]; i++)
{ document.write('<div id="t_');
  document.write(i);
  document.write('" style="position:absolute; left:130px; top:50px; width:200px; height:10px; z-index:4; background-color:yellow; layer-background-color:yellow; border: 1px; visibility:hidden; overflow:visible">');
  document.write('<font size="2"><b>');
  document.write('<table width="100%" border="1" cellpadding="0" cellspacing="0"><tr><td width="100%" height="18" bgcolor="#E1E1E1" valign="top" align="center"><font size="2"><b>'+header[i+n]+'</b></font></td></tr></table>');
  document.write('<table width="100%" border="1" cellpadding="0" cellspacing="0"><tr><td width="100%" height="18" bgcolor="#E1E1E1" valign="top" align="center"><font size="2"><b><i>'+subheader[i+n]+'</i></b></font></td></tr></table>');
  document.write('</b></font>');
  document.write('</div>');
 }
}

function tdef(v) {
for (i=0; i<nitem[v]-1; i++)
{ 
  document.write('<td height="1"><img height="1" width="'+(s_w/nitem[v])+'" src="image/spacer.gif"></td>');
}
}

function mapdef() {
var x, y;
for (n=x=0; x<n_v; x++)
{ document.write('<tr>');
  for (y=0; y<=nitem[x]; y++)
  { 
    document.write('<td');
    if (!y) document.write(' bgcolor="#FFCC99"');
    else;
    document.write(' align="center"><b><font face="Arial, Helvetica, sans-serif" size="2">');
    if (y)
    { if (item[(y-1)+n])
      { document.write('<a href="'+filidx(x, y)+'" target="_blank">');
        document.write(item[(y-1)+n]+'</a><font size="1"><br><b>'+header[(y-1)+n]+'</b><br>'+subheader[(y-1)+n]+'</font>');
      }
      else;
    }
    else
    {
      document.write(chapter[x]);
    }
    document.write('&nbsp;</font></b></td>');
  }
  document.write('</tr>');
  n+=nitem[x];
}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

var flash_TimerID;
var flash_updown = 1;
var flash_str = 1;

function flash_init()
{
if (document.all)
flash_TimerID = window.setInterval( "flash_req()", 100 );
}

function flash_req()
{
if ( flash_str > 5 || flash_str < 1 ) flash_updown = -flash_updown;

flash_str+=flash_updown;


Tref.filters( "Alpha" ).StartX = flash_str*20;
Tref.filters( "Alpha" ).FinishX = 50+flash_str*20;
}

function flash_start()
{
window.onload=flash_init
}

function clear_Timeout()
{
  if (l_ct) clearTimeout (l_ct);
//document.write("<p>l_ct=" + l_ct+"</p>");
  l_ct=0;
}
