$.fn.setupTop = function() {
  // Set up
  var current = null;
  var animating; //boolean
  var nav = $(this).find("> li");
  var subnavs = $(this).find("> li > ul > li");
  
  nav.find("> a").append($('<span class="rolloverBG"></span>'));
  
  var white = "#FFFFFF";
  var red = "#DD0000";
  var gridSize = "67px";
  var minSize = "45px"
  var mainNavMin = "50px";

  var DURATION = "fast";
  var EASING = "swing";
  
  //setup navs
  
  // Event handlers
  var hoverIn = function() {
    stopAnimating(this);
    //
    //only animate if its not the current page
    if($(this).hasClass("current") != true && $(this).hasClass("currentParent") != true){
      //animate the a's bg and text color
      $(this).find(">> .rolloverBG").animate({height:$(this).height()+"px"}, DURATION, EASING);
      $(this).find("> a").animate({color: white}, DURATION, EASING, onMaximise);
      
    } else {
      //open the dropdown straight away. use the a for scope, just like the above animate function
      onMaximise.apply($(this).find("> a").get());
    }
  };
  
  var onMaximise = function() {
    //show the dropdown
    $(this).parent().find("> ul").css({display:"block"});
     $(this).parent().find("> ul > li").each(function(i,e){ 
        $(e).stop();
        $(e).animate({top:0},DURATION, EASING);
      })
     //$(this).find("> ul > li").EffectChain({duration:2.5,delay:1,effect:"show"});
  }
  
  var hoverOut = function() {
      stopAnimating(this);
      //only animate if its not the current page
      if($(this).hasClass("current") != true && $(this).hasClass("currentParent") != true){
        $(this).find("> a").animate({color: red}, DURATION, EASING);
        $(this).find(">> .rolloverBG").animate({height:"0px"}, DURATION, EASING);
      }
      //hide the dropdown
      $(this).find("> ul > li").each(function(i,e){
         $(e).stop();
        $(e).animate({top:"-77px"},DURATION, EASING, onMinimise);
      });
  };
  
  //hide the dropdown
  var onMinimise = function(){
     $(this).parent().css({display:"none"});
  }
  
  var stopAnimating = function(obj){
    $(obj).stop();
    $(obj).find(">> .rolloverBG").stop();
    $(obj).find("> a").stop();
  }
  
  var stopAll = function(){
    nav.each(function(i){
      $(this).stop();
    })
  }
  
  var click = function() {};

  // Attach events
  nav.hover(hoverIn, hoverOut);
  //subnavs.hover(subHoverIn, subHoverOut);
  nav.click(click);

};
