// code for navigation
$(document).ready(function() {
	$(".nav").ready(function() { // scan the page for any navigations
		$(".sub").toggle(); // hide the sub menus
		$(".sub").parent().mouseover(function(){
			$(this).children(".sub").toggle(); // show the sub menu
		});

		$(".sub").parent().mouseout(function(){
			$(this).children(".sub").toggle(); // hide the sub menu
		});
	});	

	if (window.inAction != true){
	
			$(".tests-box-internal a").hover(
				function ()
				{
					$(this).find("em")
						.stop()
						.animate({"left":65, opacity:1},300)
					;
				}
				,
				function ()
				{
					$(this).find("em")
						.stop()
						.animate({"left":25, opacity:0},300)
					;
				}
			);
	
	}
	
	
	

	$("ul.test-list").find('.test-desc').hide(); // hide the descriptions

	
	var strLocation = '';

	/* This method checks for changes in the location */
	var fnCheckLocation = function(){
		if (strLocation != window.location.href){
			strLocation = window.location.href;
			$(window.location).trigger("change");
		}
	}
	
	/* Set an interval to check the location */
	setInterval(fnCheckLocation, 100);

	
	window.parse_location = true;
	
	$(window.location).bind(
		'change',
		function(){
			if (window.location.hash.length != 0 && parse_location) {
				$(".test-list li .test-desc:visible")
					.hide()
					.parent("li")
						.removeClass("activated")
				;
				
				$(".test-list li > a[name=" + window.location.hash + "]")
					.siblings('.test-desc')
						.show()
						.parent("li")
							.addClass("activated");	
				;
				
				var store_location = window.location;
				parse_location = false;
				window.location = store_location;
				parse_location = true;
			}
		}
	);
	
	
	/*$(".test-close").click(function(){

			$(".test-list li .test-desc:visible")
					.hide()
					.parent("li")
						.removeClass("activated")
				; 
			window.location = '#nogo';

	});*/
	
	
	
	

	
	
	
	
	
	
	
	
	$("#tab-box ul ul").hide();
	
	$("#tab-box li").hover(function(){
			$(this).addClass('hovered'); 
		//	$(this).children(".sub").fadeIn('medium'); 
	
		
		},function(){
			$(this).removeClass('hovered'); 
	});
	
	$("#tab-box li").click(function(){
			
			$("#tab-box li ul").hide();
			$("#tab-box li").removeClass('activated');
			$(this).addClass('activated').children("ul").show(); 

	});

	

	
});
