var time=5000;

var imgNum=0;

var totImg=32;/*TO ADD A NEW COURTHOUSE ADD ONE TO THIS NUMBER*/

imgarray= new Array('athabasca.jpg', 'battleford.jpg', 'Boyle.jpg', 'calgary.jpg', 'camrose.jpg', 'cardston.jpg', 'cardston-old.jpg', 'desmarais.jpg', 'edmonton.jpg', 'edson.jpg', 'fairview.jpg', 'grandcache.jpg', 'Hanna.jpg', 'HayRiver.jpg', 'hinton.jpg', 'killam.jpg', 'laclabiche.jpg', 'leduc.jpg', 'Lethbridge.jpg', 'Lloydminster.jpg', 'peace.jpg', 'red-deer.jpg', 'red-earth-creek.jpg', 'Regina.jpg', 'Rimbey.jpg', 'Stettler.jpg', 'St-Paul.jpg', 'Swan-hills.jpg', 'Vermilion.jpg', 'wabasca.jpg', 'Wetaskiwin.jpg', 'Yellowknife.jpg');/*TO ADD A NEW COURTHOUSE ADD THE NAME OF THE IMAGE AT THE END OF THIS LIST AND SAVE IT IN THE courthouse directory*/

textarray=new Array('Athabasca', 'Battleford', 'Boyle', 'Calgary', 'Camrose', 'Cardston', 'Cardston', 'Desmarais', 'Edmonton', 'Edson', 'Fairview', 'Grande Cache', 'Hanna', 'Hay River', 'Hinton', 'Killam', 'Lac La Biche', 'Leduc', 'Lethbridge', 'Lloydminster', 'Peace River', 'Red Deer', 'Red Earth Creek', 'Regina', 'Rimbey', 'Stettler', 'St. Paul', 'Swan Hills', 'Vermilion', 'Wabasca', 'Wetaskiwin','Yellowknife');/*ADD THE NAME OF THE COURTHOUSE TO THIS LIST*/

addressarray=new Array('4903 - 50 St', '', '5006 - 3 St', '323 - 6 Ave' , '5210 - 49 Ave', '576 Main St', 'Old Courthouse', 'Stony Point Road', '1A Sir Winston Churchill Square', '111 - 54 St', '10209 - 109 St', 'Hoppe Ave', '401 Centre St', '', '237 Jasper St, West & Pembina Ave', '4903 - 50 St', '9503 Beaver Hill Road', '4612 - 50 St', '320 - 4 St', '5124-50 St', '9905 - 97 Ave', '4909 - 48 Ave', 'adjacent to Alberta Forestry Complex', '', '5025 - 55 St', '4705 - 49 Ave', '4704 - 50 St', '4701 - 52 St', '5536 Main St', 'Stony Point Road', '4605 - 51 St', '' );/* add address to list*/

var timeout;

var content;

/*function loadGallerychanger(path){
	
	content = document.getElementById( "galcontents" );
	
	content.innerHTML="<img src='"+path+"images/courthouses/"+imgarray[imgNum]+"' width='184px' alt='' /><p>Provincial Courthouse in "+textarray[imgNum]+"<br />"+addressarray[imgNum]+"</p>";
	
	imgNum++;
	
	timeout=setTimeout("nextImg('"+path+"');", time);
	
	//try to dynamically load select box
	for (i = 0; i < totImg; i++){
		this.document.forms.form1.courthouse.options[i] = new Option(textarray[i], i);
	}
}*/

function loadGallerychanger(language){
	
	content = document.getElementById( "galcontents" );
	
	if (language == "english") {
		path = "";
		courthousetext = "Provincial Courthouse in ";
	}else{
		path = "../";
		courthousetext = "Cour provinciale à ";
	}
	
	content.innerHTML="<img src='"+path+"images/courthouses/"+imgarray[imgNum]+"' width='184px' alt='' /><p>"+courthousetext+textarray[imgNum]+"<br />"+addressarray[imgNum]+"</p>";
	
	imgNum++;
	
	timeout=setTimeout("nextImg('"+language+"');", time);
	
	//try to dynamically load select box
	for (i = 0; i < totImg; i++){
		this.document.forms.form1.courthouse.options[i] = new Option(textarray[i], i);
	}
}


function nextImg(language){
	
	if (language == "english") {
		path = "";
		courthousetext = "Provincial Courthouse in ";
	}else{
		path = "../";
		courthousetext = "Cour provinciale à ";
	}
	
	clearTimeout(timeout);
	
	content.innerHTML="<img src='"+path+"images/courthouses/"+imgarray[imgNum]+"' width='184px' alt='' /><p>"+courthousetext+textarray[imgNum]+"<br />"+addressarray[imgNum]+"</p>";
	
	//change dropdownlist selection when changing image name
	this.document.forms.form1.courthouse.options.selectedIndex = imgNum;
	
	if ((imgNum+1)< totImg)
		imgNum++;
	else
		imgNum=0;
		
	timeout=setTimeout("nextImg('"+language+"');", time);
}

//choose which courthouse to view from dropdownlist
function chooseImg(courthouse, language){
	
	Img = courthouse.options[courthouse.selectedIndex].value;
	
	if (language == "english") {
		path = "";
		courthousetext = "Provincial Courthouse in ";
	}else{
		path = "../";
		courthousetext = "Cour provinciale à ";
	}
	
	if (Img != ""){
		
		imgNum = Img;
		
		content.innerHTML="<img src='"+path+"images/courthouses/"+imgarray[imgNum]+"' width='184px' alt='' /><p>"+courthousetext+textarray[imgNum]+"<br />"+addressarray[imgNum]+"</p>";
	
	}
}

/*function loadGallerychangerF(){

    content = document.getElementById( "galcontents" );

            content.innerHTML="<img src='../courthouses/"+imgarray[imgNum]+"' width='250px' alt='' /><p>Provincial Courthouse in "+textarray[imgNum]+"</p>";

            imgNum++;

            timeout=setTimeout("nextImgF();", time);

}

function nextImgF(){

            clearTimeout(timeout);

            content.innerHTML="<img src='../courthouses/"+imgarray[imgNum]+"' width='250px' alt='' /><p>Provincial Courthouse in "+textarray[imgNum]+"</p>";

            if ((imgNum+1)< totImg)

                        imgNum++;

            else

                        imgNum=0;

            timeout=setTimeout("nextImg();", time);

            }*/

