var go=1;
var dirFill = "fill";

var cycle=1;
var del=2600;
var delStep=400;
var delMin=200;
var delMax=5000;
var ident=0;
var ext=".jpg";


function show() {
	dv1.style.visibility='visible';
	frnum.style.visibility='visible';
}

function hide() {
	dv1.style.visibility='hidden';	
	frnum.style.visibility='hidden';
}

function preload() {
	//window.setTimeout("show()",150);
	show();
	window.setTimeout("next()",0);
}

function setTitle()
{
	frnum.innerHTML = '&nbsp;' + names[cadr] + '&nbsp;';
}

function next() {
	if (go==1) {
		cadr = (cadr+1) % totCadrs;
		document.images["viewver"].onload = setTitle;
		document.images["viewver"].src = dirFill + "/" + urls[cadr] + ext;
		ident = window.setTimeout("next()",del);
  }
}


function GoPs() {
	if (go==1) {
		go = 0;
		document.images["butgp"].src='start.jpg';
		document.images["butgp"].title='Continue';
		clearTimeout(ident);
	} else {
		go = 1;
		document.images["butgp"].src='pause.jpg';
		document.images["butgp"].title='Pause';
		ident = window.setTimeout("next()",100);
	}
}


function stop() {
	go = 0;
	cadr=0;
	document.images["viewver"].onload = setTitle;
	document.images["viewver"].src = dirFill + "/" + urls[cadr] + ext;
	document.images["butgp"].src='start.jpg';
	document.images["butgp"].title='Start';
	clearTimeout(ident);
}

function left() {
	if (cadr==0) cadr=totCadrs;
	cadr=(cadr-1) % totCadrs;
	document.images["viewver"].onload = setTitle;
	document.images["viewver"].src = dirFill + "/" + urls[cadr] + ext;
}

function right() {
	cadr=(cadr+1) % totCadrs;
	document.images["viewver"].onload = setTitle;
	document.images["viewver"].src = dirFill + "/" + urls[cadr] + ext;
}

function changeF() {
	if (dirFill.length == 4) {
		dirFill = 'empty';
		document.images["chkim"].src='check.bmp';
	}	else {
		dirFill = 'fill';	
		document.images["chkim"].src='check2.bmp';
	}
	document.images["viewver"].src = dirFill + "/" + urls[cadr] + ext;
}

function slow() {
	if (del < delMax) {
		del = del + delMin;
		document.images["butsl"].title = 'Slower showing (now delay:' + del/100 + 'ms)';
		document.images["butft"].title = 'Faster showing (now delay:' + del/100 + 'ms)';
	}
}

function fast() {
	if (del > delMin) {
		del = del - delMin;
		document.images["butsl"].title = 'Slower showing (now delay:' + del/100 + 'ms)';
		document.images["butft"].title = 'Faster showing (now delay:' + del/100 + 'ms)';
	}
}

