var isIE = document.all?true:false;
var isNS = document.layers?true:false;

openWins = new Array();
function CierraVentana() 
{
	for(i=0; i<openWins.length; i++)
	if (openWins[i] && !openWins[i].closed) 
			openWins[i].close();
	openWins=new Array();
}

/*function closeAll(MyWindow) 
{
	try
	{
		if(MyWindow.opener==null)
			MyWindow.CierraVentana();
		else
			closeAll(MyWindow.opener);
	}
	catch(e)
	{
		MyWindow.CierraVentana();
	}
}*/
function AgregarArreglo(MyWindow,MyOpenWins)
{	
	MyWindow.openWins[MyWindow.openWins.length]=MyOpenWins;
	/*try
	{
		if(MyWindow.opener==null)
			MyWindow.openWins[MyWindow.openWins.length]=MyOpenWins;
		else
			AgregarArreglo(MyWindow.opener,MyOpenWins);
	}
	catch(e)
	{
		MyWindow.openWins[MyWindow.openWins.length]=MyOpenWins;
	}*/	
}

function AgregarRefrescado(MyWindow,MyOpenWins)
{	
	try
	{
		if(MyWindow.opener==null)
			MyWindow.openWins[MyWindow.openWins.length]=MyOpenWins;
		else
			AgregarArreglo(MyWindow.opener,MyOpenWins);
	}
	catch(e)
	{
		MyWindow.openWins[MyWindow.openWins.length]=MyOpenWins;
	}	
}

function CerrarVentana()
{
	window.close();
}
function VerificaValoresSistema()
{
	for(i=0;i<document.getElementsByTagName("input").length;i++)
	{		
		if(document.getElementsByTagName("input").item(i).name.indexOf('chkItem|')!=-1)
		{		
			var arr = document.getElementsByTagName("input").item(i).name.split("|"); 
			if(arr[2].length<36)
				document.getElementsByTagName("input").item(i).disabled=true;
		}
	}
}
function SeleccionaUnCheck(chkItemSel)
{
	if(chkItemSel.checked==true)
	{
		for(i=0;i<document.getElementsByTagName("input").length;i++)
		{		
			if(document.getElementsByTagName("input").item(i).name.indexOf('chkItem|')!=-1)
			{		
				if(document.getElementsByTagName("input").item(i).id!=chkItemSel.id)
					document.getElementsByTagName("input").item(i).checked=false;
			}
		}
	}
}

