function makeMailto(userInput, showOutput) {
var to = userInput.to.value;
var cc = userInput.cc.value;
var bcc = userInput.bcc.value;
var subject = userInput.subject.value;
var body = userInput.body.value;
var link = userInput.link.value;
var mailtoText = "";
var linkText = "";
if (to != "") {
mailtoText += to;
}
else {
mailtoText += "you@youremail.com";
}
if (cc != "") {
mailtoText = useAmperstand(mailtoText);
mailtoText += "cc=" + cc;
}
if (bcc != "") {
mailtoText = useAmperstand(mailtoText);
mailtoText += "bcc=" + bcc;
}
if (subject != "") {
mailtoText = useAmperstand(mailtoText);
mailtoText += "subject=" + escape(subject);
}
if (body != "") {
mailtoText = useAmperstand(mailtoText);
mailtoText += "body=" + escape(body);
}
if (link != "") {
linkText = link;
}
else {
linkText = "Send Mail";
}
mailtoText = "<a href=\"mailto:" + mailtoText + "\">" + linkText + "</a>";
showOutput.value = mailtoText;
function useAmperstand(inputString) {
var inString = inputString;
if (inString.indexOf("?") == -1) {
inString += "?";
}
else {
inString += "&";
}
return inString;
}
}
function ResetPage(){
document.mailtoForm.reset();
document.copyForm.reset();
}