(function ($) {

  // init object
  Drupal.jazztheme = Drupal.jazztheme || {}



  /** ********************************************************************
   * FUNCTIONS
   ** ***************************************************************** */

  Drupal.jazztheme.homeClick = function(selector){

    $(selector)
      //~ .hover(
        //~ function() {
          //~ $('#site-name, #primary, #main').stop().animate({opacity: 0.1}, 500);
        //~ },
        //~ function() {
          //~ $('#site-name, #primary, #main').stop().animate({opacity: 1}, 300);
        //~ }
      //~ )
      .click(function(e){
        window.location = Drupal.settings.basePath;
      });
  }

  Drupal.jazztheme.toggleCommentForm = function(selector){
    // open if user has click on a 'add comment' link
    if (window.location.hash == '#comments') {
      $('#comment-form').slideDown();
    }
    $('h2.title', selector).click(function(e){
      $(this).siblings().slideToggle();
    });
  }






  /** ********************************************************************
   * BEHAVIORS
   ** ***************************************************************** */
  //Drupal.settings.jazztheme = Drupal.settings.jazztheme || {}
  Drupal.behaviors.jazztheme = {
    attach: function(context, settings) {
      //$.extend(true, Drupal.settings, settings);

      // #logo img must be 'clickable', for UX, but not in HTML
      $('#logo', context).once('homeclick', function(){
        Drupal.jazztheme.homeClick(this);
      });

      $('#comment-form-wrapper', context).once('togglecommentform', function(){
        Drupal.jazztheme.toggleCommentForm(this);
      });


    }
  } // Drupal.behaviors.jazztheme



})(jQuery);
;

