//animate the opening of the branch (span.grower jQueryElement)
function openBranch(jQueryElement, noAnimation) {
		jQueryElement.addClass('OPEN').removeClass('CLOSE');
		if(noAnimation)
			jQueryElement.parent().find('ul:first').show();
		else
			jQueryElement.parent().find('ul:first').slideDown();
}
//animate the closing of the branch (span.grower jQueryElement)
function closeBranch(jQueryElement, noAnimation) {
	jQueryElement.addClass('CLOSE').removeClass('OPEN');
	if(noAnimation)
		jQueryElement.parent().find('ul:first').hide();
	else
		jQueryElement.parent().find('ul:first').slideUp();
}

//animate the closing or opening of the branch (ul jQueryElement)
function toggleBranch(jQueryElement, noAnimation) {
	if(jQueryElement.hasClass('OPEN'))
		closeBranch(jQueryElement, noAnimation);
	else
		openBranch(jQueryElement, noAnimation);
}

//when the page is loaded...
$(document).ready(function () {
	//to do not execute this script as much as it's called...
	if(!$('ul.treePraktic.dhtml').hasClass('dynamized'))
	{
		 $('ul.treePraktic.dhtml').css('display', 'block');
		 $('ul.treePraktic.dhtml').children().find("ul").css('display', 'none');
		 $("ul.treePraktic.dhtml li a").mouseover(function() {
			$(this).parent().find("ul").stop(true, true).show(1000);
		  }).mouseout(function(){
			$(this).parent().find("ul").stop(true, true).hide(100);
		  });
		  
		  $("ul.treePraktic.dhtml li ul").mouseover(function() {
			$(this).stop(true, true).css('display', 'block'); 
			$(this).parent().find("a:first").toggleClass('mover');
		  }).mouseout(function(){
			$(this).stop(true, true).css('display', 'none');
			$(this).parent().find("a:first").toggleClass('mover');
		  });
	}
	
	var searchQuery = $('#search_query');
	var searchQueryText = 'Introduceti termenii cautarii';
	if (searchQuery.val() == '') {
		searchQuery.val(searchQueryText).css('color', '#949494').css('font-style', 'italic');
	}
	searchQuery.focus(function(){  
		if (searchQuery.val() == searchQueryText) {
			searchQuery.css('color', '#000').css('font-style', 'normal').val('');
		}
	}).blur(function(){  
		if (searchQuery.val() == '') {
			searchQuery.val(searchQueryText).css('color', '#949494').css('font-style', 'italic');
		}
	});
	
	
});

