function showsubmenu(target, lang, web){
	if(document.getElementById(target+'sub')){
		document.getElementById(target+'sub').style.display='block';
	}
	document.getElementById(target+'img').src=web+'/images/'+target+lang+'_over.gif';
}

function hidesubmenu(target, lang, web){
	if(document.getElementById(target+'sub')){
		document.getElementById(target+'sub').style.display='none';
	}
	document.getElementById(target+'img').src=web+'/images/'+target+lang+'.gif';
}

function validar(obj, error)
{
var Valido = false;
for (i=0; i < obj.opcion_enc.length; i++) {
	Valido = Valido || obj.opcion_enc[i].checked;
}
if (!Valido)
	alert (error);
return Valido;						
}

function SelectAll(id)
{
	document.getElementById(id).focus();
	document.getElementById(id).select();
}

function showhotel(collapse1, collapse2)
{
	collapse2.slideup();
	setTimeout("collapse1.slidedown()",1000);
}

function showtour(collapse1, collapse2)
{
	collapse1.slideup();
	setTimeout("collapse2.slidedown()",1000);
}

function abrirventana(url,vwidth,vheight)
{
        LeftPosition = (screen.width) ? (screen.width-vwidth)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-vheight)/2 : 0;
        var win_param;
        win_param="top="+TopPosition+",left="+LeftPosition+",width="+vwidth+",height="+vheight+"channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=no,status=0,toolbar=0,screenX=0,screenY=0";
		msgWindow=open(url,"smallWindow",win_param);
        msgWindow.focus();
        msgWindow.opener= self;
        return false;
}
function abrirventana_2(url,vwidth,vheight)
{
        LeftPosition = (screen.width) ? (screen.width-vwidth)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-vheight)/2 : 0;
        var win_param;
        win_param="top="+TopPosition+",left="+LeftPosition+",width="+vwidth+",height="+vheight+"channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=yes,status=0,toolbar=0,screenX=0,screenY=0";
		msgWindow=open(url,"smallWindow",win_param);
        msgWindow.focus();
        msgWindow.opener= self;
        return false;
}
function abrirventana_print(url,vwidth,vheight)
{
        LeftPosition = (screen.width) ? (screen.width-vwidth)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-vheight)/2 : 0;
        var win_param;
        win_param="top="+TopPosition+",left="+LeftPosition+",width="+vwidth+",height="+vheight+"channelmode=0,dependent=0,directories=1,fullscreen=0,location=1,menubar=1,resizable=0,scrollbars=no,status=1,toolbar=1,screenX=0,screenY=0";
		msgWindow=open(url,"smallWindow",win_param);
        msgWindow.focus();
        msgWindow.opener= self;
        return false;
}

function Smile(texto){
document.frm_librovisitas.txt_mensaje.value = document.frm_librovisitas.txt_mensaje.value + texto;
}

function agregarfavoritos(a,fav){ 
   if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) { 
      var url="http://www.fortunawelcome.com/"; 
      var titulo="Fortunawelcome - " + a ; 
      window.external.AddFavorite(url,titulo); 
   } 
   else if(navigator.appName == "Netscape"){ 
         alert (fav); 
   } 
} 

function abrir_imagen(img_Tipo,img_Nomb,img_Width,img_Height,alt) {  // v4.01
	LeftPosition = (screen.width) ? (screen.width-img_Width)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-img_Height)/2 : 0;
	newWindow = window.open("","newWindow","width="+img_Width+",height="+img_Height+",scrollbars=no,left="+LeftPosition+",top="+10);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	newWindow.document.write('<img src=\"'+img_Nomb+"."+img_Tipo+'\" width='+img_Width+' height='+img_Height+' alt=\"'+alt+'\">'); 	
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function barra(txt){
	window.status = txt;
	setTimeout("borra()",2000);
}
function borra() {
	window.status="";
}

function dame_correo(a_1,a_2,a_3){ 
	return a_1 + a_2 + a_3 
} 

function escribe_enlace_correo(a_1,a_2,a_3,a_4){ 
	document.write("<a href='mailto:" + dame_correo(a_1,a_2,a_3) + "?subject="+ a_4 +"'>" + dame_correo(a_1,a_2,a_3) + "</a>") 
}

