// JavaScript Document

//Tabbed box setup with equal heights functionality						  
// Set to a different number to start on a different tab.
var currentTab = 0; 

jQuery(document).ready(function($){
                          
//Remove divider from last menu entry
    //$('.menu li:last a').css('background','none');
    
//Remove border from last post on page
    $('.post:last').css('border-bottom','none');
    
//Remove padding on top of first post on page
    $('.post:first').css('padding-top','0');
    
//Remove divider from last sidebar tab content list
    $('.tabone li:last').css('border-bottom','none');
    $('.tabtwo li:last').css('border-bottom','none');
    $('.tabthree li:last').css('border-bottom','none');
    
    $('.current_page_item').prev().css('background', 'none');
    
// Set height of tabbed box to be the height of the longest tab box
// then change tab content based on tab clicked
    $(".tabbed-content").equalHeights();
    $(".tabbed-box .tabs li a").click(function() { 
        openTab($(this)); return false; 
    });
    $(".tabbed-box .tabs li a:eq("+currentTab+")").click();
    
// Adjust shirt images to be centered in product boxes
    // $('.single_pattern img').each(function() {
    //     var imgwidth = $(this).width();
    //     var widthdiff = 155 - imgwidth;
    //     widthdiff = widthdiff / 2;
    //     $(this).css('margin-left',widthdiff);
    // });
    
});
    
// Fuction to switch tabs
function openTab(clickedTab) {
    var thisTab = jQuery(".tabbed-box .tabs a").index(clickedTab);
    jQuery(".tabbed-box .tabs li a").removeClass("active");
    jQuery(".tabbed-box .tabs li a:eq("+thisTab+")").addClass("active");
    jQuery(".tabbed-box .tabbed-content").hide();
    jQuery(".tabbed-box .tabbed-content:eq("+thisTab+")").show();
    currentTab = thisTab;
}