// JavaScript Document


//menu
function ajaxHome(url){
	if (document.getElementById) { //Verifica se o Browser suporta DHTML.
		if(window.XMLHttpRequest) {
			try {
				HttpReq = new XMLHttpRequest();
			} catch(e) {
				HttpReq = false;
			}
		} else if(window.ActiveXObject) {
			try {
				HttpReq = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				try {
					HttpReq = new ActiveXObject("Microsoft.XMLHTTP");
				} catch(e) {
					HttpReq = false;
				}
			}
		}

	if(HttpReq) {
			HttpReq.onreadystatechange = XMLHttpRequestChange;
			HttpReq.open("GET", url, true);
			HttpReq.send(null);
		}		  
	}
}

function XMLHttpRequestChange() {
	if (HttpReq.readyState == 4 && HttpReq.status == 200){
      var result = HttpReq.responseText;
      var texto = document.getElementById("home");
		texto.innerHTML = result;
   }
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////


function ajaxTopo(url){
	if (document.getElementById) { //Verifica se o Browser suporta DHTML.
		if(window.XMLHttpRequest) {
			try {
				HttpReq = new XMLHttpRequest();
			} catch(e) {
				HttpReq = false;
			}
		} else if(window.ActiveXObject) {
			try {
				HttpReq = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				try {
					HttpReq = new ActiveXObject("Microsoft.XMLHTTP");
				} catch(e) {
					HttpReq = false;
				}
			}
		}

	if(HttpReq) {
			HttpReq.onreadystatechange = XMLHttpRequestChange_1;
			HttpReq.open("GET", url, true);
			HttpReq.send(null);
		}		  
	}
}

function XMLHttpRequestChange_1() {
	if (HttpReq.readyState == 4 && HttpReq.status == 200){
      var result = HttpReq.responseText;
      var texto = document.getElementById("topo");
		texto.innerHTML = result;
   }
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

function ajaxEntrada(url){
	if (document.getElementById) { //Verifica se o Browser suporta DHTML.
		if(window.XMLHttpRequest) {
			try {
				HttpReq = new XMLHttpRequest();
			} catch(e) {
				HttpReq = false;
			}
		} else if(window.ActiveXObject) {
			try {
				HttpReq = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				try {
					HttpReq = new ActiveXObject("Microsoft.XMLHTTP");
				} catch(e) {
					HttpReq = false;
				}
			}
		}

	if(HttpReq) {
			HttpReq.onreadystatechange = XMLHttpRequestChange_2;
			HttpReq.open("GET", url, true);
			HttpReq.send(null);
		}		  
	}
}

function XMLHttpRequestChange_2() {
	if (HttpReq.readyState == 4 && HttpReq.status == 200){
      var result = HttpReq.responseText;
      var texto = document.getElementById("entrada");
		texto.innerHTML = result;
   }
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

//Enviar Email
function ajaxEmail(url, form){
	var nome = form.nome.value;
	var email = form.email.value;

	if (form.news.checked == true)	{
		var news = form.news.value;
	}else{
		var news = 0;
	}
	var texto = form.msg.value;
	
	if (document.getElementById) { //Verifica se o Browser suporta DHTML.
		if(window.XMLHttpRequest) {
			try {
				HttpReq = new XMLHttpRequest();
			} catch(e) {
				HttpReq = false;
			}
		} else if(window.ActiveXObject) {
			try {
				HttpReq = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				try {
					HttpReq = new ActiveXObject("Microsoft.XMLHTTP");
				} catch(e) {
					HttpReq = false;
				}
			}
		}
		url = url+'?email='+email+'&nome='+nome+'&texto='+texto+'&news='+news;
//		alert(url);
		if(HttpReq) {
			HttpReq.onreadystatechange = XMLHttpRequestChange_3;
			HttpReq.open("GET", url, true);
			HttpReq.send(null);
		}		  
	}
}

function XMLHttpRequestChange_3() {
	if (HttpReq.readyState == 4 && HttpReq.status == 200){
      var result = HttpReq.responseText;
      var texto = document.getElementById("home");
		texto.innerHTML = result;
   }
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
