/* jQuery Animate functions - M.J.Foskett 08/10/2009 */
function animateWidth(obj,w){
	obj.animate({width:w+"px"},{queue:false,duration:1000});
}

/* Slide content on hover */
$('#sections li')
	.mouseover(function(){
		clearTimeout(t);
		clearTimeout(t2);
		animateWidth($('#sections li').not(this), 95);
		animateWidth($(this), 479);
	})
	.mouseout(function(){
		clearTimeout(t);
		clearTimeout(t2);
		animateWidth($('#sections li'), 159);
		t3=0;
		t=setTimeout('animate(0);',10);
	});


/* Auto slide content if mouse not present */
function nextPanel(p){
	animateWidth($('#sections li').not("#panel"+p), 95);
	animateWidth($("#panel"+p), 479);
}
function animate(p){
	if (t3>0){
		animateWidth($('#sections li'), 159);
	}
	t3++;
	t2=setTimeout('nextPanel('+p+');',5500);
	p++;
	p=(p>5)?0:p++;
	t=setTimeout('animate('+p+');',4000);
}
var t=setTimeout('animate(0);',10),t2,t3=0;


/* navigation hover for IEv6 */
$('#nav li.a')
	.hover(
      function(){
        $(this).addClass("hover");
      },
      function(){
        $(this).removeClass("hover");
      }
    );

/* navigation keyboard access */
$('#nav li.a li a')
	.focus(
      function(){
        $(this)
					.parent()
					.parent()
					.parent()
					.addClass("hover")
      }
		)
	.blur(
      function(){
        $(this)
					.parent()
					.parent()
					.parent()
					.removeClass("hover");
      }
    );