function mainmenu(){
$(" #hm_nav ul.horisontalNav ").css({display: "none"}); // Opera Fix
$(" #hm_nav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(200);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});
}

function poptastic(url)
{
	var newwindow;
	newwindow=window.open(url,'name','height=450,width=500');
	if (window.focus) {newwindow.focus()}
}

function OpenPopUp(url)
{
	if(navigator.appName == "Microsoft Internet Explorer") url = "\"" + url + "\"";
	window.open(url);
}

$(document).ready(function(){					
	mainmenu();
	
	$("ul#myPracticeDataTree img").bind('click', function(){ expandCollapseMenu($(this)); });
	$("ul#myPracticeDataTree span").bind('click', function(){ expandCollapseMenu($(this).prev()); });
});

function drillDownTree(filePath)
{
	$("ul#myPracticeDataTree li.file a").each(function()
	{		
		filePath = filePath.replace(" ", "%20");		
		if(($(this).attr('href')).toUpperCase().indexOf(filePath.toUpperCase())>-1)
		{
			var imgElm = $(this).parent().parent().prev().prev();
			if(imgElm.attr('src').indexOf('minus.gif')==-1) expandCollapseMenu(imgElm);	
		}		
	});
}

function expandCollapseMenu(jqElm)
{
	var imgSrc = jqElm.attr('src');
	var mode = imgSrc.indexOf('minus.gif') > -1 ? "COLLAPSE" : "EXPAND"; 	
	
	if(mode == "EXPAND")
	{
		//Collapse all others first
		$("ul#myPracticeDataTree ul").css('display', 'none');
		$("ul#myPracticeDataTree img").attr('src', imgSrc);
		
		//Expand target children
		var targetUl = jqElm.next().next();
		jqElm.attr('src', imgSrc.replace('plusik.gif', 'minus.gif'));
		targetUl.css('display', 'block');
		
		//Expand all above target				
		targetUl.parents('ul').each(function(){$(this).css('display', 'block');});
		for(i=1; i<=targetUl.parents('ul').length; i++)
		{
			jqElm = jqElm.parent().parent().prev().prev();
			jqElm.attr('src', imgSrc.replace('plusik.gif', 'minus.gif'));		
		}			
	}
	else
	{
		jqElm.attr('src', imgSrc.replace('minus.gif', 'plusik.gif'));
		jqElm.next().next().css('display', 'none');
	}	
}

function highlight(jqElm)
{
	$('li.file a').removeClass('currentFile');
	jqElm.addClass('currentFile');
}
