/**
 * 住所から検索表示クラス(S001)
 */
Ozein.DispAddres = new Class.create();
Ozein.DispAddres.prototype = {
    kanto: new Array(),
    kansai: new Array(),
    other: new Array(),
    options:{},
    /** 初期化 */
    initialize: function(node,options){
        this.createKantoList();
        this.createKansaiList();
        this.createOtherList();
        var mapLinkList = document.getElementsByAttribute('ozein_dispaddres', '*', document.body);
        for(var i=0; i<mapLinkList.length; i++){
            var mapArea = mapLinkList[i].getAttribute('ozein_area');
            var mapLinkNum = mapLinkList[i].getAttribute('ozein_dispaddres');
            
            if(mapArea == 'kanto'){
                Event.observe(mapLinkList[i], 'mouseout', this.kantoOver.bindAsEventListener(this,mapLinkList[i],parseInt(0)));
                Event.observe(mapLinkList[i], 'mouseover', this.kantoOver.bindAsEventListener(this,mapLinkList[i],parseInt(mapLinkNum)));
            }
            else if(mapArea == 'kansai'){
                Event.observe(mapLinkList[i], 'mouseout', this.kansaiOver.bindAsEventListener(this,mapLinkList[i],parseInt(0)));
                Event.observe(mapLinkList[i], 'mouseover', this.kansaiOver.bindAsEventListener(this,mapLinkList[i],parseInt(mapLinkNum)));
            }
            else if(mapArea == 'other'){
                Event.observe(mapLinkList[i], 'mouseout', this.otherOver.bindAsEventListener(this,mapLinkList[i],parseInt(0)));
                Event.observe(mapLinkList[i], 'mouseover', this.otherOver.bindAsEventListener(this,mapLinkList[i],parseInt(mapLinkNum)));
            }
            

        }
    },
    createKantoList:function(){
        this.kanto[0] = new Image();
        this.kanto[0].src = "/img/bukken/s001_kanto_map.gif";
        this.kanto[1] = new Image();
        this.kanto[1].src = "/img/bukken/s001_kanto_map_over_001.gif";
        this.kanto[2] = new Image();
        this.kanto[2].src = "/img/bukken/s001_kanto_map_over_002.gif";
        this.kanto[3] = new Image();
        this.kanto[3].src = "/img/bukken/s001_kanto_map_over_003.gif";
        this.kanto[4] = new Image();
        this.kanto[4].src = "/img/bukken/s001_kanto_map_over_004.gif";
        this.kanto[5] = new Image();
        this.kanto[5].src = "/img/bukken/s001_kanto_map_over_005.gif";
        this.kanto[6] = new Image();
        this.kanto[6].src = "/img/bukken/s001_kanto_map_over_006.gif";
        this.kanto[7] = new Image();
        this.kanto[7].src = "/img/bukken/s001_kanto_map_over_007.gif";
        this.kanto[8] = new Image();
        this.kanto[8].src = "/img/bukken/s001_kanto_map_over_008.gif";
        this.kanto[9] = new Image();
        this.kanto[9].src = "/img/bukken/s001_kanto_map_over_009.gif";
        this.kanto[10] = new Image();
        this.kanto[10].src = "/img/bukken/s001_kanto_map_over_010.gif";
        this.kanto[11] = new Image();
        this.kanto[11].src = "/img/bukken/s001_kanto_map_over_011.gif";
        this.kanto[12] = new Image();
        this.kanto[12].src = "/img/bukken/s001_kanto_map_over_012.gif";
    },
    createKansaiList:function(){
        this.kansai[0] = new Image();
        this.kansai[0].src = "/img/bukken/s001_kansai_map.gif";
        this.kansai[1] = new Image();
        this.kansai[1].src = "/img/bukken/s001_kansai_map_over_001.gif";
        this.kansai[2] = new Image();
        this.kansai[2].src = "/img/bukken/s001_kansai_map_over_002.gif";
        this.kansai[3] = new Image();
        this.kansai[3].src = "/img/bukken/s001_kansai_map_over_003.gif";
        this.kansai[4] = new Image();
        this.kansai[4].src = "/img/bukken/s001_kansai_map_over_004.gif";
        this.kansai[5] = new Image();
        this.kansai[5].src = "/img/bukken/s001_kansai_map_over_005.gif";
        this.kansai[6] = new Image();
        this.kansai[6].src = "/img/bukken/s001_kansai_map_over_006.gif";
    },
    createOtherList:function(){
        this.other[0] = new Image();
        this.other[0].src = "/img/bukken/s001_other_map.gif";
        this.other[1] = new Image();
        this.other[1].src = "/img/bukken/s001_other_map_over_001.gif";
        this.other[2] = new Image();
        this.other[2].src = "/img/bukken/s001_other_map_over_002.gif";
        this.other[3] = new Image();
        this.other[3].src = "/img/bukken/s001_other_map_over_003.gif";
        this.other[4] = new Image();
        this.other[4].src = "/img/bukken/s001_other_map_over_004.gif";
        this.other[5] = new Image();
        this.other[5].src = "/img/bukken/s001_other_map_over_005.gif";
        this.other[6] = new Image();
        this.other[6].src = "/img/bukken/s001_other_map_over_006.gif";
    },
    /** 関東 */
    kantoOver:function(event, node, num){
        $('kanto').src  = this.kanto[num].src;
    },
    /** 関西 */
    kansaiOver:function(event, node, num){
        $('kansai').src = this.kansai[num].src;
    },
    /** その他 */
    otherOver:function(event, node, num){
//        node.src = this.other[num].src;
        $('other').src = this.other[num].src;
    }
}

