var videoStepIndex = 0;

$(document).ready(function(e) {	
	if ($('#content .video-player .video-list .video-item').length < 6) {
		$('#content .video-player .video-menu a.control').hide();
	}
	$('#content .video-player .video-menu a.control.down').each(function() {
		$(this).click(function(e) {
			e.preventDefault();
			console.log(videoStepIndex);
			if (videoStepIndex < $('#content .video-player .video-list .video-item').length - 5) {
				videoStepIndex++;
			}
			$('#video-wrapper').css({top: videoStepIndex * -60});
			$('#video-wrapper .current').css({top: videoStepIndex * 60 + 60});
			$('#content .video-list .video-item:not(.current)').removeClass('padbottom').eq(videoStepIndex).addClass('padbottom');			
		});
	});
	$('#content .video-player .video-menu a.control.up').each(function() {
		$(this).click(function(e) {
			e.preventDefault();
			if (videoStepIndex > 0) {
				videoStepIndex--;
			}
			$('#video-wrapper').css({top: videoStepIndex * -60});
			$('#video-wrapper .current').css({top: videoStepIndex * 60 + 60});			
			$('#content .video-list .video-item:not(.current)').removeClass('padbottom').eq(videoStepIndex).addClass('padbottom');			
		});
	});	
	$('#content .video-player .video-menu .video-list .video-item').each(function() {
		$(this).click(function(e) {
			e.preventDefault();
			$('#content .video-list .video-item').removeClass('current padbottom');
			$(this).addClass('current').css({top: videoStepIndex * 60 + 60});
			$('#content .video-list .video-item:not(.current)').eq(videoStepIndex).addClass('padbottom');
			Cufon.replace('#content .video-list .video-item span.video-title');
			$('.video-player .video-container').empty();
			$('.video-player .video-container').append($('<embed id="embeded-player" src="http://media.mtvnservices.com/mgid:hcx:content:mtv.co.hu:' + $(this).attr('rel') + '" width="480" height="300" flashVars="configParams=vl%3Dhu" type="application/x-shockwave-flash" allowFullScreen="true" AllowScriptAccess="false" wmode="transparent" bgcolor="#000000"></embed>'));
		});
	});	
});
