/**
 * @author Innovatics GmbH © 2009
 */

function load_today(mode){
	$('#today_block').hide();
	$('#today_spinner').show();		
	$("#today_block").load('/home/get_today_ajax/' + mode, '', load_today_result);		
}

function load_today_result()
{
	$('#today_spinner').hide();
	$("#today_block").fadeIn('slow');
	bind_today_over();
	bind_today_buttons();
}

function bind_today_buttons()
{
	$('#today_prev').bind('click', function(){
		load_today('prev')
	});

	$('#today_next').bind('click', function(){
		load_today('next')
	});		
}

function bind_today_over()
{
	$('ul#programm_heute li a').bind('mouseover', function(){
		$(this).find('img').addClass('today_hover');
		$(this).addClass('today_hover');
		$(this).parent().find('.today_content').show();
		$(this).parent().find('.start_time').addClass('hover');
		$('ul#programm_heute li').css('margin','0px 4px');
	});		
	$('ul#programm_heute li a').bind('mouseout', function(){
		$('.today_hover').removeClass('today_hover');
		$(this).parent().find('.today_content').hide();
		$(this).parent().find('.start_time').removeClass('hover');	
		$('ul#programm_heute li').css('margin','0px 9px');			
	});		
}

$(document).ready(function()
{
	bind_today_over();
	bind_today_buttons();
});