$(document).ready(function() 
{
	$('a.selection_type').click(function()
	{
		$('a.selection_type').removeClass('current');
		$(this).addClass('current');
	});
});

function epg_change_selection( type )
{
	$('#selection_type').val(type);
	if ( type == 'post' )
	{
		$('#dupa_gen').hide();
		$('#dupa_post').show();
	}
	else
	{
		$('#dupa_post').hide();
		$('#dupa_gen').show();
	}
}

// afiseaza programul tv in functie de post sau gen pe zile si intervale orare
function show_epg_prg()
{
	prg_posturi = $('#prg_posturi').val();
	prg_ziua = $('#prg_ziua').val();
	prg_interval = $('#prg_interval').val();
	prg_gen = $('#prg_genuri').val();
	sel_type = $('#selection_type').val();
	
	if ( prg_posturi != 0 || prg_gen != 0 )
	{
		$.post(
			'sources/acts.php' ,
			{
				act: 'epg_prg',
				program: prg_posturi,
				ziua: prg_ziua,
				interval: prg_interval,
				gen: prg_gen,
				type: sel_type
			} ,
			function( data )
			{
				if ( data.success )
				{
					$('#epg-list').html(data.html);
					if ( sel_type == 'gen' && $('#lista-program').hasClass('.no-channel') ) $('#lista-program').removeClass('no-channel');
					if ( sel_type == 'post' && !$('#lista-program').hasClass('.no-channel') ) $('#lista-program').addClass('no-channel');
				}
				else
				{
					$('#epg-list').html('eroare');
				}
			},
			'json'
		);
	}
}