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:
Code:
<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/";
}
</script>
My mobile site's 'Full Site' link code:
Code:
www.domain.com/?skipmobile=1
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.
Code:
<!----------  Mobile Device Redirect function ------>
<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "http://www.mob1.garyluttrell.com";
}
//-->
</script>
Any suggestions appreciated?