var hover_in  = function () { $(this).addClass('over'); };
var hover_out = function () { $(this).removeClass('over'); };

var IvoApp = function () {
    this.init = function () {
        $('#nav li:last').addClass('last');

        $('#gallery > li').hover(hover_in, hover_out);
        $('#gallery img').hover(hover_in, hover_out);
        
        $('#single li.info a').click(this.info_popup);
        
        $('#news li:last').css('background', 'transparent');
        
        // Popup Voodoo.
        if (window.opener) {
            /*
            $('#main').css({
                'margin-left': '30px',
                'width':       '250px',
                'overflow': 'auto'
            });
            */
        }
    };
    
    this.info_popup = function (event) {
        // Prevent default Event behaviour.
        event.preventDefault();
        
        // Open this link in a popup window.

        var popup = window.open($(this).attr('href'), 'Info', 'height=600,width=400,toolbar=no,resizable=yes,address=no,status=no,location=no,scrollbars=yes');
        
        if (popup) {
            popup.focus();
        }
        
        // Prevent Event bubbling.
        return false;
    };
    
    this.init();
};

$(function () {
    var ivo = new IvoApp();
});