
//////////////////////////////////////////////////////////FUNCIONES DD_roundies/////////////////////////////////////////////////////////////
/** 
* DD_roundies, this adds rounded-corner CSS in standard browsers and VML sublayers in IE that accomplish a similar appearance when comparing said browsers.
* Author: Drew Diller
* Email: drew.diller@gmail.com
* URL: http://www.dillerdesign.com/experiment/DD_roundies/
* Version: 0.0.2a
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_roundies/#license
*
* Usage:
* DD_roundies.addRule('#doc .container', '10px 5px'); // selector and multiple radii
* DD_roundies.addRule('.box', 5, true); // selector, radius, and optional addition of border-radius code for standard browsers.
* 
* Just want the PNG fixing effect for IE6, and don't want to also use the DD_belatedPNG library?  Don't give any additional arguments after the CSS selector.
* DD_roundies.addRule('.your .example img');
**/
var DD_roundies = {

	ns: 'DD_roundies',
	
	IE6: false,
	IE7: false,
	IE8: false,
	IEversion: function() {
		if (document.documentMode != 8 && document.namespaces && !document.namespaces[this.ns]) {
			this.IE6 = true;
			this.IE7 = true;
		}
		else if (document.documentMode == 8) {
			this.IE8 = true;
		}
	},
	querySelector: document.querySelectorAll,
	selectorsToProcess: [],
	imgSize: {},
	
	createVmlNameSpace: function() { /* enable VML */
		if (this.IE6 || this.IE7) {
			document.namespaces.add(this.ns, 'urn:schemas-microsoft-com:vml');
		}
		if (this.IE8) {
			document.writeln('<?import namespace="' + this.ns + '" implementation="#default#VML" ?>');
		}
	},
	
	createVmlStyleSheet: function() { /* style VML, enable behaviors */
		/*
			Just in case lots of other developers have added
			lots of other stylesheets using document.createStyleSheet
			and hit the 31-limit mark, let's not use that method!
			further reading: http://msdn.microsoft.com/en-us/library/ms531194(VS.85).aspx
		*/
		var style = document.createElement('style');
		document.documentElement.firstChild.insertBefore(style, document.documentElement.firstChild.firstChild);
		if (style.styleSheet) { /* IE */
			try {
				var styleSheet = style.styleSheet;
				styleSheet.addRule(this.ns + '\\:*', '{behavior:url(#default#VML)}');
				this.styleSheet = styleSheet;
			} catch(err) {}
		}
		else {
			this.styleSheet = style;
		}
	},
	
	/**
	* Method to use from afar - refer to it whenever.
	* Example for IE only: DD_roundies.addRule('div.boxy_box', '10px 5px');
	* Example for IE, Firefox, and WebKit: DD_roundies.addRule('div.boxy_box', '10px 5px', true);
	* @param {String} selector - REQUIRED - a CSS selector, such as '#doc .container'
	* @param {Integer} radius - REQUIRED - the desired radius for the box corners
	* @param {Boolean} standards - OPTIONAL - true if you also wish to output -moz-border-radius/-webkit-border-radius/border-radius declarations
	**/
	addRule: function(selector, rad, standards) {
		if (typeof rad == 'undefined' || rad === null) {
			rad = 0;
		}
		if (rad.constructor.toString().search('Array') == -1) {
			rad = rad.toString().replace(/[^0-9 ]/g, '').split(' ');
		}
		for (var i=0; i<4; i++) {
			rad[i] = (!rad[i] && rad[i] !== 0) ? rad[Math.max((i-2), 0)] : rad[i];
		}
		if (this.styleSheet) {
			if (this.styleSheet.addRule) { /* IE */
				var selectors = selector.split(','); /* multiple selectors supported, no need for multiple calls to this anymore */
				for (var i=0; i<selectors.length; i++) {
					this.styleSheet.addRule(selectors[i], 'behavior:expression(DD_roundies.roundify.call(this, [' + rad.join(',') + ']))'); /* seems to execute the function without adding it to the stylesheet - interesting... */
				}
			}
			else if (standards) {
				var moz_implementation = rad.join('px ') + 'px';
				this.styleSheet.appendChild(document.createTextNode(selector + ' {border-radius:' + moz_implementation + '; -moz-border-radius:' + moz_implementation + ';}'));
				this.styleSheet.appendChild(document.createTextNode(selector + ' {-webkit-border-top-left-radius:' + rad[0] + 'px ' + rad[0] + 'px; -webkit-border-top-right-radius:' + rad[1] + 'px ' + rad[1] + 'px; -webkit-border-bottom-right-radius:' + rad[2] + 'px ' + rad[2] + 'px; -webkit-border-bottom-left-radius:' + rad[3] + 'px ' + rad[3] + 'px;}'));
			}
		}
		else if (this.IE8) {
			this.selectorsToProcess.push({'selector':selector, 'radii':rad});
		}
	},
	
	readPropertyChanges: function(el) {
		switch (event.propertyName) {
			case 'style.border':
			case 'style.borderWidth':
			case 'style.padding':
				this.applyVML(el);
				break;
			case 'style.borderColor':
				this.vmlStrokeColor(el);
				break;
			case 'style.backgroundColor':
			case 'style.backgroundPosition':
			case 'style.backgroundRepeat':
				this.applyVML(el);
				break;
			case 'style.display':
				el.vmlBox.style.display = (el.style.display == 'none') ? 'none' : 'block';
				break;
			case 'style.filter':
				this.vmlOpacity(el);
				break;
			case 'style.zIndex':
				el.vmlBox.style.zIndex = el.style.zIndex;
				break;
		}
	},
	
	applyVML: function(el) {
		el.runtimeStyle.cssText = '';
		this.vmlFill(el);
		this.vmlStrokeColor(el);
		this.vmlStrokeWeight(el);
		this.vmlOffsets(el);
		this.vmlPath(el);
		this.nixBorder(el);
		this.vmlOpacity(el);
	},
	
	vmlOpacity: function(el) {
		if (el.currentStyle.filter.search('lpha') != -1) {
			var trans = el.currentStyle.filter;
			trans = parseInt(trans.substring(trans.lastIndexOf('=')+1, trans.lastIndexOf(')')), 10)/100;
			for (var v in el.vml) {
				el.vml[v].filler.opacity = trans;
			}
		}
	},
	
	vmlFill: function(el) {
		if (!el.currentStyle) {
			return;
		} else {
			var elStyle = el.currentStyle;
		}
		el.runtimeStyle.backgroundColor = '';
		el.runtimeStyle.backgroundImage = '';
		var noColor = (elStyle.backgroundColor == 'transparent');
		var noImg = true;
		if (elStyle.backgroundImage != 'none' || el.isImg) {
			if (!el.isImg) {
				el.vmlBg = elStyle.backgroundImage;
				el.vmlBg = el.vmlBg.substr(5, el.vmlBg.lastIndexOf('")')-5);
			}
			else {
				el.vmlBg = el.src;
			}
			var lib = this;
			if (!lib.imgSize[el.vmlBg]) { /* determine size of loaded image */
				var img = document.createElement('img');
				img.attachEvent('onload', function() {
					this.width = this.offsetWidth; /* weird cache-busting requirement! */
					this.height = this.offsetHeight;
					lib.vmlOffsets(el);
				});
				img.className = lib.ns + '_sizeFinder';
				img.runtimeStyle.cssText = 'behavior:none; position:absolute; top:-10000px; left:-10000px; border:none;'; /* make sure to set behavior to none to prevent accidental matching of the helper elements! */
				img.src = el.vmlBg;
				img.removeAttribute('width');
				img.removeAttribute('height');
				document.body.insertBefore(img, document.body.firstChild);
				lib.imgSize[el.vmlBg] = img;
			}
			el.vml.image.filler.src = el.vmlBg;
			noImg = false;
		}
		el.vml.image.filled = !noImg;
		el.vml.image.fillcolor = 'none';
		el.vml.color.filled = !noColor;
		el.vml.color.fillcolor = elStyle.backgroundColor;
		el.runtimeStyle.backgroundImage = 'none';
		el.runtimeStyle.backgroundColor = 'transparent';
	},
	
	vmlStrokeColor: function(el) {
		el.vml.stroke.fillcolor = el.currentStyle.borderColor;
	},
	
	vmlStrokeWeight: function(el) {
		var borders = ['Top', 'Right', 'Bottom', 'Left'];
		el.bW = {};
		for (var b=0; b<4; b++) {
			el.bW[borders[b]] = parseInt(el.currentStyle['border' + borders[b] + 'Width'], 10) || 0;
		}
	},
	
	vmlOffsets: function(el) {
		var dims = ['Left', 'Top', 'Width', 'Height'];
		for (var d=0; d<4; d++) {
			el.dim[dims[d]] = el['offset'+dims[d]];
		}
		var assign = function(obj, topLeft) {
			obj.style.left = (topLeft ? 0 : el.dim.Left) + 'px';
			obj.style.top = (topLeft ? 0 : el.dim.Top) + 'px';
			obj.style.width = el.dim.Width + 'px';
			obj.style.height = el.dim.Height + 'px';
		};
		for (var v in el.vml) {
			var mult = (v == 'image') ? 1 : 2;
			el.vml[v].coordsize = (el.dim.Width*mult) + ', ' + (el.dim.Height*mult);
			assign(el.vml[v], true);
		}
		assign(el.vmlBox, false);
		
		if (DD_roundies.IE8) {
			el.vml.stroke.style.margin = '-1px';
			if (typeof el.bW == 'undefined') {
				this.vmlStrokeWeight(el);
			}
			el.vml.color.style.margin = (el.bW.Top-1) + 'px ' + (el.bW.Left-1) + 'px';
		}
	},
	
	vmlPath: function(el) {
		var coords = function(direction, w, h, r, aL, aT, mult) {
			var cmd = direction ? ['m', 'qy', 'l', 'qx', 'l', 'qy', 'l', 'qx', 'l'] : ['qx', 'l', 'qy', 'l', 'qx', 'l', 'qy', 'l', 'm']; /* whoa */
			aL *= mult;
			aT *= mult;
			w *= mult;
			h *= mult;
			var R = r.slice(); /* do not affect original array */
			for (var i=0; i<4; i++) {
				R[i] *= mult;
				R[i] = Math.min(w/2, h/2, R[i]); /* make sure you do not get funky shapes - pick the smallest: half of the width, half of the height, or current value */
			}
			var coords = [
				cmd[0] + Math.floor(0+aL) +','+ Math.floor(R[0]+aT),
				cmd[1] + Math.floor(R[0]+aL) +','+ Math.floor(0+aT),
				cmd[2] + Math.ceil(w-R[1]+aL) +','+ Math.floor(0+aT),
				cmd[3] + Math.ceil(w+aL) +','+ Math.floor(R[1]+aT),
				cmd[4] + Math.ceil(w+aL) +','+ Math.ceil(h-R[2]+aT),
				cmd[5] + Math.ceil(w-R[2]+aL) +','+ Math.ceil(h+aT),
				cmd[6] + Math.floor(R[3]+aL) +','+ Math.ceil(h+aT),
				cmd[7] + Math.floor(0+aL) +','+ Math.ceil(h-R[3]+aT),
				cmd[8] + Math.floor(0+aL) +','+ Math.floor(R[0]+aT)
			];
			if (!direction) {
				coords.reverse();
			}
			var path = coords.join('');
			return path;
		};
	
		if (typeof el.bW == 'undefined') {
			this.vmlStrokeWeight(el);
		}
		var bW = el.bW;
		var rad = el.DD_radii.slice();
		
		/* determine outer curves */
		var outer = coords(true, el.dim.Width, el.dim.Height, rad, 0, 0, 2);
		
		/* determine inner curves */
		rad[0] -= Math.max(bW.Left, bW.Top);
		rad[1] -= Math.max(bW.Top, bW.Right);
		rad[2] -= Math.max(bW.Right, bW.Bottom);
		rad[3] -= Math.max(bW.Bottom, bW.Left);
		for (var i=0; i<4; i++) {
			rad[i] = Math.max(rad[i], 0);
		}
		var inner = coords(false, el.dim.Width-bW.Left-bW.Right, el.dim.Height-bW.Top-bW.Bottom, rad, bW.Left, bW.Top, 2);
		var image = coords(true, el.dim.Width-bW.Left-bW.Right+1, el.dim.Height-bW.Top-bW.Bottom+1, rad, bW.Left, bW.Top, 1);
		
		/* apply huge path string */
		el.vml.color.path = inner;
		el.vml.image.path = image;
		el.vml.stroke.path = outer + inner;
		
		this.clipImage(el);
	},
	
	nixBorder: function(el) {
		var s = el.currentStyle;
		var sides = ['Top', 'Left', 'Right', 'Bottom'];
		for (var i=0; i<4; i++) {
			el.runtimeStyle['padding' + sides[i]] = (parseInt(s['padding' + sides[i]], 10) || 0) + (parseInt(s['border' + sides[i] + 'Width'], 10) || 0) + 'px';
		}
		el.runtimeStyle.border = 'none';
	},
	
	clipImage: function(el) {
		var lib = DD_roundies;
		if (!el.vmlBg || !lib.imgSize[el.vmlBg]) {
			return;
		}
		var thisStyle = el.currentStyle;
		var bg = {'X':0, 'Y':0};
		var figurePercentage = function(axis, position) {
			var fraction = true;
			switch(position) {
				case 'left':
				case 'top':
					bg[axis] = 0;
					break;
				case 'center':
					bg[axis] = 0.5;
					break;
				case 'right':
				case 'bottom':
					bg[axis] = 1;
					break;
				default:
					if (position.search('%') != -1) {
						bg[axis] = parseInt(position, 10) * 0.01;
					}
					else {
						fraction = false;
					}
			}
			var horz = (axis == 'X');
			bg[axis] = Math.ceil(fraction ? (( el.dim[horz ? 'Width' : 'Height'] - (el.bW[horz ? 'Left' : 'Top'] + el.bW[horz ? 'Right' : 'Bottom']) ) * bg[axis]) - (lib.imgSize[el.vmlBg][horz ? 'width' : 'height'] * bg[axis]) : parseInt(position, 10));
			bg[axis] += 1;
		};
		for (var b in bg) {
			figurePercentage(b, thisStyle['backgroundPosition'+b]);
		}
		el.vml.image.filler.position = (bg.X/(el.dim.Width-el.bW.Left-el.bW.Right+1)) + ',' + (bg.Y/(el.dim.Height-el.bW.Top-el.bW.Bottom+1));
		var bgR = thisStyle.backgroundRepeat;
		var c = {'T':1, 'R':el.dim.Width+1, 'B':el.dim.Height+1, 'L':1}; /* these are defaults for repeat of any kind */
		var altC = { 'X': {'b1': 'L', 'b2': 'R', 'd': 'Width'}, 'Y': {'b1': 'T', 'b2': 'B', 'd': 'Height'} };
		if (bgR != 'repeat') {
			c = {'T':(bg.Y), 'R':(bg.X+lib.imgSize[el.vmlBg].width), 'B':(bg.Y+lib.imgSize[el.vmlBg].height), 'L':(bg.X)}; /* these are defaults for no-repeat - clips down to the image location */
			if (bgR.search('repeat-') != -1) { /* now let's revert to dC for repeat-x or repeat-y */
				var v = bgR.split('repeat-')[1].toUpperCase();
				c[altC[v].b1] = 1;
				c[altC[v].b2] = el.dim[altC[v].d]+1;
			}
			if (c.B > el.dim.Height) {
				c.B = el.dim.Height+1;
			}
		}
		el.vml.image.style.clip = 'rect('+c.T+'px '+c.R+'px '+c.B+'px '+c.L+'px)';
	},
	
	pseudoClass: function(el) {
		var self = this;
		setTimeout(function() { /* would not work as intended without setTimeout */
			self.applyVML(el);
		}, 1);
	},
	
	reposition: function(el) {
		this.vmlOffsets(el);
		this.vmlPath(el);
	},
	
	roundify: function(rad) {
		this.style.behavior = 'none';
		if (!this.currentStyle) {
			return;
		}
		else {
			var thisStyle = this.currentStyle;
		}
		var allowed = {BODY: false, TABLE: false, TR: false, TD: false, SELECT: false, OPTION: false, TEXTAREA: false};
		if (allowed[this.nodeName] === false) { /* elements not supported yet */
			return;
		}
		var self = this; /* who knows when you might need a setTimeout */
		var lib = DD_roundies;
		this.DD_radii = rad;
		this.dim = {};

		/* attach handlers */
		var handlers = {resize: 'reposition', move: 'reposition'};
		if (this.nodeName == 'A') {
			var moreForAs = {mouseleave: 'pseudoClass', mouseenter: 'pseudoClass', focus: 'pseudoClass', blur: 'pseudoClass'};
			for (var a in moreForAs) {
				handlers[a] = moreForAs[a];
			}
		}
		for (var h in handlers) {
			this.attachEvent('on' + h, function() {
				lib[handlers[h]](self);
			});
		}
		this.attachEvent('onpropertychange', function() {
			lib.readPropertyChanges(self);
		});
		
		/* ensure that this elent and its parent is given hasLayout (needed for accurate positioning) */
		var giveLayout = function(el) {
			el.style.zoom = 1;
			if (el.currentStyle.position == 'static') {
				el.style.position = 'relative';
			}
		};
		giveLayout(this.offsetParent);
		giveLayout(this);
		
		/* create vml elements */
		this.vmlBox = document.createElement('ignore'); /* IE8 really wants to be encased in a wrapper element for the VML to work, and I don't want to disturb getElementsByTagName('div') - open to suggestion on how to do this differently */
		this.vmlBox.runtimeStyle.cssText = 'behavior:none; position:absolute; margin:0; padding:0; border:0; background:none;'; /* super important - if something accidentally matches this (you yourseld did this once, Drew), you'll get infinitely-created elements and a frozen browser! */
		this.vmlBox.style.zIndex = thisStyle.zIndex;
		this.vml = {'color':true, 'image':true, 'stroke':true};
		for (var v in this.vml) {
			this.vml[v] = document.createElement(lib.ns + ':shape');
			this.vml[v].filler = document.createElement(lib.ns + ':fill');
			this.vml[v].appendChild(this.vml[v].filler);
			this.vml[v].stroked = false;
			this.vml[v].style.position = 'absolute';
			this.vml[v].style.zIndex = thisStyle.zIndex;
			this.vml[v].coordorigin = '1,1';
			this.vmlBox.appendChild(this.vml[v]);
		}
		this.vml.image.fillcolor = 'none';
		this.vml.image.filler.type = 'tile';
		this.parentNode.insertBefore(this.vmlBox, this);
		
		this.isImg = false;
		if (this.nodeName == 'IMG') {
			this.isImg = true;
			this.style.visibility = 'hidden';
		}
		
		setTimeout(function() {
			lib.applyVML(self);
		}, 1);
	}
	
};

