function scroll_up() {
    var d = document.getElementById('blks-inner');
    var Npages = parseInt(d.offsetHeight / ScrollN);
    if(Npages < 1) Npages = 1;
    Scroll = Scroll + 1;
    if (Scroll <= Npages) {
	d.style.top = "-" + parseInt(Scroll * ScrollN) + "px";
    } else {
	Scroll = Npages;
    }
    if (Scroll == Npages) { document.getElementById('scroll_up').style.backgroundPosition='0 -21'; }
    if (Scroll > 0) { document.getElementById('scroll_down').style.backgroundPosition='0 0'; }
    return false;
}

function scroll_top() {
    var d = document.getElementById('blks-inner');
    document.getElementById('scroll_down').style.backgroundPosition='0 -21';
    document.getElementById('scroll_up').style.backgroundPosition='0 0';
    d.style.top = "0px";
    Scroll = 0;
    return false;
}

function scroll_init() {
    var d = document.getElementById('blks-inner');
    var Npages = parseInt(d.offsetHeight / ScrollN);
    if (Scroll == 0) { document.getElementById('scroll_down').style.backgroundPosition='0 -21'; }
	else { document.getElementById('scroll_down').style.backgroundPosition='0 0'; }
    if (Scroll == Npages) { document.getElementById('scroll_up').style.backgroundPosition='0 -21'; }
    d.style.top = "-" + parseInt(Scroll * ScrollN) + "px";
}

function scroll_dn() {
    var d = document.getElementById('blks-inner');
    var Npages = parseInt(d.offsetHeight / ScrollN);
    if(Npages < 1) Npages = 1;
    Scroll = Scroll - 1;
    if (Scroll >= 0) {
	d.style.top = "-" + parseInt(Scroll * ScrollN) + "px";
    } else {
	Scroll = 0;
    }
    if (Scroll == 0) { document.getElementById('scroll_down').style.backgroundPosition='0 -21'; }
    if (Scroll < Npages) { document.getElementById('scroll_up').style.backgroundPosition='0 0'; }
    return false;
}

function startCheckPlayer() {
    window.setTimeout("checkPlayer()",1000);
    window.setInterval("checkPlayerStatus()",1000);
}
var i = 0;
function checkPlayerStatus() {

    if (navigator.appName == "Microsoft Internet Explorer") {
	playerStatus = parseInt(document.MediaPlayer.PlayState);
	if(playerStatus == 2 || playerStatus == 6) {
	    dur = parseInt(document.MediaPlayer.duration);
	    min = parseInt(dur / 60);
	    sec = parseInt(dur % 60);
	    if (min < 10) { min="0"+min; }
	    if (sec < 10) { sec="0"+sec; }
	    document.getElementById('state').innerHTML="Видео - <b>" + min + ":" + sec;
	    prc = parseInt(dur - document.MediaPlayer.currentPosition);
	    min = parseInt(prc / 60);
	    sec = parseInt(prc % 60);
    	    if (min < 10) { min="0"+min; }
	    if (sec < 10) { sec="0"+sec; }
	    document.getElementById('state').innerHTML+="</b> | Осталось - <b>" + min + ":" + sec + "</b>";
	    document.getElementById('button_play').style.backgroundPosition='0 0';
	    document.getElementById('button_pause').style.backgroundPosition='0 -38';
	    document.getElementById('button_stop').style.backgroundPosition='0 -38';
	    document.getElementById('screen_y').style.display='block';
	    document.getElementById('ban_1').style.display='none';
	    document.getElementById('ban_3').style.display='none';
	    i += 1;
	} else {
	    if(playerStatus == 1) {
		document.getElementById('state').innerHTML="Пауза...";
		document.getElementById('button_play').style.backgroundPosition='0 -38';
		document.getElementById('button_pause').style.backgroundPosition='0 0';
		document.getElementById('button_stop').style.backgroundPosition='0 -38';
		document.getElementById('ban_1').style.display='none';
		document.getElementById('ban_3').style.display='none';
	    }
	    if (playerStatus == 3) {
		document.getElementById('state').innerHTML="Пожалуйста, подождите";
		document.getElementById('button_play').style.backgroundPosition='0 -38';
		document.getElementById('button_pause').style.backgroundPosition='0 0';
		document.getElementById('button_stop').style.backgroundPosition='0 -38';
		document.getElementById('screen_y').style.display='none';
		document.getElementById('ban_1').style.display='block';
		document.getElementById('ban_3').style.display='none';
	    }
	    if (playerStatus == 0) {
		document.getElementById('state').innerHTML="Просмотр окончен";
		document.getElementById('button_play').style.backgroundPosition='0 -38';
		document.getElementById('button_pause').style.backgroundPosition='0 -38';
		document.getElementById('button_stop').style.backgroundPosition='0 1';
		document.getElementById('screen_y').style.display='none';
		document.getElementById('ban_1').style.display='none';
		document.getElementById('ban_3').style.display='block';
	    }
	}
    }
}
function checkPlayer() {}

	function showTime (tm, element, label) {
		tm = parseInt(tm);
		
		nowtime = new Date(tm);
		var ttm = tm + 1000 * 60 * nowtime.getTimezoneOffset();
		nowtime = new Date(ttm);
		
		var nowtimeHours = nowtime.getHours();
		var nowtimeMinutes = nowtime.getMinutes();
		
		if (parseInt(nowtimeHours) <= 9)	{ var nowtimeHours = "0" + nowtimeHours }
		if (parseInt(nowtimeMinutes) <= 9)	{ var nowtimeMinutes = "0" + nowtimeMinutes }
		var TimeString = nowtimeHours + ":" + nowtimeMinutes;
		document.getElementById(element).innerHTML = label + "<br /><b>"+ TimeString + "</b>";
		tm += 10000;
		setTimeout("showTime("+ tm +", '" + element + "', '" + label + "')", 10000);
	}

