

var playstopbutton;

var timer;
var count = 0;

var i = 0;

var imageshow = new Array ();

imageshow[0] = "images/pic1.jpg";
imageshow[1] = "images/pic2.jpg";
imageshow[2] = "images/pic3.jpg";
imageshow[3] = "images/pic4.jpg";
imageshow[4] = "images/pic5.jpg";
imageshow[5] = "images/pic6.jpg";
imageshow[6] = "images/pic7.jpg";
imageshow[7] = "images/pic8.jpg";
imageshow[8] = "images/pic9.jpg";
imageshow[9] = "images/pic10.jpg";
imageshow[10] = "images/pic11.jpg";
imageshow[11] = "images/pic12.jpg";
imageshow[12] = "images/pic13.jpg";
imageshow[13] = "images/pic14.jpg";
imageshow[14] = "images/pic15.jpg";
imageshow[15] = "images/pic16.jpg";
imageshow[16] = "images/pic17.jpg";
imageshow[17] = "images/pic18.jpg";


var next;
var prev;			



function docReady()		
								 
{
	
	
	prev = document.getElementById("prevbutton");

	prev.onmouseover = overPrev;
	prev.onclick = clickPrev;
	
	
	next = document.getElementById("nextbutton");

	next.onmouseover = overNext; 
	next.onclick = clickNext;


	playstopbutton = document.getElementById("playstopbutton");
	
													
	playstopbutton.onmouseover = overplaystopbutton;
	playstopbutton.onmouseout = outplaystopbutton;    
	
	
	
	play();
	
	//document.getElementById("container-noscript").className = 'show'; 

}			

function overPrev()
{
	prev.className = 'whitePrev';
}





function clickPrev()

{
	if (i == 0)
	{
		i = imageshow.length;
	
	}
	i--;
	document.getElementById("image").src = imageshow[i];

	return false;
}


function overNext()
{
	next.className = 'whiteNext'; 
}



function clickNext() 

{
i++; 

	if (i == imageshow.length)
	{
	i = 0;
	}
	document.getElementById("image").src = imageshow[i];//getElementById is a Document Object Method. The image id, as set in html, is called but the source
														//(contd).. for all of the images is within the imageshow array. The index is a sub-element of the 
														//(contd) ...imageshow array
return false; //returning a value of false means the next page won't continue
}



function overplaystopbutton()
{
	playstopbutton.className = 'whiteplaystopbutton'; 
	
}


function outplaystopbutton()
{
	playstopbutton.className = 'blueplaystopbutton'; 
	
}


function play()
{
playstopbutton.innerHTML = "STOP GALLERY";
playstopbutton.onclick = stop;

timer = setTimeout("timedMove();",5000);	
}



function timedMove()
{
count++;	
	if (count == imageshow.length)
	{
			count = 0;
	}
document.getElementById("image").src = imageshow[count];  


play(); 

}



function stop()
{
playstopbutton.innerHTML = "PLAY GALLERY";
playstopbutton.onclick = play;

clearTimeout(timer);
	
}







