/**
* Altera box de endereços na home
* 
* @access public
*/

$(document).ready(function(){
	
	$('#menuContent').corner();
	$('.btnBack').corner();
	$('#searchContent').corner();
	$('#phoneContact').corner();

	$('#addresses').change( function(){
		
		$("#result").ajaxStart ( function(){
			$(this).empty().html("carregando...");
		});
		
		$.get( "client/showAddressHome" , 
			{ a : document.getElementById('addresses').value } , 
			function(data){ $("#result").empty().html(data);}
		);
	
	});

});

/**
* Seta os dados do calendário
* 
* @access public
*/

function moveCalendar( a ){
	
	$("#calendar").ajaxStart ( function(){
			$(this).empty().html("carregando...");
			$('#events').empty();
	});
	
	$.post( "medicina_saude/moveCalendar" , 
		{ a : a } , 
		function(data){
					
			result = unserialize(data);
			
			$("#calendar").empty().html(result[1]);
			
			$("#events").empty().html(result[2]);
			
			$("#month").empty().html(result[3]);	
			
		}
	);
	
}

/**
* Change Address Internal
* 
* @access public
*/

function changeAddress( id ){
	
	$("#contentAddress").ajaxStart ( function(){
			$(this).empty().html("carregando...");
	});
	
	$.post( "enderecos/changeAddress" , 
		{ id : id } , 
		function(data){
							
			$("#contentAddress").empty().html(data);	
			
		}
	);
	
	
}

/**
* showPhones
* 
* @access public
*/

var showP = 1;

function showPhones(){
	
	if( showP == 1){
	$('#listPhones').show('slow');
	showP = 2;
	}else{
	$('#listPhones').hide('slow');	
	showP = 1;	
	}
	
}
