function TestaVal_Procura() 
{
if (document.procura.valor.value=="")
{alert ("O campo deve ser preenchido com alguma palavra chave!")
document.procura.valor.focus()
return false }
}

function Atualiza_Hora()
{
  var Hr, HoraAtual, Hora, Minuto, Segundo, hh, min, seg
  Hr = new Date()
  hh = Hr.getHours()
  min = Hr.getMinutes()
  seg = Hr.getSeconds()
  HoraAtual = ((hh < 10) ? "0" + hh + ":" : hh + ":")
  HoraAtual += ((min < 10) ? "0" + min + ":" : min + ":")
  HoraAtual += ((seg < 10) ? "0" + seg : seg)
  //document.getElementById('hora_certa').innerHTML = "<b>" + HoraAtual + " - " + Saudacoes(hh) + "</b>"
  x=setTimeout("Atualiza_Hora()",1000);
}

function Saudacoes(Hora)
{
  var Aux
  if (Hora >= 4 && Hora < 12)
    return "Bom dia!"
  if (Hora >= 12 && Hora < 18)
    return "Boa tarde!"
  if (Hora >= 18 || Hora < 4)
    return "Boa noite!"
}  
     
  //if (top.location != self.location) { top.location = self.location }
  //moveTo(-2,-2)
  //resizeTo(screen.availWidth+3,screen.availHeight + 5)
  window.moveTo(0,0);
  if (document.all) 
  {
    top.window.resizeTo(screen.availWidth,screen.availHeight);
  }
  else
  if (document.layers||document.getElementById)
  {
    if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth)
    {
      top.window.outerHeight = screen.availHeight;
      top.window.outerWidth = screen.availWidth;
    }
  }

var NewWin;

var now = new Date();
var dayNr = now.getDate();

function Detalhes(id,ancora)
{
  parametros = "status=yes,resizable=no,menubar=no,scrollbars=yes,width=620,height=510,left=0,top=0";
  url = "detalhes_prod2.asp?id=";
  
  if (NewWin == null)
  {
    NewWin=window.open(url + id + '&ancora=' + ancora,'',parametros);
  }
  else
  {
    if (window['NewWin'].closed)
    {
      NewWin=window.open(url + id + '&ancora=' + ancora,'',parametros);
    }
    else
    {
      window['NewWin'].location.href = url + id + '&ancora=' + ancora;
    }
  }
  window['NewWin'].focus();
}

var NS4 = (document.layers);
var IE4 = (document.all);

function verifica_filhas()
{
  if (window['NewWin'] != null)
    window['NewWin'].close();
}

function AbrirMenu(codigo)
{
	var obj = document.getElementById('ul_menu_produtos');
	var uls = obj.getElementsByTagName('ul');
	var imgs = obj.getElementsByTagName('img');
	for (var i=0; i < uls.length; i++)
	{
		if(uls[i] != document.getElementById('subitens_menu_' + codigo))
			uls[i].style.display = 'none';
	}
	
	for (var i=0; i < imgs.length; i++)
	{
		if (imgs[i].className == 'img_mais')
			imgs[i].src = 'imagens/mais.gif';
	}
	
	if (document.getElementById('subitens_menu_' + codigo).style.display == 'none')
	{
		document.getElementById('subitens_menu_' + codigo).style.display = '';
		document.getElementById('item_menu_' + codigo).src = 'imagens/menos.gif'
	}
	else
	{
		document.getElementById('subitens_menu_' + codigo).style.display = 'none';
		document.getElementById('item_menu_' + codigo).src = 'imagens/mais.gif'
	}
}

function TestaVal_Newsletter() 
{
if (document.form_newsletter.Nome.value=="")
{alert ("O campo Nome deve ser preenchido!")
document.form_newsletter.Nome.focus()
return false }
if (document.form_newsletter.Email.value=="")
{alert ("O campo Email deve ser preenchido!")
document.form_newsletter.Email.focus()
return false }
}

function TestaVal_Recomende() 
{
if (document.form_recomende.nome.value=="")
{alert ("O campo Nome deve ser preenchido!")
document.form_recomende.nome.focus()
return false }
if (document.form_recomende.seuemail.value=="")
{alert ("O campo Email deve ser preenchido!")
document.form_recomende.seuemail.focus()
return false }
if (document.form_recomende.nomeamigo.value=="")
{alert ("O campo Nome do(a) Amigo(a) deve ser preenchido!")
document.form_recomende.nomeamigo.focus()
return false }
if (document.form_recomende.emailamigo.value=="")
{alert ("O campo Email do(a) Amigo(a) deve ser preenchido!")
document.form_recomende.emailamigo.focus()
return false }
}


