function getLFCCookie(name) 
{
  if ( (start = document.cookie.indexOf(name + "=")) != -1) 
  {
    start += name.length + 1;
    end = document.cookie.indexOf(";", start);
    if (end == -1)
      end = document.cookie.length;
    return unescape(document.cookie.substring(start, end));
  }
  return null;
}

function setLFCCookie(name,value)
{
  var expires = new Date();
  expires.setYear(expires.getFullYear()+10);
  document.cookie = name+"="+value+"; domain=.liverpoolfc.tv; path=/; expires="+expires.toGMTString();
}

var newsletter = "";
function displayLogIn(lmrp)
{
  var page = location.href;
  var server = page.indexOf("www.liverpoolfc.tv") != -1 ? "http://www.liverpoolfc.tv" : "http://test.liverpoolfc.tv";
  var ip = page.indexOf("www.liverpoolfc.tv") != -1 ? "115c819b56b413152295931c70044897efc70d4636ac252cd63e9b58d185e1dd05c4614958" : "0e52c370b7ea5a5f2c1b214685dc1663ad1038dd93862e59c5229315e2d38c92a47dcb6e680e";
  var firstname = getLFCCookie("LFC_U_NME");
  var email = getLFCCookie("LFC_U_EML");
  if ( email == null )
    email = ""; 
  else
    email = " ("+email+")";

  if ( firstname != null && firstname != "deleted" )
  {
    //newsletter = "/cgi-bin/traffic_control?service=eup";
	newsletter = "/lfctvt/?cid=23&inv=54&dest=%2Fcgi-bin%2Ftraffic_control%3Fservice%3Deup";
    document.writeln('Welcome back '+firstname+email+'&nbsp;&nbsp;<br>');
    document.writeln('<span class="Yel">&#8250;&#8250;</span> <a href="/cgi-bin/traffic_control?service=eup" class="siteLink">My Account</a>&nbsp;&nbsp;<br>'); 
    document.writeln('<span class="Yel">&#8250;&#8250;</span> <a href="/cgi-bin/logout" class="siteLink">LogOut</a>&nbsp;&nbsp;');
  }
  else
  {
    // not logged in branch 
    //newsletter = "/cgi-bin/Fregistration?service=freg";
	newsletter = "/lfctvt/?cid=23&inv=54&dest=%2Fcgi-bin%2FFregistration%3Fservice%3Dfreg";
    document.writeln('<form action="/cgi-bin/login" method="post">');
    if ( lmrp == "Y" )
      document.writeln('<input type="hidden" name="dest" value="'+server+'/lmrp/" />');
    else
	{
      document.writeln('<input type="hidden" name="ip" value="'+ip+'" />');
      document.writeln('<input type="hidden" name="loginbtn" value="1" />');
	}

    document.writeln('<table border=0 cellpadding=0 cellspacing=0 class=banner><tr>');
    document.writeln('<td width=64>USERNAME</td>');
    document.writeln('<td width=43><input name=username type=text size=10 class=login></td>');
    document.writeln('<td width=66>&nbsp;PASSWORD&nbsp;</td>');
    document.writeln('<td width=41><input name=password type=password size=10 class=login></td>');
    document.writeln('<td width=38 align=right><input type=image src="/nimages/go.gif" width=36 height=16 border=0></td>');
    document.writeln('<td width=201>');
    document.writeln('&nbsp;<span class="Yel">&#8250;&#8250;</span> <a href="/cgi-bin/traffic_control?service=forgot" class="siteLink">Forgotten Password</a>&nbsp;&nbsp;<br>'); 
    document.writeln('&nbsp;<span class="Yel">&#8250;&#8250;</span> <a href="/regview/?ptype=1" class="siteLink">Need To Register</a>&nbsp;&nbsp;<br>'); 
    document.writeln('&nbsp;<span class="Yel">&#8250;&#8250;</span> <a href="/cgi-bin/traffic_control?service=eup" class="siteLink">My Account</a>&nbsp;&nbsp;<br>');
    document.writeln('</td></tr></table>');
    document.writeln('</form>');
  }
}

document.cookie="LFC_c_on=1; expires='Thu, 01-Jan-2100 00:00:01 GMT'; domain=.liverpoolfc.tv; path=/";

// if ((getLFCCookie("LCheck") == null) && (getLFCCookie("LFC_cookie") != null ))
// {
	// var ran_number=Math.floor(Math.random()*5); 
	// if(ran_number == 3)
	// {
	// // 	alert(ran_number);
		// window.location= '/lcheck.php3';
	// }
// }

