// JavaScript Document
function changeAjax() {
  xmlhttp = false;
  if (window.ActiveXObject) { // IE 
    try {    
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");} 
    catch (e) { 
      try {    
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");} 
      catch (e){ }}}
  else if (window.XMLHttpRequest) { // Mozilla, Safari,...      
    xmlhttp = new XMLHttpRequest(); 
    if (xmlhttp.overrideMimeType) { 
      xmlhttp.overrideMimeType('text/xml');}} 
  return xmlhttp;}

function ajaxInstitucional(op) {
		xmlhttp = changeAjax();
		xmlhttp.open("POST", op ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('institucional').innerHTML = '<div align="center"><font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Aguarde carregando...</font></div>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('institucional').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxInfoCandidato(varPar) {
		xmlhttp = changeAjax();

		xmlhttp.open("POST", varPar ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('infoprova').innerHTML = '<div align="center"><font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Aguarde carregando...</font></div>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('infoprova').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxViewLocal() {
		xmlhttp = changeAjax();
		xmlhttp.open("POST", "minfocandidato.asp?idconcurso="+document.form.idconcurso.value+"&dataprova="+document.form.dataprova.value+"&cpf="+document.form.cpf.value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewlocal').innerHTML = '<div align="center"><font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Aguarde carregando...</font></div>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewlocal').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxFoto(filtro) {
		xmlhttp = changeAjax();
		var page = "imgFull.asp?img="+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('imgFull').innerHTML = '<font size="1"><img src="img/loading.gif" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('imgFull').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxThumb(filtro) {
		xmlhttp = changeAjax();
		var page = "fotosGaleria.asp?"+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('thumbnails').innerHTML = '<font size="1" class="Trebuchet_11_666666"><img src="img/loading.gif" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('thumbnails').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxCargos(varParametro) {
		xmlhttp = changeAjax();
		var pageOpen = "listCargos.asp?"+varParametro
		xmlhttp.open("POST", pageOpen ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('list_cargos').innerHTML = '<font size="1" class="Trebuchet_11_666666"><img src="img/loading.gif" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('list_cargos').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

//------------------------------------------------------
// ATIVA/DESATIVA ELEMENTOS  ---------------------------
// -----------------------------------------------------

function toggle(idElemento){
	var varElemento = document.getElementById(idElemento)
	if (varElemento.style.display == 'none') {
		varElemento.style.display = 'block'
	} else {
		varElemento.style.display = 'none'
	}
}

