// JavaScript Document
function SubMenu(id)
{
	var Navi = document.getElementById('LeftNavi');
	var NaviSub = Navi.getElementsByTagName('div');
	if (NaviSub[id] != null) {
		if (NaviSub[id].style.display != 'block') {
			for (i = 0; i < NaviSub.length; i++) {
				NaviSub[i].style.display = 'none';
			}
			NaviSub[id].style.display = 'block';
		} else {
			NaviSub[id].style.display = 'none';
		}
	}
}

function SubMenuState(id, st)
{
	var Navi = document.getElementById('LeftNavi');
	var NaviSub = Navi.getElementsByTagName('div');
	var state = 'none';
	if (st > 0)
		state = 'block';
	if (NaviSub[id] != null) {
		if (NaviSub[id].style.display != state) {
			for (i = 0; i < NaviSub.length; i++) {
				NaviSub[i].style.display = 'none';
			}
			NaviSub[id].style.display = state;
		}
	}
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			if (typeof func == 'function')
				func();
		}
	}
}

function CFrame(url, height)
{
	var tw = window
	while (tw.top && tw.top != tw)
		tw = tw.top;
	tw.location = url;
	//var WinFrame=document.getElementById('win');
	//WinFrame.style.height=height+'px';
	//window.open(url, "MainFrame");
}

function SearchFrame(url, height)
{
	var WinFrame=parent.document.getElementById('win');
	WinFrame.style.height=height+'px';
	window.open(url, "MainFrame");
}

function SetFrame(url, height)
{
	CFrame(url, height);
	var Navi = document.getElementById('LeftNavi');
	var NaviSub = Navi.getElementsByTagName('div');
	if (NaviSub.length != 0)
	{
		for (i = 0; i < NaviSub.length; i++)
		{
			NaviSub[i].style.display = 'none';
		}
	}
}

function SetFrame1(url, height)
{
	alert('Раздел доступен только для зарегестрированных пользователей. Пожалуйста, авторизуйтесь!');
}

function OpenWindow(URL)
{
	wnd = window.open(URL, 'New', 'height=' + screen.availHeight +
			',width=' + screen.availWidth +
			',top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no,status=no');
	wnd.focus();
}

function ParentFrame(url, height)
{
	var WinFrame=parent.document.getElementById('win');
	WinFrame.style.height=height+'px';
	window.open(url, "MainFrame");
}

function PParentFrame(url, height)
{
	var WinFrame=parent.parent.document.getElementById('win');
	WinFrame.style.height=height+'px';
	window.open(url, "MainFrame");
}

function ChangeFrame(height)
{
	var WinFrame=parent.parent.document.getElementById('win');
	WinFrame.style.height=height+'px';
	
	var Navi = document.getElementById('LeftNavi');
	var NaviSub = Navi.getElementsByTagName('div');
	for (i = 0; i < NaviSub.length; i++)
	{
		NaviSub[i].style.display = 'none';
	}
}