window.onload = onLoadSlideShow;
var curImage=0;
var Interval=null;

var ImagesSrc = new Array();

var fsImagesSrc = new Array();
var Images = new Array();
var	bWrap = 1;		
var F = new Array();
F[0]  = "Barn(orientation=horizontal, motion=out)"
F[1]  = "Barn(orientation=horizontal, motion=in)"
F[2]  = "Barn(orientation=vertical, motion=out)"
F[3]  = "Barn(orientation=vertical, motion=in)"

F[4]  = "Blinds(bands=8,direction='right')"
F[5]  = "Blinds(bands=8,direction='left')"
F[6]  = "Blinds(bands=8,direction='up')"
F[7]  = "Blinds(bands=8,direction='down')"

F[8]  = "Checkerboard(squaresX=12,squaresY=8,direction='RIGHT',duration=1)"
F[9]  = "Checkerboard(squaresX=12,squaresY=8,direction='LEFT',duration=1)"
F[10] = "Checkerboard(squaresX=12,squaresY=8,direction='UP',duration=1)"
F[11] = "Checkerboard(squaresX=12,squaresY=8,direction='DOWN',duration=1)"

F[12] = "Fade(duration=1.0,overlap=1.0)"
F[13] = "Fade(duration=1.0,overlap=0.0)"

F[14] = "gradientWipe(duration=1, wipestyle=0, gradientsize=0.5)"
F[15] = "gradientWipe(duration=1, wipestyle=1, gradientsize=0.5)"

F[16] = "Inset( )"

F[17] = "Iris(irisStyle=diamond, motion=in, duration=1)"
F[18] = "Iris(irisStyle=diamond, motion=out, duration=1)"
F[19] = "Iris(irisStyle=circle, motion=in, duration=1)"
F[20] = "Iris(irisStyle=circle, motion=out, duration=1)"
F[21] = "Iris(irisStyle=cross, motion=in, duration=1)"
F[22] = "Iris(irisStyle=cross, motion=out, duration=1)"
F[23] = "Iris(irisStyle=plus, motion=in, duration=1)"
F[24] = "Iris(irisStyle=plus, motion=out, duration=1)"
F[25] = "Iris(irisStyle=square, motion=in, duration=1)"
F[26] = "Iris(irisStyle=square, motion=out, duration=1)"
F[27] = "Iris(irisStyle=star, motion=in, duration=1)"
F[28] = "Iris(irisStyle=star, motion=out, duration=1)"

F[29] = "Pixelate(maxSquare=5,duration=1, enabled='false')"
F[30] = "Pixelate(maxSquare=10,duration=1, enabled='false')"
F[31] = "Pixelate(maxSquare=20,duration=1, enabled='false')"

F[32] = "RadialWipe(duration=1, wipeStyle='clock')"
F[33] = "RadialWipe(duration=1, wipeStyle='wedge')"
F[34] = "RadialWipe(duration=1, wipeStyle='radial')"

F[35] = "RandomBars(orientation='horizontal') "
F[36] = "RandomBars(orientation='vertical') "

F[37] = "RandomDissolve()"

F[38] = "Slide(slideStyle='hide', bands=1)"
F[39] = "Slide(slideStyle='push', bands=1)"
F[40] = "Slide(slideStyle='swap', bands=1)"
F[41] = "Slide(slideStyle='hide', bands=5)"
F[42] = "Slide(slideStyle='push', bands=5)"
F[43] = "Slide(slideStyle='swap', bands=5)"
F[44] = "Slide(slideStyle='hide', bands=10)"
F[45] = "Slide(slideStyle='push', bands=10)"
F[46] = "Slide(slideStyle='swap', bands=10)"

F[47] = "Spiral(GridSizeX=10, GridSizeY=10)"
F[48] = "Spiral(GridSizeX=50, GridSizeY=50)"

F[49] = "Stretch(stretchStyle='hide')"
F[50] = "Stretch(stretchStyle='spin')"
F[51] = "Stretch(stretchStyle='push')"

F[52] = "Strips(Duration=1, Motion='leftdown')"
F[53] = "Strips(Duration=1, Motion='leftup')"
F[54] = "Strips(Duration=1, Motion='rightdown')"
F[55] = "Strips(Duration=1, Motion='rightup')"

F[56] = "Wheel(duration=1,spokes=2)"
F[57] = "Wheel(duration=1,spokes=5)"
F[58] = "Wheel(duration=1,spokes=10)"
F[59] = "Wheel(duration=1,spokes=20)"

F[60] = "Wipe(duration=1, GradientSize=0.25, motion=forward, wipeStyle=0)"
F[61] = "Wipe(duration=1, GradientSize=0.25, motion=forward, wipeStyle=1)"
F[62] = "Wipe(duration=1, GradientSize=0.25, motion=reverse, wipeStyle=0)"
F[63] = "Wipe(duration=1, GradientSize=0.25, motion=reverse, wipeStyle=1)"

F[64] = "Zigzag(GridSizeX=10, GridSizeY=10)"
F[65] = "Zigzag(GridSizeX=50, GridSizeY=50)"
 
