//people Highlighting
var isitie = document.all;
var peopleHighlight = 0;
var peopleTime = 0;
var peopleCount = 0;
var shiftCount;
var shiftCountB;
var x;
var personitem = new Array();
personitem = document.getElementById("peopleright").getElementsByTagName("div");

var people = new Array();
people = document.getElementById("peopleleft").getElementsByTagName("div");

if(personitem.length != people.length) alert("ID10T:Error");
//personitem[peopleCount].style.backgroundColor='#ffffff';

var ymove = personitem.length * 50;

if(isitie){
	for(x=personitem.length - 1; x>2; x--){
		new Effect.Move(personitem[x].id,{x:-5000, mode: 'relative', duration:0})
	}
}
Effect.Appear(people[peopleCount].id);
personitem[peopleCount].style.backgroundColor = '#856729';
protationshow(0);

function protationshow(ptrack){
	if(ptrack == people.length) ptrack = 0;
//	Effect.Appear(people[ptrack].id, {duration:1});
	
	prs = setTimeout("protationhide(" + ptrack + "); peopleNext();",6000);
}

function protationhide(ptrack){
	if(ptrack == people.length) return;
//	Effect.Fade(people[ptrack].id, {duration:0});
	ptrack++;
	prh = setTimeout("protationshow(" + ptrack + ")",0);
}

function protationstop(){
	clearTimeout(prh);
	clearTimeout(prs);
}

function protationclear(pa){
	for(x=0; x < people.length; x++){
		if (x!=pa) {
			Effect.Fade(people[x].id, {duration:0});
		}
	}
}

function protationhighlight(thing){
	if(peopleHighlight == 0){
		peopleHighlight = 1;
		protationstop();
		if(peopleCount == personitem.length) {peopleCount=0;}
		shiftCount = peopleCount + 1;
		if(shiftCount == personitem.length) {shiftCount=0;}
		shiftCountB = peopleCount + 2;
		if(shiftCountB >= personitem.length) {shiftCountB -= personitem.length}
	
		if (thing == personitem[peopleCount]){
		} else if (thing == personitem[shiftCount]){
			peopleNext();
		} else if (thing == personitem[shiftCountB]){
			peopleNext();
			setTimeout("if(peopleCount == personitem.length) {peopleCount=0;} peopleNext();",504);
			shiftCount = shiftCountB;
		}
		if(isitie){
			protationstop(); 
			protationclear(people.length);	
			Effect.Appear(people[shiftCount].id, {duration:0}); 
			peopleHighlight=0;
		} else {
			setTimeout("protationstop(); protationclear(people.length);	Effect.Appear(people[shiftCount].id, {duration:0}); peopleHighlight=0;", 505);
		}
	}
	
}

function protationrestart(){
	protationstop();
	prestart = setTimeout("protationhide(peopleCount-1);",2000);
}

function peopleNext(){
	if(isitie){
		peopleNextIE();
	} else {
		peopleNextMF();
	}
}

function peoplePrev(){
		if(isitie){
		peoplePrevIE();
	} else {
		peoplePrevMF();
	}
}

function peopleNextMF() {	
	if(peopleTime == 0){
		for(x=0;x < personitem.length;x++) {
			new Effect.Move(personitem[x].id,{y: -50, mode: 'relative', duration: .5});
		}
		if(peopleCount==personitem.length) peopleCount=0;		
		
		peopleTime = setTimeout("new Effect.Move(personitem[peopleCount].id,{y: ymove, mode: 'relative', duration:0});peopleCount++;if(peopleCount==personitem.length) peopleCount=0;",550);
		setTimeout("peopleGlow(); protationclear(people.length);	Effect.Appear(people[peopleCount].id, {duration:.5});peopleTime = 0;",570);
	}
}
function peoplePrevMF() {	
	if(peopleTime == 0){
		peopleTime=1;
		if(peopleCount == 0) peopleCount=personitem.length;
		peopleCount--;
		new Effect.Move(personitem[peopleCount].id,{y: -ymove, mode: 'relative', duration:0});
		for(x=0;x<personitem.length;x++) {
			new Effect.Move(personitem[x].id,{y: 50, mode: 'relative', duration: .5});
		}

		setTimeout("peoplePGlow(); protationclear(people.length);	Effect.Appear(people[peopleCount].id, {duration:.5});",550);
		peopleTime = setTimeout("peopleTime=0;",570);
	}
}

function peopleNextIE() {	
	if(peopleTime == 0){
		for(x=0;x < personitem.length;x++) {
			new Effect.Move(personitem[x].id,{y: -50, mode: 'relative', duration: 0});
		}
		if(peopleCount==personitem.length) peopleCount=0;		
		new Effect.Move(personitem[peopleCount].id,{x: -5000, y: ymove, mode: 'relative', duration:0});
		new protationclear(people.length);
		peopleCount++;
		peopleGlow();
		if(peopleCount==personitem.length) peopleCount=0;
		new Effect.Appear(people[peopleCount].id, {duration:.25});
		pshiftcount = peopleCount + 2;
		if (pshiftcount >= people.length) pshiftcount -= people.length;
		new Effect.Move(personitem[pshiftcount].id,{x: 5000, mode: 'relative', duration:0});
		peopleTime = 0;
	}
}
function peoplePrevIE() {	
	if(peopleTime == 0){
		if(peopleCount == 0) peopleCount=personitem.length;
		peopleCount--;
		new Effect.Move(personitem[peopleCount].id,{x: 5000, y: -ymove, mode: 'relative', duration:0});
		peopleTime=1;
		for(x=0;x < people.length;x++) {
		new Effect.Move(personitem[x].id,{y: 50, mode: 'relative', duration: 0});
		}
		new protationclear(people.length);
		new Effect.Appear(people[peopleCount].id, {duration:.25});
		pshiftcount = peopleCount + 3;
		if (pshiftcount >= people.length) pshiftcount = pshiftcount - people.length;
		new Effect.Move(personitem[pshiftcount].id,{x: -5000, mode: 'relative', duration:0});
		peoplePGlow();
		peopleTime=0;
	}
}

function peopleGlow()	{
	if(peopleCount == personitem.length) peopleCount = 0;
	pglowCount = peopleCount;
	if(pglowCount == 0) {
		pglowCount = personitem.length - 1;
	} else {
		pglowCount -= 1;
	}
	personitem[peopleCount].style.backgroundColor = '#856729';
	personitem[pglowCount].style.backgroundColor = '#8092B2';
}
function peoplePGlow() {
	pglowCount = peopleCount;
	if(pglowCount < 0){
		pglowCount = personitem.length - 1;
	}
	pglowCountB = pglowCount + 1;
	if(pglowCountB == personitem.length){
		pglowCountB = 0;
	}
	personitem[pglowCount].style.backgroundColor = '#856729';
	personitem[pglowCountB].style.backgroundColor = '#8092B2';
}