var Notice =
{
	init: function()
	{
		$$('.close').each
		(
			function (anchor)
			{
				
				anchor.writeAttribute('href', 'javascript::void(0)');
				anchor.observe('click', function() 
				{ 
					var url = $('baseUrl').getValue() + '/notice/index/read/notice_id/' + anchor.readAttribute('notice_id')
					new Ajax.Request(url, {
						  onSuccess: function(transport) {
						      $(anchor.up('li').remove());
						      
						      $$('.close').each
						      (
						    		  function (anchor, i)
						    		  {
						    			  var li = anchor.up('li');
						    			  li.removeClassName('alt1');
						    			  li.removeClassName('alt2');
						    			  var className = i % 2 == 0 ? 'alt1' : 'alt2';
						    			  li.addClassName(className);
						    		  }
						      );
						  }
						});
				});
			}
		)
		
		$$('ul.notices li').each(
			function (item, i)
			{
				var options = {startcolor: '#FFF6BF', keepBackgroundImage: 'true'}; 
				new Effect.Highlight(item, options);
			}
		);
	}
}

Event.observe(window, 'load', Notice.init);
