var login_regex=/^https*:\/\/secure\.nrdconline\.org\/site\/UserLogin.*/i;

if( login_regex.test(document.location.href) ) {
  jQuery(document).ready(function() {
    jQuery("label[for='USERNAME_1']").text("User Name (usually your email):");
    jQuery("label[for='USERNAME_2']").text("User Name (usually your email):");
    jQuery("label[for='USERNAME_3']").text("User Name (usually your email):");
  
    var send_user_name = jQuery("#SendUserName:submit").parent().parent().parent().parent().parent().parent().html();
    var send_password = jQuery("#SendPassword:submit").parent().parent().parent().parent().parent().html();
    var send_password_action = jQuery("#SendPassword:submit").parent().parent().parent().parent().parent().attr('action');
    var send_remind_me = jQuery("#USERNAME_2").parent().parent().parent().parent().parent().html();
    var send_remind_me_action = jQuery("#USERNAME_2").parent().parent().parent().parent().parent().attr('action');
    
    jQuery("#SendUserName:submit").parent().parent().parent().parent().parent().parent().parent().css("display", "none");
    jQuery("#SendPassword:submit").parent().parent().parent().parent().parent().parent().parent().css("display", "none");
    jQuery("#lmainLogonForm").parent().append('<form action="'+send_password_action+'" method="post">'+send_password+'</form>');
    jQuery("#lmainLogonForm").parent().append(send_user_name);
    jQuery("#lmainLogonForm").parent().append('<form action="'+send_remind_me_action+'" method="post">'+send_remind_me+'</form>');
    
    var replace_text = "<p><strong>Are you a new user?</strong></p>\
      <p>If you haven't already registered, <a href='http://www.nrdcaction.org/join.html'>register online today</a>.</p>\
      <p><strong>Forgot you User Name?</strong></p>\
      <p>Your username is usually your email address. If that doesn't work, please use the &quot;Email me my User Name&quot; form below.</p>\
      <p><strong>Is your Password not working?</strong></p>\
      <p>Due to a system change, passwords were automatically reset in\
      August 2009. To obtain your new password, use the &quot;Email me my\
      Password&quot; form on the left.</p>\
      <p><strong>What if I&rsquo;ve forgotten my Password?</strong></p>\
      <p>When you initially registered, you may have specified a Password\
      reminder. You can click the button labeled &quot;Give me a\
      hint&quot; to jog your memory.</p>\
      <p>If you still can&rsquo;t remember your Password, we\
      can e-mail it to you. Use the &quot;Email me my Password&quot; form on the left.</p>";
    jQuery("#USERNAME_1").parent().parent().parent().parent().parent().parent().siblings().each(function (i) {
      if(this.innerHTML.indexOf("Are you a new user") >= 0) {
        this.innerHTML = replace_text;
      }
    });
    
    jQuery(".appArea a[href='https://secure.nrdconline.org/site/UserLogin']").attr("href", "https://secure.nrdconline.org/site/UserLogin?NEXTURL=ConsProfileUser");
  });
}