///<reference path="jquery-vsdoc.js" />

//this is run after the page has fully loaded
function PageLoaded()
{

	//do drop down navigation - only needed for ie6
	$("#navigation li#lnkAbout").hover(
		function() //hover
		{ $("#lnkAbout ul").show(); },
		function() //no hover
		{ $("#lnkAbout ul").hide(); }
	);

	$("#navigation li#lnkTeam").hover(
		function() //hover
		{
			$("#lnkTeam ul").show();
			$("#lnkTeam ul li ul").hide();
		},
		function() //no hover
		{ $("#lnkTeam ul").hide(); }
	);

	$("#navigation li#lnkTeam ul li").hover(
		function() //hover
		{ $(this).find("ul").show(); },
		function() //no hover
		{ $(this).find("ul").hide(); }
	);
	
	$("#navigation li#lnkTechnology").hover(
		function() //hover
		{ $("#lnkTechnology ul").show(); },
		function() //no hover
		{ $("#lnkTechnology ul").hide(); }
	);
	
	$("#navigation li#lnkStrategy").hover(
		function() //hover
		{ $("#lnkStrategy ul").show(); },
		function() //no hover
		{ $("#lnkStrategy ul").hide(); }
	);

	$("#navigation li ul li").hover(
		function() //hover
		{
			$(this).addClass("hover");
		},
		function() //no hover
		{
			$(this).removeClass("hover");
		}
	);
	
	//fix bug in equal-height-columns (hides scrollbars)
	//$("#sidebar").css("overflow", "hidden");
}

function Hidable()
{
	//if page loading
	var link = document.location.hash
	link = link.split("#", 2)[1];
	$("#body a[name=" + link + "]").parent("h2").next(".hidable").show();

	//if in body link
	$("#body a").click(
		function(e) {
			e.preventDefault();
			if ($(this).parent("h2").next(".hidable").is(":hidden"))
			{
				$(this).parent("h2").next(".hidable").slideDown();
				
				//also swap the right column photo - PJ 08apr09
				_$this = $(this);
				
				var myRel = _$this.attr('rel');
				
				var mySrc = $('#swapMe').attr('src');
				
				//split mySrc and then re-insert '/'
				var mySrcArray = mySrc.split("/");
				
				var myNewSrc = null;
				
				if(myRel == mySrcArray[mySrcArray.length - 1])
				{
					//nada
				}
				else
				{
					for(counter = 0; counter < mySrcArray.length - 1; ++counter)
					{
						myNewSrc += mySrcArray[counter] + '/';
					}
					
					myNewSrc += myRel;
					myNewSrc = myNewSrc.replace(/null/, "");
					
					$('#swapMe').attr('src', myNewSrc);
				}
			}
			else
			{
				$(this).parent("h2").next(".hidable").slideUp();
			}
		}
	);
	
	//if in navigation link
	$("#navigation #lnkTechnology ul li a").click(
		function()
		{
			$(".hidable").hide();
			var link = $(this).attr("href");
			link = link.split("#", 2)[1];
			$("#body a[name=" + link + "]").parent("h2").next(".hidable").show();
		}
	);
	
	//apply showEmailWindow popup - requires showEmailPopup.js (provided by client May 27, 09 - and modified by Rose Design for use with jQuery)
	//$('a.disclaimerPopUp').showEmailWindow();
}