
function Client() {}

Client.prototype.mobileClients = [
    "midp",
    "240x320",
    "blackberry",
    "netfront",
    "nokia",
    "panasonic",
    "portalmmm",
    "sharp",
    "sie-",
    "sonyericsson",
    "symbian",
    "windows ce",
    "benq",
    "mda",
    "mot-",
    "opera mini",
    "philips",
    "pocket pc",
    "sagem",
    "samsung",
    "sda",
    "sgh-",
    "vodafone",
    "xda",
    "iphone",
    "android"
    ];

/**
* Mobile ÀÎÁö¸¦ ±¸ÇÑ´Ù.
*/
Client.prototype.isMobileClient = function(userAgent) 
{
    
    // ÄíÅ°°ªÀ» ±¸ÇÑ´Ù.
    if(this.getCookie("mobile2pc") == "on") {
        return false;
    }
    
    // mobile resolution
    if(screen.width < 1024  && screen.height < 768 ) {
        return true;
    }
    
    userAgent=userAgent.toLowerCase();
    for (var i in this.mobileClients) {
        if (userAgent.indexOf(this.mobileClients[i]) != -1) {
            return true;
        }
    }
    return false;
}

/**
* ÄíÅ°°ªÀ» ±¸ÇÑ´Ù.
*/
Client.prototype.getCookie = function(name) 
{
    var nameOfCookie = name + "=";
    var x = 0;
    while(x <= document.cookie.length){
        var y = (x + nameOfCookie.length);
        if(document.cookie.substring(x,y) == nameOfCookie){
            if((endOfCookie=document.cookie.indexOf(";", y)) == -1)
                endOfCookie = document.cookie.length;
            return unescape(document.cookie.substring(y, endOfCookie));
        }
        x = document.cookie.indexOf(" ", x) + 1;
        if(x == 0)
            break;
    }
    return "";

} 


/**
* ÄíÅ°°ªÀ» ÁöÁ¤ ÇÑ´Ù.
*/
Client.prototype.setCookie = function( name, value, expires, path, domain, secure ) 
{
    var today = new Date();
    today.setTime( today.getTime() );
    if ( expires ) {
        expires = expires * 1000 * 60 * 60 * 24;
    }
    var expires_date = new Date( today.getTime() + (expires) );
    document.cookie = name+'='+escape( value ) +
        ( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
        ( ( path ) ? ';path=' + path : '' ) +
        ( ( domain ) ? ';domain=' + domain : '' ) +
        ( ( secure ) ? ';secure' : '' );
}



// Advertisement Open Popup Windows
//var client = new Client();
//client.isMobileClient(navigator.userAgent);

/**
* ÇöÀç Á¢¼ÓÀÌ ¸ð¹ÙÀÏÀÎÁö¸¦ °Ë»ç ÇÑ´Ù.
* ÀÌÀü¿¡ »ç¿ëÀÚ°¡ PCº¸ÀüÀ¸·Î º»´Ù°í ÇßÀ» °æ¿ì (mobile2pc=on À¸·Î ÄíÅ°¿¡ ±â·Ï ÇßÀ» °æ¿ì)´Â 
* ¸ð¹ÙÀÏ ÀÌ¾îµµ PC ·Î Ã³¸® ÇÑ´Ù.
*/
function isMobile()
{
    var client = new Client();
    
    return client.isMobileClient(navigator.userAgent);
}

var ret = isMobile();
if(ret==true) {
  location.href="http://m.seoul.co.kr/index.php";
}
/*ÀÎµ¦½º »ý¼º½Ã <script src="/script/mobile.js"></script> »ðÀÔ*/
        

