var Comum = {
	
	/* HIDE */
	
	hide: function ( id )
	{
		$( "#" + id + "" ).hide();
	}
	,fadeIn: function ( id )
	{
		$( "#" + id + "" ).fadeIn();
	}
	,slideUp: function ( id )
	{
		$( "#" + id + "" ).slideUp();
	}
	
	/* SHOW */
	
	, show: function ( id )
	{
		$( "#" + id + "" ).show();
	}
	, fadeOut: function ( id )
	{
		$( "#" + id + "" ).fadeOut();
	}
	,slideDown: function ( id )
	{
		$( "#" + id + "" ).slideDown();
	}
	
	
	/*  */
	, limpaCampo: function ( id )
	{
		$( "#" + id + "" ).val('');
	}
	
	, getValue: function ( idCampo )
	{
		$( "#" + idCampo + "" ).val();
	}
	
	, buttonCancelar: function( controller , page )
	{
        if( page == null )
        {
            page = 1;
        }

        eval('parent'+".location='index.php?class=" + controller + "&method=listar&page=" + page + "'" );
	}
	
	, confirmExclusao: function( controller , id )
	{
		if( confirm( 'Tem Certeza que deseja remover esse registro?' ) )
		{
			eval('parent'+".location='index.php?controller=" + controller + "&action=excluir&id=" + id + "'" );
		}
	}
	
	, confirmExclusao11: function( controller , id )
	{
		if( confirm( 'Tem Certeza que deseja remover esse registro?' ) )
		{
			document.location.href = "index.php?controller=" + controller + "&action=excluir&id=" + id;
		}
	}
	
	
	
	
	
	
	, confirmarExclusao: function( controller , id )
	{
		$( "#popUpConfirmarExclusao" ).slideDown();
		$( "#popUpConfirmarExclusao" ).load( "index.php?controller=" + controller + "&action=excluir&id_cliente=" + id + "",
		  function()
		  {
		  }
		);
		
	}
	
	, openWindow: function( endereco )
	{
		jan = window.open( endereco , "consulta",
"status=no,toolbar=no,scrollbars=no,location=no,menu=no,width=800,height=600,top=0,left=100");
	}
	
	, confirmarExclusao222: function( controller , id )
	{
		$('#cenario').fadeIn();
		
		$.get(
			"index.php?controller=" + controller + "&action=confirmarExclusao"
			, {
				id: id
			}
			, function(response)
			{
				$('#cenario').html( response );
			}
		);
	}
	
	, excluir: function( controller , id )
	{
		$('#cenario').show();
		
		$.post(
			"index.php?controller=" + controller + "&action=excluir"
			, {
				id: id
				, consulta_nome: $('#consulta_nome').val()
				, compo_consulta_cpf: $('#compo_consulta_cpf').val()
			}
			, function(response)
			{
				$('#getLista').html( response );
			}
		);
	}
	
	, naoExcluir: function()
	{
		$('#cenario').hide();
	}
	
	
	
	
	
	
	
	
	
	
	
	, exibirFormInserir: function( controller )
	{
		$('#cenario').show();
		$('#areaPesquisar').hide();
		$('#getLista').hide();
		$.get(
			"index.php?controller=" + controller + "&action=inserir"
			, function(response)
			{
				$('#cenario').html( response );
			}
		);
	}
	
	, exibirFormAlterar: function( controller , id )
	{
		$('#cenario').show();
		$('#areaPesquisar').hide();
		$('#getLista').hide();
		$.get(
			"index.php?controller=" + controller + "&action=alterar"
			, {
				id: id
			}
			, function(response)
			{
				$('#cenario').html( response );
			}
		);
	}
	
	, exibirFormPesquisar: function()
	{
		$('#areaPesquisar').fadeIn();
		$('#areaMensagem').hide();
	}
	
	, pesquisar: function( controller , pagina )
	{
		$('#cenario').hide();
		$('#getLista').show();
		$.post(
			'index.php?controller=' + controller + '&action=pesquisar' + '&pagina=' + pagina
			, {
				nome: $('#pesq_nome').val()
				, categoria: $('#pesq_categoria').val()
				, estado: $('#pesq_select').val()
				, cidade: $('#pesq_cidade').val()
				
			}
			, function(response)
			{
				$('#getLista').html( response );
			}
		);
	}
	
	, confirmarExclusao2: function( controller , id )
	{
		$('#areaPesquisar').hide();
		$('#cenario').fadeIn();
		$('#areaMensagem').hide();
		
		$.get(
			"index.php?controller=" + controller + "&action=confirmarExclusao"
			, {
				id: id
			}
			, function(response)
			{
				$('#cenario').html( response );
			}
		);
	}
	
	
	
	
	, cancelar: function( controller )
	{
		eval('parent'+".location='index.php?controller=" + controller + "'" );
	}
		
}




$(document).ready(
function(){
$("#loading").ajaxStart(function(){
$(this).show();
});
});




$(document).ready(
function(){
$("#loading").ajaxStop(function(){
$(this).hide();
})
});
