function show(p,f) {
	var tmenu = document.getElementById("menu").getElementsByTagName("LI");
	tmenu[0].className = "off";
	tmenu[1].className = "off";
	tmenu[2].className = "off";
	tmenu[3].className = "off";
	tmenu[4].className = "off";
	tmenu[5].className = "off";

	for ( j = 1; j <= 7; j++ ) {
		document.getElementById("c" + j).style.display = "none";
	}

  document.getElementById(p).style.display = "block";
	f.parentNode.className = "on";
	return false;
}
function show_candidatos(p,f) {
	var tmenu = document.getElementById("tabs_candidatos").getElementsByTagName("DIV");
	tmenu[0].className = "off";
	tmenu[1].className = "off";
	tmenu[2].className = "off";

	for ( j = 1; j <= 3; j++ ) { document.getElementById("tab" + j).style.display = "none"; }

  document.getElementById("tab"+p).style.display = "block";
	f.className = "on";
	return false;
}

function validar(){
  formulario = document.getElementById('form');
  var limpo=true;
  var te='';
  for(i=0 ; i<formulario.length ; i++){
		if( formulario[i].name.substring(formulario[i].name.length-2,formulario[i].name.length)!='_2' && formulario[i].name.substring(formulario[i].name.length-2,formulario[i].name.length)!='_3' ){
	    if( formulario[i].type=='text' && formulario[i].value=='' ){
	      formulario[i].style.backgroundColor='#FFFFCC';
	      formulario[i].style.color='black';
	      limpo=false;
	    }
	    else if( formulario[i].type=='select-one' && formulario[i].value=='--' ){
	      formulario[i].style.backgroundColor='#FFFFCC';
	      formulario[i].style.color='black';
	      limpo=false;
	    }
	    else if( formulario[i].type=='textarea' && formulario[i].value=='' ){
	      formulario[i].style.backgroundColor='#FFFFCC';
	      formulario[i].style.color='black';
	      limpo=false;
	    }
	    else if( formulario[i].type=='file' && formulario[i].value=='' ){
	      formulario[i].style.backgroundColor='#FFFFCC';
	      formulario[i].style.color='black';
	      limpo=false;
	    }
	    else if( formulario[i].type!='submit' ){
				formulario[i].style.backgroundColor='#ffffff';
				formulario[i].style.color='black';
	    }
		}
    te = te + formulario[i].type + '=' + formulario[i].value +"\n";
  }
  if(limpo==false)alert("Por favor preencha os campos em falta [a amarelo]");
  return limpo;
}

function abrir(nome){ document.getElementById(nome).style.display='block';}
function fechar(nome){ document.getElementById(nome).style.display='none'; }

function alterna(what) {
	var s = document.getElementById(what);
	if ( s.style.display == "block" ) {
		s.style.display = "none";
	} else {
		s.style.display = "block";
	}
	return false;
}
