
function getCurrentPos(e) {
	var current = e;
	var currentTop = 0;
	var currentLeft = 0;
	var currentHeight = current.offsetHeight;
	var currentWidth = current.offsetWidth;
	while (current) {
		currentLeft += current.offsetLeft;
		currentTop += current.offsetTop;
		current = current.offsetParent;
	}
	return {left:currentLeft, top:currentTop, width:currentWidth, height:currentHeight};
}

function showSubmenu(e, menuID) {
	var current = getCurrentPos(e);
	var submenu = document.getElementById(menuID);
	submenu.style.left = current.left - 10;
	submenu.style.top = current.top + current.height - 10;
	submenu.style.display = 'block';
	if (submenu.offsetWidth < current.width) {
		submenu.style.width = current.width - 10
	}
}

function hideSubmenu(e, menuID) {
	var submenu = document.getElementById(menuID);
	submenu.style.display = 'none';
}

function show(e) {
	e.style.display='block';
}
function hide(e) {
	if (document.getElementById(e)) {
		document.getElementById(e).style.display='none';
	} else {
		e.style.display='none';
	}
}

function hide(e) {
	if (document.getElementById(e)) {
		document.getElementById(e).style.display='none';
	} else {
		e.style.display='none';
	}
}

function popUpOpenRS (winUrl, winW, winH)
{
//функция открывает заданный файл в окне с определёнными размерами с возможностью ресайза.
//скроллинг разрешён.
		scrol = 1;
		winProp = "width="+winW+",height="+winH+",scrollbars="+scrol+",left=50,top=50, toolbar=no,location=no,status=no,resizable=yes,screenX=50,screenY=50";
		window.open(winUrl,'',winProp);
}

function a(obj){
obj.style.border = "0";
}

function b(obj){
obj.style.border = "1px Solid Gray";
}
