﻿// slideshow control script
var id
var i
var n
var pageReady = false
var ImageArr = new Array(n)
var TextArr  = new Array(n)
var TitleArr  = new Array(n)
var placeholder = new Image
var nextPic = new Image

i  = 0	// loop counter
id = 0	// image number
n  = 10	// number of images

placeholder.src = "images/HW_sequence/0.gif"
for (i=1;i<=n;i++) {
	ImageArr[i] = new Image
	TextArr[i] = new String
	ImageArr[i].src = "images/HW_sequence/"+i+".jpg"
}

// define strings to accompany images
TextArr[1] = "Showing a typical installation"
TextArr[2] = "Excavate to a depth of 955 mm nominal. Eg. 300 mm sub-base plus 300 mm concrete base plus 350  mm for the grid itself + 5 mm bedding grout."
TextArr[3] = "To existing road gulley system. Else set drainage into base, eg. 160 mm dia perforated land drain or untrapped road gulley with 150 mm dia outlet."
TextArr[4] = "300 mm Clause 804 Aggragate Base. Eg. 300 mm of 0-40 mm compacted aggregate. Sub-base depth to be consistent with existing road or CBR test."
TextArr[5] = "eg 300 mm of mesh reinforced concrete. C40 mix to BS 8500. Once the concrete pad has cured..."
TextArr[6] = "Assemble the grid to one side and apply epoxy mortar to the underside of the kerb frame. Position the complete grid onto the concrete base and bolt down the kerb frame. Mark the base to indicate the position of the support beams....<br> When the epoxy has cured, unbolt the grid sections and set to one side."
TextArr[7] = "Apply epoxy mortar to the concrete base, in line with the position of the support beams. Prevent the grid adhering permanently to the base by covering the epoxy with plastic film. Replace the grids, making sure they are positioned and secure.<br>When the epoxy has cured.... "
TextArr[8] = "Cut away the excess plastic film and connect the drainage."
TextArr[9] = "Concrete to grid surface with C40 mix to BS 8500. Use a vibrating poker to eliminate voids around kerb frame."
TextArr[10] = "The grid is now ready for use.<br><span class='smalltagline'>Please note: This demo shows a typicall highway installation. Please refer to BS 4008 1991 for general guidance on siting, by-pass lanes and guard fences etc.</span>"

// define strings to accompany images
TitleArr[1] = "The site"
TitleArr[2] = "Excavate Pit"
TitleArr[3] = "Fit Drainage"
TitleArr[4] = "Prepare Sub-base"
TitleArr[5] = "Lay Concrete Base"
TitleArr[6] = "Fix the Kerb Frame"
TitleArr[7] = "Fix Grid to Kerb Fame"
TitleArr[8] = "Connect Drainage"
TitleArr[9] = "Concrete the Aprons"
TitleArr[10] = "Fit Gaurd Fences & Signage"

i=0
function checkifReady() {
	if (document.images) { 
		pageReady = true
	}
	else {
		i=i+1
		if ( i<10 ) { setTimeout("checkifReady()",1000) }
	}
}

function swapImage(j) {
	document.slideshow.src = ImageArr[j].src
	if (document.getElementById) {
		document.getElementById("slideshowtitle").innerHTML = TitleArr[j]
		document.getElementById("slideshowtext").innerHTML = TextArr[j]
		document.getElementById("slideshowNo").innerHTML = j
		
		for (i=1;i<=n;i++) {
			document.getElementById("link"+i).style.color = "#002876"
		}
		document.getElementById("link"+j).style.color = "red"
	}
}

function cycleImages() {
	if (pageReady) {
		id++
		var nextimageNumber = id-(n*(Math.floor((id-1)/n)))
		document.slideshow.src = placeholder.src
		nextPic.src = ImageArr[nextimageNumber].src
		nextPic.onload = swapImage(nextimageNumber)
	}	
}
