/* Cursos e Treinamentos */
function showCalendarioCursos(dia, mes, ano)
{
	$("#divCalendario").html("<img src='img/loader_ajax.gif' alt='carregando...' style='margin: 60px 0 0 70px;' />");
	$.ajax({
	   url: "index.php",
	   type: "POST",
	   data: ({ 
		   dia: dia,
		   mes: mes,
		   ano: ano,
		   type: 'cursos_e_treinamentos',
		   acao: "getCelendar"
		}),
	   dataType: "html",
	   success: function(msg){
	      $("#divCalendario").html(msg);
	      showCursos(dia, mes, ano);
	   },
	   error: function(msg){
		   
	   }	
	});	
}

function showCursos(dia, mes, ano)
{
	$("#divListaCursosTreinamentos").html("<p align='center'><img src='img/loader_ajax.gif' alt='carregando...' style='margin: 40px 0 40px 0' /></p>");
	$.ajax({
	   url: "index.php",
	   type: "POST",
	   data: ({ 
		   dia: dia,
		   mes: mes,
		   ano: ano,
		   acao: "getListaCursos"
		}),
	   dataType: "html",
	   success: function(msg){
	      $("#divListaCursosTreinamentos").html(msg);
	   },
	   error: function(msg){
		   
	   }	
	});	
} 

function showDetailsCurso(cd)
{
	$("#simpleModal").html("<p align='center'><img src='img/loader_ajax.gif' alt='carregando...' style='margin: 40px 0 40px 0' /></p>");
	$.ajax({
	   url: "index.php",
	   type: "POST",
	   data: ({ 
		   cd: cd,
		   acao: "getDetailsCurso"
		}),
	   dataType: "html",
	   success: function(msg){
	      $("#simpleModal").html(msg);
	      $("#simpleModal").modal({
	    	  overlayClose:true,
	    	  opacity:60,
	    	  overlayCss: { backgroundColor:"#000" },
	    	  containerCss:{
	    			background:"#FFF url('img/bg_pagina_home.jpg') center top",
	    			border:"3px solid #555",
	    			height:480,
	    			padding: '20px 10px',
	    			width:830
	    	  },
	    	  closeClass: "modalClose",
	    	  closeHTML: "<a href='#' style='margin-left: 10px;'><img src='img/btn_fechar_modal.jpg' alt='fechar' /></a>"

	      });

	   },
	   error: function(msg){
		   
	   }	
	});	
}

/* Eventos */
function showCalendarioEventos(dia, mes, ano)
{
	$("#divCalendario").html("<img src='img/loader_ajax.gif' alt='carregando...' style='margin: 60px 0 0 70px;' />");
	$.ajax({
	   url: "index.php",
	   type: "POST",
	   data: ({ 
		   dia: dia,
		   mes: mes,
		   ano: ano,
		   type: 'eventos',
		   acao: "getCelendar"
		}),
	   dataType: "html",
	   success: function(msg){
	      $("#divCalendario").html(msg);
	      showEventos(dia, mes, ano);
	   },
	   error: function(msg){
		   
	   }	
	});	
}

function showEventos(dia, mes, ano)
{
	$("#divListaEventos").html("<p align='center'><img src='img/loader_ajax.gif' alt='carregando...' style='margin: 40px 0 40px 0' /></p>");
	$.ajax({
	   url: "index.php",
	   type: "POST",
	   data: ({ 
		   dia: dia,
		   mes: mes,
		   ano: ano,
		   acao: "getListaEventos"
		}),
	   dataType: "html",
	   success: function(msg){
	      $("#divListaEventos").html(msg);
	   },
	   error: function(msg){
		   
	   }	
	});	
} 

/* Inovação */
function showDetailsInovacao(cd)
{
	$("#simpleModal").html("<p align='center'><img src='img/loader_ajax.gif' alt='carregando...' style='margin: 40px 0 40px 0' /></p>");
	$.ajax({
	   url: "index.php",
	   type: "POST",
	   data: ({ 
		   cd: cd,
		   acao: "getDetailsInovacao"
		}),
	   dataType: "html",
	   success: function(msg){
	      $("#simpleModal").html(msg);
	      $("#simpleModal").modal({
	    	  overlayClose:true,
	    	  opacity:60,
	    	  overlayCss: { backgroundColor:"#000" },
	    	  containerCss:{
	    			background:"#FFF url('img/bg_pagina_home.jpg') center top",
	    			border:"3px solid #555",
	    			height:480,
	    			padding: '20px 10px',
	    			width:830
	    	  },
	    	  closeClass: "modalClose",
	    	  closeHTML: "<a href='#' style='margin-left: 10px;'><img src='img/btn_fechar_modal.jpg' alt='fechar' /></a>"

	      });

	   },
	   error: function(msg){
		   
	   }	
	});	
}

function getListUnidades(estado)
{
	$("#unidadesList").html("<p align='center'><img src='img/loader_ajax.gif' alt='carregando...' style='margin: 40px 0 40px 0' /></p>");	
	$.ajax({
		   url: "ajax.php",
		   type: "POST",
		   data: { 
			   estado: estado,
			   acao: "getListUnidades"
			},
		   dataType: "html",
		   success: function(msg){
		      $("#unidadesList").html(msg)
			}
		});	
}

