/**
	JS Script file for Mangembo-fm.com 
	podcast.tpl.js : création 2011/09/14
	need : jquery 1.4.4
*/
function navigatePodcastPage(_targetId, _page, _limite, _idemi) {
	if( _idemi == null ){
		_idemi = 0;
	}
	
	$('#'+_targetId).load(
		"controller.php", 
		{
			targetId: _targetId,
			manager: 'Podcast',
			action: 'getPagedPodcastList',
			View: 'Podcast',
			ViewAction: 'renderPagedList',
			pod_page: _page,
			pod_limite: _limite,
			'idemi': _idemi
		}
	);
}

function downloadPodcast( _idpod ){
	var url = "controller.php?manager=Podcast&action=downloadPodcast&View=Podcast&ViewAction=renderDownload&idpod="+_idpod;
	window.open(url, '', 'width=1,height=1,top=300,left=500');
}

$(document).ready(
	function(){
		//gestion des onglets ----------------------------------------------
		var tIdx = -1; //id of current menu (default -1 : no menu)
		var tabs = $('.tabcontent');
		var tCount = tabs.length;
				
		$('.tablink').click(function(){
				var idx = $('.tablink').index(this);
				showTab(idx);
			}
		);
				
		function showTab(_idx){
			if( _idx == tIdx ) return;
				
			//hide current menu
			hideTab();
			$('.tablink').eq(_idx).addClass('tablinkon');
			tabs.eq(_idx).show();
			tIdx = _idx;
		}
		
		function hideTab(){
			if( tIdx == -1 ) return;
			$('.tablink').eq(tIdx).removeClass('tablinkon');
			tabs.eq(tIdx).hide();
			tIdx = -1;
		}
		
		//initialisation des menus
		if( tCount > 0 ){
			$('.tabcontent').css('display', 'none');
			tIdx = 0;
			tabs.eq(tIdx).show();
			$('.tablink').eq(tIdx).addClass('tablinkon');
		}
		//------------------------------------------------------------------
	}
);
