Optimized cookie and user agent checking

Skip checking the regular expression if the cookie is set to on or off.
Simplified request.MOBILE statement