﻿/// <reference path="../../jquery-1.3.2-vsdoc.js" />
/// <reference path="../../dsbo.js" />

/*
	Updates to this file must be run through the compressor at:
	http://javascriptcompressor.com/
	save output to content.min.js
*/

/*global $, jQuery */

jQuery.Namespace.Register('jQuery.DSBO.Content');

jQuery.DSBO.Content.CookieName = "article-style";

jQuery.DSBO.Content.SwitchStyle = function(styleName) {
	$('link[@rel*=style][title]').each(function(i) {
		this.disabled = true;
		if (this.getAttribute('title') === styleName) this.disabled = false;
	});
	$.DSBO.CreateCookie($.DSBO.Content.CookieName, styleName, 365);

	if (styleName === 'small') {
		$('.text-size').attr('rel', 'large');
	}
	else {
		$('.text-size').attr('rel', 'small');
	}
	$('#text-icon').toggleClass('text-size-big');
	$('#text-icon').toggleClass('text-size-small');
};

(function($) {
	$(document).ready(function() {
		$('.text-size').click(function() {
			var styleName = $(this).attr("rel");
			$.DSBO.Content.SwitchStyle(styleName);
			return false;
		});
		var c = $.DSBO.ReadCookie($.DSBO.Content.CookieName);
		if (c) $.DSBO.Content.SwitchStyle(c);
	});
})(jQuery);
