$(document).ready(function () {
    $('.post:odd').addClass('alt');
//	$('.forumhome table.main tbody tr:odd,.forumdisplay table.main tbody tr:odd').addClass('alt');

    $(".tab_content").hide();
    $("ul.tabs li:first").addClass("active").show();
    $(".tab_content:first").show();

    $("ul.tabs li").click(function () {
        $("ul.tabs li").removeClass("active");
        $(this).addClass("active");
        $(".tab_content").hide();
        var activeTab = $(this).find("a").attr("href");
        $(activeTab).fadeIn();
        return false;
    });
	
	$(window).resize(function() {
	    calculateNav();
	});
/*
	var c = readCookie('style');
	if (c == 'liquid') {
		createCookie('style', 'liquid', 365);
		$('#wrapper').css('width','100%')	
	}
    calculateNav();
	
	$('#liquid').click(function(){
		createCookie('style', 'liquid', 365);
		$('#wrapper').css('width','100%');
		calculateNav();
	});
	$('#fixed').click(function(){
		createCookie('style', 'fixed', 365);
		$('#wrapper').css('width','1000px');
		calculateNav();
	});
*/
});

function calculateNav() {
    var width = 215;
    var w = 0;
    $('#nav li').each(function () {
        width += $(this).width();
    });
    padding = (($('#wrapper').width() - width) / $('#nav li').length);
    $('#nav li').each(function () {
        w = $(this).width();
        $(this).css('width', padding + w);
    });
}

function createCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toGMTString();
    }
    else var expires = "";
    document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}

function eraseCookie(name) {
    createCookie(name, "", -1);
}
