var currPic = 0;
var timer;

function startTimer() {
	timer = setInterval("flipPic()",5000);
}

function stopTimer() {
	clearInterval(timer);
}

function flipPic() {
	if(currPic<numPics-1) {
		currPic++;
	} else {
		currPic=0;
	}
	thisPic = "images/galleries/" + picArr[currPic] + "_lg.jpg";
	document.images.bigPic.src = thisPic;
	flipPicTxt();
}

function flipPicTxt() {
	document.getElementById('galleryText').innerHTML = txtArr[currPic];
}

function rollOver(btn) {
	eval("document.images." + btn + ".src = 'images/btn_" + btn + "_on.gif'");
}

function rollOut(btn) {
	eval("document.images." + btn + ".src = 'images/btn_" + btn + "_off.gif'");
}

function showStatus(status,dir) {
	if(dir=="out") {
		rollOut(status);
		document.images.statusTxt.src = "images/gallery_text_none.gif";
	} else {
		rollOver(status);
		newSrc = "images/gallery_text_" + status + ".gif";
		document.images.statusTxt.src = newSrc;
	}
}

function overThumb(thumb) {
	eval("document.images.thumbFrame" + thumb + ".src='images/gallery_thumb_bk_on.gif'");
}

function outThumb(thumb) {
	eval("document.images.thumbFrame" + thumb + ".src='images/gallery_thumb_bk_off.gif'");
}

var currMenu = "menu1";
function swapMenu(menu) {
	document.getElementById(currMenu).style.display = "none";
	oldLink = currMenu + "Link";
	document.getElementById(oldLink).style.textDecoration = "underline";
	document.getElementById(oldLink).style.fontWeight = "normal";
	
	document.getElementById(menu).style.display = "block";
	clickedLink = menu + "Link";
	document.getElementById(clickedLink).style.textDecoration = "none";
	document.getElementById(clickedLink).style.fontWeight = "bold";
	currMenu = menu;
}

function swapImage(image,num) {
	document.images.bigPic.src = "images/galleries/" + image + "_lg.jpg";
	clearInterval(timer);
	currPic = num;
	flipPicTxt()
}

function playPreso() {
	nextPic();
	startTimer();
}

function pausePreso() {
	stopTimer();
}

function prevPic() {
	stopTimer();
	if(currPic != 0) {
		showPic = currPic-1;
	} else {
		showPic = lastPic;
	}
	thisPic = "images/galleries/" + picArr[showPic] + "_lg.jpg";
	document.images.bigPic.src = thisPic;
	currPic = showPic;
	flipPicTxt();
}

function nextPic() {
	stopTimer(); 
	if(currPic != lastPic) {
		showPic = currPic+1;
	} else {
		showPic = 0;
	}
	thisPic = "images/galleries/" + picArr[showPic] + "_lg.jpg";
	document.images.bigPic.src = thisPic;
	currPic = showPic;
	flipPicTxt();
}

