function cambiar_search_icons(id_onsite){
	document.getElementById('icon_property').src = 'images/iconos_fondo_blanco_property.gif';
	document.getElementById('icon_activities').src = 'images/iconos_fondo_blanco_activities.gif';
	document.getElementById('icon_cars').src = 'images/iconos_fondo_blanco_cars.gif';
	document.getElementById('icon_boats').src = 'images/iconos_fondo_blanco_boats.gif';
	document.getElementById('icon_deals').src = 'images/iconos_fondo_blanco_deals.gif';
	// solo el onsite verde
	document.getElementById(id_onsite).src = 'images/iconos_fondo_verde_'+id_onsite+'.gif';
}

// NO LA USO AHORA: funcion para saber si una actividad se selecciono, de esta forma activo o no las demas opciones
function activity_selected(id_activity_hour){
	//alert(document.getElementById(id_activity_hour).checked);
	if (document.getElementById('x_id_activity_hour_'+id_activity_hour).checked==true){
		// activo todas las opciones de este activity hour
		document.getElementById('x_adults_'+id_activity_hour).disabled = false;
		document.getElementById('x_children_'+id_activity_hour).disabled = false;
		document.getElementById('x_selected_date_'+id_activity_hour).disabled = false;
		//document.getElementById('x_selected_date_'+id_activity_hour).disabled = false;
	}else{
		// desactivo todas las opciones de este activity hour
		document.getElementById('x_adults_'+id_activity_hour).disabled = true;
		document.getElementById('x_children_'+id_activity_hour).disabled = true;	
		document.getElementById('x_selected_date_'+id_activity_hour).disabled = true;
	}
}

// NO LA USO AHORA: funcion para saber si un bote se selecciono, de esta forma activo o no las demas opciones
function boat_selected(id_boat_hour){
	//alert(document.getElementById(id_boat_hour).checked);
	if (document.getElementById('x_id_boat_hour_'+id_boat_hour).checked==true){
		// activo todas las opciones de este activity hour
		document.getElementById('x_adults_'+id_boat_hour).disabled = false;
		//document.getElementById('x_children_'+id_boat_hour).disabled = false;
		document.getElementById('x_selected_date_'+id_boat_hour).disabled = false;
		document.getElementById('x_captain_'+id_boat_hour).disabled = false;
	}else{
		// desactivo todas las opciones de este boat hour
		document.getElementById('x_adults_'+id_boat_hour).disabled = true;
		//document.getElementById('x_children_'+id_boat_hour).disabled = true;	
		document.getElementById('x_selected_date_'+id_boat_hour).disabled = true;
		document.getElementById('x_captain_'+id_boat_hour).disabled = true;
	}
}

// funcion para la paginacion: no la estoy usando actualmente
function paginacion(accion){
	document.MovePage.action.value = accion;
	document.MovePage.submit();
}

// funcion para mostrar/ocultar cuando se le da al boton book it
function show_hide(id){
	//alert(id);
	if (document.getElementById(id).style.display=='none'){
		document.getElementById(id).style.display = '';	
	}else{
		document.getElementById(id).style.display = 'none';	
	}
}

// funcion para cambiar la fecha en el buscador, una vez se selecciona FROM
function change_dropoff_date(fecha,campo_to){
	var la_fecha = new Date(fecha);
	var the_day = la_fecha.getDate(); 
	var the_month = la_fecha.getMonth(); 
	var the_year = la_fecha.getUTCFullYear(); 
	
	var nuevo_dia = the_day+2;
	the_month = the_month+1;
	
	var nueva_fecha = the_month+'/'+nuevo_dia+'/'+the_year;
	
	var la_fecha2 = new Date(nueva_fecha);
	var the_day2 = la_fecha2.getDate();
	var the_month2 = la_fecha2.getMonth(); 
	var the_year2 = la_fecha2.getUTCFullYear(); 
	
	the_month2 = the_month2+1;
	
	var nueva_fecha2 = the_month2+'/'+the_day2+'/'+the_year2;						

	//alert(campo)
	document.getElementById(campo_to).value = nueva_fecha2;
	
}

