//-------------------------------------------------------------
// I got this idea from the Vancouver 2010 Olympics website
// http://www.vancouver2010.com/en/rss
// makes me feel dumb I didn't think of it myself

function feedPaste(url)
{
	var txt = 'Copy (ctrl+c) the following url and paste it (ctrl+v)' + 
		'\ninto your preferred RSS reader. Press OK or Cancel' + 
		'\nto dismiss this message box.' + 
		'\n\nThanks for your interest in keeping track of my writing.' + 
		'\n\u2014Mary';

	prompt(txt, url);

	return false;
}

//-------------------------------------------------------------
// Avoiding Email-Link Spam
/// http://htmldog.com/ptg/archives/000063.php

function emailProtection()
{
	if (!document.getElementsByTagName('span'))
	{
		return;
	}

	var addys = document.getElementsByTagName('span');
	var num = addys.length;

	for (i = 0; i < num; i++)
	{
		if (addys[i].className && addys[i].className == 'nospam')
		{
			// find text
			var addy = addys[i];

			// convert text
			var address = addy.firstChild.nodeValue;
				address = address.replace(/ at /g, '@');
				address = address.replace(/ dot /g, '.');

			// create new link
			var mailto = document.createElement('a');
				mailto.appendChild(document.createTextNode(address));
				mailto.setAttribute('href', 'mailto:' + address);

			// insert new link
			addy.parentNode.insertBefore(mailto, addy);

			// remove old text
			addy.parentNode.removeChild(addy);
		}
	}
}

//-------------------------------------------------------------

function addEvent(obj, evType, fn)
{
	if (obj.addEventListener)
	{
		obj.addEventListener(evType, fn, false);
		return true;
	}

	else if (obj.attachEvent)
	{
		var r = obj.attachEvent('on' + evType, fn);
		return r;
	}

	else
	{
		return false;
	}
}

//-------------------------------------------------------------
// load hooks

if (document.getElementById)
{
	addEvent(window, 'load', emailProtection);
}