 function toggleDiv(id,flagit) {

if (flagit=="1"){
if (document.layers) document.layers[''+id+''].visibility = "show"

else if (document.all) document.all[''+id+''].style.visibility = "visible"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"

}

else

if (flagit=="0"){
if (document.layers) document.layers[''+id+''].visibility = "hide"
else if (document.all) document.all[''+id+''].style.visibility = "hidden"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
}
}

function ChangeText() { 
var newText = document.body.createTextRange(); 
if (tochange.value != "") 
while (newText.findText(tochange.value) ) 
newText.pasteHTML("<FONT class=change>" + tochange.value + "</FONT>"); 
} 

function sf() { 
if (document.form.login.value.length == 0)
	document.form.login.focus();
else
	document.form.senha.focus();

}


function valida_usuario() {
    var s;
    var i;	
    var num = 0, carac = 0;
	
	s = document.form.login;
    for (i = 0; i < s.value.length; i++) {
      var c = s.value.charAt(i);
      // ha um numero
      if (((c >= "0") && (c <= "9"))) {
        num++;
      }
      if (((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z"))) {
        carac++;
      }
      if (c == "'" || c == "`" || c == "~" || c == '"' || c == '^') {
        alert("Campo com caractere inválido!!");
        document.form.login.focus();
        return false;
      }
    }

    if (document.form.login.value.length == 0) {
      alert("O campo login é obrigatório!");
      document.form.login.focus();
      return false;
    }

    if (num < 2 || carac == 0) {
      alert("O campo login deve conter letras e números ( mínimo 2 números ) !");
      document.form.login.focus();
      return false;
    }

    if (document.form.login.value.length < 6) {
      alert("O campo login deve ter no mínimo 6 caracteres !");
      document.form.login.focus();
      return false;
    }

    if (document.form.login.value.length > 15) {
      alert("O nome de usuário deve ter no máximo 15 caracteres !");
      document.form.login.focus();
      return false;
    }


    if (document.form.senha.value.length == 0) {
      alert("O campo de senha é obrigatório!");
      document.form.senha.focus();
      return false;
    }

    return true;
  }
  
function doCheckContato(form){  
if (!checkVazio(form.nome,"_nome inválido"))
return false;

if (!checkVazio(form.area,"_selecione uma área para contato"))
return false;

if (!checkVazio(form.email,"_e-mail inválido"))
return false;

if (!checkVazio(form.mensagem,"_mensagem inválida"))
return false;  
}

function abre (link, tipo) {
	
	// concatena pagina atual no link
	if (tipo == 1)
		window.open(link + document.location.href, 'links');
	if (tipo == 2)
		window.open(link, '_self');
	else
		window.open(link, 'links');
}
