function target_blank() {
	if (!document.getElementsByTagName) {
		return;
	}
	var anchors = document.getElementsByTagName("a");
	var i;
	var enlace;

	for (i = 0; i < anchors.length; i++) {
		var enlace = anchors[i];
		if (enlace.getAttribute("href") && enlace.getAttribute("rel") == "external") {
			enlace.target = "_blank";
		}
	}
}

//CAMBIO DE ANCHO SEGÚN RESOLUCIÓN
/*	-------------------------------------------------------------
	function getBrowserWidth()
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	As odd as it may seem, this function returns
					the browser's width in pixels.
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Credits:		Script found on Particle Tree
					http://www.particletree.com
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	
		<!--
		function getBrowserWidth(){
			if (window.innerWidth){
				return window.innerWidth;}	
			else if (document.documentElement && document.documentElement.clientWidth != 0){
				return document.documentElement.clientWidth;	}
			else if (document.body){return document.body.clientWidth;}		
				return 0;
		}
		//-->

/*	-------------------------------------------------------------
	function determineStyle()
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	With this here function we can swap styles.
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Credits:		Script found on A List Apart
					http://www.alistapart.com
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	
		<!--
		function determineStyle(){

			var browserWidth = getBrowserWidth();
				
			var i, a, main;
			
			if (browserWidth <= 939){
				for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
					if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
						if (a.getAttribute("title").indexOf("res_") != -1) {
							a.disabled = true;
							if(a.getAttribute("title") == "res_narrow") a.disabled = false;
						}
					}
				}
			}
			
			if (browserWidth > 939){
				for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
					if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
						if (a.getAttribute("title").indexOf("res_") != -1) {
							a.disabled = true;
							if(a.getAttribute("title") == "res_wide") a.disabled = false;
						}
					}
				}
			}
		}


function attachEventListener(target, eventType, functionRef, capture) {
    if (typeof target.addEventListener != "undefined") {
        target.addEventListener(eventType, functionRef, capture);
    } else if (typeof target.attachEvent != "undefined") {
        target.attachEvent("on" + eventType, functionRef);
    } else {
        return false;
    }

    return true;
};	

attachEventListener(window, "load", target_blank, false);
attachEventListener(window, "load", determineStyle, false);
attachEventListener(window, "resize", determineStyle, false);

