/*
JSTarget function by Roger Johansson, www.456bereastreet.com
*/
var JSTarget = function () {
	// Default configuration
	var config = {
		strAtt: 'class', // The attribute to be examined
		strVal: 'new-window', // The value to match
		strWarning: ' (new window)' // Warning text
	};
	function init(props) {
		// Check for DOM support
		if (!document.getElementById || !document.createTextNode) {
			return;
		}
		// If any properties were supplied, apply them to the config object.
		for (var key in props) {
			if (config.hasOwnProperty(key)) {
				config[key] = props[key];
			}
		}
		var oWarning;
		var oLink;
		var arrLinks = document.getElementsByTagName('a');
		var oRegExp = new RegExp("(^|\\s)" + config.strVal + "(\\s|$)");
		for (var i = 0, len = arrLinks.length; i < len; i++) {
			oLink = arrLinks[i];
			// If the attribute is class, check for className
			if ((config.strAtt === 'class') && (oRegExp.test(oLink.className)) || (oRegExp.test(oLink.getAttribute(config.strAtt)))) {
				oWarning = document.createElement("em");
				oWarning.appendChild(document.createTextNode(config.strWarning));
				oLink.appendChild(oWarning);
				oLink.target = '_blank';
			}
		}
	}
	return {
		init: init
	};
}();

JSTarget.init({strWarning:''});