function CheckItemTodos(chkTodos,GUIDModulo)
{
	for(i=0;i<document.getElementsByTagName("input").length;i++)
		if(document.getElementsByTagName("input").item(i).name.indexOf('chkItem|'+GUIDModulo)!=-1)
			if(document.getElementsByTagName("input").item(i).disabled==false)
				document.getElementsByTagName("input").item(i).checked=chkTodos.checked;
}
function CheckItemTodosDif(chkTodos,GUIDModulo)
{
	for(i=0;i<document.getElementsByTagName("input").length;i++)
		if(document.getElementsByTagName("input").item(i).name.indexOf('chkItemDif|'+GUIDModulo)!=-1)
			if(document.getElementsByTagName("input").item(i).disabled==false)
				document.getElementsByTagName("input").item(i).checked=chkTodos.checked;
}
function CheckItemTodosDif2(chkTodos,GUIDModulo)
{
	for(i=0;i<document.getElementsByTagName("input").length;i++)
		if(document.getElementsByTagName("input").item(i).name.indexOf('chkItemDif2|'+GUIDModulo)!=-1)
			if(document.getElementsByTagName("input").item(i).disabled==false)
				document.getElementsByTagName("input").item(i).checked=chkTodos.checked;
}
function Colores(ControlRegreso,Color)
{
	var hexa=0;
	
	if(Color.indexOf('#')!=-1)
	{	
		Color=Color.substring(1,Color.length);
		hexa=1;
	}
	var Ruta="Functions/Colores.aspx?strControl="+ControlRegreso+"&Color="+Color+"&Hexa="+hexa;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width=145, height=310, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no'));
}
function Calendario(Control,Fecha)
{	
	AgregarArreglo(window, window.open("Functions/Calendario.aspx?strControl="+Control+"&strFecha="+Fecha, windowName='', 'width=250, height=250, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no'));
}
function CalendarioHora(Control,Fecha)
{	
	AgregarArreglo(window, window.open("Functions/CalendarioHora.aspx?strControl="+Control+"&strFecha="+Fecha, windowName='', 'width=250, height=250, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no'));
}
function CalendarioRango(Control,Fecha,Formato,FechaInicial,FechaFinal)
{
	AgregarArreglo(window, window.open("Functions/Calendario.aspx?strControl="+Control+"&strFecha="+Fecha+"&strFormato="+Formato+"&strInicial="+FechaInicial+"&strFinal="+FechaFinal, windowName='', 'width=250, height=250, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no'));
}
function CalendarioHoraRango(Control,Fecha,Formato,FechaInicial,FechaFinal)
{
	AgregarArreglo(window, window.open("Functions/CalendarioHora.aspx?strControl="+Control+"&strFecha="+Fecha+"&strFormato="+Formato+"&strInicial="+FechaInicial+"&strFinal="+FechaFinal, windowName='', 'width=250, height=250, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no'));
}
function Departamento(strControl,strGUIDControl,strDepartamentos,intOpcion)
{
	var Ruta="Functions/VerDepartamento.aspx?strControl="+strControl+"&strGUIDControl="+strGUIDControl+"&strDepartamentos="+strDepartamentos+"&intOpcion="+intOpcion;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width=300, height=350, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no'));
}
function Modulo(strControl,strGUIDControl,strModulos,intOpcion,strNombreEtiqueta)
{
	var Ruta="Functions/VerModulo.aspx?strControl="+strControl+"&strGUIDControl="+strGUIDControl+"&strModulos="+strModulos+"&intOpcion="+intOpcion+"&strNombreEtiqueta="+strNombreEtiqueta;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width=300, height=350, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no'));
}
function AbreVentana(strURL,width,height,location,menubar,status,toolbar,scrollbars,resizable)
{
	AgregarArreglo(window, window.open(strURL, windowName="", 'width='+width+', height='+height+', location='+location+', menubar='+menubar+', status='+status+', toolbar='+toolbar+', scrollbars='+scrollbars+', resizable='+scrollbars+''));
}
function DepartamentoCampo(strControl,strGUIDControl,strDepartamentos,intOpcion,strGUIDInicio)
{
	var Ruta="Functions/VerDepartamento.aspx?strControl="+strControl+"&strGUIDControl="+strGUIDControl+"&strDepartamentos="+strDepartamentos+"&intOpcion="+intOpcion+"&strGUIDInicio="+strGUIDInicio;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width=300, height=350, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no'));
}
function DepartamentoCampoLista(strControl,strGUIDControl,strDepartamentos,intOpcion,strGUIDModuloElemento,strGUIDCampo)
{
	var Ruta="Functions/VerDepartamento.aspx?strControl="+strControl+"&strGUIDControl="+strGUIDControl+"&strDepartamentos="+strDepartamentos+"&intOpcion="+intOpcion+"&strGUIDModuloElemento="+strGUIDModuloElemento+"&strGUIDCampo="+strGUIDCampo;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width=300, height=350, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no'));
}
function Buscar(RutaBusqueda,RutaPadre,GUIDControl,Control,GUIDModulo,GUIDIdioma,width,height,scrollbars)
{
	var Ruta="Buscar.aspx?Title=" + document.title +"&RutaBusqueda="+RutaBusqueda+"&RutaPadre="+RutaPadre+"&strGUIDControl="+GUIDControl+"&strControl="+Control+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=yes, toolbar=no, scrollbars='+scrollbars+', resizable=no'));
}
function BuscarConDependencia(RutaBusqueda,RutaPadre,GUIDControl,Control,GUIDModulo,GUIDIdioma,width,height,scrollbars,Dependencia)
{
	if(Dependencia!="")
	{
		var Ruta="Buscar.aspx?Title=" + document.title +"&RutaBusqueda="+RutaBusqueda+"&RutaPadre="+RutaPadre+"&strGUIDControl="+GUIDControl+"&strControl="+Control+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma+"&Dependencia="+Dependencia;
		AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=yes, toolbar=no, scrollbars='+scrollbars+', resizable=no'));
	}
}
function Buscar(RutaBusqueda,RutaPadre,GUIDControl,Control,GUIDModulo,GUIDIdioma,width,height,scrollbars,intOpcion)
{
	var Ruta="Buscar.aspx?Title=" + document.title +"&RutaBusqueda="+RutaBusqueda+"&RutaPadre="+RutaPadre+"&strGUIDControl="+GUIDControl+"&strControl="+Control+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma+"&intOpcion="+intOpcion;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=yes, toolbar=no, scrollbars='+scrollbars+', resizable=no'));
}
function BuscarConRecarga(RutaBusqueda,RutaPadre,GUIDControl,Control,GUIDModulo,GUIDIdioma,width,height,scrollbars,intOpcion,Evento)
{
	var Ruta="Buscar.aspx?Title=" + document.title +"&RutaBusqueda="+RutaBusqueda+"&RutaPadre="+RutaPadre+"&strGUIDControl="+GUIDControl+"&strControl="+Control+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma+"&intOpcion="+intOpcion+"&Recarga="+Evento;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=yes, toolbar=no, scrollbars='+scrollbars+', resizable=no'));
}
function BuscarProveedorFactura(RutaBusqueda,RutaPadre,GUIDControlProvFac,ControlDep,ControlFecha,ControlMonto,GUIDModulo,GUIDIdioma,width,height,scrollbars,intOpcion,strIncluir,strNoIncluir)
{
	var Ruta="Buscar.aspx?Title=" + document.title +"&RutaBusqueda="+RutaBusqueda+"&RutaPadre="+RutaPadre+"&strGUIDControlProvFac="+GUIDControlProvFac+"&strControlDep="+ControlDep+"&strControlFecha="+ControlFecha+"&strControlMonto="+ControlMonto+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma+"&intOpcion="+intOpcion+"&strIncluir="+strIncluir+"&strNoIncluir="+strNoIncluir;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=yes, toolbar=no, scrollbars='+scrollbars+', resizable=no'));
}
function BuscarCampo(RutaBusqueda,RutaPadre,GUIDControl,Control,GUIDModulo,GUIDIdioma,width,height,scrollbars,intOpcion,NoIncluir)
{
	var Ruta="Buscar.aspx?Title=" + document.title +"&RutaBusqueda="+RutaBusqueda+"&RutaPadre="+RutaPadre+"&strGUIDControl="+GUIDControl+"&strControl="+Control+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma+"&intOpcion="+intOpcion+"&NoIncluir="+NoIncluir;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=yes, toolbar=no, scrollbars='+scrollbars+', resizable=no'));
}
function BuscarCampo(RutaBusqueda,RutaPadre,GUIDControl,Control,GUIDModulo,GUIDIdioma,width,height,scrollbars,intOpcion,NoIncluir,GUIDTipoDato)
{
	var Ruta="Buscar.aspx?Title=" + document.title +"&RutaBusqueda="+RutaBusqueda+"&RutaPadre="+RutaPadre+"&strGUIDControl="+GUIDControl+"&strControl="+Control+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma+"&intOpcion="+intOpcion+"&NoIncluir="+NoIncluir+"&GUIDTipoDato="+GUIDTipoDato;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=yes, toolbar=no, scrollbars='+scrollbars+', resizable=no'));
}
function BuscarCampoCondicion(RutaPadre,Control,GUIDModulo,GUIDIdioma,width,height,scrollbars,intOpcion,GUIDConexion,Tabla,Campo)
{
	var Ruta="Buscar.aspx?Title=" + document.title +"&RutaBusqueda=~/Sistema/Campo/CampoCatalogoCondicion.ascx&RutaPadre="+RutaPadre+"&strControl="+Control+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma+"&intOpcion="+intOpcion+"&GUIDConexion="+GUIDConexion+"&Tabla="+Tabla+"&Campo="+Campo;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=yes, toolbar=no, scrollbars='+scrollbars+', resizable=no'));
}
function BuscarCampoProcesoTipo(RutaBusqueda,RutaPadre,GUIDControl,Control,CtrlExcluir,GUIDModulo,GUIDIdioma,width,height,scrollbars,intOpcion,NoIncluir,GUIDTipoDato,strGUIDElemento)
{
	/*if(Document.GetElementByID(CtrlExcluir)!=null)
		Document.GetElementByID(CtrlExcluir).value*/
	NoIncluir=document.getElementById(CtrlExcluir).value;
	var Ruta="Buscar.aspx?Title=" + document.title +"&RutaBusqueda="+RutaBusqueda+"&RutaPadre="+RutaPadre+"&strGUIDControl="+GUIDControl+"&strControl="+Control+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma+"&intOpcion="+intOpcion+"&NoIncluir="+NoIncluir+"&GUIDTipoDato="+GUIDTipoDato+"&strGUIDElemento="+strGUIDElemento+"&strCtrlExcluir="+CtrlExcluir;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=yes, toolbar=no, scrollbars='+scrollbars+', resizable=no'));
}
function BusquedaUsuario(RutaBusqueda,RutaPadre,GUIDControl,Control,GUIDModulo,GUIDIdioma,width,height,scrollbars,intOpcion,intTipo,strUsuariosAExcluir, strGUIDElemento)
{
	var Ruta="Buscar.aspx?Title=" + document.title +"&RutaBusqueda="+RutaBusqueda+"&RutaPadre="+RutaPadre+"&strGUIDControl="+GUIDControl+"&strControl="+Control+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma+"&intOpcion="+intOpcion+"&intTipo="+intTipo+"&strUsuariosAExcluir="+strUsuariosAExcluir+"&strGUIDElemento="+strGUIDElemento;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=yes, toolbar=no, scrollbars='+scrollbars+', resizable=no'));
}
function BusquedaUsuarioCampo(RutaBusqueda,RutaPadre,GUIDCampo,GUIDModulo,GUIDIdioma,width,height,scrollbars,intOpcion,intTipo,strUsuariosAExcluir, strGUIDElemento)
{
	var Ruta="Buscar.aspx?Title=" + document.title +"&RutaBusqueda="+RutaBusqueda+"&RutaPadre="+RutaPadre+"&strGUIDCampo="+GUIDCampo+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma+"&intOpcion="+intOpcion+"&intTipo="+intTipo+"&strUsuariosAExcluir="+strUsuariosAExcluir+"&strGUIDElemento="+strGUIDElemento;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=yes, toolbar=no, scrollbars='+scrollbars+', resizable=no'));
}
function LimpiaControles(Controles)
{
	var arr = Controles.split("|"); 
	for(i=0;i<document.getElementsByTagName("input").length;i++)
	{
		for(j=0;j<arr.length;j++)
		{
			if(document.getElementsByTagName("input").item(i).id==arr[j])
			{
				document.getElementsByTagName("input").item(i).value='';
			}
		}		
	}	
}
function LimpiaChecks(strControl)
{
	for(i=0;i<document.getElementsByTagName("input").length;i++)
	{
		if(document.getElementsByTagName("input").item(i).id==strControl)
		{
			document.getElementsByTagName("input").item(i).checked=false;
		}
	}	
}
function ActivaCheck(strCheck,strText)
{
	if(document.getElementById(strText)!=null && document.getElementById(strCheck)!=null)
	{
		if(document.getElementById(strText).value=="")
			document.getElementById(strCheck).checked=false;
	}
}
function EliminarDeExcluir(strExcluir, GUIDControl)
{
	var arr = document.getElementById(strExcluir).value.split(",");
	var strTemp="";
	for(j=0;j<arr.length;j++)
	{
		if(document.getElementById(GUIDControl).value!=arr[j])
			strTemp += arr[j] + ",";
	}
	if(strTemp!="")
		document.getElementById(strExcluir).value = strTemp.substring(0,strTemp.length-1);
	else
		document.getElementById(strExcluir).value="";
}
function Estilo(RutaEditar,RutaPadre,GUIDElemento,GUIDModulo,GUIDIdioma,width,height,scrollbars)
{
	var Ruta="Estilo.aspx?Title=" + document.title +"&RutaEditar="+RutaEditar+"&RutaPadre="+RutaPadre+"&GUIDElemento="+GUIDElemento+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=no, toolbar=no, scrollbars='+scrollbars+', resizable=no'));
}
function Editar(RutaEditar,RutaPadre,GUIDElemento,GUIDModulo,GUIDIdioma,width,height)
{
	var Ruta="Editar.aspx?Title=" + document.title +"&RutaEditar="+RutaEditar+"&RutaPadre="+RutaPadre+"&GUIDElemento="+GUIDElemento+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=yes'));
}
function Editar(RutaEditar,RutaPadre,GUIDElemento,GUIDModulo,GUIDIdioma,width,height,scrollbars)
{
	var Ruta="Editar.aspx?Title=" + document.title +"&RutaEditar="+RutaEditar+"&RutaPadre="+RutaPadre+"&GUIDElemento="+GUIDElemento+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=no, toolbar=no, scrollbars='+scrollbars+', resizable=yes'));
}
function Editar(RutaEditar,RutaPadre,GUIDElemento,GUIDModulo,GUIDIdioma,width,height,scrollbars,statusbar)
{
	var Ruta="Editar.aspx?Title=" + document.title +"&RutaEditar="+RutaEditar+"&RutaPadre="+RutaPadre+"&GUIDElemento="+GUIDElemento+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status='+statusbar+', toolbar=no, scrollbars='+scrollbars+', resizable=yes'));
}
function EditarCampo(RutaEditar,RutaPadre,GUIDElemento,GUIDModulo,GUIDIdioma,width,height,scrollbars,NoIncluir)
{
	var Ruta="Editar.aspx?Title=" + document.title +"&RutaEditar="+RutaEditar+"&RutaPadre="+RutaPadre+"&GUIDElemento="+GUIDElemento+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma+"&NoIncluir="+NoIncluir;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=no, toolbar=no, scrollbars='+scrollbars+', resizable=yes'));
}
function EditarCatalogo(RutaEditar,RutaPadre,GUIDElemento,GUIDModulo,GUIDIdioma,width,height,scrollbars,Condicion)
{
	var Ruta="Editar.aspx?Title=" + document.title +"&RutaEditar="+RutaEditar+"&RutaPadre="+RutaPadre+"&GUIDElemento="+GUIDElemento+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma+"&Condicion="+Condicion;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=no, toolbar=no, scrollbars='+scrollbars+', resizable=yes'));
}
function BuscarRolesUsuarios(RutaBuscar,RutaPadre,Tipo,Excluir,GUIDModulo,GUIDIdioma,width,height,scrollbars)
{
	var Ruta="Buscar.aspx?Title=" + document.title +"&RutaBusqueda="+RutaBuscar+"&RutaPadre="+RutaPadre+"&Tipo="+Tipo+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma+"&Excluir="+Excluir;
	window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=yes, toolbar=no, scrollbars='+scrollbars+', resizable=no');
}
function BuscarDepartamentos(RutaBuscar,RutaPadre,intOpcion,Excluir,GUIDModulo,GUIDIdioma,width,height,scrollbars)
{
	var Ruta="Buscar.aspx?Title=" + document.title +"&RutaBusqueda="+RutaBuscar+"&RutaPadre="+RutaPadre+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma+"&intOpcion="+intOpcion+"&DeptosExcluir="+Excluir;
	window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar=no, status=yes, toolbar=no, scrollbars='+scrollbars+', resizable=no');
}
function Seguridad(RutaPadre,GUIDModulo,GUIDIdioma)
{	
	var Ruta="Seguridad.aspx?Title=" + document.title +"&RutaSeguridad=~/Core/General/Permisos.ascx&RutaPadre="+RutaPadre+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width=250, height=200, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no'));
}
function Titulo(RutaPadre,GUIDModulo,GUIDIdioma)
{	
	var Ruta="TituloModulo.aspx?Title=" + document.title +"&RutaTitulo=~/Core/General/TituloEditar.ascx&RutaPadre="+RutaPadre+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width=500, height=200, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no'));
}
function Eliminar(RutaEliminar,RutaPadre,GUIDModulo,GUIDIdioma)
{
	Cadena="";
	for(i=0;i<document.getElementsByTagName("input").length;i++)
	{
		if(document.getElementsByTagName("input").item(i).name.indexOf('chkItem|'+GUIDModulo)!=-1)
		{
			if(document.getElementsByTagName("input").item(i).checked==true)
			{
				var arr = document.getElementsByTagName("input").item(i).name.split("|"); 
				Cadena=Cadena+arr[2]+",";
			}
		}
	}	
	if(Cadena!="")
	{	
		Cadena=Cadena.substring(0,Cadena.length-1);
		var Ruta="Eliminar.aspx?Title=" + document.title +"&RutaEliminar="+RutaEliminar+"&RutaPadre="+RutaPadre+"&GUIDElemento="+Cadena+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
		AgregarArreglo(window, window.open(Ruta, windowName="", 'width=250, height=200, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no'));
	}
}
function EliminarDif(RutaEliminar,RutaPadre,GUIDModulo,GUIDIdioma)
{
	Cadena="";
	for(i=0;i<document.getElementsByTagName("input").length;i++)
	{
		if(document.getElementsByTagName("input").item(i).name.indexOf('chkItemDif|'+GUIDModulo)!=-1)
		{
			if(document.getElementsByTagName("input").item(i).checked==true)
			{
				var arr = document.getElementsByTagName("input").item(i).name.split("|"); 
				Cadena=Cadena+arr[2]+",";
			}
		}
	}	
	if(Cadena!="")
	{	
		Cadena=Cadena.substring(0,Cadena.length-1);
		var Ruta="Eliminar.aspx?Title=" + document.title +"&RutaEliminar="+RutaEliminar+"&RutaPadre="+RutaPadre+"&GUIDElemento="+Cadena+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
		AgregarArreglo(window, window.open(Ruta, windowName="", 'width=250, height=200, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no'));
	}
}
function EliminarDif2(RutaEliminar,RutaPadre,GUIDModulo,GUIDIdioma)
{
	Cadena="";
	for(i=0;i<document.getElementsByTagName("input").length;i++)
	{
		if(document.getElementsByTagName("input").item(i).name.indexOf('chkItemDif2|'+GUIDModulo)!=-1)
		{
			if(document.getElementsByTagName("input").item(i).checked==true)
			{
				var arr = document.getElementsByTagName("input").item(i).name.split("|"); 
				Cadena=Cadena+arr[2]+",";
			}
		}
	}	
	if(Cadena!="")
	{	
		Cadena=Cadena.substring(0,Cadena.length-1);
		var Ruta="Eliminar.aspx?Title=" + document.title +"&RutaEliminar="+RutaEliminar+"&RutaPadre="+RutaPadre+"&GUIDElemento="+Cadena+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
		AgregarArreglo(window, window.open(Ruta, windowName="", 'width=250, height=200, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no'));
	}
}
function EliminarElemento(RutaEliminar, RutaPadre, GUIDElemento, GUIDModulo, GUIDIdioma)
{
	var Ruta="Eliminar.aspx?Title=" + document.title +"&RutaEliminar="+RutaEliminar+"&RutaPadre="+RutaPadre+"&GUIDElemento="+GUIDElemento+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width=250, height=200, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no'));
}
function Mensaje(Mensaje,Aceptar)
{	
	var Ruta="Titulo.aspx?Title=" + document.title +"&RutaTitulo=~/Core/General/TituloEditar.ascx&RutaPadre="+RutaPadre+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width="+width+", height="+height+", location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no'));
}
function MostrarRecibo(RutaPadre,GUIDElemento,GUIDModulo,GUIDIdioma)
{
	var Ruta="Editar.aspx?Title=" + document.title +"&RutaEditar=~/SPI/Recibo/VerRecibo.ascx&RutaPadre="+RutaPadre+"&GUIDElemento="+GUIDElemento+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width=550, height=250, location=no, menubar=yes, status=no, toolbar=no, scrollbars=no, resizable=yes'));
}
function SelectItemEstructura(strName)
{
	if(strName.checked==true)
	{		
		var i;	
		
		var txtElementoSel,strNombre;
		for(i=0;i<document.getElementsByTagName("input").length-1;i++)
		{
			if(document.getElementsByTagName("input").item(i).name.indexOf('chkModuloEstructura')!=-1)
			{
				document.getElementsByTagName("input").item(i).checked=false;
			}
			strName.checked = true;						
			if(document.getElementsByTagName("input").item(i).name.indexOf('txtElementoSel')!=-1)
				document.getElementsByTagName("input").item(i).value=strName.name;
		}	
	}
	else
	{
		for(i=0;i<document.getElementsByTagName("input").length-1;i++)
		{
			if(document.getElementsByTagName("input").item(i).name.indexOf('txtElementoSel')!=-1)
			{
				document.getElementsByTagName("input").item(i).value="";
				break;
			}
		}	
	}
}
function EliminarEstructura(RutaEliminar,RutaPadre,GUIDModulo,GUIDIdioma)
{
	Cadena="";
	for(i=0;i<document.getElementsByTagName("input").length;i++)
	{		
		if(document.getElementsByTagName("input").item(i).name.indexOf('chkModuloEstructura|'+GUIDModulo)!=-1)
		{	
			if(document.getElementsByTagName("input").item(i).checked==true)
			{
				var arr = document.getElementsByTagName("input").item(i).name.split("|"); 
				Cadena=Cadena+arr[2]+",";
			}
		}
	}	
	if(Cadena!="")
	{	
		Cadena=Cadena.substring(0,Cadena.length-1);
		var Ruta="Eliminar.aspx?Title=" + document.title +"&RutaEliminar="+RutaEliminar+"&RutaPadre="+RutaPadre+"&GUIDElemento="+Cadena+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
		AgregarArreglo(window, window.open(Ruta, windowName="", 'width=250, height=200, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no'));
	}
}
function SoloNumeros(e,decReq,NumDec)
{		
	var key = (isIE) ? window.event.keyCode : e.which;
	var obj = (isIE) ? event.srcElement : e.target;
	var isNum = (key > 47 && key < 58) ? true:false;
	if(key==48 && obj.value.length==0)
		isNum=false;	
	var dotOK = (key==46 && decReq=='decOK' && (obj.value.indexOf(".")<0 || obj.value.length==0)) ? true:false;
	var strValCadena;
	var strValText;

	strValText = obj.value;

	if (decReq=='decOK') 
		{
			strValCadena = strValText.split(".");
			if (strValCadena.length == 2)
				{
					var longitud = strValCadena[1];						
					if (longitud.length >=NumDec)
						{
							isNum = false;
						}
				}
		}

	if(isIE)
		window.event.keyCode = (!isNum && !dotOK) ? 0:key;
	else if(isNS)
		e.which = (!isNum && !dotOK) ? 0:key;

	if(key==0 || key==8)
		return true;
	else
		return (isNum || dotOK);
}

