ar5=new Array();
ar4=new Array();
ar3=new Array();
ar2=new Array();
ar=new Array();

function hide_1(DI)
{
	if (ar[DI]==0)
	{
	document.getElementById(DI).style.visibility="hidden";
	}
}

function hide_2(DI2)
{
	if (ar2[DI2]==0)
	{
	document.getElementById(DI2).style.visibility="hidden";
	}
}

function hide_3(DI3)
{
	if (ar3[DI3]==0)
	{
	document.getElementById(DI3).style.visibility="hidden";
	}
}

function hide_4(DI4)
{
	if (ar4[DI4]==0)
	{
	document.getElementById(DI4).style.visibility="hidden";
	}
}

function hide_5(DI5)
{
	if (ar5[DI5]==0)
	{
	document.getElementById(DI5).style.visibility="hidden";
	}
}

function show_(DI)
{
	document.getElementById(DI).style.visibility="visible";
	ar[DI] = 1;
}

function hide1(DI)
{
	ar[DI] = 0;
	st=DI.toString();
	proc="hide_1('"+st+"')";
	setTimeout(proc,200);
}

function sl(DI)
{
	ar[DI] = 1;
	document.getElementById(DI).style.visibility="visible";
}

function sla(DI)
{	
	ar[DI] = 0;
	st=DI.toString();
	proc1="hide_1('"+st+"')";
	setTimeout(proc1,200);
}

function therd_l_on1(DI,DI1){
	ml(DI,DI1);
	DI2 = DI1+""+DI;
	ar2[DI2] = 1;
	document.getElementById(DI2).style.visibility="visible";
}

function therd_l_off1(DI,DI2){
	ar2[DI2] = 0;
	st=DI2.toString();
	proc1="hide_2('"+st+"')";
	setTimeout(proc1,200);
}

function therd_l_on(DI,DI2){
	ar[DI]	 = 1;
	ar2[DI2]	 = 1;
}

function therd_l_off(DI,DI2){
	ar[DI] = 0;
	ar2[DI2] = 0;
	st=DI2.toString();
	proc1="hide_2('"+st+"')";
	setTimeout(proc1,200);
	st2=DI.toString();
	proc2="hide_1('"+st2+"')";
	setTimeout(proc2,200);
}

function forth_l_on1(DI,DI1,DI2){
	m2(DI,DI1,DI2);/*подвинули слой на нужную поизицию*/
	DI_end = DI2+""+DI1+""+DI;
	ar3[DI_end] = 1;/*объявили слой открытым*/
	document.getElementById(DI_end).style.visibility="visible";/*показали его*/
}

function forth_l_off1(DI,DI2,DI3){
	ar3[DI3] = 0;
	st=DI3.toString();
	proc1="hide_3('"+st+"')";
	setTimeout(proc1,200);
}

function forth_l_on(DI,DI2,DI3){
	ar[DI] = 1;
	ar2[DI2] = 1;
	ar3[DI3] = 1;
}

function forth_l_off(DI,DI2,DI3){
	ar[DI] = 0;
	ar2[DI2] = 0;
	ar3[DI3] = 0;
	st=DI3.toString();
	proc1="hide_3('"+st+"')";
	setTimeout(proc1,200);
	st2=DI2.toString();
	proc2="hide_2('"+st2+"')";
	setTimeout(proc2,200);
	st3=DI.toString();
	proc3="hide_1('"+st3+"')";
	setTimeout(proc3,200);
}

function fifth_l_on1(DI,DI1,DI2,DI3){
	m3(DI,DI1,DI2,DI3);/*подвинули слой на нужную поизицию*/
	DI_end = DI3+""+DI2+""+DI1+""+DI;
	ar4[DI_end] = 1;/*объявили слой открытым*/
	document.getElementById(DI_end).style.visibility="visible";/*показали его*/
}

function fifth_l_off1(DI,DI2,DI3,DI4){
	ar4[DI4] = 0;
	st=DI4.toString();
	proc1="hide_4('"+st+"')";
	setTimeout(proc1,200);
}

function fifth_l_on(DI,DI2,DI3,DI4){
	ar[DI] = 1;
	ar2[DI2] = 1;
	ar3[DI3] = 1;
	ar4[DI4] = 1;	
}

