var menu={
	init:function () {
		this.menus = $$('#mp3s ul');
		if (!this.menus[0])	return;
		
		this.menus[0].setStyle('display', 'block');
		this.categories = this.menus.pop().setStyle('display', 'block').getElements('li');
				
		this.categories.each(function (category) {
			category.addEvent('click', function (e) {
				new Event(e).stop();
				this.menus.each(function (menu) {menu.setStyle('display', 'none');});
				catID = category.className.replace('cat-item cat-item-', '');
				if ($('mp3s-' + catID))	$('mp3s-' + catID).setStyle('display', 'block');				
			}.bind(this));
		}.bind(this));
		
	}
}

var fixPNG = function (el) {
	var imgURL = el.getStyle('background-image');
	if (imgURL.test(/\((.+)\)/)){
		el.setStyles({
			background: '',
			filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='crop', src=" + imgURL.match(/\((.+)\)/)[1] + ")"
		});
	};
}

window.addEvent('domready', function () {
	menu.init();
	if (Browser.Engine.trident4) $$('#page, #logo, #header, #header #pages li, .calendar').each(function (el) {fixPNG(el);});
});
