function normalpopup(url, winid, width, height)
{
	return window.open(url ,winid ,'width='+width+',height='+height+',top='+((screen.height/2)-(height/2))+',left='+((screen.width/2)-(width/2))+',toolbar=no,scrollbars=yes,resizable=yes,menubar=no,status=no,directories=no,location=no');
}

function centerpopup(url, winid, width, height)
{
	return window.open(url ,winid ,'width='+width+',height='+height+',top='+((screen.height/2)-(height/2))+',left='+((screen.width/2)-(width/2))+',toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no,directories=no,location=no');
}

function popimg(url, title, width, height)
{
	str="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"><html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\">\n<title>"+title+"</title>\n</head>\n<body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0>\n<img src='"+url+"' alt='"+title+"'>\n</body>\n</html>";
	f_win = window.open(url ,"BigImage" ,'width='+width+',height='+height+',top='+((screen.height/2)-(height/2))+',left='+((screen.width/2)-(width/2))+',toolbar=no,scrollbars=no,resizable=yes,menubar=no,status=no,directories=no,location=no');
	f_win.document.writeln(str);
	f_win.focus();
	f_win.document.close();
}

function popup(url, title, width, height)
{
	f_win = window.open(url ,"" ,'width='+width+',height='+height+',top='+((screen.height/2)-(height/2))+',left='+((screen.width/2)-(width/2))+',toolbar=no,scrollbars=yes,resizable=yes,menubar=no,status=no,directories=no,location=no');
	f_win.focus();
}

function popup_imagef(url)
{
	var wnd = window.open('/~client/popup_iresizer.html?'+url ,'' ,'toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no,directories=no,location=no');
}

function toggle_rubric(index, stat)
{
	var big = $('news_big_'+index);
	var small = $('news_small_'+index);
	if (stat==undefined)
	{
		big.style.display=big.style.display=='none'?'':'none';
		small.style.display=big.style.display=='none'?'':'none';
	}
	else
	{
		if (stat)
		{
			big.style.display='';
			small.style.display='none';
		}
		else
		{
			big.style.display='none';
			small.style.display='';
		}
	}
}

function toggleButton(obj, remote)
{
	var opened = $(remote).style.display!='none';
	obj.childNodes[0].style.display = opened?'':'none';
	obj.childNodes[1].style.display = opened?'none':'';
	$(remote).style.display = opened?'none':'';
}

function previousElement(node)
{
	do
	{
		node = node.previousSibling;
		if (node && node.nodeType==1)
			return node;
	}
	while (node);
}

function nextElement(node)
{
	do
	{
		node = node.nextSibling;
		if (node && node.nodeType==1)
			return node;
	}
	while (node);
}

function childElements(node)
{
	var result = [];
	if (node && node.childNodes)
	{
		for (var i=0; i<node.childNodes.length; i++)
			if (node.childNodes[i].nodeType==1)
				result.push(node.childNodes[i]);
	}
	return result;
}

function activateStars(obj, active)
{
	var r_from = active?'\.gif':'_act.gif';
	var r_to = active?'_act.gif':'.gif';
	obj.src = obj.src.replace(r_from, r_to);
	obj = obj.parentNode;
	do
	{
		obj = previousElement(obj);
		if (obj && childElements(obj).length>0)
		{
			var elm = childElements(obj)[0];
			elm.src = elm.src.replace(r_from, r_to);
		}
	}
	while (obj)
}