//function fMyOnLoad() {
//}

function fMyFixMailTos() {
	mailtos = $('a.mailto');
	mailtos.each(function() {
		$(this).attr('href', $(this).attr('href').replace('(at)','@'));
		$(this).text($(this).text().replace('(at)','@'));
	});
}

function fGetLogin() {
	$.get( '/perl/getLogin.pl', function(data) { fFixLogin(data); } );
}
function fFixLogin(sLogin) {
	//alert(sLogin);
	var userArray = sLogin.split(':');
	var userCode = userArray[0];
	var userLevel = userArray[1];
	var inOut = 'in';
	if( userCode != 'Visitor') {
		inOut = 'out';
	}
	var sOutput = '';
	// <!-- <a id="login" class="button" href="/perl/Log{in,out}.pl">Log{in,out}:</a> -->
	sOutput +=
		'<a id="login" class="button" href="/perl/Log'
		+ inOut
		+ '.pl">Log'
		+ inOut
		+ ':</a>'
		+ ' '
	;
	// <!-- <span id="userCode">{userCode}</span> -->
	sOutput +=
		'<span id="userCode">'
		+ userCode
		+ '</span>'
		+ '<br/>'
	;
	// <!-- User Level: {level}<br/> -->
	sOutput +=
		'User Level: '
		+ userLevel
	;
	$('p#loginout').html( sOutput );
};

$(document).ready(function() {
	fGetLogin();
	fMyFixMailTos();
	//if( typeof fMyOnLoad == 'function' ) {
	//	fMyOnLoad();
	//}
});

