/***********************************************
* DHTML slideshow script-  © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice must stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var which=0

//Specify whether images should be linked or not (1=linked)
var linkornot=0

function keeptrack(){
	window.status="Image "+(which+1)+" of "+itemImages.length
	if(document.all){
     document.getElementById('low_picture_number').innerText = which+1;
	} else{
    document.getElementById('low_picture_number').textContent = which+1;
	}
}

function updateCaption(captionText){
	if(document.all){
     document.getElementById('picture_caption').innerText = captionText;
	} else{
    document.getElementById('picture_caption').textContent = captionText;
	}
}


function backward(){
	if (which>0){
		which--
		document.images.photoslider.src=itemImages[which]+"?maxwidth=230&maxheight=175";
    document.getElementById('main_link').onclick = function() { return Shadowbox.open(document.getElementById('ThumbPic' + which)); }
		//document.getElementById('main_link').href=itemImages[which];
		Shadowbox.setup();
		updateCaption(itemCaptions[which]);
		keeptrack()
	} else {
		which = itemImages.length-1
		document.images.photoslider.src=itemImages[which]+"?maxwidth=230&maxheight=175";
    document.getElementById('main_link').onclick = function() { return Shadowbox.open(document.getElementById('ThumbPic' + which)); }
		//document.getElementById('main_link').href=itemImages[which];
		Shadowbox.setup();
		updateCaption(itemCaptions[which]);
		keeptrack()
	}		
}

function forward(){
	if (which<itemImages.length-1){
		which++
		document.images.photoslider.src=itemImages[which]+"?maxwidth=230&maxheight=175";
    document.getElementById('main_link').onclick = function() { return Shadowbox.open(document.getElementById('ThumbPic' + which)); }
		//document.getElementById('main_link').href=itemImages[which];
		Shadowbox.setup();
		updateCaption(itemCaptions[which]);
		keeptrack()
	} else {
		which = 0;
		document.images.photoslider.src=itemImages[which]+"?maxwidth=230&maxheight=175";
    document.getElementById('main_link').onclick = function() { return Shadowbox.open(document.getElementById('ThumbPic' + which)); }
		//document.getElementById('main_link').href=itemImages[which];
		Shadowbox.setup();
		updateCaption(itemCaptions[which]);
		keeptrack()
	}
}

