/*	Copyright 2006 Siorre.ru
	Designed for www.bmstu.ru	*/

function startNav() {

	var nodes = document.getElementById("nav");
	nodes = nodes.getElementsByTagName("td");

	for (var i=0; i<nodes.length; i++)
	{
		nodes[i].onmouseover = function()
		{
			this.className = "itemOver"
		} 
		nodes[i].onmouseout = function()
		{
			var name = this.className;
			this.className = "";
		}
	}

	var stubs = adaptScreen()
	
	if (!stubs)
		return

	nodes = document.getElementById("content")
	nodes = nodes.getElementsByTagName("td")

	var n = new Array()

	for (i=0; i<nodes.length; i++)
		if (nodes[i].className=="stub")
			n.push(nodes[i])
	for (i=0; i<2; i++)
		n[i].width = stubs[i]+"%";
}

function adaptScreen() {

	var w = 0
	var h = 0

	w = screen.width
	h = screen.height

	if (w!=0) {

		if (w==1280) {

			return [3,1]
		}
		else if (w > 1280) {

			return [5,2]
		}
	}
	
	return false
}


function windowFormCentered( name, open, winwidth, winheight, param )
{
    var win = null;
    tp=Math.ceil((screen.height-winheight)/2);
    lf=Math.ceil((screen.width-winwidth)/2);
    window.open( open, name, "width="+winwidth+",height="+winheight+",top="+tp+",left="+lf+param+'location=no,status=no,resizable=yes,toolbar=no,scrollbars=1,menubar=no' )
}


