
function Photo(id,url,title,comment)
{
	this.photoid = id;
	this.url = url;
	this.title = title;
	this.comment = comment;
}

var aktindex = 0;
var lastpreviewimg;
var photoarr = new Array();

function loadPhoto()
{
	var img = document.getElementById('bigphoto');
	
	if(img != null)
	{
		var photo = photoarr[aktindex];
		
		img.src = photo.url;
		
		var cdiv = document.getElementById('commentdiv');
		cdiv.innerHTML =  photo.comment;
		
		var tdiv = document.getElementById('titlediv');
		tdiv.innerHTML =  photo.title;
		
		var navdiv = document.getElementById('fanavdiv');
		navdiv.innerHTML =  (aktindex+1) + "/" + photoarr.length;
		
		var previewimg = document.getElementById('prev' + photo.photoid);
		
		if(previewimg != null){
			if(lastpreviewimg != null)
				lastpreviewimg.className = "preview_unsel";
			previewimg.className = "preview_sel";
			lastpreviewimg = previewimg;
		}
	
	}
}

function loadPhotoById(photoid)
{
	for(var i=0;i<photoarr.length;i++)
	{
		if(photoarr[i].photoid == photoid)
		{
			aktindex = i;
			break;
		}
	}
	
	loadPhoto();
}




function startFA()
{

	aktindex = 0;
	loadPhoto();
}


function prevFA()
{

	aktindex--;
	
	if(aktindex < 0)
		aktindex = 0;
		
	loadPhoto();
}

function nextFA()
{
	aktindex++;
	
	if(aktindex >= photoarr.length)
		aktindex = photoarr.length-1;

	loadPhoto();
}

function endFA()
{
	aktindex = photoarr.length-1;
	loadPhoto();
}

function playFA()
{
	aktindex++;
	
	if(aktindex >= photoarr.length)
	{
		aktindex = 0;
	}
	
	loadPhoto();
	
	window.setTimeout("play()",4000);

}