$(document).ready(function(){
	$('#leftNav .inactive').each(function(i){
		$(this).css('opacity', .4);
	});


	//set the current display item
	var curr = 0;
	//create a variable to store the height of the largest item list
	var minHeight = 0;
	//get the text to be displayed and hide all but the first element
	var toolsItems = $('.toolsItem');
	toolsItems.each(function(i){
		if($(this).height()>minHeight)
			minHeight = $(this).height();
		if(i>0)
			$(this).hide();
	});
	$("#tools").height(minHeight+10);
	
	$("#interiorWrapper").addClass("ieAdjust");
	
	//get the navigations with which to swap the items
	var toolsNavs = $("#toolsNav p a");
	toolsNavs.each(function(i){
		$(this).click(function(){
			//if this item is not already showing else do nothing		
			if(i!=curr){
				$(this).addClass("here");
				$(toolsNavs[curr]).removeClass("here");
				
				$(toolsItems[curr]).fadeOut("slow", function(){
					$(toolsItems[i]).fadeIn("slow");									 
				});	
				curr=i;
			}
			return false;
		});
	});

	$('.promoLink a').click(function(){
		if(curr!=0){
			
			$(toolsNavs[0]).addClass("here");
			$(toolsNavs[curr]).removeClass("here");
			
			$(toolsItems[curr]).fadeOut("slow", function(){
				$(toolsItems[0]).fadeIn("slow");											 
			});
			
			
			curr=0;
		}
		return false;						
	});
});//end document.ready
