﻿// Función para mostrar el menu desplegable
var t;

function activar()
{
	clearTimeout(t);
}


function mostrar_buro()
{
	var capa = document.getElementById('menu_buro');
    capa.style.visibility = "visible";
}

function mostrar_quito()
{
	var capa = document.getElementById('menu_quito');
    capa.style.visibility = "visible";
}

function mostrar_viajes()
{
	var capa = document.getElementById('menu_viajes');
    capa.style.visibility = "visible";
}

function ocultar_submenus()
{
	var capa2 = document.getElementById('menu_buro');
    capa2.style.visibility = "hidden";
	var capa3 = document.getElementById('menu_quito');
    capa3.style.visibility = "hidden";
	var capa4 = document.getElementById('menu_viajes');
    capa4.style.visibility = "hidden";
}
function retardo()
{
	t=setTimeout('ocultar_submenus()',800);
}

// fin del menú desplegable

//popup's imagenes

function PopUp(img){
	foto1= new Image();
	foto1.src=(img);
	Control(img);
}

function Control(img){
	if((foto1.width!=0)&&(foto1.height!=0)){
		verFoto(img);
	}
	else{
		funcion="Control('"+img+"')";
		intervalo=setTimeout(funcion,20);
	}
}

function verFoto(img){
	ancho=foto1.width+20;
	alto=foto1.height+20;
	anchoPantalla=screen.width;
	altoPantalla=screen.height;
	cadena="width="+ancho+",height="+alto+",left="+(anchoPantalla-foto1.width)/2+",top="+(altoPantalla-foto1.height)/2;
	ventana=window.open(img,"",cadena);
	ventana.document.writeln ('<html>');
	ventana.document.writeln ('<head>'); 
    ventana.document.writeln ('<title></title>');
	ventana.document.writeln ('</head>');
	ventana.document.writeln ('<body>');
	ventana.document.writeln ('<img src="'+img+'" style="border:2px #e5e5e5 solid;";');
	ventana.document.writeln ('</body>');
	ventana.document.writeln ('</html>');
}

function Abrir_ventana (url,width,height) {
	
	var popup;
	var ancho_web;
	var alto_web;


	ancho_web = screen.width;
	alto_web = screen.height;

	var X = ancho_web / 2
	var Y = alto_web / 2

	popup = window.open(url, 'PopUp', 'scrollbars=yes, width=' + width + ', height=' + height + ', top=' + (Y - (height/2)) + ', left=' + (X - (width/2))) 
	
	if(window.focus){ //si window.focus es soportado, le damos el foco
		popup.focus();
	}


}

function acceptNum(evt){	
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57, '.' = 46 , ',' = 44	
var nav4 = window.Event ? true : false;
var key = nav4 ? evt.which : evt.keyCode;	
//return (key <= 13 || (key >= 48 && key <= 57)  || (key == 46) );
return (key <= 13 || (key >= 48 && key <= 57));
}