$(document).ready(function(){

	// Nav Buttons
  $("table#tableNavigation #link").mouseover(function(){
    $(this).css({background: "url(images/navTopHover.png)"});
	$(this).siblings('table#tableNavigation #bumberLeft').css({background: "url(images/navHoverLeft.png)"});
	$(this).siblings('table#tableNavigation #bumberRight').css({background: "url(images/navHoverRight.png)"});
  });
  $("table#tableNavigation #link").mouseout(function(){
	$(this).css({background: ""});
	$(this).siblings('table#tableNavigation #bumberLeft').css({background: ""});
	$(this).siblings('table#tableNavigation #bumberRight').css({background: ""});
	/*if(toggledMore == 0){
		$(this).siblings('span img').css({visibility: "hidden"});
	} else{
		if($(this).attr('id') != 'showMore'){
			$(this).siblings('span img').css({visibility: "hidden"});
		}
	}*/
  });
	
	// Page
	var toggledMore = 0;
	var navMoreH = $('#nav_more').height();
	navMoreH = navMoreH+55;
	
	$("#showMore").toggle(
		function(){
			$("#nav_more").animate({top:"55px"});
			$('#moreArrow').attr('src', 'images/navTopMoreInv.png');
			toggledMore = 1;
		},
		function(){
			$("#nav_more").animate({top:'-' + navMoreH + 'px'});
			$("a#showMore").css({background: ""});
			$('#moreArrow').attr('src', 'images/navTopMore.png');
			toggledMore = 0;
		}
	  );  
  
  // Bottom Row Border = None
  var aCount, aFloor, aIndex;
  aCount = $("#nav_more a").size();
  if(aCount % 3 === 0){
	  aIndex = aCount-4;
  } else {
	aFloor = Math.floor(aCount/3);
  	aIndex = (3*aFloor)-1;
  }
  $("#nav_more a:gt(" + aIndex + ")").css("border-bottom", "none");
  
  
  // Social
  $("#social img").fadeTo(0, .7);
  $("#social img").mouseover(function(){
	$(this).clearQueue();
    $(this).fadeTo('normal', 1);
  });
  $("#social img").mouseout(function(){
    $(this).fadeTo('normal', 0.7);
  });
});
