var moz = (document.nodeName)? true:false;	// Check if browser is mozilla
var ie = (document.all)? true:false;		// Check if browser is ie

function markExits () {
	var localhost = document.location.hostname;
	var links = document.getElementsByTagName("a");

	for (i = 0; i < links.length; i++) {
		if (links[i].hostname != "" && links[i].hostname != localhost) {
			link = links[i].href;
			//links[i].href=redirect+"?"+link;
			links[i].className += " exits";
		}
	}
}

function pullquote () {
	// Check that the browser supports the methods used
		if (!document.getElementById || !document.createElement || !document.appendChild) return false;
		var oElement, oPullquote, oPullquoteP, oQuoteContent, i, j;
	// Find all span elements with a class name of pullquote
		var arrElements = document.getElementsByTagName('span');
		var oRegExp = new RegExp("(^|\\s)pullquote(\\s|$)");
		for (i=0; i<arrElements.length; i++) {
	// Save the current element
			oElement = arrElements[i];
			if (oRegExp.test(oElement.className)) {
	// Create the blockquote and p elements
				oPullquote = document.createElement('blockquote');
				oPullquote.className = oElement.className
				oPullquoteP = document.createElement('p');
	// Insert the pullquote text
				oPullquoteP.innerHTML = "<big>&#147;</big>";
		
				for(j=0;j<oElement.childNodes.length;j++) {
					oPullquoteP.appendChild(oElement.childNodes[j].cloneNode(true));
				}
				oPullquoteP.innerHTML += "<big>&#8221;</big>";
				
				oPullquote.appendChild(oPullquoteP);
	// Insert the blockquote element before the span elements parent element
				oElement.parentNode.parentNode.insertBefore(oPullquote,oElement.parentNode);
			}
		}
}

window.onload = function () {
	markExits();
	pullquote();
}