Your PHP scripts can output whatever they (you) want. If you want to generate a JavaScript function you just get your PHP script to generate the necessary HTML:
<?php
...
?>
<script language="JavaScript">
<!-- foo bar -->
</script>
<?
...
?>
similarly with a JavaScript event handler:
<div id="main_menu" onmouseover="<?= getMouseOver('main_menu') ?>">
<!-- foo bar -->
</div>
I assume that you are either using PHP's server-side email functions or using a form action or href with the 'mailto:' protocol. Either way, you can have whatever HTML you need in your web page.
I suggest you get coding and ask any specific questions as they arise. We'll be more than happy to help :-)