/*----------------------------------------------------------------------------------------------------------------*/
function add_target_blank() {
	
	/* This will check if the "mylinks" id exists.
	*/
	if(document.getElementById('target_blank')) {
		
		/*	This creates an array of all of the "a" tags in the "mylinks" div.
		*/
		var links = document.getElementById('target_blank').getElementsByTagName('a');
		
		/* 	This calculates how many items are in the array. It's best to calulate it
			outside of the loop, so it doesn't have to constantly do the same calculation
		*/
		linklength = links.length;
		
		/* 	This loops through the array, for as many times as there are items. As we only have
			2 items, it will loop through twice. The first value "var i = 0" is the initialization -
			it is only run once, as the very beginning. The second value, "i<linklength" is the condition. 
			If he condition is met, it will enter the loop.
			The third value, "i++" will be run at the end of each loop. In this case, it is incrementing
			"i" by one, each time it is run.
		*/
		for(var i = 0; i < linklength; i++ ) {
			
			/* 	This is what is performed on each element in the array. You call the item by using the
				array name, which is "links" and appending [i], which will use the current element in
				the loop.
				When using an anonymous function such as this, you cannot refer to the element using
				links[i] andmore, because the onclick is not part of the loop when you click it, it is
				then part of the elemeent.
				I have the function alerting the "title" attribute of the link.
			*/
			links[i].onclick = function() { this.target="_blank"; };
		};		
	};
};
/*------------------------------------------------------------------------------------------------------------------*/
//Llamo a la función add_target_blank para añadir un target blank a todos los enlaces educativos y agustianos
window.onload = add_target_blank;
