function readCookie(name)
{
	if (document.cookie == '') return false;
	else
	{
		var c0, c1;
		var cookie = document.cookie;
		c0 = cookie.indexOf(name);
		if(c0 != -1)
		{
			c0 += name.length + 1;
			c1 = cookie.indexOf(';', c0);
			if(c1 == -1) c1 = cookie.length;
			return unescape(cookie.substring(c0,c1).replace('+',' '));
		}
		else return false;
    }
}

userID = readCookie(applicationName+'.USER.ID');
userName = readCookie(applicationName+'.USER.USERNAME');if (!userName) userName="";
if (userID==0)
{

	document.write("<table cellpadding=1 cellspacing=1 border=0>");
	document.write("<form action='/fanzone/mboard/' method='post'><input type='hidden' name='Reg.Login.Action' value='verifyUser'><input type='hidden' name='Reg.Login.Return' value='2'>");
	document.write("<tr>");
	document.write("<td align=right class='MboardFanZone'><small>User:</small>");
	document.write("<input class='mboardInput' name='Form_Login_UserName' size=10 maxlength=50 value="+userName+"></td>");
	document.write("<td align=right class='MboardFanZone'>&nbsp;&nbsp;<small>Pass:</small>");
	document.write("<input class='mboardInput' name='Form_Login_Password' type='password' size=10 maxlength=50></td>");
	document.write("<td align=center colspan=2 class='MboardFanZone'>&nbsp;&nbsp;Save <input alt='remember my login' type='checkbox' value=1 name='KeepCookie' checked class='Radio'> <input type='submit' class='FanZoneButton' value='login'></td>");
	document.write("<td>&nbsp;<a href='"+accountURL+"';' class='MboardFanZone'>register</a><br>");
	document.write("&nbsp;<a href='"+passwordURL+"';' class='MboardFanZone'>forgot password?</a></td>");
	document.write("</tr>");
	document.write("</form>");
	document.write("</table>");
}
else
{

	var now= new Date();
	document.write("<table cellpadding=0 cellspacing=2 border=0>");
	document.write("<tr>");
	document.write("<td align=right class='MboardFanZone'><nobr>welcome <b><a href='"+accountURL+"' class='MboardUserName'>"+userName+"</a></b></nobr>");
	document.write(" <nobr><a class='MboardFanZone' href='"+logoutURL+"';' >[logout]</a>");
	document.write(" <a class='MboardFanZone' href='"+accountURL+"';' >[view account]</a></nobr>");
	document.write("<nobr>"+now.toLocaleString()+"</nobr></td>");
	document.write("</tr>");
	document.write("</table>");
}
