
$(function() {

    var generic = new SiteGeneric()
	generic.init()

    var site = new Site()
    site.init()
})

var Site = function() {

    this.calendar = new Calendar() 

    this.init = function() {

        var self = this

        if ($('#forumTable').length) {
            var forum = new Forum()
            forum.init()
        }

        if ($('#calendarSelectors_eventsCalendar').length) {
            var calendar = new Calendar()
            calendar.init('eventsCalendar')
        }       

        if ($('#content .rhs .showAll').length) {
            $('#content .rhs .showAll').click( function() { self.showAll($(this)) })
            $('#content .rhs .hideAll').click( function() { self.hideAll($(this)) })
        } 
    }

    this.showAll = function(elem) {

        var self = this

        var id   = $(elem).attr('id').split('_')
        var type = id[1]

        $('#content .rhs .other' + type).show()
        $('#showAll_' + type).hide()        
        $('#hideAll_' + type).show()
    }

    this.hideAll = function(elem) {

        var self = this

        var id   = $(elem).attr('id').split('_')
        var type = id[1]

        $('#content .rhs .other' + type).hide()
        $('#showAll_' + type).show()        
        $('#hideAll_' + type).hide()
    }
}

