/***************************************************** LLAMADAS A JS EXTERNOS ****************************************************/
document.write('<script language="javascript" type="text/javascript" src="/js/DOMobjetos.js"></script>');
document.write('<script language="javascript" type="text/javascript" src="/js/navegador.js"></script>');
document.write('<script language="javascript" type="text/javascript" src="/js/ventana.js"></script>');
document.write('<script language="javascript" type="text/javascript" src="/js/scroll.js"></script>');
/*************************************************************************************************************************************/

newWindow=null
function Ventana(Titulo,Path)
{
if(newWindow!=null)
{
newWindow.close
}

newWindow = window.open(Path,'','status=no,statusbar=no,menubar=no,resizable=no,toolbar=no,titlebar=no,top=0px,left=0px,width=1024px,height=768px');
if (newWindow != null) {

var newContent = "<HTML><HEAD><TITLE>"
newContent += Titulo
newContent += "</TITLE></HEAD>"

AnchoMas=0
AltoMas=0
if(EsNavegador("opera","win")){
AnchoMas=10
AltoMas=36
}else if(EsNavegador("msie","win",";sv")){
AnchoMas=12
AltoMas=65
}else if(EsNavegador("msie","win")){
AnchoMas=12
AltoMas=65
}else if(EsNavegador("firefox","win")){
AnchoMas=7
AltoMas=55
}else if(EsNavegador("mozilla","win")){
AnchoMas=7
AltoMas=42
}else if(EsNavegador("opera","mac")){
AltoMas=20
}else if(EsNavegador("msie","mac")) {
AltoMas=0
}else if(EsNavegador("safari","mac")){
AltoMas=20
}else if(EsNavegador("firefox","mac")){
AltoMas=8
}else if(EsNavegador("mozilla","mac")){
AltoMas=10
}
swLeft=window.screen.availWidth/2
swTop=window.screen.availHeight/2

eventoOnLoad='window.resizeTo(this.width+'+AnchoMas+',this.height+'+AltoMas+');'
/*eventoOnLoad +="window.left="+swLeft+"-(this.width/2);"
eventoOnLoad +="window.top="+swTop+"-(this.height/2);"*/
eventoOnLoad +="window.moveTo(ajustar("+swLeft+"-(this.width/2)),ajustar("+swTop+"-(this.height/2)))"
//alert(eventoOnLoad)
newContent += "<script>function ajustar(tamano){if(tamano>0){return(tamano)}else{return(1)}}"
newContent += "</script><BODY LEFTMARGIN=0 TOPMARGIN=0><IMG SRC="+Path+' onLoad="'+eventoOnLoad+'">'
newContent += "</BODY></HTML>"
newWindow.document.write (newContent)
/*
IMG=newWindow.document.images[0]
i=0
do
{
i++
}
while(IMG.height<=0)

newWindow.resizeTo(IMG.width+10,IMG.height+30)*/

newWindow.document.close()
}
}

function EsNavegador()
{
user = navigator.userAgent;
user=user.toLowerCase()
tope=arguments.length
gBoo_Navegador=true

for(var i=0;i<tope;i++)
{
if(user.indexOf(arguments[i]) == -1 ){
gBoo_Navegador=false
}
}

/*if(nav)
{
for(var i=0;i<arguments.length;i++)
{
alert(arguments[i])
}
}*/
return(gBoo_Navegador)

}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function abrir_detalle(theURL)
{
window.open(theURL,'','width=500,height=300,top=20,left=60,scrollbars=yes');
}

function Entrar(Donde)
{
	window.document.forms[0].action="/4DACTION/"+Donde;
	window.document.forms[0].submit();
}


function CambiarOrden(campo,orden)
{
	with(window.document.forms[0])
	{
		gTxt_CampoOrdenacion.value=campo
		gTxt_OrdenOrdenacion.value=orden
		submit();
	}
}

function MostrarDetalle(id,metodo){
	window.document.forms[0].gTxt_RegID.value=id
	Entrar(metodo);
}

function buscar(){
	window.document.forms[0].gTxt_ButPulsado.value='Buscar';
	window.document.forms[0].submit()
}

function todos(){
	window.document.forms[0].gTxt_ButPulsado.value='Todos';
	window.document.forms[0].submit()
}

function antSig(registro){
	f=window.document.forms[0]
	f.gTxt_Numresgistro.value=registro
	f.submit()
}

function Paginar(totalPaginas){
	
	cajaTexto=window.document.forms[0].gTxt_VarInPagina
	comboRegPorPagina=window.document.forms[0].gTxt_RegPorPaginaMANT
	
	pag=new Number(cajaTexto.value)
	
	if(pag<=0 || pag>totalPaginas || isNaN(pag)){
		alert('No existe la página "'+cajaTexto.value+'"')
		
	}else{
		regPorPagina=comboRegPorPagina.options[comboRegPorPagina.selectedIndex].value
		registro=(pag*regPorPagina)-regPorPagina+1
		window.document.forms[0].gTxt_Numresgistro.value=registro
		window.document.forms[0].submit()
		
	}
}

function PaginarRetorno(totalPaginas,evento){
	if(evento.keyCode==13){
		Paginar(totalPaginas)
	}
}


