﻿/**
* stylesheet switcher
* Dependencies: jquery.cookie
**/

(function($) {

    $.fn.switcher = function(options) {

        return this.each(function(i) {
            $(this).click(function(e) {
                switchStylestyle(this.getAttribute("rel"));
                return false;
            });

            var c = $.cookie('style');
            if (c) switchStylestyle(c);
        });

        function switchStylestyle(styleName) {
            $('link[@rel*=style][title]').each(function(i) {
                this.disabled = true;
                if (this.getAttribute('title') == styleName) this.disabled = false;
            });
            $.cookie('style', styleName, 365);
        }
    };
    
})(jQuery);
