	function AjaxAbrePagina(url, id, method, form, fc, sqlType, action, actionId)
	{
		var id       = id       || "";
		var method   = method   || "GET";	
		var form     = form     || 0;	
		var fc       = fc       || "";
		var sqlType  = sqlType  || "";
		var action   = action   || "";
		var actionId = actionId || "";
		
		var scriptJS = "";

		if (sqlType)
		{
			if (sqlType == "DELETE")
			{
				if (!confirm("Deseja excluir registro?")) return;
			}	
			
			url += (url.indexOf("?") >= 0 ? "&" : "?") + "tpSql=" + sqlType;
		}

		var req = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
		
		req.onreadystatechange = function()
		{
			if (req.readyState == 4) {
				if (req.status == 200) {
					document.getElementById("divCarregando").innerHTML = "";
					var retorno = urlDecode(req.responseText);
					
					
					if (id)
					{
						document.getElementById(id).innerHTML = retorno;

						scriptJS = document.getElementById(id).getElementsByTagName("script"); 
						for (var i = 0; i < scriptJS.length; i++) { 
							if (scriptJS[i].innerHTML)
								eval(scriptJS[i].innerHTML);
						}						
					}

					if (sqlType)
					{					
						sucesso = retorno.charAt(0);
						retorno = retorno.substr(1, retorno.length);
						
						if (sucesso == '0')
						{		
							alert(retorno);
							
							habilitaCampoForm(form, true);
						} else {
							if (sucesso == '2')
								alert(retorno);
								
							if (action && actionId)
								AjaxAbrePagina(action, actionId);
						}

					} 
					
					if (fc)
					{
						eval(fc);					
					}
				} else {
					alert("Houve um problema ao obter os dados:\n" + req.statusText);
				}
				
				AjaxTrataPagina(url);				
			} else {
				document.getElementById("divCarregando").innerHTML = "<table border=0 style='background-color:#f7f7f7;border:1px solid #C3D6EE'><tr><td></td><td><font face='verdana' size='1' color='black'><b> Carregando...</b></font></td></tr></table>";
			}
		}
		
		switch (method)
		{
			case "GET" :
					req.open("GET", url, true);
					req.send(null);			
				break;
				
			case "POST" : 
					var parametros = pegaValoresForm(form);
	
				    req.open("POST", url, true);
					req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");  
				    req.send(parametros);	
				break;		    	
		}		
		
		 //document.getElementById("divPrincipal").innerHTML = "<table border=0 style='background-color:#f7f7f7;border:1px solid #C3D6EE'><tr><td></td><td><font face='verdana' size='1' color='black'><b> Carregando...</b></font></td></tr></table>";
					
	}
	
	var listaUrls = new Array();
		listaUrls['loginForm.php']   = "Validaçăo de Usuário"; 	
		
		listaUrls['usuarioForm.php']   = "Cadastro de Usuário"; 	
		listaUrls['usuarioListar.php'] = "Lista de Usuário(s)"; 						
		
		listaUrls['agendaForm.php']   = "Cadastro de Agenda"; 	
		listaUrls['agendaListar.php'] = "Lista de Agenda(s)"; 				
		
		listaUrls['eventoForm.php']   = "Cadastro de Evento"; 	
		listaUrls['eventoListar.php'] = "Lista de Evento(s)"; 				
		
		listaUrls['noticiaForm.php']   = "Cadastro de Notícia"; 	
		listaUrls['noticiaListar.php'] = "Lista de Notícia(s)"; 				
		
		listaUrls['clienteForm.php']   = "Cadastro de Clientes"; 	
		listaUrls['clienteListar.php'] = "Lista de Cliente(s)"; 				
		
		listaUrls['clienteForm.php']   = "Cadastro de Tipo de Evento"; 	
		listaUrls['clienteListar.php'] = "Lista de Tipo de Evento(s)"; 				
		
		listaUrls['sobreForm.php']   = "Sobre o Sistema";				
		
		listaUrls['trocaSenhaForm.php']   = "Trocar Senha"; 	

		//listaUrls['']   = "Cadastro de "; 	
		//listaUrls[''] = "Lista de (s)"; 		

	function AjaxTrataPagina(url)
	{
		var urlPagina = url.indexOf("?") >= 0 ? url.substr(0, url.indexOf("?")) : url;
		
		//Ativando div principal
		//document.getElementById("DIVIndex").style.display = "";				
		
		//Modificando barra menu
		if (listaUrls[urlPagina])
			document.getElementById("divPrincipal").innerHTML = "&nbsp; " + listaUrls[urlPagina];		
	}