try {
	document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
DD_roundies.IEversion();
DD_roundies.createVmlNameSpace();
DD_roundies.createVmlStyleSheet();

if (DD_roundies.IE8 && document.attachEvent && DD_roundies.querySelector) {
	document.attachEvent('onreadystatechange', function() {
		if (document.readyState == 'complete') {
			var selectors = DD_roundies.selectorsToProcess;
			var length = selectors.length;
			var delayedCall = function(node, radii, index) {
				setTimeout(function() {
					DD_roundies.roundify.call(node, radii);
				}, index*100);
			};
			for (var i=0; i<length; i++) {
				var results = document.querySelectorAll(selectors[i].selector);
				var rLength = results.length;
				for (var r=0; r<rLength; r++) {
					if (results[r].nodeName != 'INPUT') { /* IE8 doesn't like to do this to inputs yet */
						delayedCall(results[r], selectors[i].radii, r);
					}
				}
			}
		}
	});
}

DD_roundies.js
DD_roundies.addRule('.curva', '10px', true);
DD_roundies.addRule('.curva5px', '5px', true);
DD_roundies.addRule ('.semicurva', '5px 5px 0px 0px',true);
DD_roundies.addRule ('.leftcurva', '0px 25px 0px 0px',true);

if(document.documentMode != 8){
	DD_roundies.addRule('.png'); 
}

//////////////////////////////////////////////////////////FIN FUNCIONES DD_roundies/////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////FUNCIONES DD_belatedPNG/////////////////////////////////////////////////////////////
//ACA VA PEGADA LAS FUNCIONS DE DD_belatedPNG 
//////////////////////////////////////////////////////////FIN FUNCIONES DD_belatedPNG/////////////////////////////////

//Esta funcion cambia el estilo de cualquier letra. Recibe 2 variables 'id' y 'tipo'. 'id' es el nombre donde se encuentra la palabra que se desea aplicar la funcion y 'tipo' sirve para indicar si cambia el color o vuelve a blanco(1 cambia el color, mayor a uno vuelve a blanco).
function btnCambioColor(id,tipo){
	if(tipo == 1){
		document.getElementById(id).style.color='#E1F0CB';
	}else{
		document.getElementById(id).style.color='#FFFFFF';
	}
}

//La funcion se puede utilizar en cualquier lado que sea necesario hacer un redireccionamiento a una pagina. Se le pasa solamente un paramentro "direccion" este parametro es la url a la que se quiere redireccionar 
function redireccionar(direccion){
	window.location.href = direccion;
}

// Borrar funciones si no se utilizan: login().'&limpia;'  
function iniciarAutoSuggestControl(){
	var oTextbox = new AutoSuggestControl(document.getElementById("caja_de_texto_pais_ciudad_hoteles_buscador"), new SuggestionProvider());
}

function iluminarBorder(id,color){
	document.getElementById(id).style.borderColor=color;
}

function desiluminarBorder(id,color){
	document.getElementById(id).style.borderColor=color;
}

function cambiar_estado_over (id,color){ 
	$('#'+id).css({'color':color}); 
}

function cambiar_estado_out (id,color){ 
	$('#'+id).css({'color':color}); 
}

function v_logout(tipo,url,data){
	//alert(tipo+' 55 '+url+' 55 '+data);
	$.ajax({
		type:tipo,
		url:url,
		data:data,
		success:function(d){
			cargar_informacion_logueo(d);
		}
	});
}

function mostrarInputPaquete(){
	document.getElementById('contenedor_caja_de_texto_ciudad_paquetes_buscador').appendChild(document.getElementById('caja_de_texto_pais_ciudad_hoteles_buscador'));
}

function login(a){ // Login en el Header
	switch(a){
		case 'mostrar':
			$('#contenedor_usuario_password_login').css({'visibility':'visible','paddingBottom':'50px'});
			$('#dato_texto_login').css({'visibility':'hidden','paddingTop':'0px'});
			$('#contenedor_registrarse_formulario_login').css({'visibility':'hidden','paddingTop':'0px'});
			$('#contenedor_login').css({'top':'0px'});
			$('#contenedor_boton_login').css({'top':'65px','visibility':'visible'});
		break;
		case 'cerrar':
			$('#contenedor_usuario_password_login').css({'visibility':'hidden','paddingBottom':'0px'});
			$('#dato_texto_login').css({'visibility':'visible','paddingTop':'50px'});
			$('#contenedor_registrarse_formulario_login').css({'visibility':'visible','paddingTop':'50px'});
			$('#contenedor_boton_login').css({'visibility':'hidden'});
		break;
	}
}
// Footer
function add() {
	if (window.sidebar&&window.sidebar.addPanel) window.sidebar.addPanel("Consult House Turismo S.A.","http://www.cht.com.ar","");
	else window.external.AddFavorite("http://www.cht.com.ar","Consult House Turismo S.A.");
}

function enviar_mail_a_un_amigo_pag_cht(a){
	$('#txt_nombre_enviar_amigo').attr('value','');
	$('#txt_mail_amigo_enviar_amigo').attr('value','');
	$('#txt_contenido_enviar_amigo').attr('value','');
	$('#texto_exito_envio_amigo').css({'visibility':'visible'});
}

function isDefined( variable) { return (typeof(window[variable]) != "undefined");}

function enviar_amigo_footer(){
	posicionarEnDiv('#idContHeader');
	version_nav = window.navigator.appVersion;
	if(version_nav.indexOf('6.0') != -1){
		$('#fade').css({'width':document.body.clientWidth});
		$('#fade').css({'height':document.body.clientHeight});
	}
	$('#contenedor_enviar_a_un_amigo_link').css({'display':'block'});
	$('#fade').css({'display':'block'});
	if (isDefined("pagina")){
		
	}else{
		pagina = 'vacio';
	}
	if(pagina == 'home') $('#contenedores_mis_reservas').css({'visibility':'hidden'});
}

	$(document).ready(function(){ // Para el efecto de cerrar la ventana de enviar a un amigo del footer
		$(".white_content .estilo_boton_cerrar").click(function(){
			$('#fade').css({'display':'none'});
			$('#texto_exito_envio_amigo').css({'visibility':'hidden'});
			if (isDefined("pagina")){
			
			}else{
				pagina = 'vacio';
			}
			if(pagina == 'home') $('#contenedores_mis_reservas').css({'visibility':'visible'});
			$(this).parents(".white_content").animate({opacity:'hide'},"slow");
		});
		/**
		*En el caso de que no se haya seleccionado una ciudad en el suggest eliminamos el contenido de la caja de texto
		*/
		$('#caja_de_texto_pais_ciudad_hoteles_buscador').blur(function(){
			switch(buscador_actual){
				case 'aereos':
					if($("#contenedor_caja_de_texto_pais_ciudad_desde_aereos_origen_buscador #caja_de_texto_pais_ciudad_hoteles_buscador").attr('value')!=undefined){if($('#ciudad_desde_aereos_buscador_principal').attr('value')=='')$('#caja_de_texto_pais_ciudad_hoteles_buscador').attr('value','');}else if($('#ciudad_hasta_aereos_buscador_principal').attr('value')=='')$('#caja_de_texto_pais_ciudad_hoteles_buscador').attr('value','');
				break;
				case 'hoteles':if($('#id_ciudad_sel').attr('value')==0)$('#caja_de_texto_pais_ciudad_hoteles_buscador').attr('value','');break;
				case 'destino':if($('#id_ciudad_sel_destino').attr('value')==0)$('#caja_de_texto_pais_ciudad_hoteles_buscador').attr('value','');break;
				case 'paquetes':if($('#id_ciudad_sel_paquetes').attr('value')==0)$('#caja_de_texto_pais_ciudad_hoteles_buscador').attr('value','');break;
				case 'asistencia':if($('#idCiudadSelAsistencia').attr('value')==0)$('#caja_de_texto_pais_ciudad_hoteles_buscador').attr('value','');break;
			}
		});
	});

// Comun
function validar_campos_de_texto(obj,tipo){
	switch(tipo){
		case 'num':
			num = obj.value;
			num_val = '';
			ceros_izq = 0;
			for(i=0;i<num.length;i++){
				if(/^([0-9])*$/.test(String(num.substring(i,i+1)))){
					if(/^([1-9])*$/.test(String(num.substring(i,i+1)))) ceros_izq = 1;
					if(ceros_izq || num.length == 1) num_val += num.substring(i,i+1);
				}
			}
			if(num.length == 0) num_val = 0;
			obj.value = num_val;
		break;
	}
}
function diasEntre(nDi0,nMe0,nAn0,nDi1,nMe1,nAn1){ // Obtiene los dias de diferencia entre dos fechas dadas
	var nRes;
	if (nDi1 < nDi0) nDi1 += finMes(nMe0, nAn0);
	nRes = Math.max(0, nDi1 - nDi0);
	return nRes;
}
function finMes(nMes,nAno){
	var nRes=0;
	switch (nMes){
		case 1:nRes=31;break;
		case 2:nRes=28;break;
		case 3:nRes=31;break;
		case 4:nRes=30;break;
		case 5:nRes=31;break;
		case 6:nRes=30;break;
		case 7:nRes=31;break;
		case 8:nRes=31;break;
		case 9:nRes=30;break;
		case 10:nRes=31;break;
		case 11:nRes=30;break;
		case 12:nRes=31;break;
	}
	return nRes+(((nMes == 2) && esBisiesto(nAno))? 1: 0);
}
function esBisiesto(nAno){
	var bRes = true;
	res = bRes && (nAno % 4 == 0);
	res = bRes && (nAno % 100 != 0);
	res = bRes || (nAno % 400 == 0);
	return bRes;
}
function onmouse_over_out_cambiar_imagen(id_btn,over_or_out,url_img,type){ // Función que cambia de imagen con el mouse
	//alert('/imagenes/'+url_img);
	if(type == 'STYLE'){
		if(over_or_out == 'OVER'){
			document.getElementById(id_btn).style.backgroundImage='url(/imagenes/'+url_img+')';
		}else{
			if(over_or_out == 'OUT'){
				document.getElementById(id_btn).style.backgroundImage='url(/imagenes/'+url_img+')';
			}
		}
	} else {
		if(type == 'SRC'){
			if(over_or_out == 'OVER'){
				//alert(id_btn);
				document.getElementById(id_btn).src = '/imagenes/'+url_img;
			}else{
				if(over_or_out == 'OUT'){
					document.getElementById(id_btn).src = '/imagenes/'+url_img;
				}
			}
		}
	}
}		

function enviar_datos_hotel_carrito(ID_hotel,NombreHotel,Categoria_hotel,Precio_Neto,Impuestos,Precio_Total,Moneda,Disponibilidad,Habitaciones,Posicion,escarrito,contractName,contractOffice,idSession,fecIdSessionReserva,fuente,idCiudad){
	$('#c_id_hotel').attr('value',ID_hotel);
	$('#c_nombre_hotel').attr('value',NombreHotel);
	$('#c_categoria_hotel').attr('value',Categoria_hotel);
	$('#c_precio_neto').attr('value',Precio_Neto);
	$('#c_impuesto').attr('value',Impuestos);
	$('#c_precio_total').attr('value',Precio_Total);
	$('#c_moneda').attr('value',Moneda);
	$('#c_disponibilidad').attr('value',Disponibilidad);
	$('#c_array_habitaciones').attr('value',Habitaciones);
	$('#c_posicion_array_habitaciones').attr('value',Posicion);
	$('#c_es_carrito').attr('value',escarrito);
	$('#c_contractName').attr('value',contractName);
	$('#c_contractOffice').attr('value',contractOffice);
	$('#c_id_sesion_reserva').attr('value',idSession);
	$('#c_fecha_id_sesion_reserva').attr('value',fecIdSessionReserva);
	$('#c_id_hotel_fuente').attr('value',fuente);
	$('#c_id_ciudad').attr('value',idCiudad);
	if(pagina=='hotel'){
		var hotel_a_buscar=''; // Va a contener el valor que se encuentra en la caja de texto de buscar por hotel
		var ciudad_a_buscar=''; // Va a contener el valor que se encuentra en la caja de texto de buscar por ciudad
		var playa_a_buscar=''; // Va a contener el valor que se encuentra en la caja de texto de buscar por playa
		var tipo_de_operacion='';
		var tipo_de_operacion2='';
		var tipo_de_operacion3='';
		obj_hotel_caja_de_texto=document.getElementById('txt_hotel_refinar');
		if(fuente_datos=="CH"){obj_playa_caja_de_texto=document.getElementById('txt_playa_refinar');}
		if(obj_hotel_caja_de_texto.value != ""){ // Si la caja de texto de Buscar por Hotel no está vacía
			texto_campo_filtrado=(obj_hotel_caja_de_texto.name).split("_");
			campo_a_buscar=texto_campo_filtrado[1];
			hotel_a_buscar=obj_hotel_caja_de_texto.value;
			tipo_de_operacion=campo_a_buscar;
		}
		if(fuente_datos=="CH"){
			if(obj_playa_caja_de_texto.value!=""){ // Si la caja de texto de Buscar por Playa no está vacía
				texto_campo_filtrado=(obj_playa_caja_de_texto.name).split("_");
				campo_a_buscar=texto_campo_filtrado[1];
				playa_a_buscar=obj_playa_caja_de_texto.value;
				tipo_de_operacion3=campo_a_buscar;
			}
		}
		filtros_actuales=contarMarcados(); // Obtenemos un string con todos los checkbox sel. de la sección filtros
		array_sel_comp_lista_json=convertToJson(); // Obtenemos un string en JSON con los hoteles seleccionados
		array_filtros_actuales=filtros_actuales.split("...");
		lista_categorias_a_enviar=array_filtros_actuales[0];
		lista_comodidades_a_enviar=array_filtros_actuales[1];
		lista_de_categorias_actuales=lista_categorias_a_enviar;
		lista_de_comodidades_actuales=lista_comodidades_a_enviar;
		texto_de_hotel_a_buscar_actuales=tipo_de_operacion+'_'+hotel_a_buscar;
		texto_de_playa_a_buscar_actuales=tipo_de_operacion3+'_'+playa_a_buscar;
		$("#c_page").attr('value',1);
		$("#c_nuevo_filtro_categorias").attr('value',lista_categorias_a_enviar);
		$("#c_nuevo_filtro_comodidades").attr('value',lista_comodidades_a_enviar);
		$("#c_tipo_de_operacion").attr('value',tipo_de_operacion);
		$("#c_hotel_a_filtrar").attr('value',hotel_a_buscar);
		$("#c_tipo_de_operacion2").attr('value',tipo_de_operacion2);
		$("#c_ciudad_a_filtrar").attr('value',ciudad_a_buscar);
		$("#c_tipo_de_operacion3").attr('value',tipo_de_operacion3);
		$("#c_playa_a_filtrar").attr('value',playa_a_buscar);
		$("#c_array_sel_comp_lista").attr('value',array_sel_comp_lista_json);
		$("#c_lista_de_categorias_actuales").attr('value',lista_de_categorias_actuales);
		$("#c_lista_de_servicios_actuales").attr('value',lista_de_comodidades_actuales);
		$("#c_id_hotel_detalle_hotel").attr('value',ID_hotel);
	}
	document.frm_carrito_de_compras.submit();
}
function ocultar_mostrar(div,cant){ // var div contiene los id a ocultar o mostrar, var cant indica si existe más de un id
	if(cant == 1){
		array_div_mosocu=div.split('.,.');
		if(array_div_mosocu[1] == 'mostrar'){
			position='relative';
			visibility='visible';
		} else {
			position='absolute';
			visibility='hidden';
		}
		document.getElementById(array_div_mosocu[0]).style.position=position;
		document.getElementById(array_div_mosocu[0]).style.visibility=visibility;
	} else {
		array_divs_mosocu=div.split('___');
		for(i=0;i<array_divs_mosocu.length;i++){
			array_div_mosocu=array_divs_mosocu[i].split('.,.');
			if(array_div_mosocu[1] == 'mostrar'){
				position='relative';
				visibility='visible';
			} else {
				position='absolute';
				visibility='hidden';
			}
			document.getElementById(array_div_mosocu[0]).style.position = position;
			document.getElementById(array_div_mosocu[0]).style.visibility = visibility;
		}
	}
}
function ocultar_mostrar_ayuda(div){ // var div contiene los id a ocultar o mostrar, var cant indica si existe más de un id
	array_div_mosocu=div.split('.,.');
	switch(array_div_mosocu[1]){
		case 'mostrar':
			document.getElementById(array_div_mosocu[0]).style.visibility='visible';
//			$('#'+array_div_mosocu[0]).animate({opacity:'show'},'slow');
		break;
		case 'ocultar':
			document.getElementById(array_div_mosocu[0]).style.visibility='hidden';
//			$('#'+array_div_mosocu[0]).animate({opacity:'hide'},'slow');
		break;
	}
}
function onmouse_over_out_cambiar_color(id, color, over_or_out){
	document.getElementById(id).style.background = color;
	//document.getElementsByClassName(id).style.background = color;
}

function abrir(direccion, nombreventana ,pantallacompleta, herramientas, direcciones, estado, barramenu, barrascroll, cambiatamano, ancho, alto, izquierda, arriba, sustituir){
	if(nombreventana == 'ventanChatForm'){
		direccion = document.getElementById('vchatonlinePrueba').value;
	}
	//alert(cambiatamano);
	//alert(nombreventana);
     var opciones = "fullscreen=" + pantallacompleta +
                 ",toolbar=" + herramientas +
                 ",location=" + direcciones +
                 ",status=" + estado +
                 ",menubar=" + barramenu +
                 ",scrollbars=" + barrascroll +
                 ",resizable=" + cambiatamano +//9898
                 ",width=" + ancho +
                 ",height=" + alto +
                 ",left=" + izquierda +
                 ",top=" + arriba;
	 //alert(opciones);
     var ventana = window.open(direccion,nombreventana,opciones,sustituir);

} 
function setVisibility(id, visibility){
	document.getElementById(id).style.display = visibility;
}
function enviar_datos_paquete_carrito(ID_tarifa_paquete,Codigo_Paquete,Nombrepaquete,Cantidad_personas,Impuestos, Precio_neto, Precio_Total, Moneda, Dias, Noches, Itinerario, Descripcion_paquete, Servicios_paquetes, Hoteles, Nombre_Paquete, ID_tipo_vuelo, incluyeaereoj, aereo_detalle,tipo_habitacion,escarrito,fecha,cant_fec){
	$('#c_id_tarifa_paquete_'+ID_tarifa_paquete).attr('value',ID_tarifa_paquete);
	$('#c_codigo_paquete_'+ID_tarifa_paquete).attr('value',Codigo_Paquete);
	$('#c_nombrepaquete_'+ID_tarifa_paquete).attr('value',Nombrepaquete);
	$('#c_moneda_'+ID_tarifa_paquete).attr('value',Moneda);
	$('#c_dias_'+ID_tarifa_paquete).attr('value',Dias);
	$('#c_noches_'+ID_tarifa_paquete).attr('value',Noches);
	$('#c_itinerario_'+ID_tarifa_paquete).attr('value',Itinerario);
	$('#c_descripcion_paquetes_'+ID_tarifa_paquete).attr('value',Descripcion_paquete);
	$('#c_incluye_'+ID_tarifa_paquete).attr('value',Servicios_paquetes);
	$('#c_hoteles_'+ID_tarifa_paquete).attr('value',Hoteles);
	$('#c_nombrepaquete_'+ID_tarifa_paquete).attr('value',Nombre_Paquete);
	$('#c_idtipovuelo_'+ID_tarifa_paquete).attr('value',ID_tipo_vuelo);
	$('#c_incluyeaereo_'+ID_tarifa_paquete).attr('value',incluyeaereoj);
	$('#c_aereodetalle_'+ID_tarifa_paquete).attr('value',aereo_detalle);
	$('#c_tipo_habitacion_'+ID_tarifa_paquete).attr('value',tipo_habitacion);
	$('#c_es_carrito_'+ID_tarifa_paquete).attr('value',escarrito);
	fec_sel='';
	if(cant_fec == 1){
		if(fecha.checked){
			fec_sel=fecha.value;
		}
	}else{
		for(i=0;i<fecha.length;i++){
			if(fecha[i].checked){
				fec_sel=fecha[i].value;
			} 
		} 
	}
	if(fec_sel != ''){
		eval('document.frm_carrito_de_compras_paquete_'+ID_tarifa_paquete+'.submit();');
	}else {
		alert('POR FAVOR SELECCIONE UNA FECHA DE SALIDA.\n\nCONSULT HOUSE TURISMO');
	}
}
	function enviar_datos_trf_carrito(idform,namefrm,pos){
		//alert(document.getElementsByTagName("radio").length);
		var nom_form = document.getElementById(idform);
		posiciones='';
		for (i=0; i<nom_form.getElementsByTagName('input').length; i++){
			
			if (nom_form.getElementsByTagName('input')[i].type == 'radio' && nom_form.getElementsByTagName('input')[i].checked){
			
			posiciones = posiciones+'_'+nom_form.getElementsByTagName('input')[i].value;
			}
		}
		document.getElementById(pos).value = posiciones;
		document.forms[namefrm].submit();
	}
	
function chequea_radio_button(opcion){
	for(i=0; i<document.getElementsByTagName('input').length; i++){
		if(opcion =='RT'){
			if (document.getElementsByTagName('input')[i].type == 'radio' &&  document.getElementsByTagName('input')[i].name == 'btn_trfOWIN' || document.getElementsByTagName('input')[i].name == 'btn_trfOWOUT'){
				if(document.getElementsByTagName('input')[i].checked){
					document.getElementsByTagName('input')[i].checked=false;	
				}
			}
		} else {
			if (opcion =='OW'){
				if (document.getElementsByTagName('input')[i].type == 'radio' &&  document.getElementsByTagName('input')[i].name == 'btn_trfRTIN'){
					if(document.getElementsByTagName('input')[i].checked){
						document.getElementsByTagName('input')[i].checked=false;	
					}
				} 
			}
		}
	}
}
function corregir_caracteres(s){ /*Convierte caracteres codificados a caracteres simples*/
	s=s.replace(/&Aacute;/g, 'Á');
	s=s.replace(/&Atilde;/g, 'Ã');
	s=s.replace(/&Agrave;/g, 'À');
	s=s.replace(/&Acirc;/g, 'Â');
	s=s.replace(/&Auml;/g, 'Ä');
	s=s.replace(/&Aring;/g, 'Å');
	s=s.replace(/&Eacute;/g, 'É');
	s=s.replace(/&Egrave;/g, 'È');
	s=s.replace(/&Ecirc;/g, 'Ê');
	s=s.replace(/&Iacute;/g, 'Í');
	s=s.replace(/&Igrave;/g, 'Ì');
	s=s.replace(/&Iuml;/g, 'Ï');
	s=s.replace(/&Icirc;/g, 'Î');
	s=s.replace(/&Ntilde;/g, 'Ñ');
	s=s.replace(/&Oacute;/g, 'Ó');
	s=s.replace(/&Ograve;/g, 'Ò');
	s=s.replace(/&Ocirc;/g, 'Ô');
	s=s.replace(/&Ouml;/g, 'Ö');
	s=s.replace(/&Uacute;/g, 'Ú');
	s=s.replace(/&Ugrave;/g, 'Ù');
	s=s.replace(/&Uuml;/g, 'Ü');
	s=s.replace(/&Ccedil;/g, 'Ç');
	s=s.replace(/&Oslash;/g, 'Ø');
	s=s.replace(/&AElig;/g, 'Æ');
	s=s.replace('<br>', ' ');
	return s;
}
function validarFecha(fecha){//Verifica si una fecha es valida dd/mm/aaaa
	try{
		var fecha=fecha.split("/");
		var dia=parseInt(fecha[0]);
		var mes=fecha[1];
		var ano=parseInt(fecha[2]);
		var estado=true;
		switch(mes){
			case '01':dmax=31;break;
			case '02': if(ano % 4 == 0) dmax = 29; else dmax = 28;break;
			case '03':dmax=31;break;
			case '04':dmax=30;break;
			case '05':dmax=31;break;
			case '06':dmax=30;break;
			case '07':dmax=31;break;
			case '08':dmax=31;break;
			case '09':dmax=30;break;
			case '10':dmax=31;break;
			case '11':dmax=30;break;
			case '12':dmax=31;break;
		}
		if(dia>dmax)estado=false;
/*		dmax!=""?dmax:dmax=-1;
		if((dia >= 1) && (dia <= dmax) && (mes >= 1) && (mes <= 12)){
			for(var i=0;i<fecha[0].length;i++){
				diaC = fecha[0].charAt(i).charCodeAt(0);
				(!((diaC > 47) && (diaC < 58)))?estado = false:'';
				mesC = fecha[1].charAt(i).charCodeAt(0);
				(!((mesC > 47) && (mesC < 58)))?estado = false:'';
			}
		}else{estado=false;}
		for(var i=0;i<fecha[2].length;i++){
			anoC = fecha[2].charAt(i).charCodeAt(0);
			(!((anoC > 47) && (anoC < 58)))?estado = false:'';
		}*/
		return estado;
	}catch(err){return false}
}
function ChequearTodos(chkbox){
	for(var i=0;i<document.forms["Frm_Voucher"].elements.length;i++){
		var elemento = document.forms["Frm_Voucher"].elements[i];
		if(elemento.type == "checkbox"){
			elemento.checked = chkbox.checked
		}
	}
} 
function Valida(){
	if(IsChk('numero_voucher')){//ok, hay al menos 1 elemento checkeado envía el form!
		return true;
	}else{//ni siquiera uno chequeado no envía el form
		alert('Por favor seleccionar al menos un Vocuher para imprimir!');
		return false;
	}
}
function IsChk(chkName){
	var found=false;
	var chk=document.getElementsByName(chkName+'[]');
	for(var i=0;i<chk.length;i++){
		found=chk[i].checked ? true : found;
	}
	return found;
}
function contar(form,name,name_result){
	n=document.forms[form][name].value.length;
	t=200;
	if(n>t){document.forms[form][name].value=document.forms[form][name].value.substring(0, t);
	}else{document.forms[form][name_result].value = 'Cantidad de caracteres 200, usted ya ha escrito '+n+' caracteres.';}
}

function contar2(form,name,name_result){
	n=document.forms[form][name].value.length;
	t=200;
	if(n>t){document.forms[form][name].value=document.forms[form][name].value.substring(0, t);
	}else{document.forms[form][name_result].value = 'usted ya ha escrito '+n+' caracteres.';}
}

function imprimir_pag(){window.print();}
function solo_numeros(e,n){
	if(e.keyCode){if(e.keyCode<45 || e.keyCode>57)e.returnValue=false;//Para Internet Explorer
	}else{if(e.which<45 || e.which>57){e.preventDefault();}}//Para Firefox
}

/******************PROCESO AJAx *******************/
function enviarAUnAmigo(){
	txt_su_nombre=$('#txt_su_nombre_enviar_amigo').get(0).value;
	txt_nombre=$('#txt_nombre_enviar_amigo').get(0).value;
	txt_mail=$('#txt_mail_amigo_enviar_amigo').get(0).value;
	txt_contenido=$('#txt_contenido_enviar_amigo').get(0).value;
	var filter=/^[A-Za-z][A-Za-z0-9_.-]*@[A-Za-z0-9_-]+\.[A-Za-z0-9_.-]+[A-za-z]$/;
		//	alert('http://'+ window.location.host +'/formato_mail/enviar_mail.php');
	if((txt_mail.length == 0)||(!filter.test(txt_mail))||(txt_mail.length>50)){
		alert('*Debe ingresar un mail válido (máximo 50 caracteres)\n');
	}else{
		$.ajax({
			type:"POST",
			url:"http://"+ window.location.host +"/includes/enviar_mail.php",
            data: "proceso="+enviar_mail_a_un_amigo_pag_cht+"&txt_su_nombre="+txt_su_nombre+"&txt_nombre="+txt_nombre+"&txt_mail="+txt_mail+"&txt_contenido="+txt_contenido,
			success:function(msg){
				alert('Se ha enviado correctamente un mail a su amigo, Muchas Gracias');
				enviar_mail_a_un_amigo_pag_cht();
			}
		});
	}
}

function enviar_datos_asistencia_carrito(codigo_tarifa_asis,id_producto_asistencia,tarifa_neta_asis,impuestos_asis,tarifa_total_asis)
{
	$('#codigo_tarifa_asis').attr('value',codigo_tarifa_asis);
	$('#id_producto_asistencia').attr('value',id_producto_asistencia);
	$('#id_pais_asis').attr('value',tarifa_neta_asis);
	$('#id_area_asis').attr('value',impuestos_asis);
	$('#tarifa_total_asis').attr('value',tarifa_total_asis);
	eval('document.frm_producto_asistencia.submit();');
}

//Verifica que el campo no este vacio o sea blanco
function verificarCampoVacio(nombreId){
	var campo;
	campo = document.getElementById(nombreId);
	if((campo.value == '') || (campo.value == 'Debe completar el campo, gracias')){
		campo.value = 'Debe completar el campo, gracias';
		//alert('Debe completar el campo para realizar la busqueda, gracias');
		return false;
	}
	return true;
}

function verificarMail(email){
	var formato = /^([\w-\.])+@([\w-]+\.)+([a-z]){2,4}$/;
	var comparacion = formato.test(email);
	if((comparacion == false) || (email == '')){
		//alert('el email es incorrecto');
		return false;
	}else{
		return true;
	}
}

function informeErrorMail(){
	verificadoMail = true;
	verificadoBlanco = true;
	for(i=1;i<11;i++){
		m = document.getElementById('username'+i).value;
		if((document.getElementById('nombre_usuario'+i).value == '') && (document.getElementById('apellido_usuario'+i).value == '') && (m == '')){
			document.getElementById('username'+i).style.background = '#FFFFFF';
			document.getElementById('apellido_usuario'+i).style.background = '#FFFFFF';
			document.getElementById('nombre_usuario'+i).style.background = '#FFFFFF'
		}else{
			verifica = verificarMail(m);
			if(verifica == false){
				verificadoMail = false;
				document.getElementById('username'+i).style.background = '#F00F00';
			}else{
				document.getElementById('username'+i).style.background = '#FFFFFF';
			}
			if(document.getElementById('apellido_usuario'+i).value == ''){
				verificadoBlanco = false;
				document.getElementById('apellido_usuario'+i).style.background = '#F00F00';
			}else{
				document.getElementById('apellido_usuario'+i).style.background = '#FFFFFF';
			}
			if((document.getElementById('nombre_usuario'+i).value == '')){
				verificadoBlanco = false;
				document.getElementById('nombre_usuario'+i).style.background = '#F00F00';
			}else{
				document.getElementById('nombre_usuario'+i).style.background = '#FFFFFF';
			}
		}
	}
	if(verificadoMail == false || verificadoBlanco == false){
		alert('ERRO: Verifique que los mails esten bien ingresados o no se encuentre algun casillero en blanco');
		return false;
	}else{
		return true;
	}
	return false;
}

function verificarEnvioConsulta(t){// t nos indica si es una consulta comun(2) o una consulta por paquete u hotel(1)

	var s = document.getElementById('tiposector').value;//nos indica si la consulta es por hoteles o paquetes para luego ejecutar el script de google correspondiente.
	//alert(document.getElementById('dNom').value);
	var mail = document.getElementById('txt_mail_usuario_hotel_consulta').value;
	var mailVerificado = verificarMail(mail);
	var ok=false;
	if(mailVerificado == false){
		alert('El email no es correcto o esta vacio');
		return false;
	}
	if(document.getElementById('txt_nombre_usuario_hotel_consulta').value == ''){
		alert('Debe ingresar algun nombre');
		return false;
	}
	if(document.getElementById('txt_contenido_hotel_consulta').value == ''){
		alert('Ingrese la consulta que desea realizar');
		return false;
	}
	ok=true;
	if(ok==true){
		switch(t){
			case 1:
				if(s == 'hoteles'){
					idHotel=document.getElementById('codHotelConsulta').value;
					if(controlSitioProduccion == 1){
						pageTracker._trackPageview('/Hoteles/CntH'+idHotel);
					}
				}else{
					idPaquete=document.getElementById('codPaqueteConsulta').value;
					if(controlSitioProduccion == 1){
						pageTracker._trackPageview('/Paquetes/Cnt'+idPaquete);
					}
				}
				doAjax('/includes/enviar_mail.php','enviar_mail_consulta_por_hotel','enviar_mail_consulta_por_hotel','post',0);	
				break;
			case 2:
				//pageTracker._trackPageview('/Cnt'+idPaquete);
				break;
		}
	}
}

function enviarNewsletter(){
	mailNewsletter=$('#mail_newsletter').get(0).value;
	ubicNewsletter=$('#ubic_newsletter').get(0).value;
	var filter=/^[A-Za-z][A-Za-z0-9_.-]*@[A-Za-z0-9_-]+\.[A-Za-z0-9_.-]+[A-za-z]$/;
	if((mailNewsletter.length == 0)||(!filter.test(mailNewsletter))||(mailNewsletter.length>50)){
		alert('*Debe ingresar un mail v\u00E1lido (máximo 50 caracteres)\n');
	}else{
		$.ajax({
			type:"POST",
			url: ubicNewsletter+"/includes/enviar_mail.php",
			data:"mail_newsletter="+mailNewsletter+"&proceso=Newsletter",
			success:function(msg){
                alert('Se ha cargado correctamente su mail, pronto recibir\u00E1 nuestro newsletter');
            $('#mail_newsletter').attr('value', '');
			}
		});
		if(document.getElementById('vPage').value == 1){
			pageTracker._trackPageview('/newsletter');
		}
	}
}


function comprobarActivoDestinoHotel(idDestinoHotel,idFoto,nombreDestinoHotel,tipo){
	if(tipo == 'destino'){
		parteNombreId='publica_comentario_destino_';
		parteNombreIdFoto='Publica_fotos_Destino';
	}else{
		parteNombreId='publica_comentario_hotel_';
		parteNombreIdFoto='Publica_fotos_';
	}
	if(document.getElementById(parteNombreId+idDestinoHotel).checked){
		//alert(idDestino+' '+idFoto);
	}else{
		alert('El '+tipo+' '+nombreDestinoHotel+' no se encuentra activado, para poder activar la imagen debe primero activar el '+tipo);
		document.getElementById(parteNombreIdFoto+idFoto).checked=false;
	}
}

function descativarFotos(idDestinoHotel,idsFoto,tipo){
	if(tipo == 'destino'){
		parteNombreId='publica_comentario_destino_';
		parteNombreIdFoto='Publica_fotos_Destino';
	}else{
		parteNombreId='publica_comentario_hotel_';
		parteNombreIdFoto='Publica_fotos_';
	}
	if(document.getElementById(parteNombreId+idDestinoHotel).checked){
		//alert(idDestino+' '+idFoto);
	}else{
		var ids = idsFoto.split("_");
		for (i=0;i < ids.length;i++){
			//alert(ids[i]);
			document.getElementById(parteNombreIdFoto+ids[i]).checked=false;
		}
	}
}

/*/////////////////////////////////////FUNCIONES PARA MOSTRAR Y OCULTAR DIVS/////////////////////////////////////////*/
function ocultarDiv(nomDiv){
	//alert(nomDiv);
	if(document.getElementById(nomDiv)){
		document.getElementById(nomDiv).style.display="none";
	}
}

function mostrarDiv(nomDiv){
	if(document.getElementById(nomDiv)){
		//alert(nomDiv);
		document.getElementById(nomDiv).style.display="block";
	}
}

function ocultarDivsMapas(){
	ocultarDiv('map');
	ocultarDiv('map2');
	ocultarDiv('map3');
}
/*/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

function cambiarPropiedadesPestania(id){//SE USA PARA CAMBIAR LAS PROPIEDADES DE LAS PESTANIAS DE DESTINO
	switch(id){
		case 'PestaniaHoteles':
				document.getElementById('PestaniaHoteles').style.top = '2px';
				document.getElementById('PestaniaHoteles').style.backgroundColor = '#FFFFFF';
				document.getElementById('PestaniaHoteles').style.fontWeight = '700';
				if(document.getElementById('PestaniaAereos')){
					document.getElementById('PestaniaAereos').style.top = '0px';
					document.getElementById('PestaniaAereos').style.backgroundColor = '#DCDCDC';
					document.getElementById('PestaniaAereos').style.fontWeight = 'normal';
				}
				if(document.getElementById('PestaniaTraslados')){
					document.getElementById('PestaniaTraslados').style.top = '0px';
					document.getElementById('PestaniaTraslados').style.backgroundColor = '#DCDCDC';
					document.getElementById('PestaniaTraslados').style.fontWeight = 'normal';
				}
			break;
		case 'PestaniaTraslados':
				if(document.getElementById('PestaniaAereos')){
					document.getElementById('PestaniaAereos').style.fontWeight = 'normal';
					document.getElementById('PestaniaAereos').style.backgroundColor = '#DCDCDC';
					document.getElementById('PestaniaAereos').style.top = '0px';
				}
				document.getElementById('PestaniaHoteles').style.top = '0px';
				document.getElementById('PestaniaHoteles').style.fontWeight = 'normal';
				document.getElementById('PestaniaHoteles').style.backgroundColor = '#DCDCDC';
				document.getElementById('PestaniaTraslados').style.fontWeight = '700';
				document.getElementById('PestaniaTraslados').style.top = '2px';
				document.getElementById('PestaniaTraslados').style.backgroundColor = '#FFFFFF';
				
				
			break;
		case 'PestaniaAereos':
				document.getElementById('PestaniaAereos').style.top = '2px';
				document.getElementById('PestaniaHoteles').style.top = '0px';
				document.getElementById('PestaniaTraslados').style.top = '0px';
				document.getElementById('PestaniaAereos').style.backgroundColor = '#FFFFFF';
				document.getElementById('PestaniaHoteles').style.backgroundColor = '#DCDCDC';
				document.getElementById('PestaniaTraslados').style.backgroundColor = '#DCDCDC';
				document.getElementById('PestaniaAereos').style.fontWeight = '700';
				document.getElementById('PestaniaHoteles').style.fontWeight = 'normal';
				document.getElementById('PestaniaTraslados').style.fontWeight = 'normal';
			break;
	}
}

var estadoInfoDestino = 0;//GUARDA el estado de MOSTRAR INFO DESTINO PARA SABER SI ESTA O NO OCULTO SI ESTA EN CERO ESTA OCULTO

function cambiarEstadoInfoDestino(valor){//verifica el estado de MOSTRAR INFO DESTINO PARAA SABER SI ESTA O NO OCULTO para luego modificar su estado
	if(valor == 1){
		if(estadoInfoDestino == 0){
			estadoInfoDestino = 1;
		}else{
			estadoInfoDestino = 0;
		}
	}else{
		estadoInfoDestino = 0;
	}
}

function mostrarSectorPestania(nomDivID,cantIDs){
	for(var i=0;i<cantIDs;i++){
		if(i != nomDivID){
			if(i != 1){
				ocultarDiv(i);
			}else{
				if(estadoInfoDestino == 1){
					deslizarCiudadCaract();
					cambiarEstadoInfoDestino(0);
				}
			}
		}
	}
	mostrarDiv(nomDivID);
	switch(nomDivID){
		case 0:
			cambiarPropiedadesPestania('PestaniaHoteles');		
			break;
		case 2:
			cambiarPropiedadesPestania('PestaniaTraslados');
			break;
		case 3:
			cambiarPropiedadesPestania('PestaniaAereos');
			break;
	}
}

function mostrarOcultarDivTexto(div,idTxtCambio,aComparar,aCambiar){/*Se encarga de ocultar/mostrar un div y al mismo tiempo cambiar el tipo de texto a mostrar/ocultar o por cualquira qeu se pase en las variables 'aComparar y aCambiar', en 'idTxtCambio' se le pasa el ID del texto a obtener para cambiar y en 'div ' se pasa el nombre del div que se desea ocultar*/
	var txtLink = obtenerTextoID(idTxtCambio);
	//alert(txtLink);
	if(txtLink == aComparar){
		document.getElementById(idTxtCambio).innerHTML = aCambiar;
		mostrarDiv(div);
	}else{
		document.getElementById(idTxtCambio).innerHTML = aComparar;
		ocultarDiv(div);
	}
}

