/*
tempo = 50;
chars = 10;
texto = "SEJA BEM-VINDO(A) AO TOFFOBUS!!! - WWW.TOFFOBUS.COM.BR";
wtexto = new Array(33);
wtexto[0] = texto;
blnk = " ";
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()", 60);
}
animastatus()
*/

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//============================================================================
	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 (NomeDia[dias] + ", " + dia + " de " + NomeMes[mes] + " de " + ano)
}

// MENU
<!--
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 mClk(src) {
if(event.srcElement.tagName=='TD'){
	src.children.tags('A')[0].click();
}
}

function MM_jumpMenu(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->

//----------------------------------------------


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


//-------------------------------------------------------

// Login e Senha
function user()
{
if(document.usuario.txtEmail.value == ""){
	alert("Coloque seu E-MAIL!"); 
	document.usuario.txtEmail.focus();
	return false;
} 
if(document.usuario.txtEmail.value.indexOf('@',0) == -1){
	alert("E-MAIL errado! Falta (@)!"); 
	document.usuario.txtEmail.focus();
	return false;
}
if(document.usuario.txtEmail.value.indexOf('.',0) == -1){
	alert("E-MAIL errado! Falta o ponto (.)!"); 
	document.usuario.txtEmail.focus();
	return false;
}
if(document.usuario.txtSenha.value == ""){
	alert("Coloque sua SENHA!"); 
	document.usuario.txtSenha.focus();
	return false;
}

else {
	return true;
}

}

/*
BUSCA
*/
function base()
{
if (document.encontrar.ybusca.value == "Clique aqui para busca"){
	alert("Escreva uma palavra para BUSCAR!");
	document.encontrar.ybusca.focus();
	 return false;
}

if (document.encontrar.ybusca.value == ""){
	alert("Escreva uma palavra! (Exemplo: Scania)");
	document.encontrar.ybusca.focus();
	 return false;
}
		  
if (document.encontrar.ybusca.value.length < 2){
	alert("Campo BUSCA deve ter mais de 2 caracteres!");
	document.encontrar.ybusca.focus();
	return false;
}
else
{
	return true	;
}
}

//----------------------------------------------------------------------------------------------

<!--// usuarios
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_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; }
}
//-->


// open windows
function Abre(url, width, height)
{
window.open(url,"_blank","resizable=no,toolbar=no,status=no,menubar=no,scrollbars=yes,width=" + width + ",height=" + height)
}


// selecionar tudo para remover mensagem
function CheckAll() {
    var valor = document.formulario.valor_chk.value;
    if ((valor == "") || (valor == "false")) {
      document.formulario.valor_chk.value = true;
    } else {
      document.formulario.valor_chk.value = "";
    }
    valor = document.formulario.valor_chk.value;
    for (var i = 0; i < document.formulario.elements.length; i++) {
      var e = document.formulario.elements[i];
      if ((e.name != "allbox") && (e.name != "acao") && (e.name != "novo_folder") && (e.name != "lixeira") && (e.name != "cria_folder"))
        e.checked = valor;
    }
  }
 
//---------------------------------------------------------------Comentário--------------------------------
function valida()
{
if (document.gt.topico.value == ""){
	alert("Campo TÓPICO está sem preenchimento!");
	document.gt.topico.focus();
	return false;
}

if (document.gt.topico.value.length < 4){
	alert("Escreva TÓPICO mais de 4 caracteres!");
	document.gt.topico.focus();
	return false;
}

if (document.gt.comentario.value == ""){
	alert("Campo sem preenchimento!");
	document.gt.comentario.focus();
	return false;
}

if (document.gt.comentario.value.length < 10){
	alert("Escreva mais de 10 caracteres!");
	document.gt.comentario.focus();
	return false;
	
}	else{
	return true;
}
}

//-----------------------Emotion
function addicone(emotinours) {
	grou = document.gt.comentario.value;
	if (emotinours==1) {sup = " :u "}
	if (emotinours==2) {sup = " :)- "}
	if (emotinours==3) {sup = " :) "}
	if (emotinours==4) {sup = " :} "}
	if (emotinours==5) {sup = " :(- "}
	if (emotinours==6) {sup = " lov# "}
	if (emotinours==7) {sup = " :|- "}
	if (emotinours==8) {sup = " :{ "}
	if (emotinours==9) {sup = " :z "}
	if (emotinours==10) {sup = " :r "}
	document.gt.comentario.value = grou+sup;
	document.gt.comentario.focus();
}