var v55=window.createPopup

function onChangeFilter(nWhat) 
{
    if (v55==null) return; 
    var im = document.getElementById("pgimg");
    if(im==null) return;
    if(nWhat==0)
    {
        im.style.filter="progid:DXImageTransform.Microsoft."+F[Math.round(64*Math.random())];
        im.filters[0].apply();
    }
    else
        im.filters[0].play();
}

function DisplayImage()
{
    onChangeFilter(0);

    if(Images[curImage] == null)
    {
        // Load new image to image object if has not been read 
        Images[curImage] = new Image();
        Images[curImage].src = ImagesSrc[curImage];
    }

    // Display image 
    var im = document.getElementById("pgimg");
    if(im != null)
       im.src=Images[curImage].src;

	var tlt = document.getElementById("pgtlt");
	if(tlt != null)
		tlt.innerHTML=TitlesSrc[curImage];

    onChangeFilter(1);
}


function MaximizeWin()
{
	window.moveTo(0,0);
	if (document.all){
		top.window.resizeTo(screen.availWidth,screen.availHeight);
	}
	else 
	if (document.layers || document.getElementById){
		if (top.window.outerHeight < screen.availHeight ||
			top.window.outerWidth < screen.availWidth){
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
		}
	}
}

function onLoadSlideShow( )
{
	if(0)	
		MaximizeWin();

	// Detect current image from settings 
	paramsPos = window.location.toString().indexOf('?');
	if(paramsPos != -1)
	{
		curImage = new Number(window.location.toString().substring(paramsPos + 1));
		DisplayImage();
	}
	Interval = setInterval("onChangeTimer()",5000);
}

function onPlay( )
{
	onStop( );
	
	if(curImage+1 >= ImagesSrc.length)
		if(!bWrap) 
			curImage=0;

	onChangeTimer( );
	
	Interval = setInterval("onChangeTimer()",5000);
}

function onStop( )
{
	clearInterval(Interval);
}

function onChangeTimer( )
{
	nDirect = 0;	// Slideshow direction 

	switch( nDirect )
	{
		case 0:	 // forward 
			if(!DisplayNextImage(1))
				clearInterval(Interval);
			break;
		case 1:	 // reverse 
			if(!DisplayNextImage(-1))
				clearInterval(Interval);
			break;
		case 2:	 // random 
			if(!DisplayNextImage(0))
				clearInterval(Interval);
			break;
	}
}

function ShowImage(nDirect)
{
	DisplayNextImage(nDirect)
}

function DisplayNextImage(nDirect)
{
	switch( nDirect )
	{
		case 2:	 // last 
			curImage = ImagesSrc.length - 1;
			break;
		case 1:	 // next
			if(curImage+1 < ImagesSrc.length)
				curImage=(curImage+1);
			else if(bWrap) curImage=0;
				 else return 0; 
			break;
		case -1:	 // prev
			if(curImage > 0)
				curImage=(curImage-1);
			else if(bWrap) curImage=ImagesSrc.length-1;
				 else return 0;
			break;
		case -2:	 // first 
			curImage = 0;
			break;
		case 0:	 // random 
			curImage=Math.round((ImagesSrc.length-1)*Math.random());
			break;
		case -3:	 // image page
			window.location=ImagePages[curImage]
			return 0;
		case -4:	 // index page
			window.location=IndexPages[curImage]
			return 0;
		case 3:	 // image 
			window.location=ImagesSrc[curImage]
			return 0;
		case 4:	 // full size image
			window.location=fsImagesSrc[curImage]
			return 0;
		default:
			return 0;
	}
	DisplayImage();
	return 1;
}

function onClickImage()
{
  linkTo = 0;
  switch(linkTo)
  {
	case 0: // Image
		DisplayNextImage(3)
		break;
	case 2: // FullSize Image
		DisplayNextImage(4)
		break;
	case 3: // Image page
		DisplayNextImage(-3)
		break;
  }	
}

/* A STÁTUSZ SOR TARTALMA */
function initArray(n) {
this.length = n;
for (var i =1; i <= n; i++) {
this[i] = ' '
}
}

var slide = new Array()
slide[0]="Ü d v ö z ö l j ü k   a z   M M X   B t .   h o n l a p j á n ! ";

var delay1 = 10
var delay2 = 3000

var text = slide[0] + ""
var str = " " 
var leftmsg = "" 
var nextmsg = 0

function setMessage() {

if (str.length == 1) {

while (text.substring(0, 1) == " ") {

leftmsg += str
str = text.substring(0, 1)
text = text.substring(1, text.length) 
}

leftmsg += str 
str = text.substring(0, 1)
text = text.substring(1, text.length)

for (var x = 0; x < 120; x++) {
str = " " + str
}
}

else {
str = str.substring(10, str.length)
}

window.status = leftmsg + str

if (text == "") {

str = " "
nextmsg++

if (nextmsg >= slide.length) {
nextmsg = 0
}

text = slide[nextmsg] + " "
leftmsg = ""

setTimeout('setMessage()',delay2)
}

else {
setTimeout('setMessage()',delay1)
}
}

setMessage();
