
window.onload = function obfuscateEmail() {
	// Inserts an email address into PayPal button forms
	if (document.getElementById("switch_paypal_email")) {
		var paypal = document.getElementById("switch_paypal_email"); 
		var pieces = "payments" + "@" + "buddhafield" + ".com";	
		paypal.setAttribute("value",pieces);
	}
	
	// Switches block photos of tshirt models, women for men
	// This is preparatory to there being an in-page switch button
	if (document.getElementById("models")) {
		var tShirtImage = document.getElementById("models"); 
		var men = "multimedia/images/womenTshirtStyles.jpg";
		tShirtImage.setAttribute("src",men);
	}
	
	// Mungs email address
	if (document.getElementById("email_address")) {
		munged = document.getElementById("email_address"); 			// get <p> element with id email_address
		while (munged.childNodes[0]) {								// cycle through all of munged's children	
			munged.removeChild(munged.childNodes[0]);				// delete ev
		}
		var pieces = "Hannahaha15" + "@" + "hotmail" + ".com";
		var jigsaw = "mailto:" + pieces;
		var substitute = document.createElement("a");
		substitute.setAttribute("href",jigsaw);
		var text = document.createTextNode(pieces);
		substitute.appendChild(text);
		munged.appendChild(substitute);
	}
	
	if (document.getElementById("email_festival")) {
		munged = document.getElementById("email_festival"); 			// get <p> element with id email_address
		while (munged.childNodes[0]) {								// cycle through all of munged's children	
			munged.removeChild(munged.childNodes[0]);				// delete ev
		}
		var pieces = "festivalenquiries" + "@" + "buddhafield" + ".com";
		var jigsaw = "mailto:" + pieces;
		var substitute = document.createElement("a");
		substitute.setAttribute("href",jigsaw);
		var text = document.createTextNode(pieces);
		substitute.appendChild(text);
		munged.appendChild(substitute);
	}
}

//<span id="email_address"><span class="fauxlink">Hannahaha15</span>[replace with an &ldquo;at&rdquo;]<span class="fauxlink">hotmail</span>[replace with a &ldquo;dot&rdquo;]<span class="fauxlink">com</span><br />(This email address has been &ldquo;munged&rdquo; to stop it being harvested by email spammers.)</span>


