// JavaScript Document
var Ajax = false;
			
			function AjaxRequest() {
		        Ajax = false;
		        if (window.XMLHttpRequest) { // Mozilla, Safari,...
		            Ajax = new XMLHttpRequest();
		        } else if (window.ActiveXObject) { // IE
		            try {
		                Ajax = new ActiveXObject("Msxml2.XMLHTTP");
		            } catch (e) {
		                try {
		                    Ajax = new ActiveXObject("Microsoft.XMLHTTP");
		                } catch (e) {}
		            }
		        }		
			}


			
			//###################################################################################################
			
 			function listar() {
				AjaxRequest();
        		Ajax.onreadystatechange = mostra_listar;
				Ajax.open('GET','retorno_relatorio.php', true);
				Ajax.send(null);
    		}
			function editar() {
				AjaxRequest();
        		Ajax.onreadystatechange = mostra_listar;
				Ajax.open('GET','retorno_relatorio.php?editar='+ id, true);
				Ajax.send(null);
    		}
			
 			function listar_select(id) {
				AjaxRequest();
        		Ajax.onreadystatechange = mostra_listar;
				Ajax.open('GET','retorno_relatorio.php?grupo=' + id, true);
				Ajax.send(null);
    		}			
 			
			function altera_status(id) {
				var id;
				AjaxRequest();
        		Ajax.onreadystatechange = mostra_listar;
				Ajax.open('GET','retorno_relatorio.php?status=' + id, true);
				Ajax.send(null);
    		}			
			
 			function excluir_registro(id) {			
				var id;
				// pede confirmação par excluir
				var confirmacao = confirm('Deseja deletar o registro?');
				AjaxRequest();
				Ajax.onreadystatechange = mostra_listar;				 
				if(confirmacao==true) {
				// se confirmar exclusão passará os dados para excluir
				Ajax.open('GET','retorno_relatorio.php?excluir=' + id, true);
				} else {
				// se não confirmar exclusão não passará os dados para excluir					
				Ajax.open('GET','retorno_relatorio.php', true);
				}
				Ajax.send(null);
    		}	
			
			
			function mostra_listar() {
				if (Ajax.readyState == 4) {
            		if (Ajax.status == 200) {
						document.getElementById("retorno").innerHTML=Ajax.responseText;						            		
					} else {               		
					
						document.getElementById('retorno').innerHTML = '[Erro Destaque]';
            		
					}
        		}
    		}		
					
		//########################################################################################
		// resposavel pela edição grupo
		//########################################################################################
		
		
		function listar_grupo() {
				AjaxRequest();
        		Ajax.onreadystatechange = mostra_listar;
				Ajax.open('GET','retorno_grupo.php', true);
				Ajax.send(null);
    		}
			
			
		// excluir da tabela grupo
			function excluir_grupo(id) {			
				var id;
				// pede confirmação par excluir
				var confirmacao = confirm('Deseja deletar o registro?');
				AjaxRequest();
				Ajax.onreadystatechange = mostra_listar;				 
				if(confirmacao==true) {
				// se confirmar exclusão passará os dados para excluir
				Ajax.open('GET','retorno_grupo.php?excluir=' + id, true);
				} else {
				// se não confirmar exclusão não passará os dados para excluir					
				Ajax.open('GET','retorno_grupo.php', true);
				}
				Ajax.send(null);
    		}
			
			function exibir_form_grupo() {
				AjaxRequest();
        		Ajax.onreadystatechange = mostra_form;
				Ajax.open('GET','formulario_grupo.php', true);
				Ajax.send(null);
			}
				function mostra_form() {
				if (Ajax.readyState == 4) {
            		if (Ajax.status == 200) {
						document.getElementById("exibirForm").innerHTML=Ajax.responseText;						            		
					} else {               		
					
						document.getElementById('exibirForm').innerHTML = '[Erro Destaque]';
            		
					}
        		}
    		}	
			function cadastra_grupo(){
				var cadastra = document.getElementById("grupo").value;
				AjaxRequest();
        		Ajax.onreadystatechange = function() {
											if (Ajax.readyState == 4) {
												if (Ajax.status == 200) {
													document.getElementById("retorno").innerHTML=Ajax.responseText;						            		
												} else {               		
												
													document.getElementById('retorno').innerHTML = '[EErro Destaque]';
												
												}
											}
										}	;
				Ajax.open('GET','retorno_grupo.php?cadastra=' + cadastra, true);
				Ajax.send(null);
    		}
			
//########################################################################################
		// responsavel pela edição do grupo
		//########################################################################################
function editar_grupo(campo,id){
				var id;
				var campo;
				/*alert(campo+' , '+id);*/
				AjaxRequest();
        		Ajax.onreadystatechange = function() {
											if (Ajax.readyState == 4) {
												if (Ajax.status == 200) {
													document.getElementById(campo).style.display = 'block';
													document.getElementById(campo).innerHTML=Ajax.responseText;	
												} else {               		
												
													document.getElementById(campo).innerHTML = '[EErro Destaque]';
												
												}
											}
										}	;
				Ajax.open('GET','editar_grupo.php?editar='+ id +'&ncampo=' + campo, true);
				Ajax.send(null);
    		}

function fechar_popup(){
			
			document.getElementById('campo').style.display = 'none';
			
			setTimeout ("fechar()", 10000);
  
      }

	
			function onblur_Grupo(id,valor) {
				var id;
				//alert(valor);
				AjaxRequest();
				Ajax.onreadystatechange = function() {
											if (Ajax.readyState == 4) {
												if (Ajax.status == 200) {
													document.getElementById("retorno").innerHTML=Ajax.responseText;						            		
												} else {               		
												
													document.getElementById('retorno').innerHTML = '[EErro Destaque]';
												
												}
											}
										}	;
				Ajax.open('GET','retorno_grupo.php?update='+ id + '&valor=' + valor, true);
				Ajax.send(null);
			}


upgdete_Grupo









//########################################################################################
		// exibir_index.php
		//########################################################################################
		function select_index(id) {
				AjaxRequest();
        		Ajax.onreadystatechange = mostra_listar();
				Ajax.open('GET','pop_index.php?exibir=' + id, true);
				openWindows('pop_index.php');
				Ajax.send(null);
    		
		}
		
		function openWindows(url) { 
				  window.open(url);
		}
			