/**
 * Styleswitch stylesheet switcher built on jQuery
 * Under an Attribution, Share Alike License
 * By Kelvin Luck ( http://www.kelvinluck.com/ )
 **/

(function($) {
    $(document).ready(function() {
        // init
        $("link[href$='all.css']").attr('disabled', '');
        $("link[href$='all-larger.css']").attr('disabled', 'disabled');
        $("link[href$='all-largest.css']").attr('disabled', 'disabled');

        if ((fontSize != null)&&(fontSize!='null')&&(fontSize!="")) {
            $("link[href$='all.css']").attr('disabled', 'disabled');
            $("link[href$='" + fontSize + "']").attr('disabled', '');
        }
        else {
            fontSize='all.css';
            $('#font-resizer-0').trigger('click');
            
        }

        $('#font-resizer-0').click(function() {
            $.post('/setSessionAttribute.html', {attrName:'font-size', attrValue:'all.css'}, function(e) {
                $("link[href$='all.css']").attr('disabled', '');
                $("link[href$='all-larger.css']").attr('disabled', 'disabled');
                $("link[href$='all-largest.css']").attr('disabled', 'disabled');
            });
            return false;
        });
        $('#font-resizer-1').click(function() {
            $.post('/setSessionAttribute.html', {attrName:'font-size', attrValue:'all-larger.css'}, function(e) {
                $("link[href$='all.css']").attr('disabled', 'disabled');
                $("link[href$='all-larger.css']").attr('disabled', '');
                $("link[href$='all-largest.css']").attr('disabled', 'disabled');
            });
            return false;
        });
        $('#font-resizer-2').click(function() {
            $.post('/setSessionAttribute.html', {attrName:'font-size', attrValue:'all-largest.css'}, function(e) {
                $("link[href$='all.css']").attr('disabled', 'disabled');
                $("link[href$='all-larger.css']").attr('disabled', 'disabled');
                $("link[href$='all-largest.css']").attr('disabled', '');
            });
            return false;
        });
    });
})(jQuery);