function addEvent( obj, type, fn ) {
	if ( obj.attachEvent ) {
		obj['e'+type+fn] = fn;
		obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
		obj.attachEvent( 'on'+type, obj[type+fn] );
	} else {
		obj.addEventListener( type, fn, false );
	}
}


function initLinks()
{
	
	
	if (!document.getElementsByTagName) {
	 return;
	}
	
	var anchors = document.getElementsByTagName("a");
	// loop through all anchor tags



	for (var i=0; i<anchors.length; i++){
		var anchor = anchors[i];

		//addEvent(anchor, 'focus', function() {this.blur();});

	

		if (anchor.getAttribute("href") && (anchor.getAttribute("rel") == "lightbox")){
			anchor.onclick = function () {showLightbox(this); return false;}
		} else {

		
            if (anchor.href.indexOf('.pdf') != -1) {
                anchor.setAttribute('target', '_blank');
				anchor.style.display = "block";
                anchor.className = 'linkpdf';
            }
            if (anchor.href.indexOf('.doc') != -1) {
                anchor.setAttribute('target', '_blank');
				anchor.style.display = "block";
                anchor.className = 'linkdoc';
            }
            if (anchor.href.indexOf('.rtf') != -1) {
                anchor.setAttribute('target', '_blank');
				anchor.style.display = "block";
                anchor.className = 'linkdoc';
            }
            if (anchor.href.indexOf('.xls') != -1) {
                anchor.setAttribute('target', '_blank');
				anchor.style.display = "block";
                anchor.className = 'linkexcel';
            }		
            if (anchor.rel.indexOf('extern') != -1) {
                anchor.setAttribute('target', '_blank');
				anchor.style.display = "block";
                anchor.className = 'linkweb';
            }
            
		}
	}
}

function addLoadEvent(func)
{	
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
    	window.onload = func;
	} else {
		window.onload = function(){
		oldonload();
		func();
		}
	}

}

addEvent(window, 'load', initLinks);