$(document).ready(function(){

	$(".listaFotos li").toggle(function(){ 
											   
		var nome = $(this).find(".nomeFoto").html();
		$(this).find("img").addClass("fotoMarcada");
		$(this).find("img").css({visibility:"visible", opacity:0.6});
		$(this).find("span").css({visibility: "visible", opacity: 1});
		$(this).find(".fotos").val(nome);
	  
	},function(){ 
	
		$(this).find("img").removeClass("fotoMarcada");
		$(this).find("span").css("visibility", "hidden");
		$(this).find("img").css("opacity", 1);
		$(this).find(".fotos").val('');
	  
	})

	$(".buscaDistancia").click(function(){
		
		var buscarIdOrigem = true;
		
		var buscarIdDestino = true;
		
		if ($("#idorigem").val() == '0'){
			var buscarIdOrigem = false;
		}
		
		if ($("#iddestino").val() == '0'){
			var buscarIdDestino = false;
		}
		
		if (buscarIdOrigem == true && buscarIdDestino == true){
		
			$.ajax({
				beforeSubmit:  showRequest,  // pre-submit callback 
				success:       showResponse,  // post-submit callback 
				url:       'buscaDistancia.php',
				data:	   'idorigem='+ $("#idorigem").val() +'&iddestino='+$("#iddestino").val(), 
				type:      'post'
			});	
			
		} else {
			
			$("#resultado").html('<strong>Selecione a Origem e o Distino.</strong>');
			
		}

	})
	
	
	/*$("#cidade").change(function(){

		
		//function loadMapa(){

			$.ajax({ 
			  type: "POST", 
			  url: "teste/index.php", 
			  data: 'cidade='+ $(this).val(), 
			  success: function(msg){ 
			    $("#montaMapa").empty();
				$("#montaMapa").html(msg);
			  } 
			});


			$.ajax({
				beforeSubmit:  showRequestMapa,  // pre-submit callback 
				success:       showResponseMapa,  // post-submit callback 
				url:       'teste/index.php',
				data:	   'cidade='+ $(this).val(), 
				type:      'post'
			});	
			
		//}
	})*/
	//loadMapa();
	
});


function showRequest(formData, jqForm, options) {
	
}

function showResponse(responseText, statusText) {
	
	$("#resultado").html(responseText);
	
}