function fifth_l_off(DI,DI2,DI3,DI4){
	ar[DI] = 0;
	ar2[DI2] = 0;
	ar3[DI3] = 0;
	ar4[DI4] = 0;	
	st0=DI4.toString();
	proc0="hide_4('"+st0+"')";
	setTimeout(proc0,200);
	st1=DI3.toString();
	proc1="hide_3('"+st1+"')";
	setTimeout(proc1,200);
	st2=DI2.toString();
	proc2="hide_2('"+st2+"')";
	setTimeout(proc2,200);
	st3=DI.toString();
	proc3="hide_1('"+st3+"')";
	setTimeout(proc3,200);
}

function sixth_l_on1(DI,DI1,DI2,DI3,DI4){
	m4(DI,DI1,DI2,DI3,DI4);/*подвинули слой на нужную поизицию*/
	DI_end = DI4+""+DI3+""+DI2+""+DI1+""+DI;
	ar5[DI_end] = 1;/*объявили слой открытым*/
	document.getElementById(DI_end).style.visibility="visible";/*показали его*/
}

function sixth_l_off1(DI,DI2,DI3,DI4,DI5){
	ar5[DI5] = 0;
	st=DI5.toString();
	proc1="hide_5('"+st+"')";
	setTimeout(proc1,200);
}

function sixth_l_on(DI,DI2,DI3,DI4,DI5){
	ar[DI] = 1;
	ar2[DI2] = 1;
	ar3[DI3] = 1;
	ar4[DI4] = 1;	
	ar5[DI5] = 1;		
}

function sixth_l_off(DI,DI2,DI3,DI4,DI5){
	ar[DI] = 0;
	ar2[DI2] = 0;
	ar3[DI3] = 0;
	ar4[DI4] = 0;	
	ar5[DI5] = 0;		
	st00=DI5.toString();
	proc00="hide_5('"+st00+"')";
	setTimeout(proc00,200);
	st0=DI4.toString();
	proc0="hide_4('"+st0+"')";
	setTimeout(proc0,200);
	st1=DI3.toString();
	proc1="hide_3('"+st1+"')";
	setTimeout(proc1,200);
	st2=DI2.toString();
	proc2="hide_2('"+st2+"')";
	setTimeout(proc2,200);
	st3=DI.toString();
	proc3="hide_1('"+st3+"')";
	setTimeout(proc3,200);
}

function counter_top(name)
{
name_ = document.all[name];
top_ = 0;
while (name_.offsetParent) {
   top_=top_+name_.offsetTop;
   name_ = name_.offsetParent;
 }
top_ = top_-1;
return top_;
}

function counter_left(name)
{
name_ = document.all[name];
left_ = 0;
while (name_.offsetParent) {
   	 left_=left_+name_.offsetLeft;
  	 name_=name_.offsetParent;
 }
left_ = left_+1;
return left_;
}

function ml(DI,DI1)
{
num = "1"+(DI-1)+""+(DI1-1);
_left = counter_left('zero_xy'+num);
_top = counter_top('zero_xy'+num);
DI2 = DI1+""+DI;
document.getElementById(DI2).style.left = _left;
document.getElementById(DI2).style.top = _top;
}

function m2(DI,DI1,DI2)
{
num = (DI-1)+""+(DI1-1)+""+(DI2-1);
_left = counter_left('zero_xy2_'+num);
_top = counter_top('zero_xy2_'+num);
DI_end = DI2+""+DI1+""+DI;
document.getElementById(DI_end).style.left = _left;
document.getElementById(DI_end).style.top = _top;
}

function m3(DI,DI1,DI2,DI3)
{
num = (DI-1)+""+(DI1-1)+""+(DI2-1)+""+(DI3-1);
_left = counter_left('zero_xy3_'+num);
_top = counter_top('zero_xy3_'+num);
DI_end = DI3+""+DI2+""+DI1+""+DI;
document.getElementById(DI_end).style.left = _left;
document.getElementById(DI_end).style.top = _top;
}

function m4(DI,DI1,DI2,DI3,DI4)
{
num = (DI-1)+""+(DI1-1)+""+(DI2-1)+""+(DI3-1)+""+(DI4-1);
_left = counter_left('zero_xy4_'+num);
_top = counter_top('zero_xy4_'+num);
DI_end = DI4+""+DI3+""+DI2+""+DI1+""+DI;
document.getElementById(DI_end).style.left = _left;
document.getElementById(DI_end).style.top = _top;
}