//Esta funcion se puede cambiar por la de arriba que esta generalizada y cumple la misma funcion///////////
function mostrarOcultarItinerario(div,idTxtCambio){
	var txtLink = obtenerTextoID(idTxtCambio);
	var aComparar = 'Mostrar Itinerario';
	var aCambiar = 'Ocultar Itinerario';
	if(txtLink == aComparar){
		document.getElementById(idTxtCambio).innerHTML = aCambiar;
		mostrarDiv(div);
	}else{
		document.getElementById(idTxtCambio).innerHTML = aComparar;
		ocultarDiv(div);
	}
}
///////////////////////////////////////////////////////////////////////////////
function obtenerTextoID(id){
	var textoID=document.getElementById(id).innerHTML;
	return textoID;
}

function cambiarTextoID(id,textoID,aComparar,cambiarPor){
	if(textoID == aComparar){
		document.getElementById(id).innerHTML = cambiarPor;
		document.getElementById('mapCA').value= cambiarPor;
	}else{
		document.getElementById(id).innerHTML = aComparar;
		document.getElementById('mapCA').value= aComparar;
	}
}

function imprimirElegido(numID,cantIDs){
	//var botonReservar=document.getElementById('Btn_reservar');
	for(var i=0;i<cantIDs;i++){
		if(i != numID){
			if(!document.getElementById('contenedorP_'+i)){
				//alert( "no existe" );
			}else{
				ocultarDiv('contenedorP_'+i);
			}
		}
	}
	//botonReservar.style.display='none';
	window.print();
	confirm('Oprima aceptar si la impresion se realizo correctamente');
	for(var i=0;i<cantIDs;i++){
		if(i != numID){
			if(!document.getElementById('contenedorP_'+i)){
				//alert( "no existe" );
			}else{
				mostrarDiv('contenedorP_'+i);
			}
		}
	}
	//botonReservar.style.display='block';
}

