Drupal.behaviors.newsletter = function(context) {
   $('#chdnewsletter').submit(function() {
     if ($('#newsletter-email').val() && $('#newsletter-email').val() != 'Your email address') {
       var emailVal =  $('#newsletter-email').val();
       $.post("/proxy/"+emailVal);
       $('#newsletter-email').hide();
       $('#chdnewsletter input').hide();
       $('#chdnewsletter').prepend('<em>Thank you for signing up!</em>');
     } else {
       alert('Please enter an email.');
     }
       return false;
     }
  );
}
;
(function ($) {
Drupal.GoogleAdManagerFix = function() {
  $("div.gam-holder").each(function() {
    var banner = $("#" + $(this).attr("id").replace(/^gam-holder/, "gam-content"));
    // If the block does not exist (for unknown reason), or has no content
    // (probably because of adblockers), we simply leave everything untouched.
    if (banner.length == 0 || banner.width() == 0 || banner.height() == 0) {
      return;
    }
    $(this).css({"width": banner.width(), "height": banner.height()});
    banner.css($(this).offset());
  });
};

$(window).resize(function() {Drupal.GoogleAdManagerFix();});

// We must update the position periodically.
// There is a watch plugin, but it does not help
// when the top and left are set to "auto"
// http://www.west-wind.com/weblog/posts/478985.aspx
setInterval("Drupal.GoogleAdManagerFix();", 500);
})(jQuery);
;

(function ($) {
  Drupal.Panels = {};

  Drupal.Panels.autoAttach = function() {
    if ($.browser.msie) {
      // If IE, attach a hover event so we can see our admin links.
      $("div.panel-pane").hover(
        function() {
          $('div.panel-hide', this).addClass("panel-hide-hover"); return true;
        },
        function() {
          $('div.panel-hide', this).removeClass("panel-hide-hover"); return true;
        }
      );
      $("div.admin-links").hover(
        function() {
          $(this).addClass("admin-links-hover"); return true;
        },
        function(){
          $(this).removeClass("admin-links-hover"); return true;
        }
      );
    }
  };

  $(Drupal.Panels.autoAttach);
})(jQuery);
;
(function($) { 
  $(document).ready(function() {

    // technique found here: http://stackoverflow.com/questions/4177723/making-my-own-accordion-style-toggle-with-jquery/4177741#4177741
    $('#va-accordion .va-content').hide().addClass('hidden');
    $('#va-accordion .va-content:first').show();
    $('#va-accordion h3').not(':first').addClass('collapsed-title');
    $('#va-accordion h3').click(function() {
      if($(this).siblings('.va-content').is(':hidden')){
        $("#va-accordion div").children('.hidden').slideUp(500, 'easeInOutCirc').siblings('h3').addClass('collapsed-title'); // collapse
        $(this).removeClass('collapsed-title').siblings('.hidden:hidden').slideDown(500, 'easeInOutCirc'); // expand
      }
    });
    // And we add the feature of the click on image
    $('#va-accordion .va-content').click(function(){
      location.href = $(this).find('a').attr('href');
    });
  });
})(jQuery);;

