// ------------------------------------------
// Detectar navegador
// ------------------------------------------
function browserCheck() {
  var b = navigator.appName;
  if (b=="Netscape") this.b = "ns";
  else if (b=="Microsoft Internet Explorer") this.b = "ie";
  else this.b = b;
  this.version = navigator.appVersion;
  this.v = parseInt(this.version);
  this.ns = (this.b=="ns" && this.v>=4);
  this.ns4 = (this.b=="ns" && this.v==4);
  this.ns6 = (this.b=="ns" && this.v==5);
  this.ie = (this.b=="ie" && this.v>=4);
  this.ie4 = (this.version.indexOf('MSIE 4')>0);
  this.ie5 = (this.version.indexOf('MSIE 5')>0);
  this.min = (this.ns||this.ie);
  if(this.ns6){
  	document.all = document.getElementsByTagName("*");
  	this.ns=false;
  	this.ns4=false;
  	this.ns5=true;
  	this.ie=true;
	this.ie4=true;
	this.ie5=true;
  }
}
is = new browserCheck();
// ------------------------------------------
// Mover capas
// ------------------------------------------
function MoverA(capa, x, y){
  if(is.ie){
    EstaCapa = document.getElementById(capa).style;
  }else{
    EstaCapa = eval("document." + capa);
  }
  if(x!=null){EstaCapa.left = x};
  if(y!=null){EstaCapa.top = y};
}
// ------------------------------------------
// Cambiar imágenes
// ------------------------------------------
function CambiaImagen(capa, nombre, imagen){
  EstaImagenSrc = eval(imagen + ".src");
  if(((is.ns && !capa) || (is.ns && capa == null)) || is.ie){
	document[nombre].src = EstaImagenSrc;
  }else{
  	document.layers[capa].document.images[nombre].src = EstaImagenSrc;
  }
}
// ------------------------------------------
// Abrir nueva ventana
// ------------------------------------------
function AbrirVentana(actUrl, actW, actH, actName, scrBar, actX, actY, actR){
  self.focus();
  if((!actName) || (actName == null)){
  	actName = parseInt(Math.random()*100000);
	actName = "nm" + actName.toString(8) + actName.toString(16);
  }
  if((!actX) || (actX == null)){actX="0"}
  if((!actY) || (actY == null)){actY="0"}
  if((!scrBar) || (scrBar == null)){scrBar="0"}
  if((!actR) || (actR == null)){actR="0"}
  actProp = "status=1,top=0,toolbar=0,scrollbars=" + scrBar + ",menubar=0,directories=0,left=" + actX + ",top=" + actY + ",width=" + actW + ",height=" + actH + ", resizable=" + actR;
  window.open(actUrl, actName, actProp);
}
// ------------------------------------------
// Detección de FlashPlayer
// ------------------------------------------
// Establecer valores de versión mínima y redirección a página sin FlahsPlayer
var minimumVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
    for (var i = 0; i < words.length; ++i)
    {
	if (isNaN(parseInt(words[i])))
	continue;
	var MM_PluginVersion = words[i]; 
    }
	var MM_FlashCanPlay = MM_PluginVersion >= minimumVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & minimumVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}
// ------------------------------------------
// Crear capa
// ------------------------------------------
function CrearCapa(id,nestref,left,top,width,height,content,bgColor,visibility,zIndex) {
	if (is.ns) {
		if (nestref) {
			var lyr = eval("document."+nestref+".document."+id+" = new Layer(width, document."+nestref+")")
		}
		else {
			var lyr = document.layers[id] = new Layer(width)
			eval("document."+id+" = lyr")
		}
		lyr.name = id
		lyr.left = left
		lyr.top = top
		if (height!=null) lyr.clip.height = height
		if (bgColor!=null) lyr.bgColor = bgColor
		lyr.visibility = (visibility=='hidden')? 'hide' : 'show'
		if (zIndex!=null) lyr.zIndex = zIndex
		if (content) {
			lyr.document.open()
			lyr.document.write(content)
			lyr.document.close()
		}
	}
	else if (is.ie) {
		var str = '\n<DIV id='+id+' style="position:absolute; left:'+left+'; top:'+top+'; width:'+width
		if (height!=null) {
			str += '; height:'+height
			str += '; clip:rect(0,'+width+','+height+',0)'
		}
		if (bgColor!=null) str += '; background-color:'+bgColor		
		if (zIndex!=null) str += '; z-index:'+zIndex
		if (visibility) str += '; visibility:'+visibility
		str += ';">'+((content)?content:'')+'</DIV>'
		if (nestref) {
			index = nestref.lastIndexOf(".")
			var nestlyr = (index != -1)? nestref.substr(index+1) : nestref
			document.all[nestlyr].insertAdjacentHTML("BeforeEnd",str);
		}
		else {
			document.body.insertAdjacentHTML("BeforeEnd",str)
		}
	}
}
// ------------------------------------------
// Destruir capa
// ------------------------------------------
function DestruirCapa(id,nestref) {
	if (is.ns) {
		if (nestref) eval("document."+nestref+".document."+id+".visibility = 'hide'")
		else document.layers[id].visibility = "hide"
	}
	else if (is.ie) {
		document.all[id].innerHTML = ""
		document.all[id].outerHTML = ""
	}
}
