///////////////////
//www.fortochka.com
//Alexander Babichev 2006 Coopyright
//This script is free for private use. Otherwise a $10 fee per a site is required.
//the script can be modified but the copyright notice should be left unchanged.
///////////////////


var pic = new Array()
var moz = (document.getElementById && !document.all) ? 1 : 0;
 NS4 = (document.layers) ? 1 : 0;
 IE4 = (document.all) ? 1 : 0;
 DOM = (document.getElementById) ? 1 : 0;

function nyit(x,y) {
	mag = Number(y)*15;
	if (NS4) {
		document.layers[x].height=mag;
	} else if (IE4) {
		document.all[x].style.height=mag;
	} else if (DOM) {
		document.getElementById(x).style.height=mag;
	}
}

function banner(name, height, link){
	this.name = name	// thumbnail
	this.height = height	// thumbnail magassága
//	this.link = link	// nagykép
   }
   
pic[0] = new banner('',145)
pic[1] = new banner('scroll/kep01.jpg',145)
pic[2] = new banner('scroll/kep02.jpg',145)
pic[3] = new banner('scroll/kep03.jpg',145)
pic[4] = new banner('scroll/kep04.jpg',145)
pic[5] = new banner('scroll/kep05.jpg',145)
pic[6] = new banner('scroll/kep06.jpg',145)
pic[7] = new banner('scroll/kep07.jpg',145)
pic[8] = new banner('scroll/kep08.jpg',145)
pic[9] = new banner('scroll/kep09.jpg',145)
pic[10] = new banner('scroll/kep10.jpg',145)
pic[11] = new banner('scroll/kep18.jpg',145)
pic[12] = new banner('scroll/kep22.jpg',145)
pic[13] = new banner('scroll/kep23.jpg',145)
pic[14] = new banner('scroll/kep24.jpg',145)
pic[15] = new banner('scroll/kep25.jpg',145)
pic[16] = new banner('scroll/kep26.jpg',145)
pic[17] = new banner('scroll/kep27.jpg',145)
pic[18] = new banner('scroll/kep28.jpg',145)

var speed = 50

// összes kép:
var kk = pic.length
// kép-counter
var ii
// előzőkép száma
var fi
// összes magasság
var hhh
// max magasság
var fullh = 600

var nnn
var myInterval
var myPause
var mode = 0


var imgArray = new Array(kk)
var myTop = new Array(kk)

for (ii=0;ii<kk;ii++){
imgArray[ii] = new Image()
imgArray[ii].src = pic[ii].name
imgArray[ii].height = pic[ii].height

	hhh=fullh 
	for (nnn=0;nnn<ii;nnn++){
		hhh=hhh - pic[nnn].height - 4
	}
	myTop[ii] = hhh
}

function ready(){
	for (ii=0;ii<kk;ii++){ 
		if (document.images[ii].complete == false){
			return false	
			break
		}
	}
return true
}


function startScrolling_old(){
	if (ready() == true){		
		window.clearInterval(myPause)
		myInterval = setInterval("autoScroll()",speed)	
	}
}	
	
function startScrolling(){
		window.clearInterval(myPause)
		myInterval = setInterval("autoScroll()",speed)	
}	
	

function autoScroll(){
	for (ii=0;ii<kk;ii++){
		myTop[ii] = myTop[ii] + 1
		
//	if (myTop[ii] == -(pic[ii].height)){
	if (myTop[ii] == fullh){
		hhh = fullh
		for (nnn=0;nnn<kk;nnn++){
			if (nnn!=ii){
				hhh = hhh - pic[nnn].height - 4
			}			
		}
		myTop[ii] =  hhh
	}
		
		document.images[ii].style.top = myTop[ii]
	}
	mode = 1
}

function stop(){
	if (mode == 1){
		window.clearInterval(myInterval)
	}
	if (mode == 0){
		window.clearInterval(myPause)
	}	
}

function go(){
	if (mode == 1){
		myInterval = setInterval("autoScroll()",speed)
	}
	if (mode == 0){
		myPause = setInterval("startScrolling()",3000)
	}	
}

myPause = setInterval("startScrolling()",3000)
