var widthScreen = Math.round(document.getElementById('videolist').clientWidth/218);
var noticedEpizode = document.getElementById('videolist').getElementsByTagName('LI').length;
var c = widthScreen;
$('#prev').fadeTo(0,0.1);
document.getElementById('bordervideo').style.width = widthScreen*204+'px';
$('#bordervideo').css({'marginLeft':($('#wrapper').width() - $('#bordervideo').width()-120)/2+'px'});
for(var u=0;u<widthScreen;u++){
document.getElementById('videolist').getElementsByTagName('LI')[u].style.backgroundImage = 'url(http://'+document.getElementById('videolist').getElementsByTagName('LI')[u].getAttribute('alt')+'_200.jpeg)';
}//подгружаем столько серий сколько позволяет экран
function next(){
(noticedEpizode-c <= widthScreen) ? c = noticedEpizode : c+=widthScreen;
for(var u=0;u<c;u++){
document.getElementById('videolist').getElementsByTagName('LI')[u].style.backgroundImage = 'url(http://'+document.getElementById('videolist').getElementsByTagName('LI')[u].getAttribute('alt')+'_200.jpeg)';
}
$('#videolist').animate({'marginLeft':'-'+(204*(c-widthScreen))+'px'},250);
if(c == noticedEpizode)$('#next').fadeTo(200,0.1);
if(c != widthScreen)$('#prev').fadeTo(200,1);
}
function prev(){
if (c < widthScreen || c - widthScreen < widthScreen) {c = widthScreen;$('#videolist').animate({'marginLeft':'0px'},250);$('#next').fadeTo(200,1);$('#prev').fadeTo(200,0.1); return;}
c -= widthScreen;
$('#videolist').animate({'marginLeft':parseInt(document.getElementById('videolist').style.marginLeft) + (204*(widthScreen))+'px'},250);
if(c != noticedEpizode)$('#next').fadeTo(200,1);
if(c == widthScreen)$('#prev').fadeTo(200,0.1);
}