(function( $ ){
  
  var methods = {
    init : function( options ) { 
		this.each(function(){
		 $(this).children('.faq-section-questions').hide();
		 //$(this).children('.faq-section-header').css('float','left');
		 $(this).children('.faq-section-header').after('<button class="faq-section-toggle"/>');
		 $(this).children('.faq-section-toggle').addClass('faq-section-toggle-open');
		 var orig = $(this).html();
		 //$(this).replaceWith('<div');
       });
		
		$('.faq-section-toggle').click(function() {
  			//alert('Handler for .click() called.');
			var el = $(this).next('.faq-section-questions');
			el.toggle();
			if (el.is(':visible')) {
			  $(this).addClass('faq-section-toggle-close');
			  $(this).removeClass('faq-section-toggle-open');
			} else {
			  $(this).addClass('faq-section-toggle-open');
			  $(this).removeClass('faq-section-toggle-close');
			}
			return false;
		 });
	}
  };

  
  $.fn.faq = function( method ) {
  
    // Do your awesome plugin stuff here
    this.each(function() {
      //$(this).slideToggle();
    });
	// Method calling logic
    if ( methods[method] ) {
      return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
    } else if ( typeof method === 'object' || ! method ) {
      return methods.init.apply( this, arguments );
    } else {
      $.error( 'Method ' +  method + ' does not exist on jQuery.tooltip' );
    }    

  };
})( jQuery );


