function hideDiv(div_id)
{
   var element = document.getElementById(div_id);
   element.style.display = 'none';
}
function showDiv(div_id)
{
   var element = document.getElementById(div_id);
   element.style.display = 'block';
}
function InsertWelcomeLogin(iWidth)
{
  var sName = GetCookie('WelcomeName');
  if (iWidth == null)
  {
    iWidth = 760;
  }

  // -------------------------------------------------------
  // We don't want a successul login to take the user to
  // index_n or index_r, so convert both of these to index_a.
  // -------------------------------------------------------

  var sLocation = "" + window.location.href + "";
  var iLocation = sLocation.search(/index_n.html/);
  if (iLocation >= 0)
  {
    sLocation = sLocation.substr(0, iLocation) + "index_a.html";
  }
  iLocation = sLocation.search(/index_r.html/);
  if (iLocation >= 0)
  {
    sLocation = sLocation.substr(0, iLocation) + "index_a.html";
  }

  if (sName == null)
  {
    document.write('' +
'<div id="loginView" class="dispRight">' +
    '<form name="loginForm"' +
          'action="https://familytreemaker.genealogy.com/cgi-bin/login.cgi"' +
          'method="GET">' +
      'UserName:&nbsp;<input type="text"' +
                            'name="Username"' +
                            'size="12"' +
                            'maxlength="12">' +
      '&nbsp;&nbsp;' +
      'Password:&nbsp;<input type="password"' +
                            'name="Password"' +
                            'size="8"' +
                            'maxlength="8">' +
      '&nbsp;&nbsp;' +
      '<input type="submit" class="g-login-btn" id="b_login" name="submit" value="Log In">' +
      '<input type="hidden" name="state" value="PAGE2">' +
      '<input type="hidden" name="url" value="' + sLocation + '">' +
      '<input type="hidden" name="state" value="PAGE2">' +
      '&nbsp;' +
      '<a href="http://www.genealogy.com/cgi-bin/getpass.cgi">Forgot?</a>' +
    '</form>' +
  '</div>');
  } else
  {
    var sFirstName = sName.split('::', 1);

    document.write('' +
'<div id="welcomeView" class="dispRight">' +
' Welcome, ' + sFirstName + '!' +
'<span> <a href="http://familytreemaker.genealogy.com/cgi-bin/logout.cgi">Logout</a>' +
'&nbsp;&nbsp; ' +
'<a href="http://familytreemaker.genealogy.com/cgi-bin/MyAccount.cgi">My Account</a></span>' +
'</div>');
  }
}

