// -- mailtomaker script
var theCode;
var isReady;
function createCode(){
theCode = '';
isReady = false;
if (document.mailForm.toAddress.value == ""){
    alert('You must have a To address.');
    document.mailForm.toAddress.focus();
    return;}
if (document.mailForm.toAddress.value != ""){
    theCode="<a href\=\"mailto\:"  +
    document.mailForm.toAddress.value+"?";}
if (document.mailForm.ccAddress.value != ""){
    theCode +="cc=" +
    document.mailForm.ccAddress.value +"&";}
if (document.mailForm.bccAddress.value != ""){
      theCode +="bcc=" +
      document.mailForm.bccAddress.value +"&";}
if (document.mailForm.theSubject.value != ""){
    theCode +="subject=" +
    document.mailForm.theSubject.value +"&";}
if (document.mailForm.theBody.value != ""){
    theCode +="body=" +
    document.mailForm.theBody.value;}
theCode += "\">";
if (document.mailForm.theLink.value == ""){
    alert('You must have text for the link.');
    document.mailForm.theLink.focus();
    return;}
if (document.mailForm.theLink.value != ""){
    theCode +=
    document.mailForm.theLink.value;}
theCode += "<\/a>\n";
document.mailForm.showCode.value = theCode;
isReady = true;
}
var testWindow = null;
function doTestWindow(){
if (!isReady) return false;
if (document.mailForm.showChecked.checked){
closeTestWindow();
testWindow = null;
testWindow = window.open("about:blank","a","left=100,top=100,screenX=100,screenY=100,width=200,height=200");
with (testWindow.document){
  writeln('<html><head><title>Email Test</title><scr'+'ipt>self.focus();self.moveTo(200,200);</scr'+'ipt></head>');
  writeln('<body bgcolor=#202020 link=#00ff00 vlink=#00ff00 alink=#00ff00>');
  writeln('<font face=Arial size=2 color=#ffffff>');
  writeln('Test your code by clicking on the link below.<br><br>This will open the link in your default email client.<br><br>');
  writeln(theCode);
  writeln('</font>');
  writeln('</body></html>');}
}}
function closeTestWindow(){
if (testWindow != null && testWindow.open) testWindow.close();
}
function selectTheCode(){
if (!isReady) return false;
document.mailForm.showCode.focus();
document.mailForm.showCode.select();
}

// -- the code
