$(document).ready(function() {

	$("#btnInclude").click(function(){  
 	    document.getElementById("hdnFoto").value= document.getElementById("arquivo").value;
		document.getElementById("hdnTipoDesordem").value= document.getElementById("listDesordens").value;
		setAnonimo();
		
		if (validaCampos()) {

			$.ajax({  
						type: "POST", 
						url: "incluirDesordem.php", 
						data: jQuery("form").serialize(),  
						success:  function(data) {
									
									//alert("Inclusao da desordem efetuada com sucesso");
									sucesso("Inclusao da desordem efetuada com sucesso");
	 
									
									resetMarks();			
										$.getJSON('mostraDesordem.php',
											function(resposta){		
												
												if (resposta != "") {
													//var dataArray = resposta.split("|");
													var dataArray = resposta;
													if (dataArray.length > 0)
														for (i=0; i < dataArray.length; i++) {
															//var data = eval('('+dataArray[i]+')');
															var data = dataArray[i];
															setAddresses(data);
														}				    
												}
	
												var lat = document.getElementById("hdnLat").value;
												var lng = document.getElementById("hdnLong").value;
															
												mostraInclusao(lat,lng);					
												limparAll();
												
											}
											
										);								
	
									},
						error:    function(data) { alert("erro"); }
					});  
		}		



	});  

});
