$j(function() {
  // Login panel animation
  $j("#login").click(function(){
    $j("#login-wrapper").slideToggle("slow");
    $j(this).toggleClass("active"); 
    return false;
  });
  
  // Home page slide animation, have to place afer Fancybox call because of JS error
  $j('#slides').cycle({ 
    fx:     'scrollHorz',
    speed:  'fast', 
    prev:   '#prev', 
    next:   '#next', 
    nowrap:  1,
    after:   onAfter,
    timeout: 0,
    cleartypeNoBg: true
  });
});	 

// Callback function for home page slide animation, fades arrows when beginning and end of slideshow is reached
function onAfter(curr, next, opts) {
  var index = opts.currSlide;
  $j('#prev')[index == 0 ? 'addClass' : 'removeClass']("inactive");
  $j('#next')[index == opts.slideCount - 1 ? 'addClass' : 'removeClass']("inactive");
}