$imgsize=GetImageSize($path);
$width=$imgsize[0];
$height=$imgsize[1];
$path=ereg_replace("/+","/",$path);
$path_to_send=ereg_replace(ROOTFOLDER,"",$path);
$path=ereg_replace(ROOTFOLDER,SITEROOT,$path);
//$name=ereg_replace("\....$","",$name); // remove the extension in the name
//$name=ucfirst(ereg_replace("_"," ",$name)); // replace underscores by spaces and capitalize
echo "<a href=\"#\" onClick=\"top.document.forms[0].elements['
ImgUrl '].value='$path_to_send';";
echo "top.document.PREVIEWPIC.src='$path';\">$name</a>";
}