function arte_print_value(form_name, var_name, var_value)
{
	var form_obj = eval("document." + form_name);
	form_obj[var_name].value = var_value;
}

function show_photo(file_type, id_parent, id_file, width, height)
{
	var parametry = "TOOLBAR=no,STATUS=no, resizable, scrollbars=no, width="+width+", height="+(height+20);
	var gdzie = "pic_show.php?photo="+id_file + "&parent="+id_parent + "&type=" + file_type;
	
	if (typeof show_photo_window == "object")
		show_photo_window.close();

	show_photo_window = window.open(gdzie,"", parametry);
}

function displayWindow(url, width, height) 
{
	var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=no,toolbar=no,location=no,directories=no' );
}

window.onload = function () {
	var x = document.getElementsByTagName('DIV');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].className == 'subtitle')
			x[i].onclick = clickNav;
	}
	closeNav();

	setNav(location.href,'currentPage');
}

function closeNav()
{
	var x = document.getElementsByTagName('UL');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].className == 'submenu')
			x[i].style.display = 'none';
	}
}

function clickNav(e)
{
	if (!e) var e = window.event;
	if (e.target) var tg = e.target;
	else if (e.srcElement) var tg = e.srcElement;
	while (tg.nodeName != 'DIV') // Safari GRRRRRRRRRR
		tg = tg.parentNode;
	var nextSib = tg.nextSibling;
	while (nextSib.nodeType != 1)
		nextSib = nextSib.nextSibling;

	tg.style.background = (nextSib.style.display == 'none') ? 'url(gfx/submenu-open.gif) top right no-repeat #dce2ec' : 'url(gfx/submenu-close.gif) top right no-repeat #e9ecf0';
	tg.style.fontWeight = (nextSib.style.display == 'none') ? 'bold' : 'normal';

	var nextSibStatus = (nextSib.style.display == 'none') ? 'block' : 'none';
	nextSib.style.display = nextSibStatus;

}

function setNav(page,newID)
{
	/*
	 * 07.07.2011
	 * poprawiony kod otwierajacy submenu z uwzlglednieniem elementu span
	 */
	
	var x = document.getElementsByTagName('li');
	var i;
	
	for (i=0;i<x.length;i++)
	{
		if (page.indexOf(x[i].id)>0) //sprawdzamy czy id spanu znajduje sie w url
		{
			parUl = x[i].parentNode;
			parUl.style.display = 'block'; //ul
			parDiv = parUl.parentNode;
			parDiv.style.background = 'url(gfx/submenu-open.gif) top right no-repeat #dce2ec';
			parDiv.style.fontWeight = 'bold';
			
			
			break;
		}
	}	
	
	/*
	var test = page.indexOf('#')+1;
	if (test)
		page = page.substring(0,test-1);
	var x = document.getElementsByTagName('A');
	var i;
	for (i=0;i<x.length;i++)
	{
		if (x[i].href == page)
		{
			x[i].id = newID;
			break;
		}
	}
	
	if (i < x.length && newID == 'currentPage')
	{
		var parDiv = x[i];
		while (parDiv.parentNode.tagName == 'LI')
		{
			parDiv = parDiv.parentNode;
			parDiv.parentNode.style.display = 'block';
		
			var prevSib = parDiv.parentNode.previousSibling;
			while (prevSib.nodeType != 1)
				prevSib = prevSib.previousSibling;
			
			if (prevSib.className == 'subtitle')
			{
				prevSib.style.background = 'url(gfx/submenu-open.gif) top right no-repeat #dce2ec';
				prevSib.style.fontWeight = 'bold';
			}
		}
	}
	*/
}
