index=0;
active=0;
out=0;

function right() {
if(active)
	return;
	index++;
if (index ==images.length)
	index=0;
	
swap();

}

function left() {
	if(active)
	return;
index--;
if (index < 0)
	index=images.length-1;
	
swap();


}
function swap() {
	active=1;
document.getElementById("box2").style.opacity=0;
oldpic=document.getElementById("box2").style.backgroundImage;

oldpic=oldpic.substring(4)
oldpic=oldpic.substring(0, oldpic.length-1);
document.getElementById("box1").style.backgroundImage="url('"+oldpic+"')";
document.getElementById("box2").style.filter="alpha(opacity=0)";
document.getElementById("box2").style.backgroundImage="url('"+images[index]+"')";
document.getElementById("mainpic").src="big"+images[index];

fadeaway(100);
	}	

function fadeaway(x) {
document.getElementById("box2").style.opacity=(100-x)/100;
document.getElementById("box2").style.filter="alpha(opacity="+(100-x)+")";
if(x>0) 
setTimeout("fadeaway("+(x-5)+")", 60);
else {
document.getElementById("count").innerHTML=(index+1); 
document.getElementById("picname").innerHTML=names[index]; 

active=0;	
}
}
function show () {
document.getElementById("screen").style.display="block";
document.getElementById("whitebox").style.display="block";
out=1;
}
function hide () {
document.getElementById("screen").style.display="none";
document.getElementById("whitebox").style.display="none";
out=0;
}

function fixshading() {
if(!out) 
	document.getElementById("whitebox").style.top = document.body.scrollTop;

}
function fixbox() {
s=document.getElementById("wholeworld").offsetHeight;
document.getElementById("screen").style.height=s+"px";
} 
document.getElementById("count").innerHTML=(index+1); 
document.getElementById("picname").innerHTML=names[index]; 
document.getElementById("mainpic").src="big"+images[index];

