(function($){$.fn.tabs=function(options){options=$.extend({contentClassName:'tab_content',selectedClassName:'active',previousClassName:'prev',load:false,scrollTo:null,speed:200,easing:'linear',open:true,close:false},options);items=null;links=null;hash=window.location.hash;if(options.load && hash){$('li a[href='+hash+']',this).parents('li').addClass(options.selectedClassName).show();$('li a[href='+hash+']',this).parents('li').prev().addClass(options.previousClassName);$(hash).show();}else{if(options.open){$('li:first',this).addClass(options.selectedClassName).show();$('.'+options.contentClassName+':first').show();}}links=$('li a',this);return links.each(function(i){$(this).click(function(e){e.preventDefault();var link=$(this);var item=$($(this).parents('li'));var prev=$($(item).prev());if (options.scrollTo != null) $('html, body').animate({scrollTop:options.scrollTo},700);item.parents('ul').children().removeClass(options.previousClassName);item.siblings().removeClass(options.selectedClassName);$('.'+options.contentClassName).animate({opacity:0.0}, options.speed, options.easing).hide();$(link.attr('href')).animate({opacity:1.0}, options.speed, options.easing).show();if (!$(item).hasClass(options.selectedClassName)){item.addClass(options.selectedClassName);prev.addClass(options.previousClassName);}else{if (options.close){item.removeClass(options.selectedClassName);prev.removeClass(options.previousClassName);$('.'+options.contentClassName).animate({opacity:0.0}, options.speed, options.easing).hide();}}return false;});});}})(jQuery);
