$(function()
{
	$("#company-slideshow").cycle(
	{
		fx: "fade",
		speed: 2500,
		timeout: 2500
	});
	$("ul#company a").click(function()
	{
		$profile = $(this);
		if ($profile.parent().hasClass("office"))
		{
			preloadImages(
				"./images/companypics/buildingPicA.jpg",
				"./images/companypics/buildingPic.jpg",
				"./images/companypics/buildingPicC.jpg",
				"./images/companypics/buildingPicD.jpg",
				"./images/companypics/buildingPicE.jpg",
				"./images/companypics/buildingPicF.jpg",
				"./images/companypics/buildingPicG.jpg"
			);
		}
		else
		{
			str = $profile.attr("href");
			str = "./images/companypics/" + str.substring(0, str.indexOf(".php")) + ".jpg";
			preloadImages(str);
		}
		$("#company-profile").animate({ opacity: .01 }, 500, function()
		{
			$("#company-profile").load($profile.attr("href") + " #company-profile", function()
			{
				$(this).animate({ opacity: 1 }, 500);
				if ($profile.parent().hasClass("office"))
				{
					$ss = $("#company-slideshow");
					$ss.cycle(
					{
						fx: "fade",
						speed: 2500,
						timeout: 2500
					});
				}
			});
		});
		return false;
	});
});