try {
    // Set up detectmobile.js
    detectmobile.redirectCallback = function(mode, url) {
            if(mode == "mobile") {
                    // We could have arrived directly to a news article
                    // from a search engine, not the site home page
                    // Redirect to a corresponding article mobile version

                    // This example has some URL path for the article
                    // on both site.com and m.site.com, just different domain name.
                    // But you could any kind of URL rewrite here.
                    return detectmobile.replaceDomainName(url, "mobile", true, true);
            }

            // Take no action
            return url;
    }


    // Execute mobile redirect
    detectmobile.process();
} catch(e) {
    // Make sure that in the fault modes
    // we do not interrupt execution of other Javascript code
    if(console && console.exception) {
            console.exception(e);
    }
}
