$(document).ready(function() {
/*
  // on "secondary" pages, allow the popup/hide for the login box
  $('a#btn_user_login,a.form-close').click(function(evt) {
    $('div#loginbox-container').animate({opacity: 'toggle'}, 200);
    evt.preventDefault();
    return false;
  });
*/
  // activate any accordions on the page
  if ($('div.accordion').length > 0) {
    $('div.accordion').accordion({
      alwaysOpen: true,
      header: 'h2.block-accordion-title',
      selectedClass: 'active'
    });
    $('div.accordion').accordion("activate", 1);
  }
  
  // init dropdowns
  $('.dropdown ul li').hoverIntent({
      sensitivity: 3,
      interval: 200,
      over: expandMenu,
      out: contractMenu,
      timeout: 200
  });
  
  // init photo feature rotation if we're on the homepage
  // don't do it when we're not on the homepage because the cycle plugin isn't there
  if ($('#block-homepage-homepage_mainfeature .block-content').length) {
	  $('#block-homepage-homepage_mainfeature .block-content').cycle({  
	    fx: 'fade',
	    speed: 500,
	    timeout: 8000
	  });
  }
});

function expandMenu() {
   $(this).children('ul').show(150);
}

function contractMenu() {
   $(this).children('ul').hide(100);
}