// funcion para validar si la fecha de irse no es menor a la de from, no deberia
function validate_date(dropoff_date,campo_from,campo_to){

	var pickup_date = document.getElementById(campo_from).value;
	//alert('pick: '+pickup_date+', drop: '+dropoff_date)
	
	var pickup_date2 = new Date(pickup_date);
	var dropoff_date2 = new Date(dropoff_date);
	
	//alert('pickup: '+pickup_date2+' - dropoff: '+dropoff_date2)
	// por ahora dejare que pueda escoger el mismo dia
	if(dropoff_date2<pickup_date2){
		alert('Your Arrival Date cannot be before the Departure Date');
		change_dropoff_date(pickup_date,campo_to);
	}

}

// nolo estoy usando ahora: funcion si se escoge una fecha en activities o bats, en checkbox se activa:
function activate_checkbox(valor,id_check_box){
	if (valor==''){
		document.getElementById(id_check_box).checked = false;	
	}else{
		document.getElementById(id_check_box).checked = true;	
	}
}

// funcion para mostrar mapas o gelaria en los detalles
function mostrar_map_galeria(especifico){
	//alert(especifico)
	if(especifico=='mapa'){
		document.getElementById('div_gallery').style.display = 'none';
		document.getElementById('map_canvas').style.display = '';
		document.getElementById('link_view_map').style.display = 'none';
		document.getElementById('link_view_gallery').style.display = '';
		//showAddress(x_direccion);
		initialize();		
		GUnload();
	}else{
		if (document.getElementById('div_gallery').style.display==''){
			document.getElementById('div_gallery').style.display = 'none';
			document.getElementById('map_canvas').style.display = '';
			document.getElementById('link_view_map').style.display = 'none';
			document.getElementById('link_view_gallery').style.display = '';
			//showAddress(x_direccion);
			initialize();
		}else{
			document.getElementById('div_gallery').style.display = '';
			document.getElementById('map_canvas').style.display = 'none';		
			document.getElementById('link_view_map').style.display = '';
			document.getElementById('link_view_gallery').style.display = 'none';
		}
	}
}

// funcion para mostrar o no lso aditions en el shopping cart
function show_aditions(id){
	if (document.getElementById('adiciones_'+id).style.display=='none'){
		document.getElementById('boton_expand_'+id).src = 'images/collapse.gif';
		document.getElementById('adiciones_'+id).style.display = '';
	}else{
		document.getElementById('boton_expand_'+id).src = 'images/expand.gif';
		document.getElementById('adiciones_'+id).style.display = 'none';		
	}	
}

// funcion para actualizar los combos de ninos y adultos dependiendo del limite total
function update_combobox_limite(cantidad_adultos,limite,id){
	
	var cantidad_ninos = parseInt(limite)-parseInt(cantidad_adultos);
	var x_nuevo_combo_medio = '';
	var x_nuevo_combo_principio = '';
	var x_nuevo_combo_final = '';
	var contador = 1;
	
	x_nuevo_combo_principio = "<select style='width:40px' name='x_children"+id+"' class='letra_normal'><option value='0'>0</option>";
	for (var i = 0; i < cantidad_ninos; i++)
	{
		x_nuevo_combo_medio = x_nuevo_combo_medio+"<option value='"+contador+"'>"+contador+"</option>";
		contador++;
	}
	x_nuevo_combo_final	= "</select>";  
	
	//alert(x_nuevo_combo_principio+x_nuevo_combo_medio+x_nuevo_combo_final);
	document.getElementById('x_children_'+id).innerHTML = x_nuevo_combo_principio+x_nuevo_combo_medio+x_nuevo_combo_final;
}

