function screenSize() {
      var w, h; // Объявляем переменные, w - длина, h - высота
      w = (window.innerWidth ? window.innerWidth : (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.offsetWidth));
      h = (window.innerHeight ? window.innerHeight : (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.offsetHeight));
      return {w:w, h:h};
}
function testit() {
	if (document.getElementById('testlink')) {
		pos = getElementPosition('testlink');
		lls = document.getElementById('livelineH').style;
		llsv = document.getElementById('livelineV').style;
		lls.display='';
		lls.top = pos.top+pos.height+4+'px';
		lls.width='25px';
		llsv.top = pos.top+pos.height+4+'px';
		setTimeout("move_ll_hor()",20);
	}
	pos = getElementPosition('myleftmenu');
	document.getElementById('myrast').height=pos.height+60;
		pos =  screenSize();
		if (pos.w<1020) document.getElementById('pribor').style.display='none';
		else document.getElementById('pribor').style.display='';

}
function getElementPosition(elemId)
{
    var elem = document.getElementById(elemId);
	
    var w = elem.offsetWidth;
    var h = elem.offsetHeight;
	
    var l = 0;
    var t = 0;
	
    while (elem)
    {
        l += elem.offsetLeft;
        t += elem.offsetTop;
        elem = elem.offsetParent;
    }

    return {"left":l, "top":t, "width": w, "height":h};
}
var movetov=0;
function move_ll_hor() {
	lls = document.getElementById('livelineH').style;
	curX = lls.width.replace('px','');
	if (curX<215) {
		curX = (curX*1+10);
		lls.width=curX+'px';
		setTimeout("move_ll_hor()",20);
	} else {
		curX = 215;
		lls.width=curX+'px';
		document.getElementById('livelineV').style.display='';
		setTimeout("move_ll_ver()",20);
		pos = getElementPosition('mycontenttd');
		movetov = pos.top+pos.height - lls.top.replace('px','')+1;
		
	}
}
function move_ll_ver() {
	lls = document.getElementById('livelineV').style;
	curY = lls.height.replace('px','')*1;
	if (movetov>0) {
		if (curY+10<movetov) {
			curY = (curY*1+10);
			lls.height=curY+'px';
			setTimeout("move_ll_ver()",20);
		} else {
			curY = movetov;
			lls.height=curY+'px';
			document.getElementById("bottomsep").style.display="block";
		}
	} else {
		if (curY+10<movetov*-1) {
			curY = (curY*1+10);
			lls.height=curY+'px';
			lls.top=(lls.top.replace('px','')-10)+'px';
			setTimeout("move_ll_ver()",20);
		} else {
			curY = -movetov;
			lls.top=(lls.top.replace('px','')-10)+'px';
			lls.height=curY+'px';
			document.getElementById("bottomsep").style.display="block";
		}
	}
}
function goresize(event) {
	if (document.getElementById('testlink')) {
		pos = getElementPosition('mycontenttd');
		movetov = pos.top+pos.height - lls.top.replace('px','')+1;
		curY = movetov;
		lls.height=curY+'px';
		document.getElementById("bottomsep").style.display="block";
	}
		pos = getElementPosition('myleftmenu');
		document.getElementById('myrast').height=pos.height+60;
		pos =  screenSize();
		if (pos.w<1020) document.getElementById('pribor').style.display='none';
		else document.getElementById('pribor').style.display='';
}
function godown(id) {
	if (!noclick[id]) {
	document.getElementById('mydiv'+id).style.display=(document.getElementById('mydiv'+id).style.display=='none'?'block':'none');
	if (document.getElementById('testlink'))  {
		pos = getElementPosition('testlink');
		lls = document.getElementById('livelineH').style;
		llsv = document.getElementById('livelineV').style;
		lls.display='';
		lls.top = pos.top+pos.height+4+'px';
		llsv.top = pos.top+pos.height+4+'px';
		pos = getElementPosition('myleftmenu');
		document.getElementById('myrast').height=pos.height+60;
		pos = getElementPosition('mycontenttd');
		movetov = pos.top+pos.height - lls.top.replace('px','')+1;
		llsv.height=movetov+'px';
	} else {
		pos = getElementPosition('myleftmenu');
		document.getElementById('myrast').height=pos.height+60;
	}
	}

}
var noclick = Array();
window.onresize = goresize;
