﻿/*
    Obfuscation script that inserts email address links instead of 
    showing addresses on the page. Used to inhibit spammers.
        
    Author: Jerritte Couture
    Author URL: http://www.edgewebware.com

*/

function contactLink(emailTo, linkText, linkClass, eSubject, eTitle) {
	var emailDomain = "su.etaercu";
	var atSign = ";46#&";
	var emailAddy = (emailTo + reverseString(atSign) + reverseString(emailDomain));
	var fullSubject = '';
	var fullTitle = '';
	var fullClass = '';
	var fullLinkText = '';

    // Set fullClass value
	if (linkClass != '') {
	    fullClass = 'class="' + linkClass +'"';
	}

	// Set fullSubject value
	if (eSubject != '') {
	    fullSubject = "?subject=" + eSubject;
	}

	// Set fullTitle value
	if (eTitle != '') {
	    fullTitle = ' title = "' + eTitle + '"';
	}

	// Set linkText value
	if (linkText != '') {
	    if (linkText == 'addy') {
	        fullLinkText = emailAddy
	    }
	    else {
	        fullLinkText = linkText;
	    }
	}
	else {
	    fullLinkText = '';
	}

	// Assemble and output the link
	document.write('<a href="mailto:' + emailAddy + fullSubject + '"' + fullTitle + fullClass + '>' + fullLinkText + '<\/a>');
}

