function site_notification() {
    this.params = {
        timeout: 10000,
        animation_speed: 300,
        notification_type: '',
        notification_container: $('#site_notification'),
        notification_message_container: $("#site_notification_content")
    };
    this.messages = [];

    this.add_message = function(message) {
        this.messages.push(message);
    };

	this.set_height = function(height) {
		this.notification_height = height + 'px';
	}

    this.set_notification_type = function(type) {
        this.params.notification_type = type;
        this.params.notification_container.removeClass('success error notice');
        this.params.notification_container.addClass(type);
    };

    this.display_messages = function() {        
        var params = this.params;
	    var notification_height = this.notification_height;
        var message_string = this.messages.join("<br />");
        this.params.notification_message_container.html(message_string);

        var notification_timer = window.setTimeout(function() {
            params.notification_container.trigger('click');
        }, this.params.timeout);        

        this.params.notification_container.animate({height: notification_height}, this.params.animation_speed).click(function () {
			var current_height = $(params.notification_container).height();
			if(current_height > 10) {
				window.clearTimeout(notification_timer);
				params.notification_container.animate({height: '0px'}, params.animation_speed);
			} else {
				params.notification_container.animate({height: notification_height}, params.animation_speed);
			}
        }).hover(function() {
            window.clearTimeout(notification_timer);
        },function() {
            params.notification_container.animate({height: '0px'}, params.animation_speed);
        });
    }    
    
    this.show_only_this_message = function(message, type) {
        this.set_notification_type(type);
        this.messages = []
        this.messages.push(message);
        this.display_messages();
    }
}

