$(document).ready(function() {
	$('.ajouterAuxFavoris').AddThisButton(addthis_offset_top=0,addthis_offset_left=0);
	handleHiddenContents("#allProgramsBlk1");
	handleHiddenContents("#allProgramsBlk2");
	handleHiddenContents("#allProgramsBlk3");
	handleHiddenContents("#allProgramsBlk4");
	handleHiddenContents("#allProgramsBlk5");
	
	$('#eCenterCol')
		.find('.listeRubriques')
			.each(function(){
				var hauteurmax='178';
				$(this).find('.programmeBlk30 .ctntBlk')
					.each(function(){
						if($(this).innerHeight()>hauteurmax)
							{ hauteurmax=$(this).innerHeight();}
						else{$(this).height(hauteurmax+'px');}
					})
					.each(function(){
					$(this).height(hauteurmax+'px');
					});
			 });
	var hauteur_resume='',	hauteur_bouton='', 	hauteur_liste_fiche=''; 
	$('#eCenterCol')
		.find('.vod_resume')
			.each(function(){
				hauteur_resume=$(this).innerHeight();
				if(hauteur_resume<=480)
					hauteur_resume=(hauteur_resume-20);
				})
			.end()
		.find('.vod_bouton')
			.each(function(){
				hauteur_bouton=$(this).innerHeight();
			})
			.end()
		.find('.vod_liste_fiche')
			.each(function(){
				
				if(hauteur_resume!='' && hauteur_bouton!='')
					{
					hauteur_liste_fiche=(hauteur_resume-hauteur_bouton);
					if(hauteur_liste_fiche>200)
						{$(this).height(hauteur_liste_fiche+'px');}
					}
			});
			 	
	/*$('.vod_menu')
		.find('li.vod_theme')
			.click(function(){
				$(this)
					.each(function(){
						var theme = $(this).attr('class');
						theme = theme.replace(/^vod_theme /g, '');
						theme = theme.replace(/ selected$/g, '');
						var themedef = theme.match(/^theme[0-9]+$/, 'gi');
						if(themedef){
							showEmissionTheme(themedef);
							}
					})
				.end();
			//return false;
			});
			.filter(':first')
				.click();
	$('.vod_menu')
		.find('li.vod_theme.selected')
			.each(function(){
				var theme = $(this).attr('class');
				theme = theme.replace(/^vod_theme /g, '');
				theme = theme.replace(/ selected$/g, '');
				var themedef = theme.match(/^theme[0-9]+$/, 'gi');
				if(themedef){
					showEmissionTheme(themedef);
					}
				});*/
});

(function($, undefined) {
	showEmissionTheme = function(themedef) {
		hideEmissionTheme();
		$('.'+themedef)
			.show();
		$('.vod_menu_theme .'+themedef).addClass('selected');
	}

	,hideEmissionTheme = function() {
		$('.vod_fiche').hide();
		$('.vod_menu_theme .vod_theme').removeClass('selected');
	};
})(window.jQuery);