//Limpia texto caja de texto
//MATIAAAAAAAAAAS   Generalizar funciones para limpiar input
function limpiaBuscador(elemento){
	if(elemento.value == 'Ej. Florianopolis') {
		elemento.value = "";
	}
} 

function verificaBuscador(elemento)
{
if(elemento.value == "")
elemento.value = "Ej. Florianopolis";
}


function limpia(elemento){
	if((elemento.value == 'Ingrese su e-mail') || (elemento.value == 'Debe completar el campo, gracias')){
		elemento.value = "";
	}
} 

function limpiaCiudad(elemento){
	elemento.value = "";
} 

function verifica(elemento)
{
if(elemento.value == "")
elemento.value = "Ingrese su e-mail";
}

////////////////////////////////////////


function tildarUsuarioPass(){
	if(document.getElementById('RecUP').checked==true){
		document.getElementById('RecU').checked=true;
		document.getElementById('NoRecD').checked=false;
	}else{
		document.getElementById('RecU').checked=false;
	}
}

function tildarUsuario(){
	if(document.getElementById('RecUP').checked==true || document.getElementById('NoRecD').checked==true){
		document.getElementById('RecUP').checked=false;
		document.getElementById('NoRecD').checked=false;
	}
}

function desTildarUsuarioPass(){
	if(document.getElementById('RecUP').checked==true || document.getElementById('RecU').checked==true){
		document.getElementById('RecU').checked=false;
		document.getElementById('RecUP').checked=false;
	}
}


 
//Efecto ayuda web
$(document).ready(function(){

	$(".ayuda a").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "-100", left:"-120"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "-100", left:"-120"}, "slow");
	});
	/*if(res.style.visibility == "hidden"){
		alert('es hidden');
	}*/
});