/**
 * 会社で検索表示クラス(S003)
 */
Ozein.DispCorp = new Class.create();
Ozein.DispCorp.prototype = {
    comBtn: new Array(),
    options:{},
    /** 初期化 */
    initialize: function(node,options){
        this.createcomBtnList();
        var comBtnList = document.getElementsByAttribute('ozein_dispcorp', '*', document.body);
        for(var i=0; i<comBtnList.length; i++){
            var comBtnNum = comBtnList[i].getAttribute('ozein_dispcorp');
            Event.observe(comBtnList[i], 'mouseout', this.comOver.bindAsEventListener(this,comBtnList[i],parseInt(comBtnNum)));
            Event.observe(comBtnList[i], 'mouseover', this.comOver.bindAsEventListener(this,comBtnList[i],parseInt(comBtnNum)+1));
        }
    },
    createcomBtnList:function(){
        this.comBtn[0] = new Image();
        this.comBtn[0].src = "/img/company/s003_company_btn_001.gif";
        this.comBtn[1] = new Image();
        this.comBtn[1].src = "/img/company/s003_company_btn_001_over.gif";
        this.comBtn[2] = new Image();
        this.comBtn[2].src = "/img/company/s003_company_btn_002.gif";
        this.comBtn[3] = new Image();
        this.comBtn[3].src = "/img/company/s003_company_btn_002_over.gif";
    },
    comOver:function(event, node, num){
        node.src = this.comBtn[num].src;
    }
}

/**
 * 会社で検索結果一覧表示クラス(S014)
 */
