// addLoadEvent(funcname);
// addLoadEvent( function() { alert('something'); } );
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

// Stripe tables with odd/even
function recacheOddEven() {
	$('table.etable').each(function() {
		$(this).find('tr').removeClass('odd');
		$(this).find('tr:even').addClass('odd');
	});
}

function eLog(msg) { try { console.log(msg); } catch(e) {} }

$(document).ready(function() {
	$('ul.menu').children().filter('LI').each(function() {
		$(this).mouseover(function() {
			$(this).addClass('over');
		}).mouseout(function() {
			$(this).removeClass('over');
		});
	});
	$('table.etable:not(.nohover) TR:not(.nohover)').hover(function() {
		$(this).find('td').addClass('etableHover');
	}, function() {
		$(this).find('td').removeClass('etableHover');
	})
		.addClass('etableLineBetweenRows')
		.filter(':first')
		.removeClass('eTableLineBetweenRows');
	recacheOddEven();

	// Also in mobile!!
	$('span.eEmail').each(function() { // <span class='eEmail'>yahoo.com@user</span>
		var $span = $(this);
		$span.text( $span.text().replace( /(.+)@(.+)/, "$2@$1" ) );
		$span.wrap('<a href="mailto:' + $span.text() + '">');
	});
});