/*function comprobarV(){
	if(document.getElementById('caja_de_texto_pais_ciudad_hoteles_buscador').value != ''){
		document.getElementById('suggestions').style.visibility="hidden";
	}
}*/

/*///////////////////////////////////CODIGO BUSCADOR HEADER///////////////////////////////////////////*/
// JavaScript Document
var cantLetras= 0;
function ajaxBuscadorN(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}


function cargaContenido(abrirPagina){
	var selectDestino=document.getElementById('ContenedorResultado');
	var ajaxN=ajaxBuscadorN();
	ajaxN.open("GET", abrirPagina, true);
	ajaxN.onreadystatechange=function() 
	{ 
		/*if (ajaxN.readyState==1)
		{
			// Mientras carga elimino la opcion "Selecciona Opcion..." y pongo una que dice "Cargando..."
			selectDestino.length=0;
			var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Cargando...";
			selectDestino.appendChild(nuevaOpcion); selectDestino.disabled=true;	
		}*/
		if (ajaxN.readyState==4)
		{
			selectDestino.innerHTML=ajaxN.responseText;
		} 
	}
	ajaxN.send(null);
}

function over(id) {
	obj = document.getElementById(id);
	obj.style.opacity = 0.8;
	obj.style.filter = "alpha(opacity=80)";
}
function out(id) {
	obj = document.getElementById(id);
	obj.style.opacity = 1;
	obj.style.filter = "alpha(opacity=100)";
}
/**********************************/
/**** funciones del buscador ******/
/**********************************/
// buscador ajax
var opcion_seleccionada = 1;
var desaparece=0;
var opcion_anterior;

function setearOp(){
	opcion_seleccionada = 0;
	op = document.getElementById('opcion_'+opcion_seleccionada);
	op.style.backgroundColor = "#DDDDDD";
	opcion_anterior = op;
}

function cambio(ev) {
	//alert(opcion_seleccionada);
	desaparece = 1;
	tecla = (document.all) ? ev.keyCode : ev.which;
	b = document.getElementById("busc");
	res = document.getElementById("ContenedorResultado");
	//res.style.visibility = "visible";
	if(tecla==40){
		//alert('toca flechas abajo');
		opcion_anterior.style.backgroundColor = "#F6F7F8"
		op = document.getElementById('opcion_'+opcion_seleccionada);
		op.style.backgroundColor = "#DDDDDD";
		opcion_anterior = op;
		if(document.getElementById('opcion_'+opcion_seleccionada)) {
			opcion_seleccionada++;
		}
	} else if(tecla==38){
			//alert('toca flechas arriba');
			opcion_anterior.style.backgroundColor = "#F6F7F8"
			if(opcion_seleccionada>1) {
				opcion_seleccionada--;
			}
			op = document.getElementById('opcion_'+(opcion_seleccionada-1));
			op.style.backgroundColor = "#DDDDDD";
			opcion_anterior = op;
		} else if(tecla==13) { 
					$.ajax({
						url: '/includes/buscador.php?v='+b.value+'&linkear='+opcion_seleccionada,
						success: function(datos){
							window.location.href = datos;
						}
					});
			}else{
				if(b.value != ''){
					if(b.value.length >= 3){
						cargaContenido('/includes/buscador.php?v='+b.value);
						setTimeout ('setearOp()', 1000);
						res.style.visibility = "visible";
					}
				}else{
					res.style.visibility = "hidden";
				} 
		}
}

function ocultar_resultados() {
	res = document.getElementById("ContenedorResultado");
	res.style.visibility = "hidden";
	b = document.getElementById("busc").value = "";
}
function over_opcion(op) {
	o = document.getElementById("opcion_"+op);
	o2 = document.getElementById("opcion_"+opcion_seleccionada);
	o.style.backgroundColor = "#DDDDDD";
	if(opcion_anterior != o) {
		opcion_anterior.style.backgroundColor = "#F6F7F8"
	}
	opcion_seleccionada = op;
	opcion_anterior = o;
}
function out_opcion(op) {
	o = document.getElementById("opcion_"+op);
	o.style.backgroundColor = "#F6F7F8";
}

/*///////////////////////FUNCION PARA CAPTURAR EVENTOS EN LA PAGINA Y CERRAR LO QUE SE MUESTRA EN EL BUSCADOR GENERAL//////////////////////////////////////////*/

function ocultaResultadoConClick(){//Sirve para esconder el resultado del buscador general si hacemos click fuera o en otro sector
	if(desaparece == 1){
		ocultar_resultados();
		desaparece=0;
	}
}
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/*//////////////////////////////////////////////////////////////////////////////*/

/*//////////////////////////////FUNCIONES PARA MOSTRAR DESGLOSE COTIZACION///////////////////////////////////*/
function posicionarEnDiv(ubicacion){
	window.location.href = ubicacion;
}

function mostrarDesCotizar(divID,comdidad,regimen,base,hPre,hIva,tPre,tIva,aPre,aIva,interno){
	var totalPreHTA=0;
	var totalIvaHTA=0;
	var totalHTA=0;
	var totalH=0; 
	mostrarDiv(divID);
	document.getElementById('comodidadID').innerHTML = comdidad;
	document.getElementById('regimenID').innerHTML = regimen;
	document.getElementById('baseID').innerHTML = base;
	if(interno == 1){
		if(tPre != '0'){
			totalT = parseFloat(tPre)+parseFloat(tIva);
			totalPreHTA = totalPreHTA+parseFloat(tPre);
			totalIvaHTA = totalIvaHTA+parseFloat(tIva);
			totalHTA = totalHTA+totalT;
			document.getElementById('desTrans0').innerHTML ='<img src="/imagenes/Iconos/traslado.jpg">';
			document.getElementById('desTrans1').innerHTML =tPre;
			document.getElementById('desTrans2').innerHTML =tIva;
			document.getElementById('desTrans3').innerHTML =totalT;
		}else{
			document.getElementById('desTransTR').style.display='none';
		}
		if(aPre != '0'){
			totalA = parseFloat(aPre)+parseFloat(aIva);
			totalPreHTA = totalPreHTA+parseFloat(aPre);
			totalIvaHTA = totalIvaHTA+parseFloat(aIva);
			totalHTA = totalHTA+totalA;
			document.getElementById('desAereo0').innerHTML ='<img src="/imagenes/Iconos/icono_aereos_paquete_carrito.png">';
			document.getElementById('desAereo1').innerHTML =aPre;
			document.getElementById('desAereo2').innerHTML =aIva;
			document.getElementById('desAereo3').innerHTML =totalA;
		}else{
			document.getElementById('desAereoTR').style.display='none';
		}
		totalH = parseFloat(hPre)+parseFloat(hIva);
		totalPreHTA = totalPreHTA+parseFloat(hPre);
		totalIvaHTA = totalIvaHTA+parseFloat(hIva);
		totalHTA = totalHTA+totalH;
		document.getElementById('desHotel0').innerHTML ='<img src="/imagenes/Iconos/icono_hoteles_corrito.png">';
		document.getElementById('desHotel1').innerHTML =hPre;
		document.getElementById('desHotel2').innerHTML =hIva;
		document.getElementById('desHotel3').innerHTML =totalH;
		
		document.getElementById('desTotal1').innerHTML =totalPreHTA;
		document.getElementById('desTotal2').innerHTML =totalIvaHTA;
		document.getElementById('desTotal3').innerHTML =totalHTA;
	}else{
		ocultarDiv('desTransAereo');
	}
	
}

