var imagesArray =[["009","002","004","003","015"],["009","016","014","015","007"],["087","084","085","090","076","091"],["198","***","213","205","211"],["275","278","279","280"],["174","172","175"],["051","050","080","088","008","064"],["010","011","085","097","112","430"]];
var captionsArray = [["Massive bell-shaped column base","Silver foundation plaque of Darius I (522–486 BC)","Coin hoard from the Apadana foundation deposit","Stone box","Massive stone lion's paw from a column capital"],["Massive bell-shaped column base","Reconstructed column","Fragment of a human head from a stone column capital","Massive stone lion's paw from a column capital","Small limestone column base"],["Lapis-lazuli head of a statue","Piece of gold gate-band with embossed and chased decoration","Part of bronze gate-band with embossed and chased decoration","Polished black limestone statue of a large mastiff seated on a base","Square faience tile with coloured glazed decoration","Bronze furniture foot"],["Fragment of stone relief showing the upper part of a figure","***","Rectangular plaque in sheet gold","Cylinder seal in grey-blue chalcedony","Stone pestle and mortar of light green chert"],["Necklace of agate beads","Alabaster vessels (alabastron)","Alabaster vessels (alabastron)","Two silver coins of Aradus, 350–332 BC"],["Gold earrings","Necklace with cast gold pendants","Gold earrings"],["Panel made up of coloured glazed bricks","Fragmentary stone relief showing a priest or servant in Persian dress","Glazed brick merlon decorated with an arrowhead design","Cast of a statue of Darius I","Small bell-shaped column base","Glazed brick with part of foundation inscription of Darius in Elamite"],["Fragment from a column base in grey stone","Fragment from a column base in grey stone","Part of bronze gate-band with embossed and chased decoration","Gold bowl","Bronze bowl","Gold dagger"]];

var thumbArray = new Array();
var beginner = "<img src='../objects/60";
var ender = " width='60' height='60' border='0' vspace='4' />";

var thumbArray = new Array();
var beginner = "<img src='../objects/60";
var ender = " width='60' height='60' border='0' vspace='4' />";

//this changes the main image
function ChangeStuff(page, obj) {
    var noImages = imagesArray[page].length; 
    //alert(noImages);
    var myThumb = obj;
    var v = 0;
    
    //rebuild the thumbnail list
    function MakeThumbs(n){
        thumbArray.length = n;
        for (var i=0; i<n; i++) {
           if(v < 3){ 
                if (i == myThumb){
                    thumbArray[i] = beginner+"k/cat"+imagesArray[page][i]+".jpg' alt='"+captionsArray[page][i]+"'"+ender;
                }else{
                    thumbArray[i] = "<a href='javascript:ChangeStuff("+page+","+i+")'>"+beginner+"j/cat"+imagesArray[page][i]+".jpg' alt='"+captionsArray[page][i]+"'"+ender+"</a>";
                }
            v++;
        }else{
                if (i == myThumb){
                    thumbArray[i] = beginner+"k/cat"+imagesArray[page][i]+".jpg' alt='"+captionsArray[page][i]+"'"+ender+"<br>";
                }else{
                    thumbArray[i] = "<a href='javascript:ChangeStuff("+page+","+i+")'>"+beginner+"j/cat"+imagesArray[page][i]+".jpg' alt='"+captionsArray[page][i]+"' "+ender+"</a><br>";
                }
            v=0;
            }    
        };
        
        return thumbArray        
    }
    
    //Run the make thumb nails
    MakeThumbs(noImages);
   
    //Print the new stuff
    image.innerHTML = "<a href='../objects/cat"+imagesArray[page][obj]+".html'><img src='../objects/230j/cat"+imagesArray[page][obj]+".jpg' alt='"+captionsArray[page][obj]+"' width='230' height='230' border='0' /></a>";
    //Do I need <br> in there
	var captionText = "";
	if(captionsArray[page][obj].length<=46){
		captionText = "<br>"+captionsArray[page][obj]+"<br><br>";
	}else if(captionsArray[page][obj].length>46 && captionsArray[page][obj].length<=98){
		captionText = "<br>"+captionsArray[page][obj]+"<br>";
	}else{
		captionText = captionsArray[page][obj];
	}
	caption.innerHTML = captionText;
     var otherText = "";
     for(var w=0; w<thumbArray.length;w++){
        otherText = otherText+thumbArray[w];
        //othersText = thumbArray[0]+thumbArray[1]+thumbArray[2];
        }
     

    // holder.innerHTML = otherText;
	//"<a href='grid.html'><img src='o/thumbs/all.gif' width='60' height='60' border='0' alt='object grid' vspace='4'/></a>"
    others.innerHTML = otherText;
}