$(document).ready(function()
{
	$(".dbswitch").click(function()
	{
		if ( !$(this).hasClass('dbswitchactive') )
		{
			$(".dbswitch").each(function()
			{
				if ( $(this).hasClass('dbswitchactive') ) $(this).removeClass('dbswitchactive');
			});
			
			/*
			if ( $(this).text() == 'us' ) $('#mainform').attr('action','/search.php');
			else $('#mainform').attr('action','/' + $(this).text() + '/search.php');
			*/
			
			if ( $(this).text() == 'us' )
			{
				if ( $('.search_field').attr('value').length > 0 ) $(this).attr('href','/' + $('.search_field').attr('value'));
			}
			else
			{
				if ( $('.search_field').attr('value').length > 0 ) $(this).attr('href','/' + $(this).text() + '/' + $('.search_field').attr('value'));
			}
			
			$(this).addClass('dbswitchactive');
		}
	});
	
	$(".report_table th, .report_table3 th").mouseenter(function()
	{
		$(".th_div",this).css('background-color','#d9d9d9');
		$(".th_help",this).css('display','block');
	});
	
	$(".report_table th, .report_table3 th").mouseleave(function()
	{
		$(".th_div",this).css('background-color','#e0e0e0');
		$(".th_help",this).css('display','none');
		$(".th_help_content",this).css('display','none');
	});
	
	$(".th_help_container").mouseenter(function()
	{
		if ( $(this).hasClass("thh_right") )
		{
			$(".th_help_content", this).css('left', '-160px');
		}
		$(".th_help_content", this).css('display','block');
	});
	
	$(".th_help_container").mouseleave(function()
	{
		$(".th_help_content", this).css('display','none');
	});
	
	$('#explain').mouseenter(function()
	{
		if ( $('#explain_content').css('display') == 'none' ) $('#explain_content').show('normal');
	});
	
	$("#explain").mouseleave(function()
	{
		if ( $('#explain_content').css('display') == 'block' ) $('#explain_content').hide('normal');
	});
});