Le parentesi sono sicuramente chiuse nel punto sbagliato:

<a href="<?echo'http://www.miosito.it/index'.$numeropag.'.php';?>" onclick="return x5engine.imShowBox({ swipeImg: 'res/imSwipe.png', closeImg: 'res/imClose.png', loadingImg: 'res/imLoad.gif', startIndex: 0, media:[{type: 'iframe', url: '<?echo'http://www.miosito.it/index'.$numeropag.'.php';?>' width: 800, height: 600, description: ''}]}, 0, this);" class="imCssLink"><img src="images/file3schedav.png" onmouseover="this.src='images/file3schedau.png';" onmouseout="this.src='images/file3schedav.png';" title="File associati alla scheda" alt="File associati alla scheda"/></a></span>

Cmq io non mettere l'apertura del tag php all'interno dell'href ma all'esterno così ti eviti gli echo e qualche punto e virgola...
Questo come link non è il massimo, non puoi proprio fare diversamente?