/*==============================================================================
 *
 * パッケージ名  :
 * ファイル名    :judgeOS.js
 * 名称          :OS判定Javascript
 * 概要          :クライアントのOSを判定します。
 * 作成日・作成者:2008/12/06 jf
 * 変更履歴      :
 *
 * Copyright(c)2008 ChaseSystems Co.,Ltd.
 =============================================================================*/
function judgeOS(){

    /** 
     * 変数
     */
    // OS判定用変数
    var os;

    // navigatorオブジェクトのuserAgentプロパティの全文字列を小文字化
    // ※後の処理記述を楽にする為の準備
    var agt = navigator.userAgent.toLowerCase();

    // OS情報取得
    this.win      = ((agt.indexOf("win") != -1) || (agt.indexOf("16bit") != -1));
    this.mac      = (agt.indexOf("mac") != -1);
    this.os2      = ((agt.indexOf("os/2") != -1) ||
                     (navigator.appVersion.indexOf("OS/2") != -1) ||   
                     (agt.indexOf("ibm-webexplorer") != -1));
    this.sun      = (agt.indexOf("sunos") != -1);
    this.irix     = (agt.indexOf("irix") != -1);
    this.hpux     = (agt.indexOf("hp-ux") != -1);
    this.aix      = (agt.indexOf("aix") != -1);
    this.linux    = (agt.indexOf("inux") != -1);
    this.sco      = (agt.indexOf("sco") != -1) || (agt.indexOf("unix_sv") != -1);
    this.unixware = (agt.indexOf("unix_system_v") != -1);
    this.mpras    = (agt.indexOf("ncr") != -1);
    this.reliant  = (agt.indexOf("reliantunix") != -1);
    this.dec      = ((agt.indexOf("dec") != -1) || (agt.indexOf("osf1") != -1) || 
                     (agt.indexOf("dec_alpha") != -1) ||
                     (agt.indexOf("alphaserver") != -1) || 
                     (agt.indexOf("ultrix") != -1) || (agt.indexOf("alphastation") != -1));
    this.sinix    = (agt.indexOf("sinix") != -1);
    this.freebsd  = (agt.indexOf("freebsd") != -1);
    this.bsd      = (agt.indexOf("bsd") != -1);
    this.unix     = ((agt.indexOf("x11") != -1) || this.sun || this.irix || this.hpux || 
                      this.sco || this.unixware || this.mpras || this.reliant || 
                      this.dec || this.sinix || this.aix || this.linux || this.bsd || 
                      this.freebsd);
    this.vms      = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));



    /** 
     * OS定義
     */
    // WINDOWS
    if(this.win){
        os = "WIN";
    }
    // MACINTOSH
    else if(this.mac){
        os = "MAC";
    }

    /* 以下の OS はコメントアウトとします。
     * 将来、必要に応じて使用して下さい。
     */
    /* コメントアウト start
    // OS/2
    else if(this.os2){
        os = "OS2";
    }

    // SUN
    else if(this.sun){
        os = "SUN";
    }

    // IRIX
    else if(this.irix){
        os = "IRIX";
    }

    // HP-UX
    else if(this.hpux){
        os = "HP-UX";
    }

    // AIX
    else if(this.aix){
        os = "AIX";
    }

    // LINUX
    else if(this.linux){
        os = "LINUX";
    }

    // SCO
    else if(this.sco){
        os = "SCO";
    }

    // UNIXWARE
    else if(this.unixware){
        os = "UNIXWARE";
    }

    // MPRAS
    else if(this.mpras){
        os = "MPRAS";
    }

    // RELIANT
    else if(this.reliant){
        os = "RELIANT";
    }

    // DEC
    else if(this.dec){
        os = "DEC";
    }

    // SINIX
    else if(this.sinix){
        os = "SINIX";
    }

    // FREEBSD
    else if(this.freebsd){
        os = "FREEBSD";
    }

    // BSD
    else if(this.bsd) != -1){
        os = "BSD";
    }

    // UNIX
    else if(this.unix){
        os = "UNIX";
    }

    // VMS
    else if(this.vms){
        os = "VMS";
    }
    コメントアウト end */

    // etc
    else{
        os = "ETC";
    }

    // 定義したOS名を返却します。
    return os;
}

