var index=3;
var pos=(420*index+300);
var timer=null;
var opacity=0;

function step(target)
{
	if (target>index) pos=pos+20;
	if (target<index) pos=pos-20;
	if (pos<0) pos=300;
	if (pos>2820) pos=2820;
	document.getElementById("main").style.right=pos;
	if (pos==(target*420+300))
		{
		var stop=window.clearInterval(timer);
		document.getElementById(("nav"+index)).style.fontWeight="normal";
		document.getElementById(("nav"+target)).style.fontWeight="bold";
		timer=null;
		index=target;
	}
}

function slide(foo)
{
	if ((timer==null&&foo>=0&&foo<=6)) 
		{
		timer=setInterval(("step("+foo+")"),1);
		}
}

function themes(bar)
{
	ftcolor=document.getElementById(("theme"+bar)).style.color;
	bgcolor=document.getElementById(("theme"+bar)).style.background;

	endindex=bgcolor.indexOf(')');
	if (endindex!=-1) bgcolor=bgcolor.substring(0,endindex+1);

	document.getElementById("body").style.color=ftcolor;
	document.getElementById("body").style.background=bgcolor;

	document.getElementById("stripe").style.background=ftcolor;
	document.getElementById("stripe").style.color=bgcolor;

	document.getElementById("splash").style.color=ftcolor;

	document.getElementById("resume").style.color=ftcolor;

	document.getElementById("email").style.color=ftcolor;

	document.getElementById("topbox").style.background=bgcolor;
}

function opacstep(dir)
{
	if (dir==1) opacity=opacity+0.2;
	if (dir==0) opacity=opacity-0.2;

	document.getElementById('overlay').style.opacity = opacity;
	document.getElementById('topbox').style.opacity = opacity;

	document.getElementById('overlay').style.filter = 'alpha(opacity='+opacity*100+')';
	document.getElementById('topbox').style.filter = 'alpha(opacity='+opacity*100+')';

	if (opacity>=1) {
		var stop=window.clearInterval(timer);
		timer=null;
		}

	if (opacity<=0) {
		var stop=window.clearInterval(timer);
		timer=null;
		document.getElementById('overlay').style.visibility = 'hidden';
		document.getElementById('topbox').style.visibility = 'hidden';
		document.getElementById("boxcontent").innerHTML="";
		}
}

function showbox(sdiv)
{
	document.getElementById("boxcontent").innerHTML=this[sdiv];
	if (timer==null) {
	document.getElementById('overlay').style.visibility = 'visible';
	document.getElementById('topbox').style.visibility = 'visible';
	timer=setInterval("opacstep(1)",1);
	}
}

function closebox()
{
	if (timer==null) timer=setInterval("opacstep(0)",1);
}