                var miniCal = {
                    init: function() { miniCal.build(); },
                    build: function() {
                        var wrapper =   $dom.getById('mini_cals');
                        this.items =    wrapper.getElementsByTagName('li');
                        this.width =    1; // The number of mini calendars displayed at one time
                        this.current =  0; // The index of the 1st current calendar on display

                        this.nav = $dom.getById('mini_cal_nav').getElementsByTagName('a');
                        $pop.event.add(this.nav[0],'click',this.__navClick,this);
                        $pop.event.add(this.nav[1],'click',this.__navClick,this);
                        
                        this.update();
                    },
                    __navClick: function(e) {
                        var e = e || window.event;
                        $pop.event.stop(e);
                        var el = $pop.event.getTarget(e, 'a');
                        if (el.id.indexOf('Previous') > -1) {
                            this.go(-1);
                        } else if (el.id.indexOf('Next') > -1) {
                            this.go(1);
                        }
                    },
                    go: function(iWhich) {
                        CalDateFinder.close();
                        // if we're not at the 1st or last calendars
                        if ((this.current + iWhich) >= 0 &&
                            (this.current + iWhich) < (this.items.length - (this.width - 1))) {
                            this.current += iWhich;
                            this.update();
                        }
                    },
                    update: function() {
                        for (var i=0; i<this.items.length; i++) {
                            if (i >= this.current && i <= (this.current + (this.width - 1))) {
                                this.items[i].style.display = 'block';
                            } else {
                                this.items[i].style.display = 'none';
                            }
                        }
                        this.nav[0].className = (this.current == 0) ? this.nav[0].className + ' off' : this.nav[0].className.replace(/off/,'') ;
                        this.nav[1].className = (this.current == this.items.length - (this.width)) ? this.nav[1].className + ' off' : this.nav[1].className.replace(/off/,'') ;
                    }
                }
                $pop.event.add(window,'load',miniCal.init);

                var CalDateFinder = {
                    init: function() { CalDateFinder.build(); },
                    build: function() {
                        this.calendar = $dom.getById('mini_cals');
                        var links = this.calendar.getElementsByTagName('a');
                        this.links = [];
                        for (var i=0; i<links.length; i++) {
                            if (links[i].getAttribute('rel') && links[i].getAttribute('rel') != '') {
                                this.links.push(links[i]);
                                links[i].onclick = function () { return false; };
                                $pop.event.add(links[i],'click',this.__linkClick,this);
                            }
                        }
                        this.gui = {
                            timeWindow:     $dom.getById('date_window'),
                            btn_Close:      $dom.getById('close'),
                            h3_Head:        $dom.getById('win_head'),
                            div_Content:    $dom.getById('date_content')
                        }
                        //$pop.event.add(this.gui.btn_Close, 'click', this.__closeClick, this);
                    },
                    __linkClick: function(e) {
                        var e = e || window.event;
                        $pop.event.stop(e);
                        var link = $pop.event.getTarget(e);
                        var id = link.getAttribute('rel');
                        var date = document.getElementById('h3_' + id);
                        var content = document.getElementById('div_' + id);
                        this.open(date.innerHTML, content.innerHTML);
                    },
                    __closeClick: function(e) {
                        var e = e || window.event;
                        $pop.event.stop(e);
                        this.close();
                    },
                    open: function(sDate, sContent) {
                        // set the content
                        this.gui.h3_Head.innerHTML = sDate;
                        this.gui.div_Content.innerHTML = sContent;
                        this.gui.timeWindow.style.visibility = 'visible';
                    },
                    close: function() {
                        this.gui.timeWindow.style.visibility = 'hidden';
                    }
                }
                $pop.event.add(window,'load',CalDateFinder.init,window);


