// HIDE/DISPLAY FUNCTIONS 
// (to combat moo.fx's weak "hide" function that doesn't truly hide elements...now links aren't clickable 
//	on elements that aren't shown)
var nextnum = 1;
var slideperiod = 5000;
var totalcontent = 3;

function displayAbout() { document.getElementById('content1').style.display = ''; }
function displayCode() { document.getElementById('content2').style.display = ''; }
function displayLinks() { document.getElementById('content3').style.display = ''; }
			
function display(pagenum) { document.getElementById('content'+pagenum).style.display = ''; }
			
function hideAll() {
	for(var i = 1;i<=totalcontent;i++){
		document.getElementById('content'+i).style.display = 'none';
	}
}

function clearAllPagiClass(){
	for(var i = 1;i<=totalcontent;i++){
		document.getElementById("pagi"+i).className = '';
	}
}

function turnslide(num){
	hideAll();
	display(num); 
	opa[num].custom(0,1);
	clearAllPagiClass();
	document.getElementById("pagi"+num).className = "currentpage";
	if(num >= totalcontent){
		nextnum = 1;
	}
	else{
		nextnum = num+1;
	}
	/*
	if(num == 1){
		opa[1].custom(0,1);
		nextnum = 2;
	}
	else if(num == 2){
		opa[2].custom(0,1);
		nextnum = 3;
	}
	else if(num ==3){
		opa[3].custom(0,1);
		nextnum = 1;
	}
	*/
}

function cturnslide(num){
	stoptimer();
	playtimer();
	turnslide(num);
}

function autoslide(){
	turnslide(nextnum);
	playtimer();
}

function stoptimer(){
	if (typeof window["slidetimer"]!="undefined"){
		clearTimeout(window["slidetimer"]);
	}
}

function playtimer(){
	window["slidetimer"]=setTimeout(function(){autoslide()}, slideperiod);
}