function parceiros() {
	document.write('<map name="parceiros">');
	document.write('<area shape="rect" coords="296,0,414,27" href="http://www.mec.gov.br" alt="Ministério da Educação" target="_blank">');
	document.write('<area shape="rect" coords="215,0,294,27" href="http://www.cnpq.br" alt="CNPq" target="_blank">');
	document.write('<area shape="rect" coords="159,0,213,27" href="http://www.inep.gov.br" alt="INEP" target="_blank">');
	document.write('<area shape="rect" coords="73,0,156,27" href="http://www.capes.gov.br" alt="CAPES" target="_blank">');
	document.write('<area shape="rect" coords="3,0,72,27" href="http://www.brasil.gov.br" alt="Brasil - um país de todos" target="_blank">');
	document.write('</map><img src="img/parceiros.gif" width=424 height=27 border=0 align="middle" usemap="#parceiros" />');
}

function educmailpost(tipo) {
	if( tipo == 1 ) {
		obj = document.getElementById("educmailform");
	} else {
		obj = document.getElementById("educmailform2");
	}
	email = obj.email.value;
	senha = obj.senha.value;
	if( email.length == 0 || senha.length == 0 ) {
		alert( "Preencha os campos corretamente!" );
	} else {
		document.getElementById("webmailform").login_username.value = email;
		document.getElementById("webmailform").secretkey.value = senha;
		document.getElementById("webmailform").submit();
	}
}

function formwebmail() {
	document.write('<form id="webmailform" action="http://webmail.proeduc.org/src/redirect.php" method="post" target="_blank">');
	document.write('<input type="hidden" name="cb_auto_pass" value="0"><input type="hidden" name="login_username">');
	document.write('<input type="hidden" name="login_domainname" value="proeduc.org"><input type="hidden" name="secretkey" value="">');
	document.write('</form>');
}

function chkemail( valor ) {
  valor = valor.toLowerCase();
  retorno = '';
  x = 0;
  arr = 0;
  for( c = 0; c < valor.length; c++ ) {
    letra = asc( valor.substr( c, 1 ) );
    if( x == 0 ) {
      if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) ) {
        retorno = retorno + valor.substr( c, 1 );
        x = 1;
      }
    } else {
      if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) || ( letra == 46 ) || ( letra == 95 ) || ( letra == 64 ) ) {
        if( ( letra == 64 ) && arr == 0 ) {
          retorno = retorno + valor.substr( c, 1 );
          arr = 1;
        } else {
          if( !( letra == 46 && last == 46 ) && !( letra == 95 && last == 95 ) && !( letra == 46 && last == 64 ) ) {
            if( x >= 1 ) retorno = retorno + valor.substr( c, 1 );
            x = x + 1;
          }
        }
      }
    }
    last = letra;
  }
  valor = retorno;
  retorno = '';  
  x = 0;
  pto = 0;
  for( c = ( valor.length - 1 ); c >= 0; c-- )
  {
    letra = asc( valor.substr( c, 1 ) );
    if( letra == 46 ) pto = 1;
    if( x == 0 ) {
      if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) ) {
        retorno = valor.substr( c, 1 ) + retorno;
        x = 1;
      }
    } else {
      if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) || ( letra == 46 ) || ( letra == 95 ) || ( letra == 64 ) ) {
        if( x >= 1 ) retorno = valor.substr( c, 1 ) + retorno;
        x = x + 1;
      }
    }
  }
  
  if( arr == 0 || pto == 0 ) {
    retorno = '';
  }
  
  return retorno;
  
}

function sonumero( valor ) {
  retorno = '';    
  for( c = 0; c < valor.length; c++ )
  {
    letra = asc( valor.substr( c, 1 ) );
    if( ( letra >= 48 && letra <= 57 ) || letra == 45 )
    {
      retorno = retorno + valor.substr( c, 1 );
    }
  }
  return retorno;
}

function asc(each_char)
{
  var n = 0
  var char_str = ' !"#$%&' + "'" + '()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
  for (i = 0; i < char_str.length; i++)
  {
    if (each_char == char_str.substring(i, i+1))
    {
      break
    }
  }
  return i + 32
}

function textmax( obj, max ) {
 
 str = obj.value;
 if( str.length > max ) {
  obj.value = str.substring( 0, max );
 }
 
}