Ozein.DispCorpList = new Class.create();
Ozein.DispCorpList.prototype = {
    comBtn : new Array(),
    siteBtn: new Array(),
    options:{},
    /** 初期化 */
    initialize: function(node,options){
        this.createcomBtnList();
        this.createsiteBtnList();
        var comBtnList = document.getElementsByAttribute('ozein_dispcorplist', '*', document.body);
        var siteBtnList = document.getElementsByAttribute('ozein_dispcorplistsite', '*', document.body);
        for(var i=0; i<comBtnList.length; i++){
            var comBtnNum = comBtnList[i].getAttribute('ozein_dispcorplist')*2;
            Event.observe(comBtnList[i], 'mouseout', this.comOver.bindAsEventListener(this,comBtnList[i],parseInt(comBtnNum)-2));
            Event.observe(comBtnList[i], 'mouseover', this.comOver.bindAsEventListener(this,comBtnList[i],parseInt(comBtnNum)-1));

            Event.observe(siteBtnList[i], 'mouseout', this.siteOver.bindAsEventListener(this,siteBtnList[i],parseInt(comBtnNum)-2));
            Event.observe(siteBtnList[i], 'mouseover', this.siteOver.bindAsEventListener(this,siteBtnList[i],parseInt(comBtnNum)-1));

        }
    },
    createcomBtnList:function(){
        this.comBtn[0] = new Image();
        this.comBtn[0].src = "/img/company/subheader_profile_001.gif";
        this.comBtn[1] = new Image();
        this.comBtn[1].src = "/img/company/subheader_profile_001_over.gif";
        this.comBtn[2] = new Image();
        this.comBtn[2].src = "/img/company/subheader_profile_002.gif";
        this.comBtn[3] = new Image();
        this.comBtn[3].src = "/img/company/subheader_profile_002_over.gif";
        this.comBtn[4] = new Image();
        this.comBtn[4].src = "/img/company/subheader_profile_003.gif";
        this.comBtn[5] = new Image();
        this.comBtn[5].src = "/img/company/subheader_profile_003_over.gif";
        this.comBtn[6] = new Image();
        this.comBtn[6].src = "/img/company/subheader_profile_004.gif";
        this.comBtn[7] = new Image();
        this.comBtn[7].src = "/img/company/subheader_profile_004_over.gif";
        this.comBtn[8] = new Image();
        this.comBtn[8].src = "/img/company/subheader_profile_005.gif";
        this.comBtn[9] = new Image();
        this.comBtn[9].src = "/img/company/subheader_profile_005_over.gif";
        this.comBtn[10] = new Image();
        this.comBtn[10].src = "/img/company/subheader_profile_006.gif";
        this.comBtn[11] = new Image();
        this.comBtn[11].src = "/img/company/subheader_profile_006_over.gif";
        this.comBtn[12] = new Image();
        this.comBtn[12].src = "/img/company/subheader_profile_007.gif";
        this.comBtn[13] = new Image();
        this.comBtn[13].src = "/img/company/subheader_profile_007_over.gif";
        this.comBtn[14] = new Image();
        this.comBtn[14].src = "/img/company/subheader_profile_008.gif";
        this.comBtn[15] = new Image();
        this.comBtn[15].src = "/img/company/subheader_profile_008_over.gif";
    },
    createsiteBtnList:function(){
        this.siteBtn[0] = new Image();
        this.siteBtn[0].src = "/img/company/subheader_site_001.gif";
        this.siteBtn[1] = new Image();
        this.siteBtn[1].src = "/img/company/subheader_site_001_over.gif";
        this.siteBtn[2] = new Image();
        this.siteBtn[2].src = "/img/company/subheader_site_002.gif";
        this.siteBtn[3] = new Image();
        this.siteBtn[3].src = "/img/company/subheader_site_002_over.gif";
        this.siteBtn[4] = new Image();
        this.siteBtn[4].src = "/img/company/subheader_site_003.gif";
        this.siteBtn[5] = new Image();
        this.siteBtn[5].src = "/img/company/subheader_site_003_over.gif";
        this.siteBtn[6] = new Image();
        this.siteBtn[6].src = "/img/company/subheader_site_004.gif";
        this.siteBtn[7] = new Image();
        this.siteBtn[7].src = "/img/company/subheader_site_004_over.gif";
        this.siteBtn[8] = new Image();
        this.siteBtn[8].src = "/img/company/subheader_site_005.gif";
        this.siteBtn[9] = new Image();
        this.siteBtn[9].src = "/img/company/subheader_site_005_over.gif";
        this.siteBtn[10] = new Image();
        this.siteBtn[10].src = "/img/company/subheader_site_006.gif";
        this.siteBtn[11] = new Image();
        this.siteBtn[11].src = "/img/company/subheader_site_006_over.gif";
        this.siteBtn[12] = new Image();
        this.siteBtn[12].src = "/img/company/subheader_site_007.gif";
        this.siteBtn[13] = new Image();
        this.siteBtn[13].src = "/img/company/subheader_site_007_over.gif";
        this.siteBtn[14] = new Image();
        this.siteBtn[14].src = "/img/company/subheader_site_008.gif";
        this.siteBtn[15] = new Image();
        this.siteBtn[15].src = "/img/company/subheader_site_008_over.gif";
    },



    comOver:function(event, node, num){
        node.src = this.comBtn[num].src;
    },
    siteOver:function(event, node, num){
        node.src = this.siteBtn[num].src;
    }

}


