// Copyright © 2011 Alec Kloss

function outputWhenMatches(re, txt, outtext1, outtext2) {
	if (txt.toString().toLowerCase().match(re)) {
		document.write(outtext1);
	} else {
		document.write(outtext2);
	}
}

reSSL = /^https:\/\//
siteEmailAddress = 'YWxlYy13ZWJAc2V0ZmlsZXBvaW50ZXIuY29tCg=='

function outputWhenSSL(text1, text2) {
	outputWhenMatches(reSSL, document.location, text1, text2);
}

function outputWhenDevel(text1, text2) {
	outputWhenMatches(/https?:\/\/.*\/devel/, document.location, text1, text2);
}

function embedPage(location, name, cls, errorText) {
	if (navigator.product == "Gecko") {
		document.write('<object name="' + name + '" class="' + cls + '" data="'
			+ location + '">' + errorText + '</object>');
	} else {
		document.write('<iframe name="' + name + '" class="' + cls + '" src="'
			+ location + '">' + errorText + '</iframe>');
	}
}

function updateEmail() {
	var email = document.getElementById('email')
	if (!email) return
	var address = Base64.decode(siteEmailAddress)
	email.innerHTML = '<a href="mailto:' + address + '">email</a>';
}

