function getAbsoluteElementPosition(element) {
  if (typeof element == "string")
    element = document.getElementById(element)
    
  if (!element) return { top:0,left:0 };
  
  var y = 0;
  var x = 0;
  while (element.offsetParent) {
    x += element.offsetLeft;
    y += element.offsetTop;
    element = element.offsetParent;
  }
  return {top:y,left:x};
}


function ensenar()
{
	document.getElementById("resumen").style.display = "block";
  	var elemento = document.getElementById("otrosEnlaces");
  	var pos = getAbsoluteElementPosition(elemento);
	pos.top = pos.top - 125;
	document.getElementById("resumen").style.top = pos.top+"px";
	document.getElementById("resumen").style.left = pos.left+"px";
}

function esconder()
{
	document.getElementById("resumen").style.display = "none";
}

function mostrar(id)
{
	if (document.getElementById('td_sub_' + id)!= 'null'){
		if (document.getElementById('td_sub_' + id).style.display != ''){
			document.getElementById('td_sub_' + id).style.display ='';
			document.getElementById('vinculo' + id).className ="link1_over";
		}
		else {
			document.getElementById('td_sub_' + id).style.display='none';
			document.getElementById('vinculo' + id).className ="link1";
		}
	}
}

function mostrarocultar()
{
 	   if (document.getElementById("subterminos").style.display != 'none'){
			document.getElementById("subterminos").style.display ='none';
		}
		else {
			document.getElementById("subterminos").style.display='block';
		}
}

var vent;

function openPopUp(id)
{
	if (id == 1) {
		if (vent)
			vent.close();
		vent =  window.open('http://www.hotelcalipolis.com/Aviso-Legal_es.html','_blank','scrollbars=no, resizable=no, toolbar=no, statusbar=no, width=420, height=625');
		vent.moveTo((screen.width-450)/2,50);
	}
	else {
		if (id == 2) {
			if (vent)
				vent.close();
			vent =  window.open('http://www.hotelcalipolis.com/Terminos-y-Condiciones_es.html','_blank','scrollbars=no, resizable=no, toolbar=no, statusbar=no, width=420, height=625');
			vent.moveTo((screen.width-450)/2,50);
		}
		else {
			if (vent)
				vent.close();
			vent =  window.open('http://www.hotelcalipolis.com/Emas_es.html','_blank','scrollbars=no, resizable=no, toolbar=no, statusbar=no, width=420, height=625');
			vent.moveTo((screen.width-450)/2,50);
		}
	}
}

function openPopUpEmpresa()
{
	if (validar('document.formIdEmpresa', 'codigoEmpresa', 'Acceso a Profesionales', ''))
	{
	 	vent = window.open('', 'popUpEmpresa', 'width=450, height=192, scrollbars=yes, statusbar=no, resizable=yes');				
		centrarVentana(vent, 450, 192);
		vent.focus();
		document.formIdEmpresa.submit();
	}
}


