		hoje = new Date()
        dia = hoje.getDate()
        dias = hoje.getDay()
        mes = hoje.getMonth()
        ano = hoje.getYear()

        if (dia < 10)
                dia = "0" + dia
        if (ano < 2000)
                ano = "19" + ano

        function CriaArray (n) {

        this.length = n }

        NomeDia = new CriaArray(7)
        NomeDia[0] = "Domingo"
        NomeDia[1] = "Segunda-feira"
        NomeDia[2] = "Ter&ccedil;a-feira"
        NomeDia[3] = "Quarta-feira"
        NomeDia[4] = "Quinta-feira"
        NomeDia[5] = "Sexta-feira"
        NomeDia[6] = "S&aacute;bado"

        NomeMes = new CriaArray(12)
        NomeMes[0] = "Janeiro"
        NomeMes[1] = "Fevereiro"
        NomeMes[2] = "Mar&ccedil;o"
        NomeMes[3] = "Abril"
        NomeMes[4] = "Maio"
        NomeMes[5] = "Junho"
        NomeMes[6] = "Julho"
        NomeMes[7] = "Agosto"
        NomeMes[8] = "Setembro"
        NomeMes[9] = "Outubro"
        NomeMes[10] = "Novembro"
        NomeMes[11] = "Dezembro"

function WriteDate() {
        document.write ("<tt><font face='verdana' size='1'><b>" + 
			NomeDia[dias] + ", " + dia + " de " + 
			NomeMes[mes] + " de " + 
			ano + "</b></font></tt>")
}
			 
function validadados() {

	if (document.fident.temail.value.length == 0) {
		alert("Preencha seu e-mail!");
		document.fident.temail.focus();
		return;
	}
	
	if (document.fident.tsenha.value.length == 0) {
		alert("Preencha sua senha!");
		document.fident.tsenha.focus();
		return;
	}
	
	if (document.fcadastro.Nome.value.length == 0) {
		alert("O nome é um campo obrigatório!");
		document.fcadastro.Nome.focus();
		return false;
	}
	
	if (document.fcadastro.CPF.value.length == 0) {
		if (document.fcadastro.Pais.value == "Brasil") {
			alert("O CPF é um campo obrigatório!");
			document.fcadastro.CPF.focus();
			return false;
		}	
	}

	if (document.fcadastro.email.value.length == 0) {
		alert("O e-mail é um campo obrigatório!");
		document.fcadastro.email.focus();
		return false;
	}
	
	if (document.fcadastro.Endereco.value.length == 0) {
		alert("O endereço é um campo obrigatório!");
		document.fcadastro.Endereco.focus();
		return false;
	}

	if (document.fcadastro.NumEndereco.value.length == 0) {
		alert("O número é um campo obrigatório!");
		document.fcadastro.NumEndereco.focus();
		return false;
	}

	if (document.fcadastro.Cidade.value.length == 0) {
		alert("A cidade é um campo obrigatório!");
		document.fcadastro.Cidade.focus();
		return false;
	}

	if (document.fcadastro.DDD.value.length == 0) {
		alert("O DDD é um campo obrigatório!");
		document.fcadastro.DDD.focus();
		return false;
	}

	if (document.fcadastro.Telefone.value.length == 0) {
		alert("O telefone é um campo obrigatório!");
		document.fcadastro.Telefone.focus();
		return false;
	}
	
	if (document.fcadastro.senha.value.length == 0) {
		alert("A senha é um campo obrigatório!");
		document.fcadastro.senha.focus();
		return false;
	}
	
	if (document.fcadastro.senha2.value.length == 0) {
		alert("Você precisa redigitar a senha!");
		document.fcadastro.senha2.focus();
		return false;
	}

	if (document.fcadastro.senha.value != document.fcadastro.senha2.value) {
		alert("Sua senha não confere. Digite novamente!");
		document.fcadastro.senha1.focus();
		return false;
	}

	if (document.fcadastro.CPF.value.length != 0) {
		s = limpa_string(document.fcadastro.CPF.value);
		if (valida_CPF(document.fcadastro.CPF.value) == false ) {
	   			alert("O CPF não é válido!");
           	document.fcadastro.CPF.focus();
           	return false;
		}
	}
	
	if (document.fcadastro.CGC.value.length != 0) {
		s = limpa_string(document.fcadastro.CGC.value);
		if (valida_CGC(document.fcadastro.CGC.value) == false ) {
           	alert("O CGC não é válido!");
           	document.fcadastro.CGC.focus();
           	return false;
     	}
	}

	return true;
}	

