// JavaScript Document
var i=1;
var countdown;
var theSlide = new Array('christmasdoll', 'petiterouge', 'juniejones', 'nelsonmissing', 'nelsonfield', 'braveirene', 'nymf', 'tussaud', 'polisat' ); //All of the IDs of each link so that they can be highlighted
slideMax = parseInt(theSlide.length)+1;
function initialize(){
	for(s=0; s<parseInt(theSlide.length); s++){
		if(s==0){
		$(theSlide[s]).setStyle({color:'#FFFFFF'});
		}else{
		$(theSlide[s]).setStyle({color:'#29688a'});
		}
	}
}
function moveThis(object){
	i++; //Plus one - The mechanism that says, "Time to go to a new slide"
	cSlide=i-1;
	if(i!==slideMax){ //If plus one doesn't equal the maximum slides available (In theSlide array)...
		new Effect.Move(object, { x: -800, y: 0, mode: 'relative' }); //...then move one slide over (800px)
		countdown=setTimeout("moveThis('imgs')", 8000); //Also, in 8 seconds, run this again
		for(s=0; s<slideMax-1; s++){ //Loop the following commands over and over until it reaches the maximum number of slides available (In theSlide array)
			if(s==cSlide){ //If this round of loops is on the current slide showing...
				new Effect.Morph(theSlide[cSlide], { //...then morph the text for that slide to bold white
				style: 'color:#ffffff;font-weight:bold', duration: 0.8});
			}
			if(s!==cSlide){ //Otherwise, if it's not this slide's turn, change it's text back to normal.
				new Effect.Morph(theSlide[s], { 
				style: 'color:#29688a;font-weight:normal', duration: 0.8});
			}
		}	
	}else{ //If plus one DOES equal the maximum slides available (In theSlide array)...
		moveAmt = (i-2)*800; //take the width of all of the slides side by side...
		new Effect.Move(object, { x: moveAmt, y: 0, mode: 'relative' }); //and move the slides by that number! 
		countdown=setTimeout("moveThis('imgs')", 8000);	i=1; //oh yeah.. and run this again in 8 seconds, reset the plus one. Back to start!
		for(s=0; s<slideMax-1; s++){ //Every link except the first one fades back to normal. Success!
			if(s==0){
				new Effect.Morph(theSlide[s], { 
				style: 'color:#ffffff;font-weight:bold', duration: 0.8});
			}else{
				new Effect.Morph(theSlide[s], { 
				style: 'color:#29688a;font-weight:normal', duration: 0.8});
			}
		}
	}
	
}
function slideTo(object){
	for(s=0;s<slideMax-1; s++){
		if(theSlide[s]==object){
			clearTimeout(countdown);
			i=s+1;
			new Effect.Move($('imgs'), { x: (s)*-800, y: 0, mode: 'absolute',
			transition: Effect.Transitions.spring });
			new Effect.Morph(theSlide[s], { 
			style: 'color:#FFFFFF;font-weight:normal', duration: 0.5});
			countdown=setTimeout("moveThis('imgs')", 8000);
		}else{
			new Effect.Morph(theSlide[s], { 
			style: 'color:#29688a;font-weight:normal', duration: 0.5});
		}
	}
}