function SoloNumerosyPunto(e,decReq,NumDec)
{	
	var key = (isIE) ? window.event.keyCode : e.which;
	var obj = (isIE) ? event.srcElement : e.target;
	var isNum = (key > 45 && key < 58) ? true:false;
	var dotOK = (key==45 && decReq=='decOK' && (obj.value.indexOf(".")<0 || obj.value.length==0)) ? true:false;
	var strValCadena;
	var strValText;
				
	strValText = obj.value;

	if (decReq=='decOK') 
		{
			strValCadena = strValText.split(".");
			if (strValCadena.length == 2)
				{
					var longitud = strValCadena[1];						
					if (longitud.length >=NumDec)
						{
							isNum = false;
						}
				}
		}
	
	window.event.keyCode = (!isNum && !dotOK && isIE) ? 0:key;
	e.which = (!isNum && !dotOK && isNS) ? 0:key;

	if(key==0 || key==8)
		return true;
	else
		return (isNum || dotOK);	
}

function cmdVerArchivo(pstrPath)
{
	AgregarArreglo(window, window.open(pstrPath,"_blank","toolbar=no,menubar=no,directories=no,status=no,resizable=yes,location=no,scrollbars=yes,height=500,width=600,top=20,left=0"));
}

function cmdDowArchivo(pstrPath)
{
	if(window.navigator.appName=="Netscape")
		AgregarArreglo(window, window.open(pstrPath,"_blank","toolbar=no,menubar=no,directories=no,status=no,resizable=yes,location=no,scrollbars=yes,height=500,width=600,top=20,left=0"));
	else
		window.navigate(pstrPath);
}

