//Determinar el explorador.

var browser = new Browser();

function Browser() {

  var ua, s, i;

  this.isIE    = false;  // Internet Explorer
  this.isOP    = false;  // Opera
  this.isNS    = false;  // Netscape
  this.version = null;

  ua = navigator.userAgent;

  s = "Opera";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isOP = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Tratar el explotador "Gecko" como Netscape 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }

  s = "MSIE";
  if ((i = ua.indexOf(s))) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
}

//Oscurecer la imagen.
var veces,opacidad;
function high(which2){
	objeto=which2;
	highlighting=setInterval("highlightit(objeto)",20);
	if (browser.isNS){
		veces=0;
		opacidad=1;
	}
}

function low(which2){
	clearInterval(highlighting);
	if (browser.isIE){
		which2.filters.alpha.opacity = 100;
	}
	if (browser.isNS){
		var img = document.getElementById(which2.id).style;
		img.opacity=1;
	}
}

function highlightit(cur2){
	if (browser.isIE){
		if(cur2.filters.alpha.opacity>80){
			cur2.filters.alpha.opacity -= 2;
		}
		else {
			if(window.highlighting){
				clearInterval(highlighting);
			}
		}
	}
	if (browser.isNS){
		if(opacidad>.8){
			veces+=1;
			opacidad= 1-(veces*.02);
			var img = document.getElementById(cur2.id).style;
			img.opacity=opacidad;
		}
		else {
			if(window.highlighting){
				veces=0;
				opacidad=1;
				clearInterval(highlighting);
			}
		}
	}
}