//Función para imágenes cambiantes
/*var slideCache = new Array();
function SlideShow(pictureName,imageFiles,displaySecs)
{
  var imageSeparator = imageFiles.indexOf(";");
  var nextImage = imageFiles.substring(0,imageSeparator);
  if (document.all)
  {
	document.getElementById(pictureName).style.filter="blendTrans(duration=2)";
	document.getElementById(pictureName).filters.blendTrans.Apply();
  }
  document.getElementById(pictureName).src = nextImage;
  if (document.all)
  {
	document.getElementById(pictureName).filters.blendTrans.Play();
  }
  var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length)
	+ ';' + nextImage;
  setTimeout("SlideShow('"+pictureName+"','"+futureImages+"',"+displaySecs+")",
	displaySecs*1000);
  // Cache the next image to improve performance.
  imageSeparator = futureImages.indexOf(";");
  nextImage = futureImages.substring(0,imageSeparator);
  if (slideCache[nextImage] == null) {
	slideCache[nextImage] = new Image;
	slideCache[nextImage].src = nextImage;
  }
}*/

var zindex=0;
function fade(n,diff,opacity){
	id=divs[n];
	opacity=(opacity)?opacity:(diff<0)?100:0; opacity+=diff;
	if(document.getElementById&&document.all){
		document.getElementById(id).style.filter="alpha(opacity="+opacity+")";
	}else if(document.getElementById&&!document.all){
		document.getElementById(id).style.MozOpacity = opacity/100;
	}
	document.getElementById(id).style.visibility="visible";
	if(opacity>=99){
		zindex++;
		document.getElementById(id).style.zIndex=zindex;
		setTimeout("fade("+n+",-"+diff+","+opacity+");",tiempo);
		nn=(n==divs.length-1)?0:n+1;
		setTimeout("fade("+nn+","+diff+");",tiempo);
	} else if(opacity>0){
		setTimeout("fade("+n+","+diff+","+opacity+");",30);
	}
}

function showTaxes(campos){
	xDisplay('hidetaxes', 'none')
	xDisplay('showtaxes', 'block')
	var i;
	for (i=1; i<= campos; i=i+1){
		xDisplay('notaxes'+i+'', 'none')
		xDisplay('taxes'+i+'', 'block')		
	}
}
function hideTaxes(campos){
	xDisplay('hidetaxes', 'block')
	xDisplay('showtaxes', 'none')
	var i;
	for (i=1; i<= campos; i=i+1){
		xDisplay('notaxes'+i+'', 'block')
		xDisplay('taxes'+i+'', 'none')	
	}
}

function initBtns()
{
  var i = 1, e;
  do {
    e = xGetElementById('btn' + i);
    if (e) {
      e.onclick = btnOnClick;
      e.buttonID = i++;
    }
  } while (e);
  e = xGetElementsByClassName('btn0');
  for (i = 0; i < e.length; ++i) {
    e[i].onclick = btnOnClick;
    e[i].buttonID = 0;
  }
}
function btnOnClick()
{
  var i = this.buttonID;
  var y = xPageY(i ? 'dc'+i : xParent(this));
  xa.scroll(window, 0, i ? y-40 : 0, y, 1);
}

function dame_correo(){ 
	return usuario + conector + dominio 
}
function mailpage(titulo,descripcion,email,domain){
	usuario = email; 
	dominio = domain;
	conector = "@";
	mail_str = "mailto:"+ dame_correo() +"?subject="+ titulo +"";
	mail_str += "&body="+ descripcion +"";
	location.href = mail_str;
}

//Funcion para refrescar la pagina
function refrescar(){
    window.location.reload( false );
}

//Funcion para darle onfocus a los campos del formulario en IE
sfFocus = function() {
	var sfEls = document.getElementsByTagName("INPUT");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onfocus=function() {
			this.className+=" sffocus";
		}
		sfEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp(" sffocus\\b"), "");
		}
	}
}

//Evitamos el autocomplete
function init(id) {
	if (!document.getElementById) return false;
	var f = document.getElementById(id);
	//var u = f.elements[0];
	f.setAttribute("autocomplete", "off");
	//u.focus();
}

//Objeto ajax
function crearAjax(){ 
	/*Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui*/
	var xmlHttp = false;
	try{
		// Creacion del objeto AJAX para navegadores no IE
		xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e){
		try{
			// Creacion del objet AJAX para IE
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(E){
			if (!xmlHttp && typeof XMLHttpRequest != 'undefined') xmlHttp = new XMLHttpRequest();
		}
	}
	return xmlHttp; 
}
