jQuery(function() {
	//HTML bearbeiten
	$programs = $('body.program .program');
	if($programs.length > 0) {
		prepareDom($programs);
	}
});


function prepareDom($programs) {
	$('body').addClass('jsEnabled');
	maxHeight = 0;
	$programs
		.each(function() {
			width = $(this).attr('width');
			$(this).addClass('w'+width);
			
			if(width < 100) {
				$(this).find('.content').hide().end()
				.click(function() {
					if($(this).is('.active')) {
						$(this).removeClass('active');
						$('.program-content').html('');
					}
					else {
						$(this).addClass('active').siblings().removeClass('active');
						c = $(this).find('.content').html();
						$('.program-content').html('<div class="padding">'+c+'</div>');
					}
					return false;
				})
				.find(':header:first').hover(function() {
					$(this).addClass('hover');
				}, function() {
					$(this).removeClass('hover');
				});
				//height = $(this).height();
				//maxHeight = height > maxHeight ? height : maxHeight;
			}
		})
		.parent().append('<div class="program-content program-clear"></div>');
}
