 
    // Deteccion de dispositivo movil.
	

    var urlMobile = "http://m.hotelesplaza.com.mx";

    var createCookie = function (name, value, days) {
        if (days) {
            var date = new Date();
            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
            var expires = "; expires=" + date.toGMTString();
        }
        else var expires = "";
        document.cookie = name + "=" + value + expires + "; path=/";
    };

    var readCookie = function (name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for (var i = 0; i < ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0) == ' ') c = c.substring(1, c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
        }
        return null;
    };

    var isFromMobile = function () {
        var query = window.location.search.substring(1);
        var mobile = false;
        if (query.indexOf("nomobile") >= 0) {
            mobile = true;
            createCookie("mobile", "yes", 1);
        }
        return mobile;
    };


    if (!isFromMobile()) {
        var redirectagent = navigator.userAgent.toLowerCase();
        var redirect_devices = ['vnd.wap.xhtml+xml', 'sony', 'symbian', 'nokia', 'samsung', 'mobile', 'windows ce', 'epoc', 'opera mini', 'nitro', 'j2me', 'midp-', 'cldc-', 'netfront', 'mot', 'up.browser', 'up.link', 'audiovox', 'blackberry', 'ericsson', 'panasonic', 'philips', 'sanyo', 'sharp', 'sie-', 'portalmmm', 'blazer', 'avantgo', 'danger', 'palm', 'series60', 'palmsource', 'pocketpc', 'smartphone', 'rover', 'au-mic', 'alcatel', 'ericy', 'vodafone', 'wap1', 'wap2', 'teleca', 'playstation', 'lge', 'lg-', 'iphone', 'android', 'htc', 'dream', 'webos', 'bolt', 'nintendo'];
        for (var i in redirect_devices) {
            if (redirectagent.indexOf(redirect_devices[i]) != -1) {
                if (!readCookie("mobile"))
                    location.replace(urlMobile);
            }
        }
    }
 


