function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}
/**************************************************************************
 *                                                                        *
 *  JAVASCRIPT MENU HIGHLIGHTER v.1.0 (051123)                            *
 * --------------------------------------------                           *
 * ©2005 Media Division (www.MediaDivision.com)                           *
 *                                                                        *
 * Written by Marius Smarandoiu & Armand Niculescu                        *
 *                                                                        *
 * You are free to use, modify and distribute this file, but please keep  *
 * this header and credits                                                *
 *                                                                        *
 * Usage:                                                                 *
 * - the script will apply the .current class to the <a> and its parent   *
 *   <li> that is contained in the element with id="primarynav" and points*
 *   to the current URL                                                   *
 * - works in IE6, Firefox and Opera                                      *
 **************************************************************************/
/*function extractPageName(hrefString)
{
 var arr = hrefString.split('.');
 if(arr.length >= 2) {
  arr = arr[arr.length-2].split('/');
  return arr[arr.length-1].toLowerCase();
 } else {
  return "x";
 }
}
*/

function extractPageName(hrefString)
{
 var arr = hrefString.split('.');
 if(arr.length >= 2) {
  arr = arr[arr.length-2].split('/');
  var submenu = arr[arr.length-1].toLowerCase();
  //Ver submenu
  if (submenu.indexOf("--") != -1){//es una página de submenu
	submenu = submenu.slice (0,submenu.indexOf("--"));
	return submenu;
  }
  return arr[arr.length-1].toLowerCase();
 } else {
  return "x";
 }
}

function setActiveMenu(arr, crtPage)
{
	for(var i=0; i < arr.length; i++)
		if(extractPageName(arr[i].href) == crtPage)
		{
			var nombre;
			nombre=arr[i].parentNode.getAttribute("class");
			if(nombre==null){
				nombre="selec";
			}else{
				nombre=nombre + " selec";
			}
			arr[i].parentNode.className = nombre;	
		}

}

function setPage()
{
	if(document.location.href) 
		hrefString = document.location.href;
	else
		hrefString = document.location;
		
	/*if (document.getElementById("menu")!=null) 
		setActiveMenu(document.getElementById("menu").getElementsByTagName("a"), extractPageName(hrefString));*/
	if (document.getElementById("submenu")!=null) 
		setActiveMenu(document.getElementById("submenu").getElementsByTagName("a"), extractPageName(hrefString));
}
window.onload=function()
{
  setPage();
  externalLinks();
}

//usado para abrir nuevo navegador
function externalLinks() {

 if (!document.getElementsByTagName) return;

 var anchors = document.getElementsByTagName("a");
 var imagenes = document.getElementsByTagName("img");

 for (var i=0; i<anchors.length; i++) {

   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&

       anchor.getAttribute("rel") == "external")

     anchor.target = "_blank";
	 
	if (anchor.getAttribute("rel") == "external"){
		if(anchor.getAttribute("title")){
			var tit = anchor.getAttribute("title");
			anchor.title = tit + ". Se abre en ventana nueva";
		}else{
	     anchor.title = "Se abre en ventana nueva";
		}
	}
	
 }
 //Comprobar imagenes con enlaces externos
 for(var b=0; b<imagenes.length; b++){
		
		var imagen = imagenes[b];
		if(imagen.parentNode.getAttribute("rel")=="external"){
			if(imagen.getAttribute("alt")){
				imagen.alt = imagen.getAttribute("alt") + ". Se abre en ventana nueva";
			}else{
				imagen.alt = "Se abre en ventana nueva";
			}
			
		}

	}

}
