
function addMsnExternal() {}

addMsnExternal.prototype = {
        jumpList: [],
        jumpItem: [],
        src: '',
        loginUser: '',
        nonTopPage: '',

        init: function(){
            var self = this;
            this._addJumpList(self.jumpList, self.jumpItem);
            this._write();
        },
        addList: function(val){
            this.jumpList.push(val);
        },
        addItem: function(val){
            this.jumpItem.push(val);
        },
        isLoginUser: function(){
            this.loginUser = true;
        },
        isNonTopPage: function(){
            this.nonTopPage = true;
        },
        _addJumpList: function(list, item){
          try{
            if(window.external.msIsSiteMode()){
                this.src += "<scr" + "ipt type='text/javascript'>";
                this.src += "window.external.msSiteModeClearJumplist();";
                for(var i = 0, len = list.length; i < len; i++) {
                    this.src += "window.external.msSiteModeCreateJumplist('" + list[i].name + "');";
                }
                for(var i = 0, len = item.length; i < len; i++) {
                    if((item[i].type == 'normal') || (item[i].type == 'my' && this.loginUser) || (item[i].type == 'top' && this.nonTopPage)) {
                        this.src += "window.external.msSiteModeAddJumpListItem('" + item[i].name + "', '" + item[i].url + "', '" + item[i].image + "');";
                    }
                }
                this.src += "window.external.msSiteModeShowJumpList();";
                this.src += "</scr" + "ipt>";
            }
          }catch(e){
            ;
          }
        },
        _write: function() {
            //alert(this.src);
            document.write(this.src);
        }
}
msnJumpList = new addMsnExternal();
msnJumpList.addList({name: 'OKWaveのジャンプリスト'});
msnJumpList.addItem({name: 'マイページ', url: '/mypage', image: '/images/icon/favicon.ico', type: 'normal'});
msnJumpList.addItem({name: 'カテゴリ一覧', url: '/category', image: '/images/icon/favicon.ico', type: 'normal'});
msnJumpList.addItem({name: '閲覧の多い質問（今日）', url: '/list/many_pv', image: '/images/icon/favicon.ico', type: 'normal'});
msnJumpList.addItem({name: '未回答の質問', url: '/list/no_answer', image: '/images/icon/favicon.ico', type: 'normal'});
msnJumpList.addItem({name: '最新の一覧', url: '/list/new_question', image: '/images/icon/favicon.ico', type: 'normal'});
msnJumpList.addItem({name: 'OKWaveトップ', url: '/', image: '/images/icon/favicon.ico', type: 'top'});

