I have a javascript I would like to use so that when someone leaves my website they get redirected to another page. This is the script:

<script type="text/javascript" language="javascript">
var DontGoYet = false;
var Link = false;
function stay() {
if (!DontGoYet && !Link) {
DontGoYet = true;
return "Before you leave this page, I highly recommend you check out this free offer ";
window.onbeforeunload = stay;

I want to modify the script so that it doesn't pop up if they click other links on the page or if they fill out my form.