I'm trying to deploy a small javascript in an existing simple HTML site to redirect mobile visitors to the mobile site, with a 'Full site' link on the mobile site to allow full site access.

The script I'm testing is from here: http://ezmobilewebsitetools.com/howto-redirect.html

My main site script:
if (document.location.search.indexOf("skipmobile") >= 0) {
document.cookie = "skipmobile=1";
else if ((document.location.hostname.match(/\.mobi$/) || screen.width < 699)
&& document.cookie.indexOf("skipmobile") == -1)
document.location = "mobile/";
My mobile site's 'Full Site' link code:
My question is, nothing is happening, mobile devices are not being redirected to the mobile site using my above code.

I originally used this code, but users can't reach the main site.
<!----------  Mobile Device Redirect function ------>
<script type="text/javascript">
if (screen.width <= 699) {
document.location = "http://www.mob1.garyluttrell.com";
Any suggestions appreciated?