/**
 * 物件一覧表示クラス（S008,S009,S010,S012,S021）
 */
Ozein.DispBukkenList = new Class.create();
Ozein.DispBukkenList.prototype = {
    comBtn: new Array(),
    detailBtn: new Array(),
    options:{},
    /** 初期化 */
    initialize: function(node,options){
        this.createDetailBtnList();
        var detailBtnList = document.getElementsByAttribute('ozein_dispdetail', '*', document.body);
        for(var i=0; i<detailBtnList.length; i++){
            var detailBtnNum = detailBtnList[i].getAttribute('ozein_dispdetail');
            Event.observe(detailBtnList[i], 'mouseout', this.detailOver.bindAsEventListener(this,detailBtnList[i],parseInt(detailBtnNum)));
            Event.observe(detailBtnList[i], 'mouseover', this.detailOver.bindAsEventListener(this,detailBtnList[i],parseInt(detailBtnNum)+1))
        }
    },
    createDetailBtnList:function(){
        this.detailBtn[0] = new Image();
        this.detailBtn[0].src = "/img/bukken/btn_detail.gif";
        this.detailBtn[1] = new Image();
        this.detailBtn[1].src = "/img/bukken/btn_detail_o.gif";
        this.detailBtn[2] = new Image();
        this.detailBtn[2].src = "/img/bukken/btn_inquire.gif";
        this.detailBtn[3] = new Image();
        this.detailBtn[3].src = "/img/bukken/btn_inquire_o.gif";
    },
    comOver:function(event, node, num){
        node.src = this.comBtn[num].src;
    },
    detailOver:function(event, node, num){
        node.src = this.detailBtn[num].src;
    }
}

/**
 * 履歴表示クラス（S016,S017,S018）
 */
Ozein.DispHistory = new Class.create();
Ozein.DispHistory.prototype = {
    img: new Array(),
    options:{},
    /** 初期化 */
    initialize: function(node,options){
        this.createDetailBtnList();
        var historyBtnList = document.getElementsByAttribute('ozein_history', '*', document.body);
        for(var i=0; i<historyBtnList.length; i++){
            var historyBtnNum = historyBtnList[i].getAttribute('ozein_history');
            Event.observe(historyBtnList[i], 'mouseout', this.imgOver.bindAsEventListener(this,historyBtnList[i],parseInt(historyBtnNum)));
            Event.observe(historyBtnList[i], 'mouseover', this.imgOver.bindAsEventListener(this,historyBtnList[i],parseInt(historyBtnNum)+1))
        }
    },
    createDetailBtnList:function(){
        this.img[0] = new Image();
        this.img[0].src = "/img/bukken/btn_alldelete.gif";
        this.img[1] = new Image();
        this.img[1].src = "/img/bukken/btn_alldelete_o.gif";
        this.img[2] = new Image();
        this.img[2].src = "/img/bukken/btn_alldelete.gif";
        this.img[3] = new Image();
        this.img[3].src = "/img/bukken/btn_alldelete_o.gif";
        this.img[4] = new Image();
        this.img[4].src = "/img/bukken/close_btn.gif";
        this.img[5] = new Image();
        this.img[5].src = "/img/bukken/close_btn_over.gif";
    },
    imgOver:function(event, node, num){
        node.src = this.img[num].src;
    }
}

/**
 * 物件詳細表示クラス（S020）
 */
