$(function () {
	$('#accordion').accordion({
		autoHeight: false,
		icons: false,
		collapsible: true,
		active: false
	});
	
	$('a#switch').click(function () {
		$('#wrapper, #footer').fadeOut(300, function() {
			window.location = $('a#switch').attr('href');
		});
		
		return false;
	});
	
	/*
	$('#accordion table tr:not(:last-child) td').css('border-bottom-width', '1px');
	$('#accordion table tr td:not(:last-child)').css('border-right-width', '1px');
	*/
	$('#accordion table td').each(function(i, e) {
		var $p = $(e).children('p');
		if (($p.length > 1) && ($p.eq(1).find('a[href]'))) {
			$p.eq(1).addClass('case');
		}
	});
	
	if ($('body').hasClass('fade')) {
		$(window).load(function () {
			$('#wrapper, #footer').fadeIn(300);
		});
	}
	
	if ($('#flash').length > 0) {
		$('html').mousewheel(function (event, delta) {
			var direction = (delta > 0) ? 1 : -1;
			$('#flash')[0].doWheel(direction);
			
			return false;
		});
	}
});
