Mixi.Common.Namespace.createNamespace('Mixi.Press',function(){
    // [Task]プルダウンセレクタ
    this.PullDownSelector = {
        init: function() {
            var targetCandidates;
            if ( (targetCandidates = $$('p.selectHistory select')).length > 0 ) {
                targetCandidates[0].observe('change',this.changeYear);
            }
        },
        changeYear: function() {
            var year = this.options[this.selectedIndex].value;
            // "" も「最新へのリンク」として受け入れます。
            window.location.href = "/press/" + year;
        }
    };
    // [Task]Pimp Our Tables!
    this.PimpOurTables = {
        init: function() {
            var targetCandidates;
            if ( (targetCandidates = $$('.pressBody01 table:not([class~=legacy])')).length > 0 ) {
                targetCandidates.each(function(table){
                    if ( !table.readAttribute('style') ) {
                        table.wrap('div',{'class':'table01'});
                        table.writeAttribute({cellspacing:"1"});
                    }
                });
            }
        }
    };
    // [Task]空文字列での検索を抑制
    this.AvoidBlankSearch = {
        init: function() {
            if ( $('searchform') ) {
                $('searchform').observe('submit',function(evt) {
                    if ( this.elements['s'].value == '' ) {
                        evt.stop();
                    }
                });
            }
        }
    };
    

    // 各タスクの初期実行
    this.PullDownSelector.init();
    this.PimpOurTables.init();
    this.AvoidBlankSearch.init();
});
