// JavaScript Document
//Swaps images after a defined amount of time. 

var images=
	[
   "images/rndmImg/kFalls.jpg",
   "images/rndmImg/rainbow.jpg",
   "images/rndmImg/sokehsSunset.jpg",
   "images/rndmImg/hut.jpg"
 
	];

var banner=[ "phtp/images/phtpBanner.gif","images/sumReg09.jpg"];
var links = ["http://www.comfsm.fm/phtp/index.html","http://www.comfsm.fm/news/summerReg09.html"];
var index = 0;	//counter
var index2 = 0; //banner counter

function imgSwap()
{

	var newImg = document.getElementById('toSwap');//image to be changed
	
	if(index == images.length)//if the index is at the end off array start again
	{
		 index = 0;	
    } 
		 newImg.src = images[index];//otherwise display the array element at index
		 
		index++; 
		return true;
}	

function banrSwap()
{
	var newBanr = document.getElementById('banSwap');//image to be changed
	var newLink =  document.getElementById('swapLink');
	if(index2 == banner.length)//if the index is at the end off array start again
	{
		 index2 = 0;	
    } 
		 newBanr.src = banner[index2];//otherwise display the array element at index
		 newLink.href= links[index2];  //dispaly the link at index
		index2++; 
		return true;
}

	


Animator.add(4500, null, imgSwap);
Animator.add(15000, null, banrSwap);

