rendered paste body<script>
function changeImage(filename)
{
document.mainimage.src = filename;
}
</script>
<body>
<table align=center>
<tr><td valign=top>
<table align=center class=border cellpadding=0 cellspacing=10>
<?php
$i=0;
foreach (glob("gallery/*.{jpg,png,gif}", GLOB_BRACE) as $filename) {
if($i == 3) {
echo "<tr>
<td class=border>
<img src=\"$filename\" onclick=\"changeImage('$filename')\" width=75 height=75>
</td></tr>";
} else { echo"
<td class=border>
<img src=\"$filename\" onclick=\"changeImage('$filename')\" width=75 height=75>
</td>";}
$i++;
}
?>
</table>
</td><td valign=top>
<img name=mainimage src=<?$filename?> class=border height=600 width=400>";
</td></tr>
</table>
</body>