// JavaScript Document
var l=0;
function init() {
	document.write('<span>'+photos[l][1]+'</span><br /><img id="photo" onclick="next_photo2()" src="'+photos[l][0]+'" /><p id="text">'+photos[0][2]+'</p>');
}

function change(y) {
	l=y;
	var txt=document.getElementById('text');
	var photo=document.getElementById('photo');
	var spans=document.getElementById('big').getElementsByTagName('span');
	photo.src=photos[l][0];
	chng_txt(txt,photos[l][2]);
	chng_txt(spans[0],photos[l][1]);
}
function chng_txt(where,what) {
	where.replaceChild(document.createTextNode(what), where.firstChild);
}

function small_pics(x,y) {
	for (i=x; i<y; i++) {
		document.write('<img onclick="show('+i+')" onclick="next_photo2()" src="'+photos[i][0]+'"/>');
	}
}
	
		
function show(x) {
	l=x;
	change(l);
}
	
function next_photo2() {
	if(l<photos.length) {
		l++;
		change(l);
	}
}
function prev_photo2() {
	if(l>0) {
		l--;
		change(l);
	}
}