I have created a simple slideshow/ gallery.
There are five small pictures with titles below the slideshow.

How can I get the title box above the slide show to change according
to the selected picture.

Been playing with it but nothing seems to work.

Any help will be much appreciated.


HTML Code:
<head>
<title>Gallery</title>
<script language ="JavaScript">
<!--

 var photos = new Array(5);
 var p_no = 0;

     for ( i= 0; i <= 4; i++){
        no = i+1;
        photos[i] = "img"+( i+1) +"_L.jpg";
     }


  function change_photos( op ){

   switch ( op ){
     case -1:
       p_no--;
       break;
     case 5:
       p_no ++;
       break;
     default:
     p_no =op;
   }

   if ( p_no== 5){
       p_no =0;
   } else if ( p_no == -1){
      p_no = 4;
   }

   document.images[0].src= photos[p_no];  
    }




//-->
</script>


</head>

<body>
<center>
<form name = "form_1" >
 <input type = "text" name ="title" value ="LAX"><br>
<img src = "img1_L.jpg">

<br>

<input type= "button" value= "Back" onClick = "change_photos(-1)">&nbsp;
<input type= "button" value= "Next" onClick="change_photos(5)" ><br>
<br>
</form>
</center>
<hr>


<center><table>
<tr>
<td><img src ="img1_S.jpg" onClick = "change_photos('0')"></td>
<td><img src ="img2_S.jpg" onClick = "change_photos('1')"></td>
<td><img src ="img3_S.jpg" onClick = "change_photos('2')"></td>
<td><img src ="img4_S.jpg" onClick = "change_photos('3')"></td>
<td><img src ="img5_S.jpg" onClick = "change_photos('4')"></td></tr>

<tr>

<form name = "form_2">
<td> <input type = "text" name ="titel1" value="LAX"        onChange = "change_photos('0')"></td>
<td><input type = "text" name ="titel2" value="Universal Studios" onChange = "change_photos('1')"></td>
<td> <input type = "text" name ="titel3" value="Parade"    onChange = "change_photos('2')" ></td>
<td> <input type = "text" name ="titel4" value="Golden Gate Bridge"          onChange = "change_photos('3')"></td>
<td> <input type = "text" name ="titel5" value="Beach"      onChange = "change_photos('4')"></td>
</form>
</table>
</center>
<br>
<hr>
<br>
</body>