var Site = {
  Common: {
    hoverClass: function(e) {
      // add a "hover" class while hovered. Used for dropdowns
      $(e).hover(function() {
        $(this).addClass('hover');
      },
      function() {
        $(this).removeClass('hover');
      });
    },
    init: function(e) {
      $('body').removeClass('nojs').addClass('js');
    }
  }
};

$(document).ready(function() {
  Site.Common.init();
  
  /* Navigation Dropdown */
  Site.Common.hoverClass($('#main_nav li'));
  
  /* Accessible input values */
   $("#sitewide_nav .search input[type=text]").each(function(){
    var id = $(this).attr("id");
    var val = $(this).prev().html();
    if(this.value == '') this.value = val;
    $(this)
     .focus(function(){
      if(this.value == val) this.value = '';
     }).blur(function(){
      if(this.value == '') this.value = val;
    })
   });
   
   /* Tabs */
   $('div.tabs ul.tabs a').click(function () {
     $('div.tabs .tab-panel').removeClass('tab-panel-active').hide().filter(this.hash).addClass('tab-panel-active').show();
     $('div.tabs ul.tabs a').removeClass('tab-active');
     $(this).addClass('tab-active');
     return false;
   }).filter(':first').click();
   
   /* Fancybox */
   $("a.fancybox").fancybox({
		'zoomOpacity'			: true,
		'overlayShow'			: true,
		'zoomSpeedIn'			: 500,
		'zoomSpeedOut'		: 500
	});


});