function mostrarDesglosePorDia(datos,id,fechaDesde){
	var desgloseDatos = datos.split("_");
	var desgloseFecha = fechaDesde.split("_");
	var logitudDesglose = desgloseDatos.length;
	var recorreDesglose = 0;
	var precioyDiasDivididos = '';//$precioyDiasDivididos separa los dias del precio. En '0' estan los dias y en '1' esta el precio por cada uno de esos dias
	var cantDias='<p>Desglose de la tarifa hotel por d&iacute;a:';
	if(logitudDesglose == 1){
		cantDias+=desgloseDatos[0];
	}else{
		for(i=0;i<logitudDesglose;i++){
			cantDias+=' + '+desgloseDatos[i];
		}
	}
	cantDias+='</p>';
	var c = 0;
	var cantLi = 0;
	var contadorDias = 0;
	var fechaDia = desgloseFecha[0];
	switch(fechaDia){
		case '01':
			fechaDia = 1;
			break;
		case '02':
			fechaDia = 2;
			break;
		case '03':
			fechaDia = 3;
			break;
		case '04':
			fechaDia = 4;
			break;
		case '05':
			fechaDia = 5;
			break;
		case '06':
			fechaDia = 6;
			break;
		case '07':
			fechaDia = 7;
			break;
		case '08':
			fechaDia = 8;
			break;
		case '09':
			fechaDia = 9;
			break;
	}
	var fechaMes = desgloseFecha[1];
	switch(fechaMes){
		case '01':
			fechaMes = 0;
			break;
		case '02':
			fechaMes = 1;
			break;
		case '03':
			fechaMes = 2;
			break;
		case '04':
			fechaMes = 3;
			break;
		case '05':
			fechaMes = 4;
			break;
		case '06':
			fechaMes = 5;
			break;
		case '07':
			fechaMes = 6;
			break;
		case '08':
			fechaMes = 7;
			break;
		case '09':
			fechaMes = 8;
			break;
		case '10':
			fechaMes = 9;
			break;
		case '11':
			fechaMes = 10;
			break;
		case '12':
			fechaMes = 11;
			break;
	}
	var fechaAnio = parseInt(desgloseFecha[2]);
	var fecha = new Date(fechaAnio, fechaMes, fechaDia);
	var valorFecha = fecha.valueOf();  // 1269226800000
	var dia = fecha.getDay();
	//alert(dia);
	while(recorreDesglose < logitudDesglose){
		precioyDiasDivididos = desgloseDatos[recorreDesglose].split("x");
		c = 0;
		while(c < precioyDiasDivididos[0]){
			if(dia > 6){
				dia = 0;
			}
			if(cantLi > 6){
				cantDias+='</ul>';
				cantLi = 0;
			}
			if(cantLi == 0){
				cantDias+='<ul class="dias">';
			}
			valorFechaTermino = valorFecha +  ( contadorDias * 24 * 60 * 60 * 1000 ); // 60 días después, como milisegundos ( días * horas * minutos * segundos * milisegundos )
			fechaTermino = new Date(valorFechaTermino); // nuevo objeto de fecha: 20 de mayo - Thu May 20 2010 23:00:00 GMT-0400 (CLT)
			//alert(fechaTermino);
			switch(fechaTermino.getMonth()){
				case 0:
					fechaTerminoMes = 1;
					break;
				case 1:
					fechaTerminoMes = 2;
					break;
				case 2:
					fechaTerminoMes = 3;
					break;
				case 3:
					fechaTerminoMes = 4;
					break;
				case 4:fechaTerminoMesfechaMes = 5;
					break;
				case 5:
					fechaTerminoMes = 6;
					break;
				case 6:
					fechaTerminoMes = 7;
					break;
				case 7:
					fechaTerminoMes = 8;
					break;
				case 8:
					fechaTerminoMes = 9;
					break;
				case 9:
					fechaTerminoMes = 10;
					break;
				case 10:
					fechaTerminoMes = 11;
					break;
				case 11:
					fechaTerminoMes = 12;
					break;
			}
			switch(dia){
				case 1: 
					cantDias+='<li><div class="ContFechaPrecio"><span>Lunes<br/>'+fechaTermino.getDate()+'/'+fechaTerminoMes+'</span><br><span><b>'+precioyDiasDivididos[1]+'</b></span></div></li>';
					break;
				case 2: 
					cantDias+='<li><div class="ContFechaPrecio"><span>Martes<br/>'+fechaTermino.getDate()+'/'+fechaTerminoMes+'</span><br><span><b>'+precioyDiasDivididos[1]+'</b></span></div></li>';
					break;
				case 3: 
					cantDias+='<li><div class="ContFechaPrecio"><span>Miercoles<br/>'+fechaTermino.getDate()+'/'+fechaTerminoMes+'</span><br><span><b>'+precioyDiasDivididos[1]+'</b></span></div></li>';						
					break;
				case 4:
					cantDias+='<li><div class="ContFechaPrecio"><span>Jueves<br/>'+fechaTermino.getDate()+'/'+fechaTerminoMes+'</span><br><span><b>'+precioyDiasDivididos[1]+'</b></span></div></li>';
					break;
				case 5:
					cantDias+='<li><div class="ContFechaPrecio"><span>Viernes<br/>'+fechaTermino.getDate()+'/'+fechaTerminoMes+'</span><br><span><b>'+precioyDiasDivididos[1]+'</b></span></div></li>';
					break;
				case 6: 
					cantDias+='<li><div class="ContFechaPrecio"><span>Sabado<br/>'+fechaTermino.getDate()+'/'+fechaTerminoMes+'</span><br><span><b>'+precioyDiasDivididos[1]+'</b></span></div></li>';
					break;
				case 0: 
					cantDias+='<li><div class="ContFechaPrecio"><span>Domingo<br/>'+fechaTermino.getDate()+'/'+fechaTerminoMes+'</span><br><span><b>'+precioyDiasDivididos[1]+'</b></span></div></li>';
					break;
			}
			c++;
			dia++;
			cantLi++;
			contadorDias++;
		}
		recorreDesglose++;
	}
	document.getElementById(id).innerHTML=cantDias;
}
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////*/

/*/////////////////////////////////FUNCION PARA CHECK TRASLADO Y AEREOS EN DETALLE HOTEL////////////////////////////////////*/
function trasladoAereoCheck(id,idHiden){
	var IdentificadorCheck = document.getElementById(id).checked;
	var IdentificadorHidden =  document.getElementById(idHiden).value;
	if(IdentificadorCheck){
		document.getElementById(idHiden).value = 1;
	}else{
		document.getElementById(idHiden).value = 0;
	}
}
/*/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

var pestaniaSeleccionadaTarifa = 0;
/*///////////////////////////////////////FUNCIONES PARA LAS SOLAPAS EN DETALLE HOTEL///////////////////////////////////////////////////////*/
function mostrarFormCotizacionRF(){
	document.getElementById('checkTrasAereo').style.display='block';
	document.getElementById('contenedor_titulo_ninios_edad_parentesis').style.display='none';
	document.getElementById('contenedor_titulo_edad_parentesis').style.display='none';
	document.getElementById('contenedor_habitaciones_base_hoteles_buscador').style.display='none';
	document.getElementById('contenedor_titulo_adulto_edad_parentesis').style.display='none';
	//document.getElementById('contenedor_chkbox_buscar_disponibilidad_o_hotel').style.display='none';
	document.getElementById('cotizaRF').style.top = '1px';
	document.getElementById('cotizaRF').style.fontWeight = '700';
	document.getElementById('cotizaRF').style.backgroundColor = '#FFFFFF';
	document.getElementById('cotizaBS').style.top = '0px';
	document.getElementById('cotizaBS').style.backgroundColor = '#DCDCDC';
	document.getElementById('contenedor_chkbox_buscar_disponibilidad_o_hotel').style.display='none';
	if(document.getElementById('identificaBusRFBS').value != 'RF'){
		document.getElementById('identificaBusRFBS').value = 'RF';
	}
	pestaniaSeleccionadaTarifa = 0;
	document.getElementById('solapaEstadoCotiza').value='1';
}

function mostrarFormCotizacionBS(){
	document.getElementById('checkTrasAereo').style.display='none';
	document.getElementById('contenedor_titulo_ninios_edad_parentesis').style.display='block';
	document.getElementById('contenedor_titulo_edad_parentesis').style.display='block';
	document.getElementById('contenedor_habitaciones_base_hoteles_buscador').style.display='block';
	document.getElementById('contenedor_titulo_adulto_edad_parentesis').style.display='block';
	//document.getElementById('contenedor_chkbox_buscar_disponibilidad_o_hotel').style.display='block';
	document.getElementById('cotizaBS').style.top = '1px';
	document.getElementById('cotizaBS').style.fontWeight = '700';
	document.getElementById('cotizaBS').style.backgroundColor = '#FFFFFF';
	document.getElementById('cotizaRF').style.top = '0px';
	document.getElementById('cotizaRF').style.backgroundColor = '#DCDCDC';
	document.getElementById('contenedor_chkbox_buscar_disponibilidad_o_hotel').style.display='block';
	if(document.getElementById('identificaBusRFBS').value != 'BS'){
		document.getElementById('identificaBusRFBS').value = 'BS';
	}
	pestaniaSeleccionadaTarifa = 1;
	document.getElementById('solapaEstadoCotiza').value='2';
}

function ocultarSolapaCotizaRF(){
	//alert('hola');
	document.getElementById('cotizaRF').style.display='none';
	document.getElementById('cotizaBS').style.left= '0px';
}

function solapasBuscadorDetalle(id){
	var solapa1 = document.getElementById(id).style.display;
	if(solapa1 == 'none'){
		document.getElementById(id).style.display = 'block';
	}else{
		document.getElementById(id).style.display = 'none';
	}
}

function cargarSolapaSeleccionada(){
	if(document.getElementById('identificaBusRFBS').value == 'BS'){
		mostrarFormCotizacionBS();
	}else{
		mostrarFormCotizacionRF()
	}
	
}
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

/*/////////////////////////////////////////////Funciones Resultado Busqueda Hotel////////////////////////////////////////*/
cambioSolapaResHotel = 0;

function cambiarEstadoVariable(valor){//verifica el estado de MOSTRAR INFO DESTINO PARAA SABER SI ESTA O NO OCULTO para luego modificar su estado
	if(valor == 1){
		cambioSolapaResHotel = 1;
	}else{
		cambioSolapaResHotel = 0;
	}
}

function cambiarSolapasResBusHotel(id1,id2){//FUNCION PARA LAS SOLAPAS DE RESULTADO BUSQUEDA HOTEL
//	document.getElementById(id1)
	//alert(cambioSolapaResHotel);
	if(cambioSolapaResHotel == 0){//SI ES UNO QUIERE DECIR QUE ESTA PULSADO EL BOTON HOTELES
		document.getElementById(id1).style.backgroundColor = '#DCDCDC';
		document.getElementById(id1).style.top = '0px';
		document.getElementById(id2).style.backgroundColor = '#FFFFFF';
		document.getElementById(id2).style.top = '1px';
	}else{
		document.getElementById(id1).style.backgroundColor = '#FFFFFF';
		document.getElementById(id1).style.top = '1px';
		document.getElementById(id2).style.backgroundColor = '#DCDCDC';
		document.getElementById(id2).style.top = '0px';
	}
	//document.getElementById('id2');
}
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

function mostrarOcultarListsaPaises(id,id1,id2){
	var IdentificadorCheck = document.getElementById(id).checked;
	if(IdentificadorCheck){
		mostrarDiv(id1);
		mostrarDiv(id2);
	}else{
		ocultarDiv(id1);
		ocultarDiv(id2);
	}
}

/*/////////////////////////////////////////////FUNCION PARA EL CALENDARIO/////////////////////////////////////////////////*/
function cambiarFechaHasta(id){
	document.getElementById(id).value='dd/mm/aaaa';
}
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

/*//////////////////////////////////////////////////CARGAR ANIMACIONES FLASH/////////////////////////////////////////////*/
function animacion(direccion,ancho,alto){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ancho+'" height="'+alto+'">');
document.write('<param name="movie" value="'+direccion+'" /><param name="quality" value="high" /><embed src="'+direccion+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ancho+'" height="'+alto+'"</embed></object>');
}

function ocultarDivsVideos(cantDivs, divMostrar){
	//alert(divMostrar);
	var divOcultar,div; 
	for(i=1;i <= cantDivs;i++){
		div = 'IdVideoAyuda'+i;
		divOcultar = document.getElementById(div);
		if(divOcultar.style.display == 'block' && divMostrar != div){
			divOcultar.style.display = 'none';
		}
	}
}
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

/*////////////////////////////////////////////FUNCIONES PARA TEXTO///////////////////////////////////////////////////////*/

function boldSeleccion(id){//pone el texto seleccionado en bold
	//alert(id);
	document.getElementById(id).style.fontWeight="bold";
}

function normalSeleccion(id){//pone el texto seleccionado en normal
	//alert(id);
	document.getElementById(id).style.fontWeight="normal";
}

function darEstiloNegritaCiuSel(id_playa,pais_o_ciudad,abc){
		filtrar_los_hoteles_del_listado='NO';
		//alert(id_playa);
		//alert(id_sel_anterior);
		if(id_playa!='0'){//Doy estilo en negrita a la localidad seleccionada
			if((abc!='porciudad')&&(abc!='TODO')){
				if(valor_abc!=abc){
					valor_abc_anterior=valor_abc;
					valor_abc=abc;
					document.getElementById(valor_abc).style.fontWeight="bold";
					document.getElementById(valor_abc).style.fontSize='14px';
					document.getElementById(valor_abc_anterior).style.fontWeight="normal";
					document.getElementById(valor_abc_anterior).style.fontSize='12px';
					filtrar_los_hoteles_del_listado='SI';
				}
			}else{
				if(abc=='porciudad'){
					if(control==1){
						valor_abc_real=valor_abc;
						control++;
					}
					valor_abc='TODO';
				}
				
				if(id_sel_anterior!=id_playa){
					//alert(id_playa);
					if(marcaNegroCiudad == -1){
						id_sel_anterior=id_playa;
						valor_id_playa=id_playa;
						marcaNegroCiudad = 0;
					}else{
						//alert(id_sel_anterior);
						if(id_sel_anterior == '0'){
							id_sel_anterior = "todos_los_hoteles_en_seccion_hoteles_destino";
							document.getElementById(id_sel_anterior).style.fontWeight="bold";
							document.getElementById(id_sel_anterior).style.fontSize='14px';
						}
						document.getElementById(id_sel_anterior).style.fontWeight="normal";
						document.getElementById(id_sel_anterior).style.fontSize='12px';
					}
					if(id_sel_anterior == "todos_los_hoteles_en_seccion_hoteles_destino"){
						id_sel_anterior = '0'; 
					}
					document.getElementById(id_playa).style.fontWeight="bold";
					document.getElementById(id_playa).style.fontSize='14px';
					valor_id_playa=id_playa;
					id_sel_anterior=valor_id_playa;
					filtrar_los_hoteles_del_listado='SI';
				}
				filtrar_los_hoteles_del_listado='SI';
			}
		}else{
			control=1;
			if(valor_abc=='TODO'){
				if (typeof (valor_abc_real) == "undefined"){
					valor_abc_real=valor_abc;
				}else{
					valor_abc=valor_abc_real;
				}
			}
			if(marcaNegroCiudad == -1){
				if(id_playa == '0'){
					id_playa = "todos_los_hoteles_en_seccion_hoteles_destino";
				}
				id_sel_anterior=id_playa;
				valor_id_playa=id_playa;
				marcaNegroCiudad = 0;
			}
			//alert(id_sel_anterior);
			document.getElementById(id_sel_anterior).style.fontWeight="normal";
			document.getElementById(id_sel_anterior).style.fontSize='12px';
			if(id_playa == '0'){
				id_playa = "todos_los_hoteles_en_seccion_hoteles_destino";
				document.getElementById(id_playa).style.fontWeight="bold";
				document.getElementById(id_playa).style.fontSize='14px';
				//alert(id_playa);
			}else{
				document.getElementById(valor_id_playa).style.fontWeight="bold";
				document.getElementById(valor_id_playa).style.fontSize='14px';
			}
			if(id_playa == "todos_los_hoteles_en_seccion_hoteles_destino"){
				id_playa = '0'; 
			}
			//document.getElementById(valor_id_playa).style.fontWeight="bold";
			/*if(valor_id_playa!='0'){
				document.getElementById(valor_id_playa).style.fontWeight="normal";
				//id_sel_anterior=valor_id_playa;
			}*/
			/*id_sel_anterior='0';
			valor_id_playa='0';*/
			valor_id_playa=id_playa;
			id_sel_anterior=valor_id_playa;
			filtrar_los_hoteles_del_listado='SI';
		}
}
/*/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/


/*//////////////////////////////////INFORME PARA GOOGLE///////////////////////////////////////////////////////////////*/

