nadskap2 0 Newbie Poster

Hey there...
I got a website which i want to work properly...
But i cant make it work properly without image popup working properly...
PHP and HTML code:

<?php			    
if ($handle = opendir('./bsbilleder')) {
    while (false !== ($file = readdir($handle))) {
        if(substr($file, 0, 1) != ".") {
		    $bspic = array(".jpg", ".png", ".gif");
		    if(in_array(substr($file, strrpos($file, '.'), strlen($file)-strrpos($file, '.')), $bspic)) {
	                echo "<a class=\"bspic\" onclick=\"picopen();\" href=\"#\"><img border=\"0\" src=\"./bsbilleder/".$file."\" height=\"80\" width=\"80\" /></a>";	   
				echo "<div id=\"bspicdiv\" class=\"bspicdiv\"><a href=\"#\" onclick=\"picclose();\" class=\"bspicclose\"><img border=\"0\" src=\"./bsbilleder/".$file."\" height=\"450px\" width=\"450px\" /></a></div>";
			}
        }
    }
    closedir($handle);
}
?>

JavaScript Code:

<script type="text/javascript">
function picopen() {
    document.getElementById('bspicdiv').style.display = 'block';
    document.getElementById('bspicdiv').style.marginTop = '-400px';
}

function picclose() {
    document.getElementById('bspicdiv').style.marginTop = '0px';
    document.getElementById('bspicdiv').style.display = 'none';
}
</script>

What happens:
Well when i click on the first image in the line than it works fine... but for all the others it dont... when i click fx on the 5th image in the line than the 1st image gets up in the box not the 5th image...
see it yourself here:
http://bstagdaekning.dk?p=13

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.