// JavaScript Document
var seleccion = false;
var busco     = false;
var tipo_experiencia ='';
var tipo_isla ='';
$(document).ready(function(){
	$("#form_search").submit(function(){
		
		var Search = $('#search').val();
		
		if (Search) {
				seleccion = true;
				busco = true;
		}
			
		/********* 	tipo_experiencia */
		tipo_experiencia = '';
			$(".tipo_experiencia").each(function(){
					var valor = $(this).val();
					if ($(this).attr("checked")){
						 seleccion = true;
						 busco = true;
						 if (!tipo_experiencia)
						 		tipo_experiencia = valor;
							  else
							  	tipo_experiencia += ','+valor;
					}
			})
		/********* 	tipo_experiencia */
		/********* 	tipo_isla */
		tipo_isla = '';
			$(".tipo_isla").each(function(){
					var valor = $(this).val();
					if ($(this).attr("checked")){
						 seleccion = true;
						 busco = true;
						 if (!tipo_isla)
						 		tipo_isla = valor;
							  else
							  	tipo_isla += ','+valor;
					}
			})
		/********* 	tipo_isla */
		 if (busco){
			$("#contenedor").animate({left:'-773px'});
			_find(Search , tipo_isla , tipo_experiencia );
		}
	})
	
	
})


function add_favoritos(id){
	acordeon('box_favorito');
	var H = $('#box_favorito').css('height');
		if (H == '0px'){
				$('#box_favorito').animate({ height : '296px' })
				$('.jScrollPaneContainer , #list_favoritos ').show();
		}
	
	capa = $("#list_favoritos");
	$("#informacion").html('');
	$.ajax({
					type   : "POST",
					url    : "ajax.php",
					data   : "act=add_favorito&id="+id,
					success: function(msg){
						if (msg) capa.html(msg);
					}
				})
	
	capa.jScrollPane();

	
}

function remove_favorito(id){
	$.ajax({
					type   : "POST",
					url    : "ajax.php",
					data   : "act=remove_favorito&id="+id,
					success: function(msg){
						$("#fav_"+id).fadeOut();
						$('#list_favoritos').jScrollPane();
					}
				})
		
}