/**
* Styleswitch stylesheet switcher built on jQuery
* Under an Attribution, Share Alike License
* By Kelvin Luck ( http://www.kelvinluck.com/ )
**/

(function($)
{
	$(document).ready(function() {
		$('.styleswitch').click(function()
		{
			switchStylestyle(this.getAttribute("rel"));
			return false;
		});
		var c = $.cookie('style');
		if (c) { 
			switchStylestyle(c);
			if (c == 'textOnly') {
				$('.styleswitch').attr('rel', 'standard');
			} else {
				$('.styleswitch').attr('rel', 'textOnly');
			}
		}
	});

	function switchStylestyle(styleName)
	{
		$('link[rel*=style][title]').each(function(i) 
		{
			this.disabled = true;
			if (this.getAttribute('title') == styleName) this.disabled = false;
		});
		$.cookie('style', styleName);
		if (styleName == 'textOnly') {
			$('.styleswitch').attr('rel', 'standard');
		} else {
			$('.styleswitch').attr('rel', 'textOnly');
		}
	}
})(jQuery);