function mediaReady(){
$.get('/appftv/akamai/token/gentoken1.php?flux=toowamwebtv', function(returned_data){
		$('.media').attr({
			href: returned_data
		}).mediaCatchup({
			width: 640,
			height: 430,
			optionsMedia: {
				bgColor: 'black'
			}
		});
	});
}

function popCenter(bUrl, bName, bWidth, bHeight){
	var centerX = (screen.width - bWidth) / 2;
	var centerY = (screen.height - bHeight) / 2;
	var viewerpop = window.open(bUrl,bName,'location=no, toolbar=no, directories=no, menubar=no, resizable=no, scrollbars=auto,status=no,width='+bWidth+',height='+bHeight+',left='+centerX+',top='+centerY);
}

//Tagage à la minute
function tagMinute(){
	image1 = new Image();
	image1.src = 'http://stat3.cybermonitor.com/'+ftvi_portail+'_v?R=' + ftvi_portail + "_" + ftvi_section + "_" + ftvi_rubrique + '&S=total;' + ftvi_portail + "_" + ftvi_section;
	setTimeout("tagMinute()", 60000);
}

setTimeout("tagMinute()", 60000);

// GESTION DE LA LISTE DES SERIES

// Clic sur une série
function descriptionSerie(){
	$('#a_voir ul li a').click(function(){
		var idSerie = $(this).attr('id');
		$('#a_voir').load('descriptionSerie.php?serie='+idSerie, descriptionSerieRetour);
		return false;
	});
}

// Clic sur le retour
function descriptionSerieRetour(){
	$('#a_voir a.retour').click(function(){
		$('#a_voir').load('listeSeries.php', function(){descriptionSerie();paginationInit();});
		return false;
	});
}

// Initialisation
function paginationInit(){
	$('#a_voir ul').not('#page1').hide();
	$('#a_voir li.pagination').click(function(){
		$('#a_voir ul').hide();
		$('ul#'+$(this).attr('name')).show();
	});
}

function rafraichirProg(jour){
	variable_date=new Date();
	timestamp=variable_date.getYear()+''+variable_date.getMonth()+''+variable_date.getDate()+''+variable_date.getHours()+''+variable_date.getMinutes();				
	$('#programmation').load('ajax_programmation.php?jour='+jour+'&lecture=true&timestamp='+timestamp);
}


$('document').ready(function(){
	descriptionSerie();
	paginationInit();
	mediaReady();
});