function onBeforeSend(form) {
	var fields = [   "nome"
					, "email"
					, "assunto"
					, "msg"
				];

	for (var i=0; i<fields.length; i++) {
		var cmd = "(form." + fields[i] + ".value == '')";
		if (eval(cmd)) {
			alert("Campo obrigat\u00f3rio n\u00e3o preenchido!");
			cmd = "form." + fields[i] + ".focus()";
			eval(cmd);
			return false;
		}
	}
	
	return true;
}

function onBeforeSubmitMail(form) {
	var fields = [   "email"
				];

	for (var i=0; i<fields.length; i++) {
		var cmd = "(form." + fields[i] + ".value == '')";
		if (eval(cmd)) {
			alert("Campo obrigat\u00f3rio n\u00e3o preenchido!");
			cmd = "form." + fields[i] + ".focus()";
			eval(cmd);
			return false;
		}
	}
	
	return true;
}

function onBeforeComment(form) {
	var fields = [   "nome"
					, "email"
					, "msg"
				];

	for (var i=0; i<fields.length; i++) {
		var cmd = "(form." + fields[i] + ".value == '')";
		if (eval(cmd)) {
			alert("Campo obrigat\u00f3rio n\u00e3o preenchido!");
			cmd = "form." + fields[i] + ".focus()";
			eval(cmd);
			return false;
		}
	}
	
	return true;
}

// Ajax para calendario
function ajax(url, id_div) {
	var  xmlhttp = null;
	
	try {
		xmlhttp = new XMLHttpRequest()
	}
	catch(erro1) {
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP")
		}
		catch(erro2) {
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch(erro3){
				xmlhttp = false
			}
		}
	}
	
	ajax_status = 0
	
	xmlhttp.onreadystatechange = function() {
		var div_req = document.getElementById(id_div)
		
		if (xmlhttp.readyState == 4) {
			div_req.innerHTML = xmlhttp.responseText
			
			ajax_status = xmlhttp.status
		}
	}
	xmlhttp.open("GET", url, true)
	xmlhttp.send(null)
	
	if (ajax_status == 200)
		return true
	else
		return false
}

function loadContent(URL) {
	var contObj = document.getElementById('calendario');
	
	contObj.innerHTML = "Carregando...";
	
	ajax(URL, 'calendario');
}

function loadComments() {
	if(document.getElementById('comentarios')) {
		document.getElementById('comentarios').style.visibility = "visible";
		document.getElementById('infoBotao').style.visibility = "visible";
	}
}