addLoadEvent(Index);

function Index()
{
	
}

function CargarFormulario(idformulario, id)
{
    if(id == "" || id == " ")
    {
        alert("Seleccione un registro haciendo click encima de la fila")
        return ;
    }
    
	if(document.getElementById(idformulario).op.value == "BorrarRegistro")
	{
		ConfirmaBorrar(idformulario, id)
		return ;
	}
	
	document.getElementById(idformulario).idregistro.value = id
    
	document.getElementById(idformulario).submit();
}

function MostrarBusqueda()
{
	var left = (screen.width-550)/2;
		
	document.getElementById('busqueda').style.left = left + 'px'
	MostrarOcultar('busqueda')
}

function CambiarPagina(pag)
{
	document.getElementById('FormPaginacion').pagina.value = pag
	document.getElementById('FormPaginacion').submit()
}

function CambiarPaginaWeb(pag, idform)
{
    document.getElementById('pagina'+idform).value = pag
    document.getElementById('FormPaginacion'+idform).submit()
}

function Ordenar(ordenar, ordenarpor)
{
    document.getElementById('Ordenamiento').ordenar.value = ordenar 
    document.getElementById('Ordenamiento').ordenarpor.value = ordenarpor
	document.getElementById('Ordenamiento').submit()
}

function ConfirmaBorrar(idformulario, id)
{
	var respuesta=confirm('¿Realmente desea borrar este registro?')					
	if (respuesta==true)
	{
		document.getElementById(idformulario).idregistro.value = id;
		document.getElementById(idformulario).submit()
	}			
}

function ExportarResultado()
{
	document.getElementById('FormExportarResultado').submit()
}

function Imprimir()
{
	VentanaImprimir()
	document.getElementById('FormImprimir').submit()
}

function SeleccionarRegistro(idregistro)
{
    if(document.getElementById("fila"+document.getElementById("FormVarios").idregistro.value))
        document.getElementById("fila"+document.getElementById("FormVarios").idregistro.value).className = "fila-contenido"
        
    document.getElementById("FormVarios").idregistro.value = idregistro;
    document.getElementById("fila"+idregistro).className = "seleccionada"
}

function RegistroSeleccionado()
{
    return document.getElementById("FormVarios").idregistro.value
}