function FormatoHora(e,decReq,NumDec)
{
	var key = (isIE) ? window.event.keyCode : e.which;
	var obj = (isIE) ? event.srcElement : e.target;
	var isNum = (key > 47 && key < 58) ? true:false;
	var isDPunt = (key == 58) ? true:false;
	var dotOK = (key==46 && decReq=='decOK' && (obj.value.indexOf(".")<0 || obj.value.length==0)) ? true:false;
	var strValCadena;
	var strValText;

	strValText = obj.value;

	if (decReq=='decOK') 
		{
			strValCadena = strValText.split(".");
			if (strValCadena.length == 2)
				{
					var longitud = strValCadena[1];						
					if (longitud.length >=NumDec)
						{
							isNum = false;
						}
				}
		}

	if(isIE)
		window.event.keyCode = (!isNum && !dotOK) ? 0:key;
	else if(isNS)
		e.which = (!isNum && !dotOK) ? 0:key;

	return (isNum || dotOK);
}

function CatalogoCheck(Elemento,NombreGeneral)
{	
	if(Elemento.checked==true)
	{
		for(i=0;i<document.getElementsByTagName("input").length;i++)
		{		
			if(document.getElementsByTagName("input").item(i).id.indexOf(NombreGeneral)!=-1)
			{	
				if(document.getElementsByTagName("input").item(i).id!=Elemento.id)
					document.getElementsByTagName("input").item(i).checked=false;
			}
		}	
	}
}
function CatalogoText(Elemento,NombreGeneral)
{
	if(Elemento.value!="")
	{
		for(i=0;i<document.getElementsByTagName("input").length;i++)
		{		
			if(document.getElementsByTagName("input").item(i).id.indexOf(NombreGeneral)!=-1)
			{					
				if(document.getElementsByTagName("input").item(i).id!=Elemento.id)
					document.getElementsByTagName("input").item(i).value="";
			}
		}	
	}
}
function MostrarExpediente(Tabla)
{
	if(Tabla.style.display=="none")
	{
		Tabla.style.display="block";
	}
	else
	{
		Tabla.style.display="none";
	}	
}
function EstableceValor(control,valor,intOpcion)
{
	for(i=0;i<document.getElementsByTagName("input").length;i++)
	{
		if(document.getElementsByTagName("input").item(i).name.indexOf(control)!=-1)
		{
			if(intOpcion=="1")
			{
				document.getElementsByTagName("input").item(i).value=valor;
				break;
			}
			else if(intOpcion=="2")
			{
				document.getElementsByTagName("input").item(i).checked=valor;
				break;
			}
		}
	}
}
function EstableceValorCombo(control,valor)
{
	for(i=0;i<document.getElementsByTagName("select").length;i++)
	{
		if(document.getElementsByTagName("select").item(i).name.indexOf(control)!=-1)
		{
			document.getElementsByTagName("select").item(i).options[valor].selected=true;
			break;
		}
	}
}
function ObtenIDCampoINPUT(control)
{	
	for(i=0;i<document.getElementsByTagName("input").length;i++)
	{
		if(document.getElementsByTagName("input").item(i).name.indexOf(control)!=-1)
		{
			return(document.getElementsByTagName("input").item(i).id);
		}
	}
}
function ObtenCampoSELECT(control)
{	
	Cadena="";
	for(i=0;i<document.getElementsByTagName("select").length;i++)
	{
		if(document.getElementsByTagName("select").item(i).name.indexOf(control)!=-1)
		{						
			for(j=0;j<document.getElementsByTagName("select").item(i).options.length;j++)
			{															
				if(document.getElementsByTagName("select").item(i).options[j].selected==true)
				{						
					Cadena+="apos"+document.getElementsByTagName("select").item(i).options[j].value+"apos,";			
				}
			}			
			if(Cadena!="")
			{				
				Cadena=Cadena.substring(0,Cadena.length-1);				
			}
			else
				Cadena="aposapos";
			return(Cadena);
		}
	}
}
function EstableceEstado(objControl,blnEstado)
{	
	if(blnEstado==true)
		objControl.style.display="block";
	else
		objControl.style.display="none";	
}
function SeleccionaDia(txtOpcion,strCssSel,strCssNoSel,spnItem,intDia)
{
	if(txtOpcion.value==intDia)
	{
		txtOpcion.value="";
		spnItem.style.backgroundColor=strCssNoSel;
	}
	else
	{
		txtOpcion.value=intDia;
		spnItem.style.backgroundColor=strCssSel;
	}			
}
function ObtenOpcion(nombre)
{
	for(i=0;i<document.getElementsByTagName("input").length;i++)
	{		
		if(document.getElementsByTagName("input").item(i).name.indexOf('rblOpcion')!=-1)
		{		
			if(document.getElementsByTagName("input").item(i).checked==true)
				return document.getElementsByTagName("input").item(i).value;
		}
	}
}
function MaximaLongitud(e,intMaximo)
{		
	//var key = (isIE) ? window.event.keyCode : e.which;
	var obj = (isIE) ? event.srcElement : e.target;
	if(obj.value.length > intMaximo)
		return false;
	else
		return true;
}

