$.fn.fadeToggle = function(normal, linear) {
   return this.animate({opacity: 'toggle'}, normal, linear);

};

$(document).ready(function(){
	
	$("div.entry-meta").hide();

	$("#recent > ul").tabs();
    
	$("a.toggle").toggle(
		  function () {
	        $(this).html("&#8211; collapse info");
	      },
	      function () {
	        $(this).html("+ expand info");
	      }
	    );

	$("a.toggle").click(function () {		
		$(this).next('span').fadeToggle().toggle;
    	$(this).parent().next('div').slideToggle(500);
    	return false;
    });

	$('ul.drawers').accordion({
	    // the drawer handle
	    header: 'h5.drawer-handle',

	    // our selected class
	    selectedClass: 'open',
        
		// all drawers closed on start
		active: 'none',
	
	    // match the Apple slide out effect
	    event: 'click'
	  });
	
	
	function filterPath(string) {
	    return string
	      .replace(/^\//,'') 
	      .replace(/(index|default).[a-zA-Z]{3,4}$/,'')
	      .replace(/\/$/,'');
	  }
	
	  $('a.scroll').each(function() {
	    if ( filterPath(location.pathname) == filterPath(this.pathname)
	    && location.hostname == this.hostname
	    && this.hash.replace(/#/,'') ) {
	      var $targetId = $(this.hash), $targetAnchor = $('[name=' + this.hash.slice(1) +']');
	      var $target = $targetId.length ? $targetId : $targetAnchor.length ? $targetAnchor : false;
	       if ($target) {
	         var targetOffset = $target.offset().top;
	         $(this).click(function() {
	           $('html, body').animate({scrollTop: targetOffset}, 400);
	           return false;
	         });
	      }
	    }
	  });
 });