document.observe("dom:loaded", add_visual_effects);

function add_visual_effects() {
  // Show and hide the email address tooltip.
  if ($('ctl00_ContentBody_UserName') && $('UserName_Tooltip'))
    {add_blinding_to_form_field('ctl00_ContentBody_UserName', 'UserName_Tooltip');}
  
  // Check the requested username if the user is allowed to choose a username.
  if ((checkUserName == 'true') && $('ctl00_ContentBody_UserName') && $('UsernameCheck')) {
    $('ctl00_ContentBody_UserName').onblur = function() {
      if ($('UserName_Tooltip'))
        {toggle_blinding_for('UserName_Tooltip');}

      toggle_blinding_for('UsernameCheck');
      check_username();
    }
  }

  // Show and hide the password tooltip.
  if ($('ctl00_ContentBody_Password') && $('Password_Tooltip')) {
    // See the comments for add_blinding_to_form_field() for an explanation of that function wasn't used here.
    $('ctl00_ContentBody_Password').onfocus = function() {toggle_blinding_for('Password_Tooltip');}
    $('ctl00_ContentBody_Password').onblur  = function() {toggle_blinding_for('Password_Tooltip');}
  }
}

