var sid=1;
var pause=false;
var interval=7;
function AdvanceFrame(counter,add) {
	sid=+sid+add;
	if(sid > 9) {
		sid=sid-9;
	} else {
		if(sid < 1) {
			sid=9;
		}
	}
	if(sid==1) {
		prev=9;
	} else {
		prev=sid-1;
	}
	if(sid==9) {
		next=1;
	} else {
		next=sid+1;
	}
	if(sid < 3) {
		other1=sid+2;
		other2=sid+3;
		other3=sid+4;
		other4=sid+5;
		other5=sid+6;
		other6=sid+7;
	} else {
		if(sid == 7) {
			other1=sid-6;
			other2=sid-5;
			other3=sid-4;
			other4=sid-3;
			other5=sid-2;
			other6=sid+2;
		} else {
			if(sid==3) {
				other1=sid-2;
				other2=sid+2;
				other3=sid+3;
				other4=sid+4;
				other5=sid+5;
				other6=sid+6;
			} else {
				if(sid==4) {
					other1=sid-3;
					other2=sid-2;
					other3=sid+2;
					other4=sid+3;
					other5=sid+4;
					other6=sid+5;
				} else {
					if(sid==5) {
						other1=sid-4;
						other2=sid-3;
						other3=sid-2;
						other4=sid+2;
						other5=sid+3;
						other6=sid+4;
					} else {
						if(sid==6) {
							other1=sid-5;
							other2=sid-4;
							other3=sid-3;
							other4=sid-2;
							other5=sid+2;
							other6=sid+3;
						} else {
							other1=sid-7;
							other2=sid-6;
							other3=sid-5;
							other4=sid-4;
							other5=sid-3;
							other6=sid-2;
						}
					}
				}
			}
		}
	}
	if(pause) {
		return;
	}
	if(counter < interval) {
		counter++;
		timeoutID=window.setTimeout("AdvanceFrame(" + counter + ",0)",1000);
	} else {
		document.getElementById('slide' + prev).style.display="none";
		document.getElementById('slide' + next).style.display="block";
		document.getElementById('slide' + sid).style.display="none";
		document.getElementById('slide' + other1).style.display="none";
		document.getElementById('slide' + other2).style.display="none";
		document.getElementById('slide' + other3).style.display="none";
		document.getElementById('slide' + other4).style.display="none";
		document.getElementById('slide' + other5).style.display="none";
		document.getElementById('slide' + other6).style.display="none";
		AdvanceFrame(0,1);
	}
}
