function verifyCompatibleBrowser(){ 
    this.ver=navigator.appVersion 
    this.dom=document.getElementById?1:0 
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
 
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 
    return this 
} 
//bw=new verifyCompatibleBrowser() 
 
 
var speed=50
 
var loop, timer 
 
function ConstructObject(obj,nest){ 
    nest=(!nest) ? '':'document.'+nest+'.' 
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight 
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight 
    this.up=MoveAreaUp;this.down=MoveAreaDown; 
    this.MoveArea=MoveArea; this.x; this.y; 
    this.obj = obj + "Object" 
    eval(this.obj + "=this") 
    return this 
} 
function MoveArea(x,y){ 
    this.x=x;this.y=y 
    this.css.left=this.x 
    this.css.top=this.y 
} 
 
function MoveAreaDown(move){ 
	if(this.y>-this.scrollHeight+objContainer.clipHeight){ 
    this.MoveArea(0,this.y-move) 
    if(loop) setTimeout(this.obj+".down("+move+")",speed) 
	} 
} 
function MoveAreaUp(move){ 
	if(this.y<0){ 
    this.MoveArea(0,this.y-move) 
    if(loop) setTimeout(this.obj+".up("+move+")",speed) 
	} 
} 
 
function PerformScroll(speed){ 
	if(initialised){ 
		loop=true; 
		if(speed>0) objScroller.down(speed) 
		else objScroller.up(speed) 
	} 
} 
 
function CeaseScroll(){ 
    loop=false 
    if(timer) clearTimeout(timer) 
} 
var initialised; 
function InitialiseScrollableArea(){ 
    objContainer=new ConstructObject('divContainer') 
    objScroller=new ConstructObject('divContent','divContainer') 
    objScroller.MoveArea(0,0) 
    objContainer.css.visibility='hidden' 
    initialised=true; 
} 
function findTag(eItem) {
	var objATag = new Object();
	objATag = eItem.all.tags("A").item(0)
	return objATag;
}
function NavMOver(eItem){
	eItem.DefaultBgColor = eItem.style.backgroundColor;
	eItem.DefaultTxtColor = eItem.style.color;
	eItem.style.backgroundColor = "#D8D8D8";
	eItem.style.cursor="hand";
}
function NavMOut(eItem){
	eItem.style.backgroundColor = eItem.DefaultBgColor;
}