//-----------------lentras grandes não podem
function checkCapsLock( e ) {
	var myKeyCode=0;
	var myShiftKey=false;
	var myMsg='Caps Lock está ligado!';

	// Internet Explorer 4+
	if ( document.all ) {
		myKeyCode=e.keyCode;
		myShiftKey=e.shiftKey;

	// Netscape 4
	} else if ( document.layers ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	// Netscape 6
	} else if ( document.getElementById ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	}

	// Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on
	if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) {
		alert( myMsg );

	// Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on
	} //else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) {
		//alert( myMsg );

	//}
}

// enviar Fotos
function enviafoto() 
{
	if (document.formulario.categoria.value == -1){
	alert("Escolha uma CATEGORIA!");
	document.formulario.categoria.focus();
	return false;
} 

if (document.formulario.comentario.value == ""){
	alert("Escreva seu COMENTÁRIO!");
	document.formulario.comentario.focus();
	return false;
}


	else{
	return true;
}
}

//------------------------ fale conosco

function y(){
	
if(document.fale.nome.value == ""){
	alert("Campo NOME está sem preenchimento!");
	document.fale.nome.focus();
	return false;
}
if(document.fale.endereco.value == ""){
	alert("Campo ENDEREÇO está sem preenchimento!");
	document.fale.endereco.focus();
	return false;
}	
if(document.fale.cidade.value == ""){
	alert("Campo CIDADE está sem preenchimento!");
	document.fale.cidade.focus();
	return false;
}

if(document.fale.estado.value == ""){
	alert("Campo ESTADO está sem preenchimento!");
	document.fale.estado.focus();
	return false;
}

if(document.fale.email.value == ""){
	alert("Campo E-MAIL está sem preenchimento!");
	document.fale.email.focus();
	return false;	
}

if(document.fale.email.value.indexOf('@',0) == -1){
	alert("E-MAIL errado! Falta (@)");
	document.fale.email.focus();
	return false;
}

if(document.fale.email.value.indexOf('.',0) == -1){
	alert("E-MAIL errado! Falta o ponto (.)");
	document.fale.email.focus();
	return false;
}

if(document.fale.comentario.value == ""){
	alert("Campo COMENTÁRIO está sem preenchimento!");
	document.fale.comentario.focus();
	return false;
}
else {
	return true;
	}


}

//------------------------senha

function senha()
{

if(document.cadastro.txtSenha.value == ""){
	alert("Campo SENHA está sem preechimento");
	document.cadastro.txtSenha.focus();
	return false;
}


if(document.cadastro.txtSenha.value.length < 4 ){
	alert("Campo SENHA dever ter mais de 4 caracteres");
	document.cadastro.txtSenha.focus();
	return false;
}

if(document.cadastro.Confirma_senha.value == ""){
	alert("Campo CONFIRMA SENHA está sem preechimento!");
	document.cadastro.Confirma_senha.focus();
	return false;
}

if(document.cadastro.Confirma_senha.value != document.cadastro.txtSenha.value){
	alert("Campo SENHA não confere com a outra SENHA!");
	return false;
}
	
	
else{
	return true;
}
	
}

//======================= enviar fotos

function yfotos()
{

if(document.efotos.categoria.value == -1){
	alert("ESCOLHA UMA CATEGORIA DE SUA FOTO!");
	document.efotos.categoria.focus();
	return false;
}

if(document.efotos.nome_foto.value == ""){
	alert("Campo NOME DA FOTO está sem preechimento");
	document.efotos.nome_foto.focus();
	return false;
}

if(document.efotos.localidade.value == ""){
	alert("Campo LOCALIDADE está sem preechimento");
	document.efotos.localidade.focus();
	return false;
}

if(document.efotos.comentario.value == ""){
	alert("Campo COMENTÁRIO está sem preechimento");
	document.efotos.comentario.focus();
	return false;
} 
else {
	return true;
}


	
}

//-----------------------------------------

function remover_agora()
{
	
if(document.detonar.remover_email.value == ""){
	alert("E-MAIL está vazio!!");
	document.detonar.remover_email.focus();
	return false;
}

if(document.detonar.remover_email.value.indexOf('@',0) == -1){
	alert("E-MAIL errado! Falta (@)");
	document.detonar.remover_email.focus();
	return false;
}

if(document.detonar.remover_email.value.indexOf('.',0) == -1){
	alert("E-MAIL errado! Falta o ponto (.)");
	document.detonar.remover_email.focus();
	return false;
}

if(document.detonar.remover_senha.value == ""){
	alert("SENHA está vazio!!");
	document.detonar.remover_senha.focus();
	return false;
} else {
	return true;
}

	
}