Problem s otvaranim noveho okna

Mam nieco podobne:
<?
$your_dirname="include/pic/images/";

$your_alt_tag="Obrázok";

function displayAaPHPrandomImage($dirname, $alt){
$dirhandle = opendir($dirname);
while (false !== ($file = readdir($dirhandle))) {
if ($file != "." && $file != ".." && !is_dir($file) ) {
$filelist[] = $file;
}
}
closedir($dirhandle);

srand((double)microtime()*1000000);
$picnum = rand(0, sizeof($filelist) - 1);
$imageName=$dirname.$filelist[$picnum];
if($imageSize[2]==4) {
$result="<A target=_blank href=\"".$imageName ."\" onclick=instruct();><img width=\"120\" height=\"120\" src=\"".$imageName ."\" ". $imageSize[3] ."alt=\"". $alt. "\"></A>";
} else $result="<A target=_blank href=\"".$imageName ."\" onclick=instruct();><img width=\"70%\" height=\"70%\" src=\"".$imageName ."\" ". $imageSize[3] ."alt=\"". $alt. "\"></A>";

return $result;

}
?>

<?=displayAaPHPrandomImage($your_dirname, $your_alt_tag)?>

Otvara sa mi to v novom okne ale chcel by som to otvarat v novom okne s urcitymi parametrami (width,height)
Javascript. Ten umí ovlivňovat parametry nových oken.
Ved to je jasne ze javascriptom!
Ja mam problem s tym ako zjednotit php + javascript
pletes hrusky se svestkama. S otviranim novych oken nema PHP vubec nic spolecnyho. zjisti si fci v JS, ktera otevira novy okna, PHPcko ti do toho muze potom akorat dosadit nejaky atributy.