//-------------------------------------------------
//DATA: 25/09/2008
//PROGR.: Carlos Alberto Vettorato
//FUNÇÃO: Arquivo Genérico de Funções JavaScript
//-------------------------------------------------

//-----------------------------------------------------------------------
//Funções Prototype
//-----------------------------------------------------------------------

function getPagina(url)
{
var div = document.getElementById("pagina");
div.innerHTML = "<img src='loading.gif' width='24' height='24' style='border:0'><br><font size='1'>Carregando...</font>";
return new Ajax.Request(url, {
method: 'POST',
onComplete: function(transport) {
div.innerHTML = transport.responseText;
}
});
}

function getResultado(url)
{
var div = document.getElementById("resultado");
div.innerHTML = "<img src='loading.gif' width='24' height='24' style='border:0'><br><font size='1'>Carregando...</font>";
return new Ajax.Request(url, {
method: 'POST',
onComplete: function(transport) {
div.innerHTML = transport.responseText;
}
});
}

function getLogin(url)
{
var div = document.getElementById("resultado");
return new Ajax.Request(url, {
method: 'POST',
onComplete: function(transport) {
div.innerHTML = transport.responseText;
}
});
}

function pesquisaLogin(valor)
{
getLogin("buscaLogin.php?valor="+valor);
}

function excluir(url) {
    if (confirm('Tem certeza que deseja excluir este registro?'))
    {
    var div = document.getElementById("resultado");
    div.innerHTML = "<img src='loading.gif' width='24' height='24' style='border:0'><br><font size='1'>Carregando...</font>";
    return new Ajax.Request(url, {
    method: 'POST',
    onComplete: function(transport) {
    div.innerHTML = transport.responseText;
    }
 });
}}

//-----------------------------------------------------------------------
//Fim Funções Prototype
//-----------------------------------------------------------------------

//FUNÇÃO VALIDA LOGIN
function validaLogin(form)
{

    var str = form.login.value
    if (str == "") {
    alert("Você não colocou o seu Login!!!");
    form.login.focus();
    return(false);
	}
 	
    var str = form.senha.value
    if (str == "") {
    alert("Favor colocar sua Senha!!!");
    form.senha.focus();
    return(false);
	}
	
    return (true);

}
//FIM FUNÇÃO VALIDA LOGIN

//FUNÇÃO FALE CONOSCO/CONTATO
function validaForm(theForm)
{

	if(theForm.nome.value == "") {
		 alert("Você não colocou o seu nome!!!");
		 theForm.nome.focus();
		 return(false);
	}

	if(theForm.email.value == "") {
		 alert("Favor colocar um e-mail válido!!!");
		 theForm.email.focus();
		 return(false);
	}

	if(theForm.assunto.value == "") {
		 alert("Você não preencheu o assunto!!!");
		 theForm.assunto.focus();
		 return(false);
	}

	if(theForm.mensagem.value == "") {
		 alert("Você não colocou a sua mensagem!!!");
		 theForm.mensagem.focus();
		 return(false);
	}

	return (true);
}
//FIM FUNÇÃO FALE CONOSCO

//Script Saudação
{
  var now = new Date();
  var mName = now.getMonth() + 1;
  var dName = now.getDay() + 1;
  var dayNr = now.getDate();
  var yearNr=now.getYear();
  var nHours = now.getHours();
  if(dName==1) Day = "Domingo";
  if(dName==2) Day = "Segunda-feira";
  if(dName==3) Day = "Ter&ccedil;a-feira";
  if(dName==4) Day = "Quarta-feira";
  if(dName==5) Day = "Quinta-feira";
  if(dName==6) Day = "Sexta-feira";
  if(dName==7) Day = "S&aacute;bado";
  if(yearNr < 2000) Year = 1900 + yearNr;
  else Year = yearNr;
  if((nHours < 12) && (nHours >= 5)) {Saudacao = "Bom dia.";}
  if((nHours >= 12) && (nHours < 19)) {Saudacao = "Boa tarde.";}
  if((nHours >= 19) && (nHours < 24)) {Saudacao = "Boa noite.";}
  if((nHours >= 0) && (nHours < 5)) {Saudacao = "Boa madrugada.";}

  	if(dayNr < 10) {
  		var dia =(" " + Day + ", 0" + dayNr); } else {var dia =(" " + Day + ", " + dayNr) ;
	}
  	if(mName < 10) {
  		var mes =("/0" + mName + "/" + Year); } else {var mes =("/" + mName + "/" + Year) ;
	}
	var todaysDate =(dia + mes) ;
	var saudar =(Saudacao + " Seja bem-vindo");
}
//Fim saudação