Ozein.DispBukkenDetail = new Class.create();
Ozein.DispBukkenDetail.prototype = {
    detailBtn: new Array(),
    options:{},
    /** 初期化 */
    initialize: function(node,options){
        this.createDetailBtnList();
        var detailBtnList = document.getElementsByAttribute('ozein_dispdetail', '*', document.body);
        for(var i=0; i<detailBtnList.length; i++){
            var detailBtnNum = detailBtnList[i].getAttribute('ozein_dispdetail');
            Event.observe(detailBtnList[i], 'mouseout', this.detailOver.bindAsEventListener(this,detailBtnList[i],parseInt(detailBtnNum)));
            Event.observe(detailBtnList[i], 'mouseover', this.detailOver.bindAsEventListener(this,detailBtnList[i],parseInt(detailBtnNum)+1));
        }
//        Event.observe($('history_back'), 'click', this.historyBack.bindAsEventListener(this,$('history_back')));
    },
    createDetailBtnList:function(){
        this.detailBtn[0] = new Image();
        this.detailBtn[0].src = "/img/bukken/btn_detail_inquire2.gif";
        this.detailBtn[1] = new Image();
        this.detailBtn[1].src = "/img/bukken/btn_detail_inquire2_o.gif";
        this.detailBtn[2] = new Image();
        this.detailBtn[2].src = "/img/bukken/btn_detail_inquire.gif";
        this.detailBtn[3] = new Image();
        this.detailBtn[3].src = "/img/bukken/btn_detail_inquire_o.gif";
    },
    detailOver:function(event, node, num){
        node.src = this.detailBtn[num].src;
    },
    historyBack:function(event, node){
        Event.stop(event);
        history.back();
    }
}


/**
 * クイズ表示クラス（C019, C020）
 */
Ozein.DispQuiz = new Class.create();
Ozein.DispQuiz.prototype = {
    img: new Array(),
    options:{},
    /** 初期化 */
    initialize: function(node,options){
        this.createBtnList();
        var quizBtnList = document.getElementsByAttribute('ozein_quiz', '*', document.body);
        for(var i=0; i<quizBtnList.length; i++){
            var quizBtnNum = quizBtnList[i].getAttribute('ozein_quiz');
            Event.observe(quizBtnList[i], 'mouseout', this.imgOver.bindAsEventListener(this,quizBtnList[i],parseInt(quizBtnNum)));
            Event.observe(quizBtnList[i], 'mouseover', this.imgOver.bindAsEventListener(this,quizBtnList[i],parseInt(quizBtnNum)+1))
        }
    },
    createBtnList:function(){
        this.img[0] = new Image();
        this.img[0].src = "/img/contents/play/quiz_check_btn.gif";
        this.img[1] = new Image();
        this.img[1].src = "/img/contents/play/quiz_check_btn_over.gif";
        this.img[2] = new Image();
        this.img[2].src = "/img/contents/play/backto_quiz_btn.gif";
        this.img[3] = new Image();
        this.img[3].src = "/img/contents/play/backto_quiz_btn_over.gif";
    },
    imgOver:function(event, node, num){
        node.src = this.img[num].src;
    }
}

/**
 * ヘッダ表示クラス
 */
Ozein.DispHeader = new Class.create();
Ozein.DispHeader.prototype = {
    img: new Array(),
    options:{},
    /** 初期化 */
    initialize: function(node,options){
        this.createBtnList();
        var headerBtnList = document.getElementsByAttribute('ozein_header', '*', document.body);
        for(var i=0; i<headerBtnList.length; i++){
            var headerBtnNum = headerBtnList[i].getAttribute('ozein_header');
            Event.observe(headerBtnList[i], 'mouseout', this.imgOver.bindAsEventListener(this,headerBtnList[i],parseInt(headerBtnNum)));
            Event.observe(headerBtnList[i], 'mouseover', this.imgOver.bindAsEventListener(this,headerBtnList[i],parseInt(headerBtnNum)+1))
        }
    },
    createBtnList:function(){
        this.img[0] = new Image();
        this.img[0].src = "/img/global/header_btn_examination.gif";
        this.img[1] = new Image();
        this.img[1].src = "/img/global/header_btn_examination_over.gif";
        this.img[2] = new Image();
        this.img[2].src = "/img/global/header_btn_recent.gif";
        this.img[3] = new Image();
        this.img[3].src = "/img/global/header_btn_recent_over.gif";
        this.img[4] = new Image();
        this.img[4].src = "/img/global/header_btn_place.gif";
        this.img[5] = new Image();
        this.img[5].src = "/img/global/header_btn_place_over.gif";
    },
    imgOver:function(event, node, num){
        node.src = this.img[num].src;
    }
}

