var now = 1;

function gallarySwap(ID){
	if (now != ID){
		prev = now;
		document.getElementById('photo').src = document.getElementById('photo'+ID).src;
		document.getElementById('photo' + ID).parentNode.className = 'selected';
		document.getElementById('photo' + prev).parentNode.className = '';
		now = ID;
	}
}


function sumnailNext(){
	if (now < document.getElementById('photo-sumnail').getElementsByTagName('a').length){
		nextNum = now+1;
		prevNum = now;
	
		document.getElementById('photo').src = document.getElementById('photo'+nextNum).src;
		document.getElementById('photo' + nextNum).parentNode.className = 'selected';
		document.getElementById('photo' + prevNum).parentNode.className = '';
		now = nextNum;
	}	
}


function sumnailBack(){
	if (Number(now) > 1){
		nextNum = now-1;
		prevNum = now;
	
		document.getElementById('photo').src = document.getElementById('photo'+nextNum).src;
		document.getElementById('photo' + nextNum).parentNode.className = 'selected';
		document.getElementById('photo' + prevNum).parentNode.className = '';
		now = nextNum;
	}
}