// http://dynamic-tools.net/toolbox/isMouseLeaveOrEnter/
function isMouseLeaveOrEnter(e, handler)
{		
	if (e.type != 'mouseout' && e.type != 'mouseover') return false;
	var reltg = e.relatedTarget ? e.relatedTarget :
	e.type == 'mouseout' ? e.toElement : e.fromElement;
	while (reltg && reltg != handler) reltg = reltg.parentNode;
	return (reltg != handler);
}

var newsBoxClass = new Class({
	initialize: function() {
		
	},
	onload: function() {
  		$$('.newsBox').action({
			initialize : function()
			{
				var bgArr = $ES('.newsBackground', this);
				bgArr[0].effect('opacity', {duration:0}).custom(1,0);
			},		
			mouseoverevent : function(e){
				if (isMouseLeaveOrEnter(e, this)) 
				{
					var bgArr = $ES('.newsBackground', this);
					bgArr[0].effect('opacity', {duration:100}).custom(0,.8);
				}
			},
			mouseoutevent : function(e){
				if (isMouseLeaveOrEnter(e, this)) 
				{
					var bgArr = $ES('.newsBackground', this);
					bgArr[0].effect('opacity', {duration:100}).custom(.8,0);
				}
			}
		})
	} 
});

var newsBox = new newsBoxClass();
