addEvent(window, "load", lir_init);

/*
	Modify behavior, title, and style of 'rel="external"' links.
*/
function lir_init() {
	if (!document.getElementsByTagName) return;	
	// Get all 'a' tags; look for those with 'rel' == 'external'
	
	oElems = document.getElementsByTagName('a');

	for (var i = 0; i < oElems.length; i++) {
		var oElem = oElems[i];
		if (attribute(oElem, 'href') &&  ((' ' + oElem.className + ' ').indexOf('lir-link') != -1)) {			
			
			// Get the containing element and assign an 'onclick' event to it.
			var oParent = oElem.parentNode;
			
			if (oParent) {
				var fClick = function(e) {
					// Get the link
					var oHref = getTarget(e).firstChild;
					var sHref = attribute(oHref, 'href');
					
					location.href = sHref;
				}
				
				var fMouseOver = function(e) {
					// Get the link
					var oHref = getTarget(e).firstChild;
					var sHref = attribute(oHref, 'href');
					
					window.status = sHref;
					return true;
				}
				
				var fMouseOut = function(e) {
					window.status = '';
					return true;
				}
				
				addCSSClass(oParent, 'lir-wrapper');
				addEvent(oParent, 'click', fClick);
				addEvent(oParent, 'mouseover', fMouseOver);
				addEvent(oParent, 'mouseout', fMouseOut);
			}
		}
    }
}
