$(document).ready(function()
{
	setInterval(change, 5000);
	
	function change()
	{
		$('#title').fadeOut(1000, function()
		{
			var classes = new Array('slogon-1', 'slogon-2', 'slogon-3', 'slogon-4', 'slogon-5', 'slogon-6');
			
			//alert(num);
			var num = Math.floor(Math.random()*6);
			
			while ($(this).is('.'+classes[num]))
			{
				var num = Math.floor(Math.random()*6);
			}
			
			var newClass = classes[num];
			
			$(this).attr('class', '');
			$(this).addClass(newClass);
			$(this).fadeIn(1000);
		});
	}

	$('#circle_close').click(function(e)
	{
		$('.circle').fadeOut(250);
	});
	
	$('#circle_toggle').click(function(e)
	{
		if ($('.circle').is(':visible'))
		{
			$('.circle').fadeOut(250);
		}
		else
		{
			$('.circle').fadeIn(250);
		}
	});
	
	if ($('#main').size())
	{
	//	reload();
	};
	
    Cufon.replace('h1, h2, h3, #header, #footer, #menu li a, .works .year span, .contacts .file, .contacts .form span', { fontFamily: 'PlumbMediumC', hover: 'true' });
	Cufon.replace('h2', { textShadow: '#fff 0px 1px 0px' });
});
/*
function reload()
{
	$(document).ready(function()
	{
		$('#menu a').live('click', function(e)
		{
			e.preventDefault();
			
			var uri = $(this).attr('href');
			
			if ($('#main').size())
			{
				uri += '&main_page=true';
			}

			$.ajax(
			{
				type: "POST",
				url: "/?ajax_request=true&uri=" + uri,
				dataType:'json',
				success: function(msg)
				{
					if ($('#main').size())
					{
						$('#wrapper').html(msg);
						Cufon.replace('h1, h2, h3, #header, #footer, #menu li a, .works .year span, .contacts .file, .contacts .form span', { fontFamily: 'PlumbMediumC', hover: 'true' });
						Cufon.replace('h2', { textShadow: '#fff 0px 1px 0px' });
						reload();
					}
					else
					{
						$('#content').fadeOut(250, function()
						{
							$('#content').html(msg);
							$('#content').fadeIn(250);
						});
					}
				}
			});
		});
	});
}*/