/**
 * トップ画面表示クラス(A001)
 */
Ozein.DispTop = new Class.create();
Ozein.DispTop.prototype = {
    imgBtn: new Array(),
    options:{},
    /** 初期化 */
    initialize: function(node,options){
        this.createBtnList();
        var imgBtnList = document.getElementsByAttribute('ozein_top', '*', document.body);
        for(var i=0; i<imgBtnList.length; i++){
            var imgBtnNum = imgBtnList[i].getAttribute('ozein_top');
            Event.observe(imgBtnList[i], 'mouseout', this.imgOver.bindAsEventListener(this,imgBtnList[i],parseInt(imgBtnNum)));
            Event.observe(imgBtnList[i], 'mouseover', this.imgOver.bindAsEventListener(this,imgBtnList[i],parseInt(imgBtnNum)+1));
        }
    },
    createBtnList:function(){
        this.imgBtn[0] = new Image();
        this.imgBtn[0].src = "/img/top/btn_top_search_area.gif";
        this.imgBtn[1] = new Image();
        this.imgBtn[1].src = "/img/top/btn_top_search_area_o.gif";
        this.imgBtn[2] = new Image();
        this.imgBtn[2].src = "/img/top/btn_top_search_rosen.gif";
        this.imgBtn[3] = new Image();
        this.imgBtn[3].src = "/img/top/btn_top_search_rosen_o.gif";
        this.imgBtn[4] = new Image();
        this.imgBtn[4].src = "/img/top/btn_top_search_corp.gif";
        this.imgBtn[5] = new Image();
        this.imgBtn[5].src = "/img/top/btn_top_search_corp_o.gif";
        this.imgBtn[6] = new Image();
        this.imgBtn[6].src = "/img/top/btn_top_search_newbukken.gif";
        this.imgBtn[7] = new Image();
        this.imgBtn[7].src = "/img/top/btn_top_search_newbukken_o.gif";
        this.imgBtn[8] = new Image();
        this.imgBtn[8].src = "/img/top/btn_top_search_special.gif";
        this.imgBtn[9] = new Image();
        this.imgBtn[9].src = "/img/top/btn_top_search_special_o.gif";
    },
    imgOver:function(event, node, num){
        node.src = this.imgBtn[num].src;
    }
}

/**
 * _blankでウィンドウを開く（メニューバー等はそのまま表示する ＆ 開くウィンドウを１つのみにする）
 * this.winの初期化をnullからnew Array()に変更し、this.winをthis.win[name]にするとtargetごとにサブウィンドウが開けるようになる
 * @author suwahara
 */
Ozein.MonoPopup = new Class.create();
Ozein.MonoPopup.prototype = {
    win: null,
    node: null,
    options: {},
    initialize : function(node, options) {
        this.setOptions(options);
        var popupList = document.getElementsByAttribute('ozein_popup', '*', document.body);
        for(var i=0; i<popupList.length; i++){
            Event.observe(popupList[i], 'click', this.popup.bindAsEventListener(this,popupList[i]));
        }
    },
    setOptions : function(options) {
        this.options = {
            width: document.body.offsetWidth,
            height: document.body.offsetHeight,
            menubar:'yes',
            toolbar:'yes',
            location:'yes',
            status:'yes',
            scrollbars:'yes',
            resizable:'yes'
        }
        Object.extend(this.options, options || {});
    },
    popup : function(event,node) {
        var href =  (this.options.href || node.getAttribute('href'));
        var name =  (this.options.target || node.getAttribute('ozein_popup'));
        if(this.win == null || this.win.closed == undefined || this.win.closed) {
            var settings = "";
            var settings = $H(this.options).toQueryString().replace(/&/g, ',');
            this.win = window.open(href, name, settings);
        } else {
            this.win.location.replace(href);
            this.win.focus();
        }
        Event.stop(event);
    }
}