function informeMiroVideo(queMiro){
	if(controlSitioProduccion == 1){
		pageTracker._trackPageview(queMiro);
	}
}

function mailErrorGoogle(abrirPagina){
	var ajaxN=ajaxBuscadorN();
	ajaxN.open("GET", abrirPagina, true);
	ajaxN.send(null);
}

function googleMapError(){
	//alert(pagina);
	if(document.getElementById('cargoGoogle').value == 0){
		if(pagina == 'destino_ciudad_hotel'){
			var lugarMap = ''; 
			switch(texto_donde_quiero_ir_a){
				case 'pais':
					lugarMap = 'Pais Seleccionado: ';
					break;
				case 'estado':
					lugarMap = 'Estado Seleccionado: ';
					break;
				case 'ciudad':
					lugarMap = 'Ciudad Seleccionada: ';
					break;
				case 'playa':
					lugarMap = 'Playa Seleccionada: ';
					break;
			}
			lugarMap = lugarMap + document.getElementById('texto_ciudad_sel_buscador_principal').value;
			mailErrorGoogle('/includes/informeErrorGoogle.php?lg='+lugarMap);
		}else{
			fuente = document.getElementById('googleFuenteHotel').value;
			idHotel = document.getElementById('googleIdHotel').value;
			session = document.getElementById('sessionR').value;
			mailErrorGoogle('/includes/informeErrorGoogle.php?f='+fuente+'&i='+idHotel+'&s='+session);
		}
		//alert(document.getElementById('cargoGoogle').value);
	}
}

function asignaValoresEjecutaIframe(id_playaMap,pais_o_ciudadMap,abcMap){//esta funcion asigna los valores a las variables hidden para poder levantarlas desde el iframe que esta misma funcion ejecuta luego de asignar los valores correspondientes.	
	document.getElementById('iniMapIdPlaya').value =id_playaMap;
	document.getElementById('iniMapPaisCiudad').value =pais_o_ciudadMap;
	document.getElementById('iniMapAbc').value =abcMap;
	if(document.getElementById('iniMapIdPlaya').value == 0){
		if(document.getElementById('cargoGoogle').value == 0){
			darEstiloNegritaCiuSel(id_playaMap,pais_o_ciudadMap,abcMap);
			doAjax('/destino/seccion_listado_hoteles_destino.php',valor_id_playa+'_'+valor_abc,'cargar_seccion_listado_hoteles_destino','post',0);
		}else{
			window.frames.iframeGoogleMap2.location.href = '/cargaMapaGoogle.php?tipoDiv=5';
		}
	}else{
		if(document.getElementById('cargoGoogle').value == 0){
			darEstiloNegritaCiuSel(id_playaMap,pais_o_ciudadMap,abcMap);
			doAjax('/destino/seccion_listado_hoteles_destino.php',valor_id_playa+'_'+valor_abc,'cargar_seccion_listado_hoteles_destino','post',0);
		}else{
			window.frames.iframeGoogleMap2.location.href = '/cargaMapaGoogle.php?tipoDiv=4';
		}
	}
}

function asignaValoresEjecutaIframe2(id_playaMap,pais_o_ciudadMap,abcMap,monTipo,tc,tcbrs,l,df){//esta funcion asigna los valores a las variables hidden para poder levantarlas desde el iframe que esta misma funcion ejecuta luego de asignar los valores correspondientes.	
	document.getElementById('fade2').style.display='block';
	document.getElementById('fondoCargandoEspere').style.display='block';
	if(isNaN(id_playaMap)){
		document.getElementById('filtroEstCiuNum').value = 0;
	}else{
		document.getElementById('filtroEstCiuNum').value = id_playaMap;
	}
	document.getElementById('iniMapIdPlaya').value =id_playaMap;
	t = document.getElementById('filtroHotelesX').value;
	document.getElementById('iniMapPaisCiudad').value =pais_o_ciudadMap;
	document.getElementById('iniMapAbc').value =abcMap;
	if(document.getElementById('iniMapIdPlaya').value == 0){
		if(document.getElementById('cargoGoogle').value == 0){
			//alert('entrada 1');
			darEstiloNegritaCiuSel(id_playaMap,pais_o_ciudadMap,abcMap);
			doAjax('/destino/seccion_listado_hoteles_destino.php?df='+df+'&por='+t+'&monTrf='+monTipo+'&tc='+tc+'&tc_brs='+tcbrs+'&leyendaTrf='+l,valor_id_playa+'_'+valor_abc,'cargar_seccion_listado_hoteles_destino','post',0);
		}else{
			//alert('entrada 1.1');
			window.frames.iframeGoogleMap2.location.href = '/cargaMapaGoogle.php?df='+df+'&por='+t+'&tipoDiv=5&monTrf='+monTipo+'&tc='+tc+'&tc_brs='+tcbrs+'&leyendaTrf='+l;
		}
	}else{
		if(document.getElementById('cargoGoogle').value == 0){
			//alert('entrada 2');
			darEstiloNegritaCiuSel(id_playaMap,pais_o_ciudadMap,abcMap);
			doAjax('/destino/seccion_listado_hoteles_destino.php?df='+df+'&por='+t+'&monTrf='+monTipo+'&tc='+tc+'&tc_brs='+tcbrs+'&leyendaTrf='+l,valor_id_playa+'_'+valor_abc,'cargar_seccion_listado_hoteles_destino','post',0);
		}else{
			//alert('entrada 2.2');
			window.frames.iframeGoogleMap2.location.href = '/cargaMapaGoogle.php?df='+df+'&por='+t+'&tipoDiv=4&monTrf='+monTipo+'&tc='+tc+'&tc_brs='+tcbrs+'&leyendaTrf='+l;
		}
	}
	/*fEstSelect = document.getElementById('filtroEstSelect').value;
	fEstLista = document.getElementById('filtroEstLista').value;
	fEstCant = document.getElementById('filtroEstCant').value;
	setTimeout ('ocultarMostrarEstr(fEstSelect,fEstCant,fEstLista)', 6000);
	setTimeout ("document.getElementById('fade2').style.display='none'", 6000);
	setTimeout ("document.getElementById('fondoCargandoEspere').style.display='none'", 6000);*/
	setTimeout ("posicionarEnDiv('#titulo_detalle_hotel')", 6000);	
}

function ordenHotelesXFiltro(t,monTipo,tc,tcbrs,l,df){
	document.getElementById('fade2').style.display='block';
	document.getElementById('fondoCargandoEspere').style.display='block';
	/*l = l.replace('\u00f3', 'ó');*/
	doAjax('/destino/seccion_listado_hoteles_destino.php?df='+df+'&por='+t+'&monTrf='+monTipo+'&tc='+tc+'&tc_brs='+tcbrs+'&leyendaTrf='+l,valor_id_playa+'_'+valor_abc,'cargar_seccion_listado_hoteles_destino','post',0);
	//window.location.href = '/hoteles/destino/FLORIANOPOLIS/ciudad-257-CH.html';
	/*fEstSelect = document.getElementById('filtroEstSelect').value;
	fEstLista = document.getElementById('filtroEstLista').value;
	fEstCant = document.getElementById('filtroEstCant').value;
	setTimeout ('ocultarMostrarEstr(fEstSelect,fEstCant,fEstLista)', 6000);*/
}
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

