﻿$(document).ready(function() {

	var post = $(".post");

	post.prepend("<span class='post-top'><!-- --></span>");

    post.append("<span class='post-bottom'><!-- --></span>");

    $(".tabs li:first-child").addClass("active")

	$(".categories ul:first").addClass("sidebar-item");

	$(".sidebar-item").prepend("<span class='sidebar-item-bottom'><!-- --></span>")





});



// the tabs



$.tabs = function(containerId, start) {

    var ON_CLASS = 'active';

    var id = '#' + containerId;

    var i = (typeof start == "number") ? start - 1 : 0;

    $(id + '>div:lt(' + i + ')').add(id + '>div:gt(' + i + ')').hide();

    $(id + '>ul>li:nth-child(' + i + ')').addClass(ON_CLASS);

    $(id + '>ul>li>a').click(function() {

        if (!$(this.parentNode).is('.' + ON_CLASS)) {

            var re = /([_\-\w]+$)/i;

            var target = $('#' + re.exec(this.href)[1]);

            if (target.size() > 0) {

                $(id + '>div:visible').animate({opacity:'hide'}, function(){target.animate({opacity:'show'}); });

                $(id + '>ul>li').removeClass(ON_CLASS);

                $(this.parentNode).addClass(ON_CLASS);

            } else {

                //

            }

        }

        return false;

    });

};