function Imprimir(RutaEditar,RutaPadre,GUIDElemento,GUIDModulo,GUIDIdioma,width,height,scrollbars,statusbar,menubar)
{
	var Ruta="Editar.aspx?Title=" + document.title +"&RutaEditar="+RutaEditar+"&RutaPadre="+RutaPadre+"&GUIDElemento="+GUIDElemento+"&GUIDModulo="+GUIDModulo+"&GUIDIdioma="+GUIDIdioma;
	AgregarArreglo(window, window.open(Ruta, windowName="", 'width='+width+', height='+height+', location=no, menubar='+menubar+', status='+statusbar+', toolbar=no, scrollbars='+scrollbars+', resizable=yes'));
}

function FechaCombo(cboAnio,cboMes,cboDia,txtFecha)
{	
	var vartxtFecha;	
	for(i=0;i<document.getElementsByTagName("input").length;i++)
	{		
		if(document.getElementsByTagName("input").item(i).name.indexOf(txtFecha)!=-1)
		{			
			vartxtFecha = document.getElementsByTagName("input").item(i); 			
			break;
		}
	}
	for(i=0;i<document.getElementsByTagName("select").length;i++)
	{
		if(document.getElementsByTagName("select").item(i).name.indexOf(cboAnio)!=-1)
		{
			vartxtFecha.value=document.getElementsByTagName("select").item(i).value+',';
			break;
		}
	}
	for(i=0;i<document.getElementsByTagName("select").length;i++)
	{
		if(document.getElementsByTagName("select").item(i).name.indexOf(cboMes)!=-1)
		{
			vartxtFecha.value=vartxtFecha.value+document.getElementsByTagName("select").item(i).value+',';
			break;
		}
	}
	for(i=0;i<document.getElementsByTagName("select").length;i++)
	{
		if(document.getElementsByTagName("select").item(i).name.indexOf(cboDia)!=-1)
		{
			vartxtFecha.value=vartxtFecha.value+document.getElementsByTagName("select").item(i).value;
			break;
		}
	}
}