function limpa_string(S){
	// Deixa so' os digitos no numero
	var Digitos = "0123456789";
	var temp = "";
	var digito = "";
   	for (var i=0; i<S.length; i++){
      digito = S.charAt(i);
      if (Digitos.indexOf(digito)>=0){temp=temp+digito}
   	}
   return temp
}

function valida_CPF(s)
{
	var i;
	s = limpa_string(s);
	var c = s.substr(0,9);
	var dv = s.substr(9,2);
	var d1 = 0;
	for (i = 0; i < 9; i++)
	{
		d1 += c.charAt(i)*(10-i);
	}
        if (d1 == 0) return false;
	d1 = 11 - (d1 % 11);
	if (d1 > 9) d1 = 0;
	if (dv.charAt(0) != d1)
	{
		return false;
	}

	d1 *= 2;
	for (i = 0; i < 9; i++)
	{
		d1 += c.charAt(i)*(11-i);
	}
	d1 = 11 - (d1 % 11);
	if (d1 > 9) d1 = 0;
	if (dv.charAt(1) != d1)
	{
		return false;
	}
   
   return true;
}

function copiadados() {
		document.fcadastro.EnderecoEntrega.value = document.fcadastro.Endereco.value;
		document.fcadastro.NumEnderecoEntrega.value = document.fcadastro.NumEndereco.value;
		document.fcadastro.ComplementoEntrega.value = document.fcadastro.Complemento.value;
		document.fcadastro.BairroEntrega.value = document.fcadastro.Bairro.value;		
		document.fcadastro.CidadeEntrega.value = document.fcadastro.Cidade.value;
		document.fcadastro.CmbEstadoEntrega.value = document.fcadastro.CmbEstado.value;				
		document.fcadastro.CEPEntrega.value = document.fcadastro.CEP.value;						
}

function abreJanelaFale() {
	jan1=window.open("fale.asp","janelaNet","width=300,height=220,left=230,top=150'");
}

function abreJanelaQuem() {
	jan1=window.open("quemsomos.asp","janelaNet","width=300,height=250,left=230,top=150'");
}

tempo = 10;
chars = 5;
texto = ":: MOOW - Especialização UFMS 2004 ::";
wtexto = new Array(33);
wtexto[0] = texto;
blnk = "                                              ";//Mantenha este espaço
for (i = 1; i < 32; i++) {
b = blnk.substring(0, i);
wtexto[i] = "";
for (j = 0; j < texto.length; j++) wtexto[i] = wtexto[i] + texto.charAt(j) + b;
}
function animastatus() {
if (chars > -1) str = wtexto[chars]; 
else str = wtexto[0];
if (chars-- < -40) chars = 31;
status = str;
clearTimeout(tempo);
tempo = setTimeout("animastatus()", 150);
}

function mOvr(src,clrOver) {if (!src.contains(event.fromElement)) {src.style.cursor = 'hand';
src.bgColor = clrOver;
}
}
function mOut(src,clrIn) {if (!src.contains(event.toElement)) {src.style.cursor = 'default';
src.bgColor = clrIn;
}
}

function abreJanelaFale() {
	jan1=window.open("fale.asp","janelaNet","width=300,height=220,left=230,top=150'");
}
function abreJanelaQuem() {
	jan1=window.open("quemsomos.asp","janelaNet","width=300,height=250,left=230,top=150'");
}