var url = "hilltopcountrychurch.net";
var replchar = "!"; 

function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

function print_mail_to_link(who) { 
document.write('<font size="-1" face="arial" color="blue">'); 
document.write("<A HREF=\"mailto"); 
document.write(":" + who + "@"); 
document.write(url + "\">" + who + "@" + url + "<\/a>"); 
document.write('</font>'); 
} 

function print_mail_to_link_more(text,who,subject,body) { 
document.write('<font size="-1" face="arial" color="blue">'); 
document.write("<A HREF=\"mailto"); 
document.write(":" + who + "@"); 
document.write(url + "?subject=" + subject + "&body=" + body + "\">" + text + "<\/a>"); 
document.write('</font>'); 
} 

function hide_email_address(who) {
document.write('<font size="-1" face="arial" color="blue">'); 
document.write("<A HREF=\"mailto:"); 
document.write(replace(who,replchar,'@')); 
document.write("\">" + replace(who,replchar,'@') + "<\/a>"); 
document.write('</font>'); 
} 

function hide_email_address_more(text,who,cc,subject,body) {
document.write('<font size="-1" face="arial" color="blue">'); 
document.write("<A HREF=\"mailto:"); 
document.write(replace(who,replchar,'@')); 
document.write("?cc=");
document.write(replace(cc,replchar,'@')); 
document.write("&subject=" + subject + "&body=" + body + "\">" + text + "<\/a>"); 
document.write('</font>'); 
} 

