var FlashHeaders = {

	initialize: function() {
		if (Browser.Plugins.Flash.version < 8) return;
		FlashHeaders.pageTitle();
		FlashHeaders.boxTitle();
	},

	pageTitle: function() {
		var headers = $$('h2.pageTitle');

		headers.each(function(el, eli) {
			var tag = el.get('tag');
			var text = el.get('text');
			var color = el.getStyle('color').replace('#', '');
			el.empty().setStyles({
				'padding': 0,
				'height': '26px'
			});
			new Swiff('/htdoc/flash/header_box.swf', {
			    id: 'fheader-' + eli,
			    width: 692,
			    height: 32,
				container: el,
			    params: {
			        'wmode': 'transparent'
			    },
				vars: {
					'txt': text.replace('%', '%25'),
					'color': color ? (color.length == 6 ? color : color + color) : 'ffffff'
				}
			});
		});
	},

	boxTitle: function() {
		var headers = $$('h2.boxTitle');
		headers.each(function(el, eli) {
			var tag = el.get('tag');
			var text = el.get('text');
			var color = el.getStyle('color').replace('#', '');
			el.empty().setStyles({
				'padding': 0,
				'height': '26px'
			});
			new Swiff('/htdoc/flash/header_title.swf', {
			    id: 'fheader-' + eli,
			    width: 205,
			    height: 26,
				container: el,
			    params: {
			        'wmode': 'transparent'
			    },
				vars: {
					'txt': text.replace('%', '%25'),
					'color': color ? (color.length == 6 ? color : color + color) : 'ffffff'
				}
			});
		});
	}
}; window.addEvent('domready', FlashHeaders.initialize);

var FlashDate = {
	initialize: function() {
		if (Browser.Plugins.Flash.version < 8) return;
		var dates = $$('.fdate');
		dates.each(function(el, eli) {
			var date = el.get('text').split('-');
			el.empty();
			new Swiff('/htdoc/flash/date.swf', {
			    id: 'fdate-' + eli,
			    width: 140,
			    height: 50,
				container: el,
			    params: {
			        'wmode': 'transparent'
			    },
				vars: {
					'day': date[2],
					'month': window.month_names[date[1].toInt() - 1],
					'color': '999999'
				}
			});
		});
	}
}; window.addEvent('domready', FlashDate.initialize);
