vedo che il tuo file contiene già
echo "<script type=\"text/javascript\">

quindi basta che fai l'include del file nell'head

Codice PHP:
<head>
....
<?php include "[path]gallery_home.php";?>
....
</head>