function payment_method(id){
	if (id==1){
		document.frmReservation3.action	= "reservation_confirm.asp";
		document.frmReservation3.submit();
	}else{
		document.frmReservation3.action	= "reservation_confirm.asp";
		document.frmReservation3.submit();
	}
}

// funcion para validar que se escogio una actividad a la hora de agregar al carrito
function activity_selected(formulario){
	var hay_checked="";
	var x_hasta = formulario.x_id_activity_hour.length;
	if (formulario.x_id_activity_hour.length==undefined){
		if (formulario.x_id_activity_hour.checked==true){
			if (hay_checked==""){
				hay_checked = "yes";	
			}
		}
	}else{
		for(var a=0;a<x_hasta;a++){
			if (formulario.x_id_activity_hour[a].checked==true){
				if (hay_checked==""){
					hay_checked = "yes";	
				}
			}
		}
	}
	
	if (hay_checked==""){
		alert("Please select an hour for your reservation")
		return false;
	}else{
		return true;
	}
}

// funcion para validar que se escogio un bote a la hora de agregar al carrito
function boat_selected(formulario){
	var hay_checked="";
	var x_hasta = formulario.x_id_boat_hour.length;
	if (formulario.x_id_boat_hour.length==undefined){
		if (formulario.x_id_boat_hour.checked==true){
			if (hay_checked==""){
				hay_checked = "yes";	
			}
		}
	}else{
		for(var a=0;a<x_hasta;a++){
			if (formulario.x_id_boat_hour[a].checked==true){
				if (hay_checked==""){
					hay_checked = "yes";	
				}
			}
		}
	}
	
	if (hay_checked==""){
		alert("Please select an hour for your reservation")
		return false;
	}else{
		return true;
	}
}


/*********************************** C ajax  **************************/
var http_request = false;

function makeRequest(url,layer) {

	//************************************************************
	//************************************************************
	//var x_tabla_principal=document.form_reporte.x_tabla_principal
	//************************************************************
	//************************************************************
	//valor_x_tabla_principal=x_tabla_principal.options[x_tabla_principal.selectedIndex].value
	//************************************************************
	//************************************************************
	//url=url+"&id_tabla_principal="+valor_x_tabla_principal
	//************************************************************
	//************************************************************
	//alert(url);
	abrexml(url,layer);

}

function abrexml(url,layer){
				//Defino a que layer se va a ejecutar el script
                eldiv=layer
                http_request = false;
                document.getElementById(eldiv).innerHTML= "<img src='images/loading.gif' width='48' height='47' />"
                if (window.XMLHttpRequest) { // Mozilla, Safari,...
                    http_request = new XMLHttpRequest();
                    if (http_request.overrideMimeType) {
                        http_request.overrideMimeType('text/xml');
                    }
                } else if (window.ActiveXObject) { // IE
                    try {
                        http_request = new ActiveXObject("Msxml2.XMLHTTP");
                    } catch (e) {
                        try {
                        http_request = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch (e) {}
                    }
                }
                if (!http_request) {
                    alert('Giving up :( Cannot create an XMLHTTP instance');
                    return false;
                }
                http_request.onreadystatechange = alertContents;
                http_request.open('GET', url, true);
                http_request.send(null);
            }

//********************************************************************************
//********************************************************************************
function alertContents() {
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			document.getElementById(eldiv).innerHTML=(http_request.responseText)
			
		} else {}}

}
			

//********************************************************************************
//********************************************************************************
function valor_de_radio(elradio){
	for(var i=0; i<elradio.length; i++)	{if (elradio[i].checked){break}}
	return elradio[i].value
}
//********************************************************************************
//********************************************************************************
function valor_de_checkbox(elcheck){
	var texto=""
	var coma=""
	var comacomprueba=0
	for(var i=0; i<elcheck.length; i++){if(elcheck[i].checked){	if(comacomprueba!=0){coma=","}texto=texto+coma+elcheck[i].value
		comacomprueba=1	}} return texto
}
/*********************************** T ajax  **************************/