// ------------------------------------------
// 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};
}
// ------------------------------------------
// Mostrar/Ocultar capas
// ------------------------------------------
function Mostrar(capa){
  if(is.ie){
	EstaCapa = document.getElementById(capa).style;
	Muestra = "visible";
  }else{
    EstaCapa = eval("document." + capa);
	Muestra = "show";
  }
  EstaCapa.visibility = Muestra;
}

function Ocultar(capa){
  Muestra = "hidden";
  if(is.ie){
	EstaCapa = document.getElementById(capa).style;
  }else{
    EstaCapa = eval("document." + capa);
  }
  EstaCapa.visibility = Muestra;
}
// ------------------------------------------
// Escribir en capas
// ------------------------------------------
function EscribirCapa(capa, contenido){
  if(is.ie){
    //EstaCapa = eval("document.all." + capa)
	EstaCapa = document.getElementById(capa);
	EstaCapa.innerHTML = contenido;
  }else{
    document.layers[capa].document.open();
    document.layers[capa].document.write(contenido);
    document.layers[capa].document.close();
  }
}
// ------------------------------------------
// 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, actT, actM){
  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 + ", toolbar=" + actT + ", menubar=" + actM ;
  window.open(actUrl, actName, actProp);
}
// ------------------------------------------
// Control de estilos del men� principal
// ------------------------------------------
function ControlMenu(idItem1, colorItem1, idItem2, colorItem2){
	if (is.ie) {
		(idItem1) ? document.getElementById(idItem1).className = colorItem1 : null ;
		(idItem2) ? document.getElementById(idItem2).className = colorItem2 : null ;
	}
}
// ------------------------------------------
// Switch row colors
// Pasar (this) como valor para (name) si se llama desde una celda de la fila, es suficiente
// ------------------------------------------
function paintRow(name, style){
	if(is.ie){
		var rowObj = name.parentElement;
		rowObj.className = style;
		for(var i=0; i < (rowObj.childNodes).length; i++){
			rowObj.childNodes[i].className = style;
		}
	}
}
// ------------------------------------------
// Switch text style
// Pasar (this) como valor para (name) si se llama desde una celda de la fila, es suficiente
// ------------------------------------------
function changeStyle(name, style){
	if(is.ie){
		var inputEnabled;
		if(name.checked){
			inputEnabled = false;
		}else{
			inputEnabled = true;
		}
		var formObj = name.parentElement;
		while(formObj.tagName!="FORM"){
			formObj = formObj.parentElement;
		}
		var input = eval(formObj.name + "." + name.name + "_UNITS");
		input.disabled = inputEnabled;
		if(!name.checked){
			input.value="";
		}else{
			input.focus();
		}
		//
		var fontWeightStyle;
		if(name.checked){
			fontWeightStyle = "bold";
		}else{
			fontWeightStyle = "normal";
		}
		var rowObj = name.parentElement;
		while(rowObj.tagName!="TR"){
			rowObj = rowObj.parentElement;
			
		}
		for(var i=0; i < (rowObj.childNodes).length; i++){
			rowObj.childNodes[i].style.fontWeight = fontWeightStyle;
		}
	}
}
// ------------------------------------------
// Precarga de las im�genes de las flechas
// ------------------------------------------
empty = new Image();
empty.src = "/opencms/opencms/pt/_galleries/pics/empty.gif";
fl1 = new Image();
fl1.src = "/opencms/opencms/pt/_galleries/pics/fl_01.gif";
fl2 = new Image();
fl2.src = "/opencms/opencms/pt/_galleries/pics/fl_01.gif";
fl3 = new Image();
fl3.src = "/opencms/opencms/pt/_galleries/pics/fl_02.gif";

leftOff = new Image();
leftOff.src = "/opencms/opencms/pt/_galleries/pics/common/012_off.gif";
leftOn = new Image();
leftOn.src = "/opencms/opencms/pt/_galleries/pics/common/012_in.gif";
rightOff = new Image();
rightOff.src = "/opencms/opencms/pt/_galleries/pics/common/011_off.gif";
rightOn = new Image();
rightOn.src = "/opencms/opencms/pt/_galleries/pics/common/011_in.gif";

menu1On = new Image();
menu1On.src = "/opencms/opencms/pt/_galleries/pics/in/in_01_menu_01_on.gif";
menu1Off = new Image();
menu1Off.src = "/opencms/opencms/pt/_galleries/pics/in/in_01_menu_01_off.gif";
menu2On = new Image();
menu2On.src = "/opencms/opencms/pt/_galleries/pics/in/in_01_menu_02_on.gif";
menu2Off = new Image();
menu2Off.src = "/opencms/opencms/pt/_galleries/pics/in/in_01_menu_02_off.gif";
menu3On = new Image();
menu3On.src = "/opencms/opencms/pt/_galleries/pics/in/in_01_menu_03_on.gif";
menu3Off = new Image();
menu3Off.src = "/opencms/opencms/pt/_galleries/pics/in/in_01_menu_03_off.gif";
menu4On = new Image();
menu4On.src = "/opencms/opencms/pt/_galleries/pics/in/in_01_menu_04_on.gif";
menu4Off = new Image();
menu4Off.src = "/opencms/opencms/pt/_galleries/pics/in/in_01_menu_04_off.gif";
menu5On = new Image();
menu5On.src = "/opencms/opencms/pt/_galleries/pics/in/in_01_menu_05_on.gif";
menu5Off = new Image();
menu5Off.src = "/opencms/opencms/pt/_galleries/pics/in/in_01_menu_05_off.gif";

//abre popups
function abrePopup(popup, title){
  window.open(popup, title, "toolbar=NO, location=no, scrollbars=yes, top=5, left=100; resizable=yes, directories=no, menubar=no, width=710, height=700");
}

function opnPop(popup, title){
  window.open(popup, title, "toolbar=NO, location=no, scrollbars=yes, top=5, left=100; resizable=yes, directories=no, menubar=no, width=790, height=700");
}



