//Set the random images up in a Array
var thetopImages = new Array() 
thetopImages[0] = 'images/main001.jpg';
thetopImages[1] = 'images/main002.jpg';
thetopImages[2] = 'images/main003.jpg';
thetopImages[3] = 'images/main004.jpg';
thetopImages[4] = 'images/main005.jpg';
thetopImages[5] = 'images/main006.jpg';
thetopImages[6] = 'images/main007.jpg';
thetopImages[7] = 'images/main008.jpg';
thetopImages[8] = 'images/main009.jpg';
thetopImages[9] = 'images/main010.jpg';
thetopImages[10] = 'images/main011.jpg';
thetopImages[11] = 'images/main012.jpg';
thetopImages[12] = 'images/main013.jpg';
thetopImages[13] = 'images/main014.jpg';
thetopImages[14] = 'images/main015.jpg';
thetopImages[15] = 'images/main016.jpg';


//Set the routine to get random image
var p = thetopImages.length;
var whichImage = Math.round(Math.random()*(p-1));



// function to write the selcted random image to the page
function showImage(){
document.write('<img src="' + newImageRoute + thetopImages[whichImage] +'" width="179" height="394" alt="South Cheshire College student">');
}

//This for a aligned image
function showImage2(direction){
document.write('<img src="' + newImageRoute + thetopImages[whichImage] +'" align="'+direction+'" width="179" height="394" alt="South Cheshire College student">');
}

function WebcamBGImage(idName, ImagesPath, WindowWidth){
if (document.getElementById){//only implement on later browsers

//Get the size of the open window Width
var winW = 0;
if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape"){
  winW = window.innerWidth;
}
 
if (navigator.appName.indexOf("Microsoft")!=-1) {
winW = document.body.offsetWidth;
}	
}

//if the open window is larger than the WindowWidth variable, or if the WindowWidth variable is omitted, then add in the background image
if ((winW>WindowWidth)||(WindowWidth==null)){
document.getElementById(idName).style.backgroundImage="url('"+ ImagesPath + thetopImages[whichImage] +"')";
}

}}






