// image slides

var dimension="4x2" //Specify dimension of gallery (number of images shown), such as 4x2, 3x1 etc

//Specify images:
//galleryarray[x]=["path_to_image", "optional_title_attribute", "optional_text_description", "optional_link"]
var galleryarray=new Array()
galleryarray[0]=["photos/photo1_small.jpg", "Click to download photo", "", "photos/bob_oberstar2.jpg"]
galleryarray[1]=["photos/photo2_small.jpg", "Click to download photo", "", "photos/cleaning_off_surface.jpg"]
galleryarray[2]=["photos/photo3_small.jpg", "Click to download photo", "", "photos/crw_4925.jpg"]
galleryarray[3]=["photos/photo4_small.jpg", "Click to download photo", "", "photos/DSC00944.jpg"]
galleryarray[4]=["photos/photo5_small.jpg", "Click to download photo", "", "photos/img_4783.jpg"]
galleryarray[5]=["photos/photo6_small.jpg", "Click to download photo", "", "photos/iStock_000001184300air.jpg"]
galleryarray[6]=["photos/photo7_small.jpg", "Click to download photo", "", "photos/light_snow.jpg"]
galleryarray[7]=["photos/photo8_small.jpg", "Click to download photo", "", "photos/old_spray_system_fixings.jpg"]
galleryarray[8]=["photos/photo9_small.jpg", "Click to download photo", "", "photos/rock7inch.jpg"]
galleryarray[9]=["photos/photo10_small.jpg", "Click to download photo", "", "photos/SafeLaneComparison_flat.jpg"]
galleryarray[10]=["photos/photo11_small.jpg", "Click to download photo", "", "photos/SBL_epoxy spreading.JPG"]
galleryarray[11]=["photos/photo12_small.jpg", "Click to download photo", "", "photos/sweep1.jpg"]
galleryarray[12]=["photos/photo13_small.jpg", "Click to download photo", "", "ophotos/Workers_apply_epoxy.jpg"]


var href_target="_new" //Enter target attribute of links, if applicable

var totalslots=dimension.split("x")[0]*dimension.split("x")[1]

function buildimage(i){
var tempcontainer=galleryarray[i][3]!=""? '<a href="'+galleryarray[i][3]+'" target="'+href_target+'">' : ""
tempcontainer+='<img src="'+galleryarray[i][0]+'" border="0" title="'+galleryarray[i][1]+'">'
tempcontainer=galleryarray[i][3]!=""? tempcontainer+'</a>' : tempcontainer
tempcontainer=galleryarray[i][2]!=""? tempcontainer+'<br \/>'+galleryarray[i][2] : tempcontainer
return tempcontainer
}

function jumptopage(p){
var startpoint=(p-1)*totalslots
var y=1;
for (i=0; i<totalslots; i++){
document.getElementById("slide"+i).innerHTML=(typeof galleryarray[startpoint+i]!="undefined")? buildimage(startpoint+i) : ""
}
while(document.getElementById("navlink"+y)!=null){
document.getElementById("navlink"+y).className=""
y++
}
document.getElementById("navlink"+p).className="current"
}

var curimage=0
for (y=0; y<dimension.split("x")[1]; y++){
for (x=0; x<dimension.split("x")[0]; x++){
if (curimage<galleryarray.length)
document.write('<div id="slide'+curimage+'" class="slideshow">'+buildimage(curimage)+'</div>')
curimage++
}
document.write('<br style="clear: left" />')
}
