/* Drop-down Navigation
---------------------------------------------------------- */
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover); 

/* Drop Down List navigation
    (used by the global locations list in the header)
---------------------------------------------------------- */
function goto_dropdown_selection(entered) {
	with (entered) 	{
  	ref = options[selectedIndex].value; 
  	splitcharacter = ref.lastIndexOf("&"); 

	  if (splitcharacter != -1) {
  	  loc = ref.substring(0,splitcharacter); 
  	  target = ref.substring(splitcharacter+1,1000).toLowerCase();
	  }
    else {
      loc = ref;
      target = "_self";
      }

  	lowloc = loc.toLowerCase();
	
  	if (lowloc == "false" || lowloc == "") {
	    return;
	    }
	  else if (target=="_self") {
  	  document.location=loc;
	    } 
	  else if (target=="_top") {
  	  top.location=loc;
	    } 
	  else if (target=="_blank") {
  	  window.open(loc);
	    } 
	  else if (target=="_parent") {
  	  parent.location=loc;
	    }
	  else {
  	  parent.frames[target].location = loc;
	    } 
    }
}

// Setea la clase current al tab correspondiente
function tabSelect() {
    var fooElement;
    var browserName = navigator.appName;

    if (window.location.pathname.indexOf('quienes_somos') != -1) {
        fooElement = document.getElementById("quienes_somos_li");
        if (browserName == "Microsoft Internet Explorer") {
            fooElement.setAttribute('className', 'current');
        }
        else {
            fooElement.setAttribute('class', 'current');
        }
    }
    else if (window.location.pathname.indexOf('nuestros_producto') != -1) {
        fooElement = document.getElementById("nuestros_productos_li");
        if (browserName == "Microsoft Internet Explorer") {
            fooElement.setAttribute('className', 'current');
        }
        else {
            fooElement.setAttribute('class', 'current');
        }
    }
    else if (window.location.pathname.indexOf('nuestros_servicios') != -1) {
        fooElement = document.getElementById("nuestros_servicios_li");
        if (browserName == "Microsoft Internet Explorer") {
            fooElement.setAttribute('className', 'current');
        }
        else {
            fooElement.setAttribute('class', 'current');
        }
    }
    else if (window.location.pathname.indexOf('biotecnologia') != -1) {
        fooElement = document.getElementById("biotecnologia_li");
        if (browserName == "Microsoft Internet Explorer") {
            fooElement.setAttribute('className', 'current');
        }
        else {
            fooElement.setAttribute('class', 'current');
        }
    }
    else if (window.location.pathname.indexOf('prensa') != -1) {
        fooElement = document.getElementById("prensa_li");
        if (browserName == "Microsoft Internet Explorer") {
            fooElement.setAttribute('className', 'current');
        }
        else {
            fooElement.setAttribute('class', 'current');
        }
    }
    else if (window.location.pathname.indexOf('responsabilidad_corporativa') != -1) {
        fooElement = document.getElementById("responsabilidad_corporativa_li");
        if (browserName == "Microsoft Internet Explorer") {
            fooElement.setAttribute('className', 'current');
        }
        else {
            fooElement.setAttribute('class', 'current');
        }
    }
    else {
        fooElement = document.getElementById("home_li");
        if (browserName == "Microsoft Internet Explorer") {
            fooElement.setAttribute('className', 'current');
        }
        else {
            fooElement.setAttribute('class', 'current');
        }
    }
}