Redirecting A Visitor With Script Alerts

Let's say you have an R rated website, or something you don't want the mama to see, with JavaScript, you can warn people of your website before they even enter. The user can then decide if they want to press OK and proceed to your website, or they can press cancel and proceed to a website of your choice.

<html>
<head>
<title>TITLE HERE</title>

<script language="javascript" type="text/javascript">
<!--
if (confirm("Hey, this website has R rated content, are you sure that you want in?")) {
alert("Well, come on in then!")
}
else {
window.location="http://www.google.com"
}
//-->
</script>

</head>
<body>
WEBSITE CONTENT
</body>
</html>

The three parts that you need to edit are this:
Hey, this website has R rated content, are you sure that you want in?: This is the warning box that people will see when they come to your site. Your website will not even load until they select OK or Cancel.
Well, come on in then!: If the viewer selects OK, then another message box will appear alerting the user that they have selected OK. When they press OK in this box your website will finally load.
http://www.google.com: This should be the URL of where you want the user to be directed in the event that they do not want to enter your website. This URL can be anything.

Main?