/*///////////////////////////////////////////////////RECUPERAR PASSWORD DESDE SISTEMA INTERNO//////////////////////////////*/
function recuperarPassDesdeAdmin(nom,tProceso,indice){
	/*alert(nom);
	alert(tProceso);
	alert(indice);*/
	var selectDestino=document.getElementById('resRecuperoPass_'+indice);
	var ajaxN=ajaxBuscadorN();
	ajaxN.open("GET", '../includes/enviar_mail.php?procesoUser='+tProceso+'&userRecPass='+nom, true);
	ajaxN.onreadystatechange=function() 
	{
		if (ajaxN.readyState==4)
		{
			//selectDestino.innerHTML=ajaxN.responseText;
			selectDestino.innerHTML='Password Enviado';
		} 
	}
	ajaxN.send(null);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function comentariosCarga(num,desde,hasta,sec){
	valorDestinoAC = 1;
	var comentariosDest=document.getElementById('map3');
	var ajaxN=ajaxBuscadorN();
	ajaxN.open("GET", '/comentarios/muestra_comentarios_destino.php?n='+num+'&num1='+desde+'&num2='+hasta+'&donde='+sec, true);
	ajaxN.onreadystatechange=function() 
	{
		if (ajaxN.readyState==1)
		{
			comentariosDest.innerHTML='Cargando...';
		} 
		if (ajaxN.readyState==4)
		{
			comentariosDest.innerHTML=ajaxN.responseText;
		} 
	}
	ajaxN.send(null);
}

/*////////////////////////////////////////////////////Filtro Estrellas Hotel///////////////////////////////////////*/
var catMarcada=0;
function marcarCategoria(num,n,id){
	document.getElementById('catId-'+num).style.fontWeight='bold';
	document.getElementById('catId-'+num).style.fontSize='14px';
	document.getElementById('catId-'+catMarcada).style.fontWeight='normal';
	document.getElementById('catId-'+catMarcada).style.fontSize='12px';
	catMarcada=num;
	estadoEsTodas(n);
	document.getElementById('filtroEstSelect').value=id;
}

function ocultarMostrarEstr(id,n,list){
	//alert(id);
	//alert(n);
	//alert(list);
	var numId;
	arrayList = list.split(';');
	arrayList[0] = 0;
	if(id != 0){
		for(i=0;i <= n;i++){
			if(document.getElementById('est-'+id+'-'+i)){
				mostrarDiv('est-'+id+'-'+i);
			}else{
				for(k=0;k < arrayList.length;k++){
					if(document.getElementById('est-'+arrayList[k]+'-'+i)){
						ocultarDiv('est-'+arrayList[k]+'-'+i);
					}
				}
			}
		}
	}else{
		for(i=0;i <= n;i++){
			for(k=0;k < arrayList.length;k++){
				if(document.getElementById('est-'+arrayList[k]+'-'+i)){
					mostrarDiv('est-'+arrayList[k]+'-'+i);
				}
			}
		}
	}
	document.getElementById('filtroEstSelect').value=id;
}

function descDestino(num,d){//DESCRIPCION FILTRO DESTINO
	/*if(d == 'cp'){
		document.getElementById('infoExtra').innerHTML = document.getElementById(num).innerHTML;
	}else{
	
	}*/
}

function tarifasPorHotel(num,ocultaDiv,nomDiv,tc,tcBrs,trfLey,idLi,idImg){
	deslizarMapa2(ocultaDiv);
	trfLey = trfLey.replace('\u00f3', 'ó');
	trfLey = trfLey.replace('\u00f3', 'ó');
	if(document.getElementById(nomDiv).innerHTML == ''){
		valorDestinoAC = 1;
		var divCarga=document.getElementById(nomDiv);
		var f1 = document.getElementById('fecha_desde_destino').value;
		var f2 = document.getElementById('fecha_hasta_destino').value;
		var ajaxN=ajaxBuscadorN();
		ajaxN.open("GET", '/destino/cargaTarifas.php?n='+num+'&tcAjax='+tc+'&tc_brsAjax='+tcBrs+'&leyendaTrfAjax='+trfLey+'&f1='+f1+'&f2='+f2, true);
		ajaxN.onreadystatechange=function() 
		{
			if (ajaxN.readyState==1)
			{
				divCarga.innerHTML='Cargando...';
			} 
			if (ajaxN.readyState==4)
			{
				divCarga.innerHTML=ajaxN.responseText;
			} 
		}
		ajaxN.send(null);
		document.getElementById(idLi).style.border='1px solid';
		document.getElementById(idLi).style.borderColor='#006600';
		document.getElementById(idLi).style.background='#D9F1D1';
		document.getElementById('imgTarifas-'+idImg).src='/imagenes/Iconos/tarifa_cerrar.png';
	}else{
		document.getElementById(nomDiv).innerHTML = '';
		document.getElementById(idLi).style.border='';
		document.getElementById(idLi).style.background='';
		document.getElementById('imgTarifas-'+idImg).src='/imagenes/Iconos/tarifa_abrir.png';
	}
}

var fPorCat = 0;
function mostrarFiltroCategoria(){
	if(fPorCat == 0){
		document.getElementById('OMcategoria').innerHTML='Ocultar Filtros&nbsp;<img src="/imagenes/iconos/icono_mostrar_contenido.png" height="21" width="21" alt="" />';
		for(i=1;i<=3;i++){
			mostrarDiv('listaCat-'+i);
		}
		fPorCat = 1;
	}else{
		document.getElementById('OMcategoria').innerHTML='Mostrar Filtros&nbsp;<img src="/imagenes/iconos/icono_mostrar_contenido.png" height="21" width="21" alt="" />';
		for(i=1;i<=3;i++){
			ocultarDiv('listaCat-'+i);
		}
		fPorCat = 0;
	}
}

var fPorLoc = 0;
function mostrarFiltroLocalidad(){
	if(fPorLoc == 0){
		document.getElementById('OMLoc').innerHTML='Ocultar Filtros&nbsp;<img src="/imagenes/iconos/icono_mostrar_contenido.png" height="21" width="21" alt="" />';
		for(i=1;i<=3;i++){
			mostrarDiv('listFiltroLoc-'+i);
		}
		fPorLoc = 1;
	}else{
		document.getElementById('OMLoc').innerHTML='Mostrar Filtros&nbsp;<img src="/imagenes/iconos/icono_mostrar_contenido.png" height="21" width="21" alt="" />';
		for(i=1;i<=3;i++){
			ocultarDiv('listFiltroLoc-'+i);
		}
		fPorLoc = 0;
	}
}

var ciuFiltroMarcada=0;
function estadoEsTodas(num){
	if(num == 2){
		ciuFiltroMarcada=0;
	}
	//alert('num:'+num);
	//alert('catMarcada:'+catMarcada);
	//alert('ciuFiltroMarcada:'+ciuFiltroMarcada);
	if((num == 0 || num == 2) && catMarcada == 0 && document.getElementById('filtroEstCiuNum').value == 0){
		mostrarDiv('contenedor_localidad2');
	}else{
		ocultarDiv('contenedor_localidad2');
	}
}


/*////////////////////////////////////////////////////FUNCIONES ALTA COTIZACION////////////////////////////////////////////*/
var ocultoListClientes = 0;
function BCP(texto){
	if(texto != ''){
		//ocultoListClientes = 1;
		var radio = document.cotizacion.bP;
		var x;
		var comentariosDest = document.getElementById('bcpResultado');
		comentariosDest.style.display='block';
		for(i=0;i<radio.length;i++){
			if(radio[i].checked){		
				x = radio[i].value;
			} 
		}
		var ajaxN=ajaxBuscadorN();
		ajaxN.open("GET", 'buscarCP.php?t='+texto+'&p='+x, true);
		ajaxN.onreadystatechange=function() 
		{
			if (ajaxN.readyState==1)
			{
				comentariosDest.innerHTML='Cargando...';
			} 
			if (ajaxN.readyState==4)
			{
				comentariosDest.innerHTML=ajaxN.responseText;
			} 
		}
		ajaxN.send(null);
	}else{
		alert('Complete el casillero con lo que desea buscar');
	}
}

function ocultarListClientes(){
	if(ocultoListClientes == 1){
		ocultarDiv('bcpResultado');
		ocultoListClientes = 0;
	}
}

function asignarDatosAltaCot(d){
	arrayDatosCot = d.split('=');
	document.getElementById('clienteCodigo').value = arrayDatosCot[0];
	document.getElementById('clienteNuevo').value = arrayDatosCot[1];
	document.getElementById('tel').value = arrayDatosCot[3];
	document.getElementById('mail').value = arrayDatosCot[4];
	var datosContacto = document.getElementById('datosContacto');
	var ajaxN=ajaxBuscadorN();
	ajaxN.open("GET", 'clienteContactoPta.php?n='+document.getElementById('clienteCodigo').value, true);
	ajaxN.onreadystatechange=function() 
	{
		if (ajaxN.readyState==1)
		{
			comentariosDest.innerHTML='Cargando...';
		} 
		if (ajaxN.readyState==4)
		{
			datosContacto.innerHTML=ajaxN.responseText;
		} 
	}
	ajaxN.send(null);
}

function asignarClienteCont(d){
	arrayDatosClienteCont = d.split('=');
	document.getElementById('nomCont').value = arrayDatosClienteCont[0];
	document.getElementById('mailCont').value = arrayDatosClienteCont[1];
}

function checkCotizacionAlta(){
	var ok = true;
	var okTexto = true;
	var mailTelVacios = '';
	var mail_usuario = $('#mail').get(0);
	var mail_contacto = $('#mailCont').get(0);
	var checkMail = $('#mailUsuario').get(0);
	var tel_usuario = $('#tel').get(0);
	var nomb_usuario = $('#clienteNuevo').get(0);
	var nom_contacto = $('#nomCont').get(0);
	var destino = $('#id_destino').get(0);
	var producto = $('#id_producto').get(0);
	var comoLlego = $('#id_como_llego').get(0);
	var tipoContacto = $('#id_tipo_contacto').get(0);
	var textoCotizacion = $('#cotizacionTexto').get(0);
	var solicitudCot = $('#solTextoArea').get(0);
	var solicitudOld = $('#solicitud_old').get(0);
	var filter=/^[A-Za-z0-9_.-][A-Za-z0-9_.-]*@[A-Za-z0-9_-]+\.[A-Za-z0-9_.]+[A-za-z]$/;
	if(mail_usuario.value != ''){
		tel_usuario.style.backgroundColor='#FFFFFF';
		if(!filter.test(mail_usuario.value)){
			mail_usuario.style.backgroundColor='#FF4A4A';
			ok = false;
		}else{
			mail_usuario.style.backgroundColor='#FFFFFF';
		}
	}else{
		if(tel_usuario.value == ''){
			tel_usuario.style.backgroundColor='#FF4A4A';
			mail_usuario.style.backgroundColor='#FF4A4A';
			mailTelVacios = '*Debe completar al menos el Telefono o Mail de la agencia para continuar';
			ok = false;
		}else{
			tel_usuario.style.backgroundColor='#FFFFFF';
			mail_usuario.style.backgroundColor='#FFFFFF';
		}
	}
	
	if(mail_contacto.value == '' && nom_contacto.value != ''){
		if(mail_usuario.value == ''){
			mail_contacto.style.backgroundColor='#FF4A4A';
			mail_usuario.style.backgroundColor='#FF4A4A';
			mailTelVacios = '*Debe completar al menos el Mail de la Agencia o Mail de Contacto para continuar';
			ok = false;
		}else{
			mail_contacto.style.backgroundColor='#FFFFFF';
		}
	}else{
		if(mail_contacto.value != '' && !filter.test(mail_contacto.value)){
			mail_contacto.style.backgroundColor='#FF4A4A';
			ok = false;
		}else{
			mail_contacto.style.backgroundColor='#FFFFFF';
		}
	}
	
	if(nomb_usuario.value == ''){
		nomb_usuario.style.backgroundColor='#FF4A4A';
		ok = false;
	}else{
		nomb_usuario.style.backgroundColor='#FFFFFF';
	}
	
	if(destino.value == 'NULL'){
		destino.style.backgroundColor='#FF4A4A';
		ok = false;
	}else{
		destino.style.backgroundColor='#FFFFFF';
	}
	
	if(producto.value == 'NULL'){
		producto.style.backgroundColor='#FF4A4A';
		ok = false;
	}else{
		producto.style.backgroundColor='#FFFFFF';
	}
	
	if(comoLlego.value == 'NULL'){
		comoLlego.style.backgroundColor='#FF4A4A';
		ok = false;
	}else{
		comoLlego.style.backgroundColor='#FFFFFF';
	}
	
	if(tipoContacto.value == 'NULL'){
		tipoContacto.style.backgroundColor='#FF4A4A';
		ok = false;
	}else{
		tipoContacto.style.backgroundColor='#FFFFFF';
	}
	
	if(solicitudCot.value == '' && typeof solicitudOld == 'undefined'){
		solicitudCot.style.backgroundColor='#FF4A4A';
		ok = false;
	}else{
		solicitudCot.style.backgroundColor='#FFFFFF';
	}
	if(ok){
		if(textoCotizacion.value == ''){
			document.cotizacion.submit();
		}else{
			if(checkMail.checked){
				document.cotizacion.submit();
			}else{
				confirmacion = confirm('Esta por guardar la cotizacion sin enviarla al cliente si desea seleccionar la opcion para enviar al cliente presione CANCELAR.');
				if(confirmacion == true){
					document.cotizacion.submit();	
				}
			}
		}
	}else{
		alert('*Verfique los campos marcados en Rojo\n'+mailTelVacios);
		posicionarEnDiv('#contTituloPag');
	}
}

function checkCotRespuesta(){
	var ok = true;
	var resCot = $('#cotizacion').get(0);
	if(resCot.value == ''){
		resCot.style.backgroundColor='#FF4A4A';
		ok = false;
	}else{
		resCot.style.backgroundColor='#FFFFFF';
	}
	if(ok){
		document.cotizacion.action=dOriginal;
		document.cotizacion.target ="_self";
		document.cotizacion.submit();
	}else{
		alert('*Verfique los campos marcados en Rojo');
		posicionarEnDiv('#detalle_solicitud');
	}
}

function checkCotFile(){
	var errorFecha = '';
	var fecha = new Date();
	var diames = parseInt(fecha.getDate());
	var dia = parseInt(fecha.getDay());
	var mes = parseInt(fecha.getMonth()+1);
	var anio = parseInt(fecha.getFullYear());
	var ok = true;
	var fSalida = $('#fecha_salida').get(0);
	var fRegreso = $('#fecha_regreso').get(0);
	var fileCot = $('#id_cliente_pta').get(0);
	if(fileCot.value == ''){
		fileCot.style.backgroundColor='#FF4A4A';
		ok = false;
	}else{
		fileCot.style.backgroundColor='#FFFFFF';
	}
	
	if(fSalida.value == 'dd/mm/aaaa'){
		fSalida.style.backgroundColor='#FF4A4A';
		ok = false;
	}else{
		var desgloseFecha = fSalida.value.split("/");
		
		if(parseInt(desgloseFecha[1]) > mes && parseInt(desgloseFecha[2]) >= anio){
			fRegreso.style.backgroundColor='#FFFFFF';
		}else{
			if(parseInt(desgloseFecha[1]) == mes){
				if(parseInt(desgloseFecha[0]) > diames){
					fRegreso.style.backgroundColor='#FFFFFF';
				}else{
					fRegreso.style.backgroundColor='#FF4A4A';
					ok = false;
					errorFecha+= '*La fecha de Salida debe ser mayor a la Fecha de Hoy\n';
				}	
			}else{
				fRegreso.style.backgroundColor='#FF4A4A';
				ok = false;
				errorFecha+= '*La fecha de Salida debe ser mayor a la Fecha de Hoy\n';
			}
		}
	}
	
	if(fRegreso.value == 'dd/mm/aaaa'){
		fRegreso.style.backgroundColor='#FF4A4A';
		ok = false;
	}else{
		var desgloseFechaS = fSalida.value.split("/");
		var desgloseFechaR = fRegreso.value.split("/");
		if((parseInt(desgloseFechaR[1]) > parseInt(desgloseFechaS[1])) && (parseInt(desgloseFechaR[2]) >= parseInt(desgloseFechaS[2]))){
			fRegreso.style.backgroundColor='#FFFFFF';
		}else{
			if(parseInt(desgloseFechaR[1]) == parseInt(desgloseFechaS[1])){
				if(parseInt(desgloseFechaR[0]) > parseInt(desgloseFechaS[0])){
					fRegreso.style.backgroundColor='#FFFFFF';
				}else{
					fRegreso.style.backgroundColor='#FF4A4A';
					ok = false;
					errorFecha+= '*La fecha de Regreso debe ser mayor a la Fecha de Salida\n';
				}	
			}else{
				fRegreso.style.backgroundColor='#FF4A4A';
				ok = false;
				errorFecha+= '*La fecha de Regreso debe ser mayor a la Fecha de Salida\n';
			}
		}
	}
	
	if(ok){
		document.cotizacion.submit();
	}else{
		alert('*Verfique los campos marcados en Rojo\n'+errorFecha);
		posicionarEnDiv('#Contenedor_titulo_pag');
	}
}

function cotExistentes(dct,todas){
	var divCarga = document.getElementById('mostrarCotizacionE');
	var ajaxN=ajaxBuscadorN();
	ajaxN.open("GET", '/cotizacion/cotizacionesExistente.php?n='+dct+'&t='+todas, true);
	ajaxN.onreadystatechange=function() 
	{
		if (ajaxN.readyState==1)
		{
			divCarga.innerHTML='Cargando...';
		} 
		if (ajaxN.readyState==4)
		{
			divCarga.innerHTML=ajaxN.responseText;
		} 
	}
	ajaxN.send(null);
}

function moFBC(n){
	if(n == 1){
		document.getElementById('fBC').style.border='1px solid #CECECE';
		document.getElementById('BC1').style.display='block';
		document.getElementById('BC2').style.display='block';
		document.getElementById('lBC').innerHTML='Buscar Cliente Existente:';
		document.getElementById('cerrarBC').style.display='block';
		document.getElementById('abrirBC').style.display='none';
	}else{
		document.getElementById('fBC').style.border='0px';
		document.getElementById('BC1').style.display='none';
		document.getElementById('BC2').style.display='none';
		document.getElementById('lBC').innerHTML='Buscar Cliente Existente:';
		document.getElementById('cerrarBC').style.display='none';
		document.getElementById('abrirBC').style.display='block';
	}
}

function moVRC(n){
	if(n == 1){
		document.getElementById('VRC').style.border='1px solid #CECECE';
		document.getElementById('VRC1').style.display='block';
		document.getElementById('VRC2').style.display='block';
		document.getElementById('lVRC').innerHTML='Respuesta Cotizacion (Tarifas - A\u00e9reos):';
		document.getElementById('cerrarVRC').style.display='block';
		document.getElementById('abrirVRC').style.display='none';
	}else{
		document.getElementById('VRC').style.border='0px';
		document.getElementById('VRC1').style.display='none';
		document.getElementById('VRC2').style.display='none';
		document.getElementById('lVRC').innerHTML='Ver Respuesta Cotizacion (Tarifas - A\u00e9reos):';
		document.getElementById('cerrarVRC').style.display='none';
		document.getElementById('abrirVRC').style.display='block';
	}
}

function moSC(n){
	if(n == 1){
		document.getElementById('SC').style.border='1px solid #CECECE';
		document.getElementById('SC1').style.display='block';
		document.getElementById('lSC').innerHTML='Solicitud Cotizaci\u00f3n:';
		document.getElementById('cerrarSC').style.display='block';
		document.getElementById('abrirSC').style.display='none';
	}else{
		document.getElementById('SC').style.border='0px';
		document.getElementById('SC1').style.display='none';
		document.getElementById('lSC').innerHTML='Ver Solicitud Cotizaci\u00f3n:';
		document.getElementById('cerrarSC').style.display='none';
		document.getElementById('abrirSC').style.display='block';
	}
}

function verificarBC(){
	if(document.getElementById('dct').value == ''){
		moFBC(1);
		moSC(1);
	}
}

/*////////////////////////////////////////////////FUNCION PARA ATTACH DE COTIZACION TARIFA/////////////////////////////////////*/
var dOriginal = '';
var textoAgregar = '';
function adjuntarArchivoCot(n){
	if(dOriginal == ''){
		dOriginal = document.cotizacion.action;
	}
	textoAgregar = document.getElementById('cotizacion').value;
	document.cotizacion.action='subirAttachCotizacion.php?n='+n;
	document.cotizacion.target ="_blank";
	document.cotizacion.submit();
}

function actualizarAdjuntos(text,n){
	if(text == 'EL ARCHIVO SE ADJUNTO CORRECTAMENTE' || text == ''){
		var divCarga = document.getElementById('mensajeCargado');
		var ajaxN=ajaxBuscadorN();
		ajaxN.open("GET", '/cotizacion/archivosAdjuntos.php?n='+n, true);
		ajaxN.onreadystatechange=function() 
		{
			if (ajaxN.readyState==1)
			{
				divCarga.innerHTML='Cargando...';
			} 
			if (ajaxN.readyState==4)
			{
				divCarga.innerHTML=text+'<br/>'+ajaxN.responseText;
			} 
		}
		ajaxN.send(null);
	}else{
	
	}
}
/*//////////////////////////////////////////////FUNCION PARA BUSQUEDA AVANZADA POR TARIFA/////////////////////////*/

function buscoTarifas(){
	tHasta = document.getElementById('tar_has_bus_tar').value;
	if(tHasta != 0){
		verificar_datos_formulario_tarifas();
		posicionarEnDiv('#contenedor_buscador_tarifa');
	}
}
