// JavaScript Document

$(document).ready(function () {
	var openWidth = "320px";
	var closedWidth = "101px";
    var scrWidth = document.width;

	if (scrWidth <= 800) {
		openWidth = "256px";
	    closedWidth = "61px";
	}

  $('#nav ul li a').hover(function() {  
    if ($(this).is(':animated')) {
      $(this).addClass("active").stop().animate({width: openWidth}, {duration: 450, easing: "easeOutQuad", complete: "callback"});
    } else {
      $(this).addClass("active").stop().animate({width: openWidth}, {duration: 400, easing: "easeOutQuad", complete: "callback"});
    }
  }, function () {
    if ($(this).is(':animated')) {
      $(this).removeClass("active").stop().animate({width: closedWidth}, {duration: 400, easing: "easeInOutQuad", complete: "callback"})
    } else {
      $(this).removeClass("active").stop(':animated').animate({width: closedWidth}, {duration: 450, easing: "easeInOutQuad", complete: "callback"});
    }
  });
});
