// write_address(linklist, textlist)
// linklist = ["", "", "", "", ""];
// textlist = ["", "", "", "", ""];
// element 0 - display name		 John Smith
// element 1 - email name			 johnsmith
// element 2 - domain portion1 yahoo
// element 3 - domain portion2 com
// element 4 - domain portion3 au
// include example 1 -
// <script language="javaScript" src="/common/write_address.js"></script>
// execute example
// <script language="javascript">
// linklist = ["John Smith", "johnsmith", "yahoo", "com", "au"];
// textlist = ["John Smith", "[johnsmith", "yahoo", "com", "au]"];
// write_address(linklist, textlist);
// </script>
// execute example 2 -
// <script language="javascript">
// function initialise(){
//   var addlist = ["", "johnsmith", "yahoo", "com", "au"];
//   document.both_form.form_to.value=compile_address(addlist);
// }
// </script>

function write_address(llist, tlist){
  if (llist[1] > ""){
    document.write("<a " + "hr" + "ef=" + "\"" + "ma" + "il" + "to" + ":");
    if (llist[0] > ""){
      document.write(llist[0] + " &#60;");
    }
    document.write(compile_address(llist));
    if (llist[0] > ""){
      document.write("&#62;");
    }
    document.write("\"" + ">");
  }
  if ((tlist[0] > "") || (tlist[1] > "")){
    if (tlist[0] > ""){
      document.write(tlist[0] + " ");
    }
    if (tlist[1] > ""){
      document.write(compile_address(tlist));
    }
  }
  if (llist[1] > ""){
    document.write("</" + "a>");
  }
}

function compile_address(thelist){
  var theaddress = "";
  theaddress += thelist[1] + "&#64;" + thelist[2];
  theaddress += "&#46;" + thelist[3];
  if (thelist[4]){
    theaddress += "&#46;" + thelist[4];
  }
  return theaddress;
}
