function flow(objId, hBlock) 
 {
 var sum = 6; //количество объектов
 var on = 1; //начальная скорость открытия
 var oc = 40; //начальная скорость закрытия
 var sp = 1.122; //коэффициент ускорения/замедления
 var so = 0.031; //скорость прозрачности
 var px = 10; //количество пикселей за цикл
 var foc = 0;
 
 var obj = document.getElementById("b" + objId);
 var arrow = document.getElementById("a" + objId);
 var covert = document.getElementById("l" + objId);
 var footer = document.getElementById("footer");
 
 obj.style.textShadow = "none";
 footer.style.textShadow = "none";

 for (var id_div = 1; id_div <= sum; id_div++)
  {
  if (document.getElementById("b" + id_div).offsetHeight > 1)
   {
   var obj_close = document.getElementById("b" + id_div);
   var arrow_right = document.getElementById("a" + id_div);
   var covert_close = document.getElementById("l" + id_div);
   obj_close.style.border = 0;
   obj_close.style.textShadow = "none";
   covert_close.style.opacity = 1;
   foc = 1;
   close_div();
   break;
   }
  if ((id_div == sum) && (foc != 1))
   {
   if (obj.offsetHeight < 1)
	{
	arrow.src = "/img/arrow_down.png";
	obj.style.display = "block";
	covert.style.opacity = 0;
	open_div();
	}
   else
	{
	close_div();
	}
   }
  }
  
 function open_div()
  {
  if (obj.offsetHeight < (hBlock - 5))
   {
   on = on * sp;
   obj.style.height = (obj.offsetHeight + px) + "px";
   covert.style.opacity = parseFloat(covert.style.opacity) + so;
   setTimeout(open_div, on);
   }
  else
   {
   covert.style.opacity = 1;
   obj.style.textShadow = "0px 1px 1px rgb(0,0,0)";
   footer.style.textShadow = "0px -1px 1px rgb(255,255,255), 0px 1px 1px rgb(150,150,150)";
   }
  }

 function close_div()
  {
  if (obj_close.offsetHeight >= 5)
   {
   oc = oc / sp;
   obj_close.style.height = (obj_close.offsetHeight - px) + "px";
   covert_close.style.opacity = parseFloat(covert_close.style.opacity) - so;
   setTimeout(close_div, oc);
   }
  else
   {
   arrow_right.src = "/img/arrow_right.png";
   obj_close.style.display = "none";
   obj.style.textShadow = "0px 1px 1px rgb(0,0,0)";
   footer.style.textShadow = "0px -1px 1px rgb(255,255,255), 0px 1px 1px rgb(150,150,150)";
   if ((foc = 1) && (objId != id_div))
    {
	arrow.src = "/img/arrow_down.png";
	obj.style.display = "block";
	covert.style.opacity = 0;
    obj.style.textShadow = "none";
	footer.style.textShadow = "none";
	open_div();
	}
   }
  }
 }

function openback()
 {
 if (window.location.hash != '')
  {
  an = window.location.hash.replace('#','')
  if (an == "inex") {an = 1;}
  if (an == "lestnicy") {an = 2;}
  if (an == "ograjdeniya") {an = 3;}
  if (an == "peregorodki") {an = 4;}
  if (an == "pregrady") {an = 5;}
  if (an == "drugoe") {an = 6;}
  flow(an, 325);
  }
 }

function open_all()
 {
 for (var opal = 1; opal <= 6; opal++)
  {
  c_open = document.getElementById("c" + opal);
  c_open.style.cursor = "default";
  c_open.onclick = "";
  c_open.onmouseover = "";
  c_open.onmouseout = "";
  document.getElementById("oc").src = "/img/bl_close.png";
  document.getElementById("a" + opal).src = "/img/arrow_down.png";
  l_open = document.getElementById("l" + opal);
  l_open.style.opacity = 1;
  l_open.style.textShadow = "0px 1px 1px rgb(0,0,0)";
  b_open = document.getElementById("b" + opal);
  b_open.style.height = "325px";
  b_open.style.display = "block";
  document.getElementById("oa").style.display = "none";
  document.getElementById("ca").style.display = "inline";
  }
 }

function ll_on(line)
 {
 document.getElementById("line_" + line).style.background = "url(/img/bg_line_"+line+"_active.png)";
 }
function ll_off(line)
 {
 document.getElementById("line_" + line).style.background = "url(/img/bg_line_"+line+".png)";
 }

function ll_on_all()
 {
 for (var llon = 1; llon <= 6; llon++)
  {
  document.getElementById("line_" + llon).style.background = "url(/img/bg_line_"+llon+"_active.png)";
  }
 }
function ll_off_all()
 {
 for (var lloff = 1; lloff <= 6; lloff++)
  {
  document.getElementById("line_" + lloff).style.background = "url(/img/bg_line_"+lloff+".png)";
  }
 }