function gotourl() { //v3.0
  var i, args=gotourl.arguments; document.tv1_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function shlayer() {
  var i,p,v,obj,args=shlayer.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function	setClass(cssClass,TD){
TD.className = cssClass;
}

				function fnc_valida(y){
//substituir função testa_branco por essa
				 var msg="";
			     for(x=0;x<document.forms[y].elements.length;x++){
				  if((document.forms[y].elements[x].type=="select-one" | document.forms[y].elements[x].type=="password" | document.forms[y].elements[x].type=="text" | document.forms[y].elements[x].type=="textarea")&document.forms[y].elements[x].obrigatorio=="sim"){
					if(document.forms[y].elements[x].value==""){
				     msg+="- "+document.forms[y].elements[x].nome+"\n";
                    }
				  }
				 }
				 if(msg.length>0){
				  window.alert("VTC - O campo abaixo é obrigatório:\n\n"+msg);
				  return(false);
				 }
				 return(true);
				}

//document.body.onload = InitialiseScrollableArea;

function testa_branco()
{
    aux=document.forms[0]
	if (aux.nome.value == '')
	{
		alert("VTC - O campo abaixo é obrigatório:\n\nFavor preencher o campo NOME");
		aux.nome.focus ();
		return false;
	}
	else if (aux.sexo[0].checked == false && aux.sexo[1].checked == false)
	{
   		alert ("VTC - O campo abaixo é obrigatório:\n\nFavor preencher o campo SEXO");  
                aux.sexo[0].focus();      
    		return false;
	}
	else if (aux.datanasc.value == '')
	{
		alert("VTC - O campo abaixo é obrigatório:\n\nFavor preencher o campo DATA DE NASCIMENTO");
                aux.datanasc.focus ();
		return false;
	}
	else if (aux.estadocivil[0].checked == false && aux.estadocivil[1].checked == false && aux.estadocivil[2].checked == false && aux.estadocivil[3].checked == false)
	{
		alert("VTC - O campo abaixo é obrigatório:\n\nFavor preencher o campo ESTADO CIVIL");
                aux.estadocivil[0].focus();
		return false;
	}
	else if (aux.estadocivil[3].checked == true && aux.estado.value=="")
	{
		alert("VTC - O campo abaixo é obrigatório:\n\nFavor preencher o campo ESTADO CIVIL");
		aux.estado.focus();
		return false;
	}
	else if (aux.endereco.value == '')
	{
		alert("VTC - O campo abaixo é obrigatório:\n\nFavor preencher o campo ENDEREÇO");
                aux.endereco.focus ();
		return false;	
	}
	else if (aux.cidade.value == '')
	{
		alert("VTC - O campo abaixo é obrigatório:\n\nFavor preencher o campo CIDADE");
                aux.cidade.focus ();
		return false;	
	}
	else if (!verificaEmail(aux.email.value))
	{
              alert("Você deve preencher corretamente o campo de E-mail!");
              aux.email.focus();
              return false;
	}
	else if (aux.cargopretendido.value == "" )
	{
		alert("VTC - O campo abaixo é obrigatório:\n\nFavor preencher o campo CARGO PRETENDIDO");
		aux.cargopretendido.focus();
		return false;
	}
	else if (aux.instituicao_ensino.value == "" )
	{
		alert("VTC - O campo abaixo é obrigatório:\n\nFavor preencher o campo INSTITUIÇÃO DE ENSINO");
		aux.instituicao_ensino.focus();
		return false;
	}
/*	else if (aux.escolaridade[0].checked == false && aux.escolaridade[1].checked == false && aux.escolaridade[2].checked == false && aux.escolaridade[3].checked == false && aux.escolaridade[4].checked == false && aux.escolaridade[5].checked == false && aux.escolaridade[6].checked == false && aux.escolaridade[7].checked == false && aux.escolaridade[8].checked == false)
	{
		alert("VTC - O campo abaixo é obrigatório:\n\nFavor preencher o campo ESCOLARIDADE");
                aux.escolaridade[0].focus();
		return false;
	}*/
	else if ((aux.escolaridade[8].checked == false && aux.escolaridade1.value != '') || (aux.escolaridade[8].checked == true && aux.escolaridade1.value == '')){
		alert("VTC - O campo abaixo é obrigatório:\n\nFavor preencher o campo ESCOLARIDADE");
                aux.escolaridade1.focus();
		return false;
	}
	else if ((aux.escolaridade[3].checked == true || aux.escolaridade[6].checked == true) && (aux.turnoestuda[0].checked == false && aux.turnoestuda[1].checked == false && aux.turnoestuda[2].checked == false && aux.turnoestuda[3].checked == false)){
                alert("VTC - O campo abaixo é obrigatório:\n\nFavor informar o TURNO DE AULA");
                aux.turnoestuda[0].focus();
                return false;
        }
        else if ((aux.escolaridade[2].checked == true || aux.escolaridade[3].checked == true || aux.escolaridade[5].checked == true || aux.escolaridade[6].checked == true)&& aux.semestre.value == '')
        {
                alert("VTC - O campo abaixo é obrigatório:\n\nFavor informar o SEMESTRE");
                aux.semestre.focus();
                return false;
        }
        else if (aux.escolaridade[5].checked == true && aux.curso.value == '')
        {
                alert("VTC - O campo abaixo é obrigatório:\n\nFavor informar o CURSO");
                aux.curso.focus();
                return false;
        }
        else if (aux.escolaridade[6].checked == true && aux.curso.value == '')
        {
                alert("VTC - O campo abaixo é obrigatório:\n\nFavor informar o CURSO");
                aux.curso.focus();
                return false;
        }
        else if (aux.escolaridade[7].checked == true && aux.curso.value == '')
        {
                alert("VTC - O campo abaixo é obrigatório:\n\nFavor informar o CURSO");
                aux.curso.focus();
                return false;
        }        
/*        else if ((aux.informatica[4].checked == true && aux.informatica1.value == '') || (aux.informatica[4].checked == false && aux.informatica1.value != '')){
                alert("VTC - O campo abaixo é obrigatório:\n\nFavor informar qual habilidade tem em INFORMÁTICA");
                aux.informatica1.focus();
                return false;
        }*/
		else if ((aux.idioma[2].checked == true && aux.idioma1.value == '') || (aux.idioma[2].checked == false && aux.idioma1.value != '')){
                alert("VTC - O campo abaixo é obrigatório:\n\nFavor informar qual o outro IDIOMA");
                aux.idioma1.focus();
                return false;
        }
		else if ((aux.possui[2].checked == true && aux.categoria.value == '') || (aux.possui[2].checked == false && aux.categoria.value != '')){
                alert("VTC - O campo abaixo é obrigatório:\n\nFavor informar qual a CATEGORIA");
                aux.categoria.focus();
                return false;
        }
	else
	{
		return true;
	}
} 

function verificaEmail(email)
{
	var arroba = false;
	var ponto = false;
	for (var i = 0; i < email.length; i++)
	{
		if (email.substring(i-1,i) == "@")
		{ 
			arroba = true;
		}
		if (email.substring(i-1,i) == ".")
		{ 
			ponto = true;
		}
	}
	if ((arroba == false) || (ponto == false))
	{
		return false;
	}
	else
        {
                return true;
	}
}
