codice:
<script language="JavaScript" type="text/JavaScript"> 
    // Specify the image files
    var Pic = new Array() // don't touch this
    // to add more images, just continue
    // the pattern, adding to the array below

<? 
$absolute_path = "images";
$dir = opendir($absolute_path); 
$f=array(); 

while($file = readdir($dir)) 
   if (($file != "..") and ($file != ".")) 
       $f[]=$file; 


unset($file,$dir); 
sort($f); 

$i = 0;

foreach($f as $file) 
    echo "Pic[$i] = '$file'\n";

$i++;
?>

    var p = Pic.length

    var preLoad = new Array()
    for (i = 0; i < p; i++){
       preLoad[i] = new Image()
       preLoad[i].src = Pic[i]
    }

</script>
ciao