var photo_id = 1;
var photo_total = 1;

function load_photo(url, nr) {
	document.getElementById('photo').src = url;
	set_pid(nr);	
}

function prev_photo() {
	if(document.getElementById('thumb_'+ (photo_id-1))) {
		document.getElementById('thumb_'+ (photo_id-1)).onclick();
	}
}

function next_photo() {
	if(document.getElementById('thumb_'+ (photo_id+1))) {
		document.getElementById('thumb_'+ (photo_id+1)).onclick();
	}
}

function load_large_photo(url) {
	document.getElementById('photo').src = url;
}

function set_pid(nr){
	if(document.getElementById('thumb_'+ photo_id)) {
		// Voor AWD templates, haal rand weg om oude geselecteerde foto
		document.getElementById('thumb_'+ photo_id).className = 'thumb';
	}
	photo_id = nr;
	if(document.getElementById('thumb_'+ photo_id)) {
		// Voor AWD templates, zet rand om nieuwe geselecteerde foto
		document.getElementById('thumb_'+ photo_id).className = 'thumbSelected';
	}
	
	if(document.getElementById('prevPhotoButton')) {
		// Voor AWD templates, plaats of verwijder vorige knop.
		if(photo_id == 1) {
			document.getElementById('prevPhotoButton').style.display = 'none';
		} else {
			document.getElementById('prevPhotoButton').style.display = '';
		}
	}
	
	if(document.getElementById('prevPhotoButton')) {
		// Voor AWD templates, plaats of verwijder volgende knop.
		if(photo_id == photo_total) {
			document.getElementById('nextPhotoButton').style.display = 'none';
		} else {
			document.getElementById('nextPhotoButton').style.display = '';
		}
	}
}

function set_photo_total(total) {
	photo_total = total;
}

function large_photo(sid, big) {
	if(big) {
		imgwin = window.open("big.html?sid="+sid+"&pid="+photo_id, "imgwin", "width=750,height=750");
	} else {
		imgwin = window.open("big.html?sid="+sid+"&pid="+photo_id, "imgwin", "width=660,height=705");
	}
	imgwin.focus();
}