// INICIO DE: Calculo para el height del iframe en el INDEX
function agranda_cuerpo(){
	parent.document.getElementById('iframe_cuerpo').style.height = document.getElementById('contenedor_pagina').clientHeight;
	setTimeout("agranda_cuerpo()", 1);
}
// FIN DE: Calculo para el height del iframe en el INDEX

// INICIO DE: Calculo para el height del iframe ofetas destacadas en INICIO
function agranda_ofertas_destacadas(){
	parent.document.getElementById('iframe_ofertas').style.height = document.getElementById('contenedor_ofertas_destacadas').clientHeight;
	setTimeout("agranda_ofertas_destacadas()", 1);
}
// FIN DE: Calculo para el height del iframe ofetas destacadas en INICIO

//INICIO DE: Activamos la opción del menú que le corresponde. HAY QUE DEFINIR EN CADA HTML EXTERNO LA VARIABLE 'id_opcion_menu'  -->
function menu_on(){parent.document.getElementById(id_opcion_menu).className=id_opcion_menu+'_on';}

function sub_menu_on(){
	parent.document.getElementById(id_opcion_menu).className=id_opcion_menu+'_on';
	parent.document.getElementById(id_sub_opcion_menu).className='sub_menu_on';
}
//FIN DE: Activamos la opción del menú que le corresponde. HAY QUE DEFINIR EN CADA HTML EXTERNO LA VARIABLE 'id_opcion_menu'  -->

// FUNCIONES PARA EL ROLLOVER DE LOS CAMPOS DE TEXTO DEL FORMULARIO "CONTACTAR CON NOSOTROS"
function estilos_hover(descripcion){
	eval('caja_'+descripcion).className='fondo_'+descripcion+'_on';
}

function estilos_out(descripcion){
	eval('caja_'+descripcion).className='fondo_'+descripcion+'_off';
}


function abrir_oferta(oferta){
	var ofe =  "../../../pdf/pub/destacadas/" + oferta;
	window.open(ofe,'','width=792, height=592, resizable=yes');
}

function abrir_oferta_centro(enlace){
	var url =  "../../../pdf/pub/destacadas/" + enlace;
	var vwidth = 900;
 	var vheigth = 600;
	var posx = (screen.height-vheigth)/2;
	var posy = (screen.width-vwidth)/2;
	var horizontal = posy - 18;
 	window.open(url,'','width='+ vwidth +', height='+ vheigth +', toolbar=no, scrollbars=yes, location=no, directories=no, status=yes, menubar=no, resizable=yes, top='+ posx +', left='+ horizontal);
}


function pdf_banner(oferta){
	var ofe =  "../../../pdf/pub/banner/" + oferta;
	window.open(ofe,'','width=792, height=592, resizable=yes');
}

function pop_600x600(oferta){
	window.open(oferta,'','width=792, height=592, resizable=yes');
}


// INICIO DE: Funciones para la cortina absoluta
var tempo;
var opa = 0;

function fade_in() {
  opa+=10;
  if (opa==100) clearInterval(tempo);
  obj = top.iframe_cortina.document.getElementById('contenedor_popup_generica');
  if (document.all)
    obj.style.filter = 'alpha(opacity='+opa+')';
  else
    obj.style.MozOpacity = opa/100; 
    obj.style.opacity = opa/100; 
}

function fade_out() {
  opa=0;
  if (opa==0) clearInterval(tempo);
  obj = top.iframe_cortina.document.getElementById('contenedor_popup_generica');
  if (document.all)
    obj.style.filter = 'alpha(opacity='+opa+')';
  else
    obj.style.MozOpacity = opa*0; 
    obj.style.opacity = opa*0; 
}

function abrir_cortina(url){
//	top.document.getElementById('iframe_cortina').style.width = top.window.frames['iframe_cortina'].document.getElementById('contenedor_popup_generica').clientWidth+1;
	top.document.body.style.overflowX='hidden';
	top.document.body.style.overflowY='hidden';
	top.document.getElementById('cortina_absoluta').style.display ='inline';
	top.document.getElementById('contenedor_tabla_iframe_cortina').style.display ='inline';	
	top.document.getElementById('contenedor_iframe_cortina').style.display ='inline';
	tempo=setInterval('fade_in()',1);
	opa = 0;
	setTimeout("top.iframe_cortina.iframe_pop_cortina.location.href = '" + url + "';", 100);
}

function cerrar_cortina(){
	top.document.getElementById('cortina_absoluta').style.display='none';
	top.document.getElementById('contenedor_tabla_iframe_cortina').style.display='none';
	top.document.getElementById('contenedor_iframe_cortina').style.display ='none';
	top.document.body.style.overflowX='auto';
	top.document.body.style.overflowY='scroll';
	top.document.getElementById('principal').style.width = top.document.body.offsetWidth-21;
	fade_out();
	opa = 0;
	top.window.frames['iframe_cortina'].location='../../../html/pub/popups/generica.html';
}

