// JavaScript Document
var currImg = 0;
var intval="";

var captionText = new Array(
	"Legacies Receptionist Team",
	"Clinic reception and waiting room.",
	"Clinic Multipurpose Room. Used for presentations, group/team therapy, and our in-house training seminars.",
	"One of our four treatment rooms.  We use the best equipment, and maintain a professional therapeutic environment.",
	"Our therapists utilize the most current evidence-based approaches to treatment.  We will also send a Progress Report back to all referring physicians.",
	"Matt Furlot and Sukh Mann at the Vancouver 2010 Olympics.",
	"Erin Maxymchuk carrying the Paralympic Flame during the 2010 Torch Relay.",
	"We volunteer at many community athletic events, such as here at the Surrey Rick Hansen Wheels in Motion.",
	"Providing medical coverage at the 2009 Para-nordic World Cup in Whistler.",
	"We are the exclusive therapy providers to the CFL BC Lions."
)

function initAll() {
	document.getElementById("descriptions").innerHTML = captionText[0];
	document.getElementById("prevLink").onclick = processPrevious;
	document.getElementById("nextLink").onclick = processNext;
	document.getElementById("play").onclick = start_Int;
	document.getElementById("stop").onclick = stop_Int;
}

function processPrevious() {
	newSlide(-1);
}

function processNext() {
	newSlide(1);
}

function start_Int(){
	if(intval==""){
    intval=window.setInterval("processNext()",6000);
    }else{
    stop_Int();
    }
}
	
function stop_Int(){
	if(intval!=""){
    window.clearInterval(intval);
    intval="";
  }
}




function playSlide(){
	
	var cars = setInterval("processNext()", 1000);	
}
	function stopSlide(){

	clearInterval(cars);	
	
}



function newSlide(direction) {
	var imgCt = captionText.length;

	currImg = currImg + direction;
	if (currImg < 0) {
		currImg = imgCt-1;
	}
	if (currImg == imgCt) {
		currImg = 0;
	}
	document.getElementById("slideshow").src = "images/slideImg" + currImg + ".jpg";
	document.getElementById("descriptions").innerHTML = captionText[currImg];
}

