function saveAddress(linkobj)	{
	return true;
}

function backtotop() {
        var backtotop = document.getElementById("backtotop");
        if (backtotop == null) return;
	var fhrep = document.location.href;
        backtotop.onclick = function() {
                document.location.href = fhrep + "#shell";
                return false;
        }
}


function initHeader() {
	if (is_mac && is_ie) return;
	var content = document.getElementById("header-date");
	if (content != null) {
		value = printDate(content.firstChild.nodeValue);
		content.firstChild.nodeValue = value;
    	}
	if (num_attachments > 0)	{
		content = document.getElementById("header-subject");
		if (content != null)	{
			content.className = "attachment";
		}
	}
}

function initViewSource() {
	var content = document.getElementById("tool-viewsource");
	if (content != null) {
		content.onclick = function() {
			pop(this.href, 650, 820, "_blank");
			return false;
		}
	}
}

function printDate(datestr)     {
	var mydate = new Date(datestr);
	if (isNaN(mydate))      {
		return datestr;
	}
	else    {
		return mydate.toLocaleString();
	}
}

// Fix layout if it's been broken by poorly formatted HTML emails
function fixLayout() {
  if (is_mac && is_ie) return;
  bodyDiv = document.getElementById("body");
  contentDiv = document.getElementById("content");
  columnsDiv = document.getElementById("columns");

  if (bodyDiv == null || contentDiv == null || columnsDiv == null) return false;

  test = getElementsByClassName(contentDiv, "div", "utility-bot");
  if (test.length == 1) return false;

  utilityBot = getElementsByClassName(document, "div", "utility-bot")[0];
  utilityBot.parentNode.removeChild(utilityBot);
  contentDiv.appendChild(utilityBot);

  navDiv = document.getElementById("nav");
  navDiv.parentNode.removeChild(navDiv);
  columnsDiv.appendChild(navDiv);

  footerDiv = document.getElementById("footer");
  footerDiv.parentNode.removeChild(footerDiv);
  bodyDiv.appendChild(footerDiv);
}


addLoadEvent(function() {
	roundCorners(document.getElementById("source-header"), true, false);
        msglistSyncMove("readmail");
        initHeader();
        initViewSource();
        fixLayout();
	backtotop();
        }

);
