$(document).ready(function() {
	var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
	if (badBrowser) {
		var t = setTimeout("init_rating()", 6000);
	}
	else {
		var t = setTimeout("init_rating()", 4000);
	}
});

function init_rating()
{
	$('.notation').each(function() {
	var id = $(this).attr('id');
	var i = id.split('note-');
     $('#note-'+i[1]+' .rating').rating( {
			callback: function(value, link){
				$.ajax({
					url: '/vote.php?value='+value+'&med_id='+i[1],
					cache: false,
					success: function(html){}
				});					
				var date = new Date();
				date.setTime(date.getTime() + (60*60*24*365));
				$.cookie('note-'+i[1], 'vote', { path: '/', expires: date });
				$.ajax({
					url: "/getVideoInfos_en.php?id="+i[1]+"&v=ok",
					cache: false,
					success: function(html){
						$("#streamlike-"+i[1]).html(html);
						$('#note-'+i[1]+' .rating').rating();
					}
				});
			}
		});
	});
}