function ajustar_popup(){
	
	var navegador = navigator.appName 

	if (navegador == "Microsoft Internet Explorer"){ 
		top.document.getElementById('iframe_cortina').style.width = document.getElementById('contenedor_popup_generica').clientWidth+1;
		top.document.getElementById('iframe_cortina').style.height = document.getElementById('contenedor_popup_generica').clientHeight;
		document.getElementById('borde_sup_pop_cortina').style.width = document.getElementById('iframe_pop_cortina').clientWidth;
		document.getElementById('borde_inf_pop_cortina').style.width = document.getElementById('iframe_pop_cortina').clientWidth;
		setTimeout("ajustar_popup()", 1);
	}else{ 
		top.document.getElementById('iframe_cortina').style.width = document.getElementById('contenedor_popup_generica').clientWidth;
		top.document.getElementById('iframe_cortina').style.height = document.getElementById('contenedor_popup_generica').clientHeight;
		document.getElementById('borde_sup_pop_cortina').style.width = document.getElementById('iframe_pop_cortina').clientWidth;
		document.getElementById('borde_inf_pop_cortina').style.width = document.getElementById('iframe_pop_cortina').clientWidth;
		setTimeout("ajustar_popup()", 1);
	}
//	top.document.getElementById('iframe_cortina').style.width = document.getElementById('contenedor_popup_generica').clientWidth+1;
//	top.document.getElementById('iframe_cortina').style.height = document.getElementById('contenedor_popup_generica').clientHeight;
//	document.getElementById('borde_sup_pop_cortina').style.width = document.getElementById('iframe_pop_cortina').clientWidth;
//	document.getElementById('borde_inf_pop_cortina').style.width = document.getElementById('iframe_pop_cortina').clientWidth;
//	setTimeout("ajustar_popup()", 1);
}

function anchopop(wpop){
	top.window.frames['iframe_cortina'].document.getElementById('iframe_pop_cortina').style.width= wpop;
}

function altopop(hpop){
	top.window.frames['iframe_cortina'].document.getElementById('iframe_pop_cortina').style.height= hpop;
}

function scrolling(valor){
	var navegador = navigator.appName 

	if (navegador == "Microsoft Internet Explorer"){
	}else{
		if(valor=='si'){
			top.window.frames['iframe_cortina'].document.getElementById('iframe_pop_cortina').style.overflowY= 'scroll';
			top.window.frames['iframe_cortina'].document.getElementById('iframe_pop_cortina').style.overflowX= 'auto';
		}
		if(valor=='no'){
			top.window.frames['iframe_cortina'].document.getElementById('iframe_pop_cortina').style.overflowY= 'hidden';
			top.window.frames['iframe_cortina'].document.getElementById('iframe_pop_cortina').style.overflowX= 'hidden';
		}
	}
}
// FIN DE: Funciones para la cortina absoluta


// FUNCION PARA ABRIR EL DESPLEGABLE DE DELEGACION
function desplegar(event){
	if(caja_delegacion.className=='fondo_delegacion_on'){
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if(keyCode==40){
			caja_delegacion_on.style.display='inline';
			formi.delegacion_2.focus();
		}
	}
}


//FUNCION PARA MOVERSE POR LAS OPCIONES DEL DESPLEGABLE DE DELEGACION CON LAS FLECHAS DEL TECLADO
function tecla_presionada (event, valor) {
	if (caja_delegacion_on.style.display=='inline'){
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		
		var opcion_mayor = valor + 1;
		var opcion_menor = valor - 1;
		
		if(keyCode==40 && opcion_mayor< 16){
			eval('formi.delegacion_'+opcion_mayor).focus();
			for (a=3; a<=15; a++){
				eval('formi.delegacion_'+a).className='estilo_delegacion_off';
			}
			eval('formi.delegacion_'+opcion_mayor).className='estilo_delegacion_over';
		}
		
		if(keyCode==38 && opcion_menor> 2){
			eval('formi.delegacion_'+opcion_menor).focus();
			for (b=15; b>=3; b--){
				eval('formi.delegacion_'+b).className='estilo_delegacion_off';
			}
			eval('formi.delegacion_'+opcion_menor).className='estilo_delegacion_over';
		}
		
		if(keyCode==13){
			formi.domicilio.focus();
		}
	}
}      

function catalogos_full(catalogo){
	var cat =  "" + catalogo;
	var vwidth = screen.width-10;
 	var vheigth = screen.height-65;
 	window.open(cat,'','width='+vwidth +',height='+ vheigth +', toolbar=no,scrollbars=yes,location=no,directories=no, status=no, menubar=no,resizable=yes, top=0, left=0');
}

function popCatalogo(URL) {
	if(URL!='0'){
	  var vwidth = screen.width-10;
	  var vheigth = screen.height-65;
	  day = new Date();
	  id = day.getTime();
	  eval("page" + id + " = window.open(URL, '" + id + "','width='+vwidth +',height='+ vheigth +', toolbar=no,scrollbars=yes,location=no,directories=no, status=no, menubar=no,resizable=yes, top=0, left=0');");
    }
}

function combobox_on(){
	document.getElementById('contenedor_combobox_catalogos').style.display ='inline';	
}


function abrir_pdf(enlace){
	var url =  "http://www.catalogostravelplan.com/pdf/pub/promociones_reserva/" + enlace;
	var vwidth = 900;
 	var vheigth = 600;
	var posx = (screen.height-vheigth)/2;
	var posy = (screen.width-vwidth)/2;
	var horizontal = posy - 18;
 	window.open(url,'','width='+ vwidth +', height='+ vheigth +', toolbar=no, scrollbars=yes, location=no, directories=no, status=yes, menubar=no, resizable=yes, top='+ posx +', left='+ horizontal);
}

