function $(id) { return document.getElementById(id); }

function menu() {
	var nodes = document.getElementById("menu").getElementsByTagName("LI");
	for (var i=0; i<nodes.length; i++) {
		nodes[i].onmouseover=function() { this.className+=" over"; }
		nodes[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" over\\b"), ""); }
	}
}

function move(items,to,shift) {
	items = $(items);
	box = items.parentNode;

	if ((to == 'top')||(to == 'bottom')) { direct = 'top'; core(direct); }
	if ((to == 'left')||(to == 'right')) { direct = 'left'; core(direct); }

	function core(direct) {
		if (!items.style[direct]) items.style[direct] = 0;
		var shif_now = parseInt(items.style[direct]);
		if (((to == 'top')||(to == 'left'))&&(shif_now < 0)) items.style[direct] = (shif_now + shift) + 'px';
		if ((to == 'bottom')&&(box.scrollHeight >= (box.offsetHeight + shift))) items.style[direct] = (shif_now - shift) + 'px';
		if ((to == 'right')&&(box.scrollWidth >= (box.offsetWidth + shift))) items.style[direct] = (shif_now - shift) + 'px';
	}
}

function photogal(img,img_big) {
	$('photogal_big').src = img;
	$('photogal_big').parentNode.href = img_big;
}

function mi_switches(link) {
	linkRoot = link.parentNode.parentNode;
	blockRoot = $('mod_table');
	j = 0;
	n = 0;
	for (i=0; i<linkRoot.childNodes.length; i++) {
		node = linkRoot.childNodes[i];
		if (node.nodeName == "TD") {
			if (node == link.parentNode) num = j;
			node.className = node == link.parentNode ? "act" : "";
			j++;
		}
	}
	for (m=0; m<blockRoot.childNodes.length; m++) {
		node = blockRoot.childNodes[m];
		if (node.nodeName == "TR") {
			node.className = n == num ? "" : "n_act";
			n++;
		}
	}
}

function popup(url,width,height) {
	var okno, url, width, height;
	okno = window.open(url,'_blank','copyhistory=no,directories=no,location=no,status=no,scrollbars=yes,menubar=no,toolbar=no,resizable=no,width='+width+',height='+height);
}
