
cookie	= {
	__get_cookie_val	: function(offset) {
		var endstr = document.cookie.indexOf(";", offset);
		if (endstr == -1) endstr = document.cookie.length;
		return unescape(document.cookie.substring(offset, endstr));
	},
	get		: function(name) {
		var arg = name + "=";
		var alen = arg.length;
		var clen = document.cookie.length;
		var i = 0;
		while (i < clen) {
			var j = i + alen;
			if (document.cookie.substring(i, j) == arg)
				return this.__get_cookie_val(j);
			i = document.cookie.indexOf(" ", i) + 1;
			if (i == 0) break;
		}
		return null;
	},
	set		: function(name, value) {
		var argv = this.set.arguments;
		var argc = this.set.arguments.length;
		var expires = (argc > 2) ? argv[2] : null;
		var path = (argc > 3) ? argv[3] : null;
		var domain = (argc > 4) ? argv[4] : null;
		var secure = (argc > 5) ? argv[5] : false;
		document.cookie = name + "=" + escape (value) +
			((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
			((path == null) ? "" : ("; path=" + path)) +
			((domain == null) ? "" : ("; domain=" + domain)) +
			((secure == true) ? "; secure" : "");
	}
}

fontsize = {
	defsize	: null,
	el		: null,
	__init		: function() {
		if (!this.el) {
			this.el = jQuery('#wrapper1, .header, .footer');
			this.defsize = Math.round(100 * parseFloat(cookie.get('fontsize'))) / 100;
			if (!this.defsize) this.defsize = 0.77;
		}
	},

	decrease	: function() {
		this.__change(-0.03);
	},
	increase	: function() {
		this.__change(0.03);
	},

	__change	: function(step) {
		this.__init();
		this.defsize += step;
		this.defsize = Math.round(100 * this.defsize) / 100;
		if (this.defsize < 0.57) this.defsize = 0.57;
		if (this.defsize > 1.37) this.defsize = 1.37;
		this.el.css('fontSize', this.defsize + 'em');
		var expireCookieDate = new Date(); 
		expireCookieDate.setTime(expireCookieDate.getTime() + 365*60*60*1000); 
		cookie.set('fontsize', this.defsize, expireCookieDate, '/');
	}
}

registar = {
	additional_data : {
		fixborders	: function(table) {
			jQuery('TR.additional-data-shown', table).each(function() {
				if (jQuery(this).prevAll('.additional-data:first').is(":visible")) {
					jQuery(this).prevAll('.separator:first').removeClass('separator-navy');
				} else {
					jQuery(this).prevAll('.separator:first').addClass('separator-navy');
				}
			});
		},
		hide	: function(el) {
			var el = jQuery(el).parents("TR:first");
			el
				.removeClass('additional-data-shown')
				.find("~ TR.additional-data:first").addClass('hidden').end()
				.prevAll('.separator:first').removeClass('separator-navy').end()
				.find("~ TR.separator:first TD").css('border', '0px solid');
			this.fixborders(el.parents("TABLE:first"));
		},
		show	: function(el) {
			var el = jQuery(el).parents("TR:first");
			el
				.addClass('additional-data-shown')
				.find("~ TR.additional-data:first").removeClass('hidden').end()
				.find("TD:first").addClass("first-cell").end()
				.find("TD:last").addClass("last-cell").end();
			jQuery("~ TR.separator:first TD", el).css({
				'border-left': jQuery("TD:first", el).outerWidth() + 'px solid #153872',
				'border-right': '1px solid #153872'
			});
			this.fixborders(el.parents("TABLE:first"));
		}
	}
}