$(document).ready(function()
{
	$(".tabs ul li a").click(function()
	{
		var index = $(".tabs ul li a").index(this);

		$(".tabs ul li").removeClass("active");
		$(".tabs ul li").eq(index).addClass("active");

		$(".tabs .tab").hide();
		$(".tabs .tab").eq(index).show();

		return false;
	});

	$(".accordion .item .title a").click(function()
	{
		var Height = 0;
		var index = $(".accordion .item .title a").index(this);

		if (!$(".accordion .item").eq(index).hasClass("active"))
		{
			$(".accordion .item .inside").each(function(i)
			{
				if (index != i)
				{
					Height = $(this).height();

					$(this).stop(false, true).animate({height: 0}, 400, function()
					{
						$(".accordion .item").eq(i).removeClass("active");

						$(this).height(Height);
					});
				}
			});

			$(".accordion .item").eq(index).addClass("active");

			Height = $(".inside", $(".accordion .item").eq(index)).height();

			$(".inside", $(".accordion .item").eq(index)).height(0);

			$(".inside", $(".accordion .item").eq(index)).stop(false, true).animate({height: Height}, 400);
		}

		return false;
	});
});

function RotateLogo()
{
	var rotation = function ()
	{
		$(".menu_list li.logo img.mini").rotate(
		{
			angle: 0,
			animateTo: 360,
			duration: 400,
			callback: rotation,
			/*easing: $.easing.easeOutQuart,*/
			easing: function (x, t, b, c, d)
			{
				return c * (t / d) + b;
			}
		});
	}

	rotation();
}

function AnimateLogo(rotation)
{
	if (rotation)
	{
		RotateLogo();
	}

	$(".menu_list li.logo img.mini").fadeOut(800, function()
	{
		$(".menu_list li.logo img.ext").fadeIn(800);
	});
}

function ShowSubMenu(Name)
{
	var el = $("#submenu_" + Name);

	if (el.is(":visible"))
	{
		//el.hide();
	}

	else
	{
		HideSubMenu();

		el.fadeIn(500);
		el.prev(".arrow").eq(0).fadeIn(500);
	}

	return false;
}

function HideSubMenu()
{
	$(".submenu_list").hide();
	$(".submenu_list").prev(".arrow").hide();

	return false;
}
