'use strict';
/*jslint undef: true, eqeqeq: true, bitwise: true, regexp: true, strict: true, immed: true */
/*global jQuery, window */ // jslint

/* accordion */
(function($) {
/* the plug-in */
$.fn.accordion = function(options) {
  var opts = $.extend({}, $.fn.accordion.defaults, options||{});
  return this.each(function () {
    // 'this' is single dom element (ul)
    var $this = $(this);
    $this.find('.'+opts.show+' , .'+opts.hide).css('cursor', 'pointer').unbind('click.accordion').bind(
      'click.accordion',
      function (event) {
        if (event.currentTarget === event.target) {
          if ($(this).hasClass(opts.show)) {
            $(this).removeClass(opts.show).addClass(opts.hide);
          } else {
            $(this).removeClass(opts.hide).addClass(opts.show);
          }
        }
      });
    // do the links (which we lose otherwise)
    $this.find('a').unbind('click.accordion').bind('click.accordion', function (event) {
      if ('_blank' !== $(this).attr('target')) { window.location = this.href; } // go!
    });
  });
};

$.fn.accordion.defaults = {
  show: 'show',
  hide: 'hide'
};
}(jQuery));

(function($) {
// onload
  $(function() {
    $('.content_nav').accordion();
  });
}(jQuery));

