// toggle href
(function () {
	var d = document,
		id = d.__hrefId, // id (class actually) to identify our spans
		es, // list of elements
		e, // link
		t, // span template
		s, // span
		i; // counter

	if (!id) { // show
		d.__hrefId = id = 'href' + (new Date()).getTime();

		t = d.createElement('span');
		// thanks firefox web developer toolbar for the styles
		t.style.background = '#ffff99';
		t.style.border = '1px solid #ffcc66';
		t.style.color = '#000000';
		t.style.font = '12px sans-serif'; // but with a larger font
		t.style.letterSpacing = '0';
		t.style.opacity = '0.9';
		t.style.margin = '0 1px 0 0';
		t.style.padding = '1px';
		t.style.textAlign = 'left';
		t.style.textDecoration = 'none';
		t.style.textTransform = 'none';
		t.style.zIndex = '1';

		es = d.getElementsByTagName('a');

		for (i = es.length - 1; i >= 0; i--) {
			e = es[i];

			if (!e.href) {
				continue;
			}

			s = t.cloneNode(true);
			s.__hrefId = id;
			s.innerHTML = 'href=' + e.href;
			e.parentNode.insertBefore(s, e);
		}

	} else { // hide
		es = d.getElementsByTagName('span');

		for (i = es.length - 1; i >= 0; i--) {
			e = es[i];

			if (e.__hrefId != id) {
				continue;
			}

			e.parentNode.removeChild(e);
		}

		d.__hrefId = null;
	}
})()
