newWin = null;
function popup(href) {
	var height = 510;
	var width = 600;		
	var top = parseInt((screen.height - height) / 2);
	var left = parseInt((screen.width - width) / 2);		
	newWin = window.open(href,'show','toobar=no,location=no,directories=no,status=no,scrollbars,resizable=no,copyhistory=no,width='+width+',height='+height+',top='+top+',left='+left);
}
function checkModal() 
{
	if(newWin) newWin.focus();
}
function saveCont(from, to, formObj) 
{		
	from = (from) ? from : 'content';
	to = (to) ? to : 0;
	formObj = (formObj) ? formObj : document.cont;
	formObj.elements[to].value = document.getElementById(from).innerHTML;
}

var prevMenuItem = null;

function collapse()
{	
	if(this.className == '')
	{
		this.className = 'curr';
	}
	else
	{
		this.className = '';
	}
	if(prevMenuItem && ( prevMenuItem.firstChild.href != this.firstChild.href ))
	{		
		prevMenuItem.className = '';		
		prevMenuItem = this;
	}	
	else
	{
		prevMenuItem = this;
	}
}

function cancel(e)
{
	e = (e) ? e : window.event;
	e.cancelBubble = true;	
}

function initLeftMenu(obj)
{
	var items = obj.childNodes;
	for(var i=0; i<items.length; i++)
	{
		if(items[i].tagName == 'LI' && items[i].getElementsByTagName('UL').length > 0)
		{
			items[i].onclick = collapse;
			var links = items[i].getElementsByTagName('A');
			for(var j=0; j<links.length; j++)
			{
				links[j].onclick = cancel;
			}
		}				
	}
}

function init()
{
	var leftMenu = document.getElementById('leftMenu');
	if(leftMenu)
	{
		initLeftMenu(leftMenu);
	}
}
window.onload = init;