$(document).ready(function(){

    //switcher
    var cookieName = 'theme';
    var cookieOptions = {path: '/', expires: 3};
    if ($.cookie(cookieName) == null){
        if (themeDefault == null || themeDefault == 'undefined') {
            themeDefault = 1;  
        } 
        $.cookie(cookieName, themeDefault, cookieOptions);
    }
    $('body').addClass('theme' + $.cookie(cookieName));
    $('#switcher > li').eq($.cookie(cookieName) - 1).addClass('current');
    var totalTheme = $('#switcher > li').length;
    $('#switcher').find('a').each(function(e){
        $(this).click(function(){
            $.cookie(cookieName, $(this).attr('rel'), cookieOptions);
            $('#switcher > li').removeClass('current').eq($.cookie(cookieName) - 1).addClass('current');
            for (var i=1; i<=totalTheme ; i++ ){
                $('body').removeClass('theme' + i);
            }
            $('body').addClass('theme' + $.cookie(cookieName));
            return false;
        });
    });
    
    

});
