// JavaScript Document

	function inicializaObjAjax(){
			try{
			//se a versão Javascript for maior do que 5
			xmlhttp = new ActiveXObject("Msxm12.XMLHTTP");
			}catch(e){
				try{
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				}catch(e){
					xmlhttp = null;
				}
			}
			
			if (!xmlhttp && typeof XMLHttpRequest != 'undefined'){
				xmlhttp = new XMLHttpRequest();
			}		
		}


	function fazRequisicao(pgservidor,objID){
		var obj = document.getElementById(objID);
		xmlhttp.open("GET",pgservidor);
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 1 ){
				obj.innerHTML = '<img src="imagens/icones/loading6.gif" alt="carregando" style="margin:90px 0 90px 80px;"/>';
			}
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
				obj.innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}
	
	/*usado para avançar ou voltar os meses no calendario da agenda*/
	function movAgd(ano,mes,complemento){
		if(complemento == 1){
			path = "lunacom/";
		}else{
			path = "";	
		}
		url = "comum/calendario_ajax.php?Y="+ano+"&m="+mes;
		objID = "agenda_dinamica";		
		fazRequisicao(url,objID);
	}
	
	function fazRequisicaoAdmin(pgservidor,objID){
		var obj = document.getElementById(objID);
		xmlhttp.open("GET",pgservidor);
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 1 ){
				obj.innerHTML = '<div style="margin: 10px 0 0 250px;"><img src="../imagens/icones/loading7.gif" alt="carregando" style="margin:90px 0 90px 80px;"/></div>';
			}
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
				obj.innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}
	

