// Funciones genericas del sistema
//Desarrollada por: Jesús Alberto Coronado.
//C.I:16.287.828.
//Fecha:04/07/2007;
//Telefono: (0412)-399-20-74. Caracas-Venezuela.
var FuncionInicio="Validacion.Validar('Form1');";
var IdiomaPredeterminado=1;
 var FormatoDePagina = 
					{
						Cabecera : function(Campo) 
						 {
							 CabeceraHtml="<table>";
							 	CabeceraHtml+="<tr>";
										CabeceraHtml+="<td>";
											CabeceraHtml+="<img src='../../Sistema_base/Imagenes/header6.jpg' height='100px' width='940px'>";
										CabeceraHtml+="</td>";
								CabeceraHtml+="</tr>";
							CabeceraHtml+="</table>";
							 
							document.getElementById(Campo).innerHTML=CabeceraHtml;
						 },
						PieDePagina : function(Campo) 
						{
							PieHtml="<table width='100%'>";
							 	PieHtml+="<tr>";
										PieHtml+="<td align='right'>";
											PieHtml+="<img src='../../Sistema_base/Imagenes/explorador.gif'  height='25px'>";
										PieHtml+="</td>";
								PieHtml+="</tr>";
							PieHtml+="</table>";
							document.getElementById(Campo).innerHTML=PieHtml;//pie de pagina
						}
					}
					
var TraerCodigoJs={
					TraerCodigo:function(IdModulo)
					{
						var Campos=new Array(1); 
						Campos[0]=new Array(2)
						Campos[0]["Campo"]= "IdAccion";
						Campos[0]["Valor"]= IdModulo;
						Ajax.Mifuncion("../../Sistema_base/Libreria/Php/TreerFunciones.php","TraerFuncionesJs",Campos);
					},
					TraerIdioma:function(IdModulo)
					{
						var Campos=new Array(1); 
						Campos[0]=new Array(2)
						Campos[0]["Campo"]= "IdAccion";
						Campos[0]["Valor"]= IdModulo;
						Ajax.Mifuncion("../../Sistema_base/Libreria/Php/TreerFunciones.php","TraerIdioma",Campos);
					}
				  }
				  
	//Objeto que determina el navegador utilizado y la version.
function Navegador() 
{
	var EspecificacionesNavegador, s, i;
	this.IntExp = false;
	this.NesCap = false;
	this.Version = null;
	EspecificacionesNavegador = navigator.userAgent;
	s = "MSIE";
	if ((i = EspecificacionesNavegador.indexOf(s)) >= 0)
	{
		this.IntExp = true;
		this.Version = parseFloat(EspecificacionesNavegador.substr(i + s.length));
		return;
	}
	
	s = "Netscape6/";
	if ((i = EspecificacionesNavegador.indexOf(s)) >= 0) 
	{
	   this.NesCap = true;
	   this.Version = parseFloat(EspecificacionesNavegador.substr(i + s.length));
		return;
	}
	s = "Gecko";
	if ((i = EspecificacionesNavegador.indexOf(s)) >= 0) 
	{
	 this.NesCap = true;
	 this.Version = 6.1;
	 return;
	}
}
	
//Trae las funciones de javascript al cliente desde el servidor.				  
TraerCodigoJs.TraerCodigo(IdModulo);
//Verifica que la funcion ajax alla terminado
IdIntervalo=setInterval(Comprobar,1000)
function Comprobar()
{
	if(Ajax.ProcesandoAjax!=1)
	{
		Ajax.Sw=0;
		TraerCodigoJs.TraerIdioma(IdiomaPredeterminado);
		clearTimeout(IdIntervalo)
	}
}

//Maneje posicion de las capas
function ObtenerPosicionElemento(Obj) 
{
  if (!Obj)
  {
  	return { top:0,left:0 };
  } 
  
  var y = 0;
  var x = 0;
  
  while (Obj.offsetParent) 
  {
    x += Obj.offsetLeft;
    y += Obj.offsetTop;
    Obj = Obj.offsetParent;
  }
  return {Top:y,Izq:x};
}


function PosicionarCapa_4(IdFijo,IdMover) 
{
  var Posicion = ObtenerPosicionElemento(document.getElementById(IdFijo));
  document.getElementById(IdMover).style.left = Posicion.Izq + 425 + "px"; 
  document.getElementById(IdMover).style.top = Posicion.Top + 165 + "px"; 
}


function BuscarEnter(e,IdObj,N,FuncionJs)
{

	Campo=document.getElementById(IdObj).value;
	var Tecla;
	if(window.event) // IE
		Tecla = e.keyCode;
	else if(e.which) // Netscape/Firefox/Opera
		Tecla = e.which;
	var ExpReg = new RegExp("\\d");                
	//	if(Tecla==13 || Tecla==46)
	if(Tecla==13 && document.getElementById(IdObj).value!="")
	{
		eval(FuncionJs);
		return true;
	}
	else
	{
		if(N==1)
		{
			Resp=ExpReg.test(String.fromCharCode(Tecla));
			return ExpReg.test(String.fromCharCode(Tecla))
		}
		else
		{
			return true;
		}
		
	}
}
