/*
 * Copyright (c) 2008 Kahvipapu Software. All rights reserved.
 * @author Tarmo Hyvärinen <th@kahvipapusoftware.com>
 */

$(document).ready(function() {

	if($.browser.msie&&$.browser.version<"8.0") {
		$('#notsupported').show();
	};

	// Close messages by click
	$('#messagecontainer div').click(function() {
		$(this).fadeOut('fast');
	});

	// Autoclose messages
	$('#messagecontainer div').ready(function() {
		if($('#messagecontainer div').length>0) {
			setTimeout('$(\'#messagecontainer div\').fadeOut("fast");',4000);
		}
	});

	// Check for unread messsages
	$('#title-notify').ready(function() {
		if($('#title-notify').length>0) {
			if(typeof Notify!="undefined") {
				// First time
				Notify.getMailNotify();
				// Repeat once every 60 seconds
				setInterval('Notify.getMailNotify();',60000);
			}
		}
	});

});

