function setPhoto(i) {
	var NewPhotoURL = Photos[i];
	document.getElementById('photo').src = NewPhotoURL;
//    document.getElementById('position').innerHTML = 'Foto '+ (i+1) +' z '+Photos.length;

// 	if (Names[i]) {
// 		var NewPhotoName = Names[i];
// 		document.getElementById('photoname').style.visibility = "visible";
// 		document.getElementById('photoname').innerHTML = NewPhotoName;
// 	}
// 	else {
	//	document.getElementById('photoname').style.visibility = "hidden";
// 	}

// 	if (Descripts[i]) {
// 		var NewPhotoDescript = Descripts[i];
// 		document.getElementById('descript').style.visibility = "visible";
// 		document.getElementById('descript').innerHTML = "" + NewPhotoDescript + "";
// 	}
// 	else {
// 		document.getElementById('descript').style.visibility = "hidden";
// 	}

	if (i == 0) {
		document.getElementById('prev').style.visibility = "hidden";
	}
	else {
		document.getElementById('prev').style.visibility = "visible";
	}

	if (i == (Photos.length - 1)) {
		document.getElementById('next').style.visibility = "hidden";
	}
	else {
		document.getElementById('next').style.visibility = "visible";
	}
}

function nextPhoto() {
	if (i < Photos.length) {
		i++;
		setPhoto(i);
	}
}

function prevPhoto() {
	if (i > 0) {
		i--;
		setPhoto(i);
	}
}

var newWindow = null;


function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}


function popUpWin(url, type, strWidth, strHeight){
	closeWin();
	
	if (type == "fullScreen"){
		strWidth = screen.availWidth - 10;
		strHeight = screen.availHeight - 160;
	}
	
	leftVal = (screen.width - strWidth ) / 2;
	topVal = (screen.height - strHeight) / 2;	
	
	var tools="";	
	if (type == "standard" || type == "fullScreen") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
	if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left="+leftVal+",top="+topVal+"";
	if (type == "scroll") tools = "resizable,toolbar=no,location=no,scrollbars=yes,width="+strWidth+",height="+strHeight+",left="+leftVal+",top="+topVal+"";
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}

