
var archieve_dynamic = Class.create();
archieve_dynamic.prototype = {
    cur_year:  null,
    y_prefix: null,
    m_prefix: null,
    m_title: null,
    m_id: null,
    m_index: null,
    m_current: null,
    m_active:null,
    initialize: function(y_prefix, m_prefix, year){
        this.y_prefix = y_prefix;
        this.m_prefix = m_prefix;
        this.cur_year = year;
        this.m_title = new Array();
        this.m_id = new Array();
        this.m_index = 0;
        this.m_active = true;
    },
    select: function(year){
        $(this.y_prefix + this.cur_year).removeClassName('active');
        $(this.y_prefix + year).addClassName('active');
        $(this.m_prefix + this.cur_year).setStyle({display:'none'});
        $(this.m_prefix + year).setStyle({display:'block'});
        this.cur_year = year;
    },
    setCurrent: function(id){
        this.m_current = id;
    },

    setActive: function(active){
        this.m_active = active;
    },
    add: function(title, id){
        this.m_title[this.m_index] = title;
        this.m_id[this.m_index] = id;
        this.m_index++;
        $("month_"+id).observe('mouseover', function(){
                if(this.id != this.obj.m_current && this.obj.m_active){
                    this.obj.m_active = false;
                    $("morach_title").innerHTML = this.title;
                    $("month_"+this.id).addClassName("active");
                    $("morach_"+this.id).setStyle({"display":"block"});
                    $("morach_"+this.obj.m_current).setStyle({"display":"none"});
                    //$("morach_"+this.id).appear();
                    //$("morach_"+this.obj.m_current).fade();
                    $("month_"+this.obj.m_current).removeClassName("active");
                    this.obj.setCurrent(this.id);
                    setTimeout(function(){
                            this.setActive(true);
                    }.bind(this.obj), 0);
                }
            }.bind({"id":id,"title":title,"obj":this})
        );
    }
};
