$echo='';
$c=0;
$G=getDirectoryList ('gallery');
shuffle($G);
foreach ($G as $g)
{
if ($c % 3==0) $echo.="
";
$GG=getDirectoryList ("gallery/$g");
shuffle($GG);
$i='';
foreach ($GG as $gg)
{
if (substr($gg,0,4)=='main')
{
$echo.="
";
}
$i.="
";
}
$c++;
if ($c % 3==0) $echo.= "
";
$echo=str_replace('XXX',$i,$echo);
$i='';
}
echo $echo;
?>