// JavaScript Document
//here you place the ids of every element you want.
var ids=new Array('a0','a1','a2','a3','a4');
var page=0;

//Make them rotate, called onload of body
function rotate()
{
	moveby(1);
	t=setTimeout("rotate()",4000);
}

//stop rotate when user clicks any button, called on the links.
function clearRotate(){
	clearTimeout(t)
}

function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function moveby(num) {
	
	if ((page+num) < 0)
	{
		page=ids.length
	}
	if ((page+num) > ids.length-1)
	{
		page=-1
	}
	hideallids();
	page=page+num;
	showdiv(page);
}

function hidediv(id) {
		
	var n = parseInt(id.replace("a",""),10);
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
		document.getElementById("N" + n).style.fontSize = '';
	}
	else {
		if (document.layers) { // Netscape 4
			document.layers[id].display = 'none';
			document.layers["N" + n].style.fontSize = '';
			
		}
		else { // IE 4
			document.all[id].style.display = 'none';
			document.all["N" + n].style.fontSize = '';	
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
	page=id;	  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById([ids[id]]).style.display = 'block';
		document.getElementById("N" + id).style.fontSize = '16';
	}
	else {
		if (document.layers) { // Netscape 4
			document.layers[ids[id]].display = 'block';
			document.layers["N" + id].style.fontSize = '16';
		}
		else { // IE 4
			document.all[ids[id]].style.display = 'block';
			document.all["N" + id].style.fontSize = '16';		
		}
	}
}
