$(document).ready(function()
{
	$(".dbswitch").click(function()
	{
		if ( !$(this).hasClass('dbswitchactive') )
		{
			$(".dbswitch").each(function()
			{
				if ( $(this).hasClass('dbswitchactive') ) $(this).removeClass('dbswitchactive');
			});
			
			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');
	});
	
	$('.open-reg').click(function(){
		
		window.location = '/report.php';
		return false;
		
		/*
		var sif = $('<iframe />').attr('id','sif').addClass('hiframe').attr('src','http://us.semrush.com/regterms.html');
        $('.reg-semrush').append(sif);
		
		$('#registration2').css('opacity', '1.0');
		$('#registrationContainer2').show();
		$('#registration2').show();
		$('#regnew_top').focus();
		return false;
		*/
	});
	
	$('#close').click(function(){
		$('#registrationContainer2').hide();
		$('#registration2').hide();
	});
	
});

	function addCPass2()
	{
		$('#c_corepass2').attr('value',$('#corepass2').attr('value'));
	}
