var AjaxFooter = new Class({

    /**
     * Constructor
     */
    initialize: function() {
        $('sitemap').addEvent('click', this._showSitemap.bind(this));
        $('downloads').addEvent('click', this._showDownloads.bind(this));
        $('links').addEvent('click', this._showLinks.bind(this));
        $('contact').addEvent('click', this._showContact.bind(this));
        
        this._showSitemap();
    },
    
    _setStyles: function() {
        $('sitemap').setStyle('font-weight', 'normal');
        $('downloads').setStyle('font-weight', 'normal');
        $('links').setStyle('font-weight', 'normal');
        $('contact').setStyle('font-weight', 'normal');
    },
    
    /**
     * View the sitemap through Ajax call
     */    
    _showSitemap: function() {
        this._setStyles();
        $('sitemap').setStyle('font-weight', 'bold');
        new Request.HTML({
            url:        VIRTUAL_URL + 'footer/sitemap',
            method:     'get',
            update:     'footercontent'
        }).send();
    },
    
    /**
     * View the downloads through Ajax call
     */    
    _showDownloads: function() {
        this._setStyles();
        $('downloads').setStyle('font-weight', 'bold');
        new Request.HTML({
            url:        VIRTUAL_URL + 'footer/downloads',
            method:     'get',
            update:     'footercontent'
        }).send();
    },
    
    /**
     * View the links through Ajax call
     */    
    _showLinks: function() {
        this._setStyles();
        $('links').setStyle('font-weight', 'bold');
        new Request.HTML({
            url:        VIRTUAL_URL + 'footer/links',
            method:     'get',
            update:     'footercontent'
        }).send();
    },
    
    /**
     * View the contact page by redirect
     */    
    _showContact: function() {
        window.location = WEB_URL + 'contact';
    }
});

var _AJAXFOOTER;
window.addEvent('domready', function() {
    _AJAXFOOTER = new AjaxFooter();
});
