var value=new Array(8);
value[0]= "/gallery/ajax/img0.jpg";
value[1]= "/gallery/ajax/img1.jpg";
value[2]= "/gallery/ajax/img2.jpg";
value[3]= "/gallery/ajax/img3.jpg";
value[4]= "/gallery/ajax/img4.jpg";
value[5]= "/gallery/ajax/img5.jpg";
value[6]= "/gallery/ajax/img6.jpg";
value[7]= "/gallery/ajax/img7.jpg";

var text=new Array(8);
text[0]="Slide 1";
text[1]="Slide 2";
text[2]="Slide 3";
text[3]="Slide 4";
text[4]="Slide 5";
text[5]="Slide 6";
text[6]="Slide 7";
text[7]="Slide 8";

function initSlideShow() {
	// create option
	var select=document.getElementById("picture");
 	for (var i=0;i<text.length;i++) {
		var option=document.createElement('option');
  		option.text=text[i];
		option.value=value[i];
	  	try {
    			select.add(option,null);	// W3C compliant
		} catch(ex) {
    			select.add(option);		// IE  compliant
			}
		}
	// select event
	select.onchange=function() {
		document.images.pictures.src=document.mygallery.picture.options[document.mygallery.picture.selectedIndex].value;
		};
	// backward event
	document.getElementById("backward").onclick=function() {
		if((document.mygallery.picture.selectedIndex-1)<0)
			document.mygallery.picture.selectedIndex=document.mygallery.picture.length-1;
			else document.mygallery.picture.selectedIndex=document.mygallery.picture.selectedIndex-1;
		document.images.pictures.src=document.mygallery.picture.options[document.mygallery.picture.selectedIndex].value;
		};
	// forward  event
	document.getElementById("forward").onclick=function() {
		if((document.mygallery.picture.selectedIndex+1)>=document.mygallery.picture.length)
			document.mygallery.picture.selectedIndex=0;
			else document.mygallery.picture.selectedIndex=document.mygallery.picture.selectedIndex+1;
		document.images.pictures.src=document.mygallery.picture.options[document.mygallery.picture.selectedIndex].value;
		};
	}

initSlideShow();

