var Registration = function(){}



Registration.REGISTRATION_COOKIE = "wpniuser";



Registration.prototype.getEditProfileLink = function( txt )

{

  return '<a href="/ac2/wp-dyn?node=admin/registration/manage&destination=manage&nextstep=gather">'+txt+'</a>';

}

Registration.prototype.getSignInLink = function( txt )

{

  return '<a href="/ac2/wp-dyn?node=admin/registration/register&destination=login&nextstep=gather&application=reg30-globalnav&applicationURL=http://www.washingtonpost.com">'+txt+'</a>';

}

Registration.prototype.getSignOutLink = function( txt )

{

  return '<a href="/ac2/wp-dyn?node=admin/registration/login&destination=logout&nextstep=confirm">'+txt+'</a>';

}

Registration.prototype.getRegisterLink = function( txt )

{

  return '<a href="/ac2/wp-dyn?node=admin/registration/register&destination=register&nextstep=gather&application=reg30-globalnav&applicationURL=http://www.washingtonpost.com">'+txt+'</a>';

}

Registration.prototype.isSignedIn = function()

{

  if( typeof this.signedIn == 'undefined' )

  {

    this.signedIn = ( document.cookie.indexOf( Registration.REGISTRATION_COOKIE ) != -1 );

  }

  return this.signedIn;

}

Registration.prototype.getUserName = function()

{

  if( typeof this.username == 'undefined' )

  {

    if (document.cookie.indexOf(Registration.REGISTRATION_COOKIE) != -1)

    {

      var start = (document.cookie.indexOf(Registration.REGISTRATION_COOKIE) + Registration.REGISTRATION_COOKIE.length + 1);

      var end = (document.cookie.indexOf(";",start)) == -1 ? document.cookie.length : document.cookie.indexOf(";",start);

      this.username = document.cookie.substring(start,end);

      if( this.username.indexOf( "@" ) != -1 ) this.username = this.username.substring(0,this.username.indexOf("@"));

    }

  }

  return this.username;

}



