var CURRENT_DIV = 0;

function photo_next(tg) {
	var obj='photo_num';
	var cnt=3;
	NextPrePhotoView (tg, obj, cnt);
	return;
}

var setRoll = 0;
function setPhotoRolling () {
	var tg, obj, cnt, timeLimit;

	tg = 1; 
	obj = 'photo_num';
	cnt = 3; 
	timeLimit = 5000; 

	if (setRoll == 0) {
		setRoll = 1;
		setTimeout("setPhotoRolling( "+tg+",'"+obj+"',"+cnt+","+timeLimit+")", timeLimit);
		return
	}
	NextPrePhotoView(tg,obj,cnt);
	setTimeout("setPhotoRolling( "+tg+",'"+obj+"',"+cnt+","+timeLimit+")", timeLimit);
}

function NextPrePhotoView (tg, obj, cnt) {
	var i,n,c;
	n = cnt;
	if(tg == 1) { CURRENT_DIV += 1; } else { CURRENT_DIV = CURRENT_DIV + (n - 1); }
	CURRENT_DIV %= n;
	for(i = 0; i < n; i++) {
		c = document.getElementById(obj + i);
		if(i == CURRENT_DIV) { c.style.display = ''; } else { c.style.display = 'none'; }
	}
}

