  var xmlhttp;
  
  try {
    xmlhttp = new XMLHttpRequest();
  } catch (ee) {
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch(E) {
          xmlhttp = false;
        }
    }
  }


window.addEvent('domready', function() {
	
	var noticiasAccordion = new Accordion($('noticias'), 'h3.togglerN', 'div.elementN', {
		onActive: function(toggler, element){
			toggler.setStyle('font-weight', 'bold');
			element.setStyle('border', '1px solid #C7E1F1');
			toggler.setStyle('background', 'url(../image/x1.png) 12px 7px no-repeat');
			toggler.setStyle('padding-left', '23px');
			toggler.setStyle('text-decoration', 'none');
},
		onBackground: function(toggler, element){
			toggler.setStyle('font-weight', 'normal');
			element.setStyle('border', 'none');
			toggler.setStyle('background', 'url(../image/x1.png) 4px 7px no-repeat');
			toggler.setStyle('padding-left', '15px');
			toggler.setStyle('text-decoration', 'underline');
		}
	});

	var avisosAccordion = new Accordion($('avisos'), 'h3.togglerA', 'div.elementA', {
		onActive: function(toggler, element){
			toggler.setStyle('font-weight', 'bold');
			element.setStyle('border', '1px solid #C7E1F1');
			toggler.setStyle('background', 'url(../image/x1.png) 12px 7px no-repeat');
			toggler.setStyle('padding-left', '23px');
			toggler.setStyle('text-decoration', 'none');
},
		onBackground: function(toggler, element){
			toggler.setStyle('font-weight', 'normal');
			element.setStyle('border', 'none');
			toggler.setStyle('background', 'url(../image/x1.png) 4px 7px no-repeat');
			toggler.setStyle('padding-left', '15px');
			toggler.setStyle('text-decoration', 'underline');
		}
	});

	
});

function calendar()
{
	var monthNames = new Array("Janeiro", "Fevereiro", "Março", "Abril",
	"Maio", "Junho", "Julho", "AGOSTO", "Setembro", "Outubro", "Novembro", "Dezembro");
	var today = new Date();
	var thisDay = today.getDate();
	var monthDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	
	year = today.getYear();
	// ano bissexto?
	if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
		monthDays[1] = 29;
	// achar o numero de dias deste mes
	nDays = monthDays[today.getMonth()];
	firstDay = today;
	firstDay.setDate(1);
	startDay = firstDay.getDay();
	document.writeln("<table id=\"calendario\">");
	document.writeln("<caption>Calendário</caption>");
	document.writeln("<tr><th colspan=7>");
	document.writeln(monthNames[ today.getMonth() ]);
	document.writeln("<tr><th>");
	document.writeln("D<th>S<th>T<th>Q<th>Q<th>S<th>S");
	document.writeln("<tr>");
	column = 0;
	for (i=0, column=0; i<startDay; i++, column++)
		document.writeln("<td>")
	
	for (i=1; i<=nDays; i++)
	{
		if (i == thisDay)
		{
			document.writeln("<td bgcolor=\"#D7EAF4\">");
			document.writeln("<b>" + i + "</b>");
		}
		else
		{
			document.writeln("<td>");
			document.writeln(i);
		}
			column++;
		if (column == 7)
		{
			document.writeln("<tr>"); // inicio de nova linha
			column = 0;
		}
	}
	document.writeln("</table>");
}

function faleConosco()
{
	var nome = document.getElementById('nome').value;
	var email = document.getElementById('email').value;
	var telefone = document.getElementById('telefone').value;
	var assunto = document.getElementById('assunto').value;
	var mensagem = document.pfc.mensagem.value;
	if( nome == '' || email == '' || telefone == '' || assunto == '' || mensagem == '' )
	{
		alert('Preencha todos os campos');
		return false;
	}
	document.pfc.submit();
}

function painelLogin()
{
	alert("OI");
	document.plog.submit();	
}
