if (navigator.appName == "Microsoft Internet Explorer") {ie=true;} else {ie=false;}
function GE(obj) {
	return document.getElementById(obj);
}
function verThumb(img){
	document.getElementById("imgCont").src=img;
	return false;
}
function volver(){
	window.history.back();
	return false;
}
function overCel(obj){
	obj.style.backgroundColor='#ffffff';
}
function outCeld(obj, id){
	color='#EFF3F1';
	if(id=='1'){
		color='#F5F7F6';
	}
	obj.style.backgroundColor=color;
}

function filtrarTecla(e){
	var tecla = (e.keyCode) ? e.keyCode : e.which;
	if(e.ctrlKey && tecla==118) return false;
    if(tecla==8 || tecla==9 || tecla==0 || tecla==13 || tecla==46 || tecla==35 || tecla==36 || tecla==37 || tecla==39 || tecla==32) return true;
	patron = /[a-zA-Z]/;
    te = String.fromCharCode(tecla);
    return patron.test(te);
}

function soloLetras(e){
	tecla = (e.keyCode) ? e.keyCode : e.which;
	if(e.ctrlKey && tecla==118 || tecla==39) return false;
    if (tecla==8 || tecla==0 || tecla==13 || tecla==9 || tecla==32) return true;
    patron = /[A-Za-z]/;
    return patron.test(String.fromCharCode(tecla));
}
function dateDiff(f1, f2){
	_s = "/";
	vF1 = f1.split(_s);
	_f1 = new Date(vF1[1] + _s + vF1[0] + _s + vF1[2]);
	vF2 = f2.split(_s);
	_f2 = new Date(vF2[1] + _s + vF2[0] + _s + vF2[2]);
	return (_f2-_f1)/24/60/60/1000;
}

function dateAdd(fecha, dias){
	_s = "/";
	vFecha = fecha.split(_s);
	time = new Date(vFecha[2],vFecha[1]-1,vFecha[0]);
	time = new Date(time.valueOf()+dias*1000*3600*24);
	return time.getDate().biDig() + _s + (time.getMonth()+1).biDig() + _s + time.getFullYear();
}

Number.prototype.biDig = function(){
	return Number(this)<10 ? "0"+this : this;
}

memSRC = "";
function rollOver(obj){memSRC = obj.src;obj.src =  memSRC.substr(0,memSRC.length-4) + "_over" + memSRC.substring(memSRC.length-4);}
function rollOut(obj){obj.src =  memSRC;}
function Cachear(){
	cacheOver=[];
	for(im=0; im<Cachear.arguments.length; im++){
		imagenCachear = Cachear.arguments[im];
		cacheOver[im] = new Image();
		cacheOver[im].src = imagenCachear;
	}
}
function BipCache(){
	var DI=document.images;
	for(var i=0;i<DI.length; i++){
		if(DI[i].className){
			if(DI[i].className.toString().toLowerCase().indexOf('rollover')>-1){
				path=DI[i].src;
				ext=path.substr(path.length-4,4);
				img=path.substr(0,path.length-4);
				Cachear(img+'_over'+ext);
				DI[i].onmouseover=new Function('rollOver(this)');
				DI[i].onmouseout=new Function('rollOut(this)');
			}
		}
	}
}
function expandir(obj){
	with(GE(obj)){
		if(style.display=="block"){
			style.display="none";
		}else{
			style.display="block";
		}
	}
}

// scroll
_yscroll=_scrollto=0;
function scrollerTo(posv){
	_yscroll = getTopScroll();
	_scrollto=posv;
	intervalScroll=setInterval(scrollerMove,50);
	return false;
}
function scrollerMove(){
	_yscroll += (_scrollto-_yscroll)/2;
	_ymove=Math.round(_yscroll);
	if(_ymove==_scrollto){
		clearInterval(intervalScroll);
	}
	window.scrollTo(0,_ymove);
}
function getTopScroll(){
	if(self.pageYOffset){
		scrolTop = self.pageYOffset;
	}else if (document.documentElement && document.documentElement.scrollTop){
		scrolTop = document.documentElement.scrollTop;
	}else if (document.body){
		scrolTop = document.body.scrollTop;
	}
	return scrolTop;
}

function wl(ruta){
	window.location=ruta;
}

function CNhotel(noches) {
	document.busquedaHotelesForm.Hasta.value = dateAdd(document.busquedaHotelesForm.Desde.value, noches.value);
}
function setTip(obj,texto) {
	if(obj.value==texto){
		obj.value='';
		obj.style.color='#6D7783';
	}
}

function setCookie(nombre, valor) {
	caduca=new Date(2010, 12, 31);
	document.cookie = nombre + "=" + escape(valor) + "; expires=" + caduca.toGMTString();
}
function getCookie(nombre) {
  var buscar = nombre + "=";
  if (document.cookie.length > 0) {
	i = document.cookie.indexOf(buscar);
	if (i != -1) {
	  i += buscar.length;
	  j = document.cookie.indexOf(";", i);
	  return unescape(document.cookie.substring(i,j));
	}else{
		return ""
	}
  }
}

// Multiple
function SetLinea(sel) {
	/* if(sel.value != '' && GE('CiasID').length<3){
		GE('btnAddAero').style.visibility='visible';
	}else{
		GE('btnAddAero').style.visibility='hidden';
	}*/
}
function AgregarLinea() {
	if(document.MotorFrmVuelos.aerolinea.selectedIndex==0){
		alert('Para agregar multiples aerolineas, debe seleccionarla primero.')
		return false;
	}
	if(document.MotorFrmVuelos.CiasID.length != 3) {
		var newOpt = document.createElement("OPTION");
		aeroText = document.MotorFrmVuelos.aerolinea.options[document.MotorFrmVuelos.aerolinea.selectedIndex].text;
		aeroValue = document.MotorFrmVuelos.aerolinea.options[document.MotorFrmVuelos.aerolinea.selectedIndex].value;
		if(aeroValue=='') {
			return false;
		}
		if (document.MotorFrmVuelos.CiasID.length>0) {
			for(i=0;i<document.MotorFrmVuelos.CiasID.length;i++){
				if(GE('CiasID').options[i].value == aeroValue){
					alert(aeroText+" ya se encuentra dentro de la lista.")
					return false;
				}
			}
			if(GE('CiasID').options[document.MotorFrmVuelos.CiasID.length-1].value == aeroValue) {
				return false;
			}
		}
		newOpt.text = aeroText;
		newOpt.value = aeroValue;
		GE('CiasID').options.add(newOpt);
		GE('btnDelAero').style.visibility='visible';
		if(GE('CiasID').length==3){
			GE('btnAddAero').style.visibility='hidden';
		}
	}
}
function EliminarLinea() {
	var selLength = document.MotorFrmVuelos.CiasID.length;
	if (selLength>0) {
		var optSel = GE('CiasID').selectedIndex;
		if (optSel>=0) {
			selLength = optSel;
		} else {
			selLength -= 1;
		}
		GE('CiasID').remove(selLength);
		if(GE('CiasID').length==0){
			GE('btnDelAero').style.visibility='hidden';
		}else{
			GE('btnAddAero').style.visibility='visible';
		}
	}
}

// document.write('<script type="text/javascript" src="../js/swfobject.js"></script>');
