/* funções de pop_up de imagens */
function Foto(img){
  foto1= new Image();
  foto1.src=(img);
  controla(img);
}
function controla(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    verFoto(img);
  }
  else{
    funzione="controla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function verFoto(img){
  largura=foto1.width+20;
  altura=foto1.height+20;
  stringa="width="+largura+",height="+altura;
  finalizada=window.open(img,"",stringa);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function escreve_menu_home(){
  MM_preloadImages('img/menu/o_bellini_hover.jpg','img/menu/o_ambiente_hover.jpg','img/menu/nossos_servicos_hover.jpg','img/menu/eventos_hover.jpg','img/menu/sobre_o_chef_hover.jpg','img/menu/cardapio_a_la_carte_hover.jpg','img/menu/reservas_hover.jpg','img/menu/localizacao_hover.jpg','img/menu/contato_hover.jpg');
  document.write('<table width=\"173\" height=\"399\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"img/menu/menu_bellini_home.jpg\">');
  document.write('  <tr>');
  document.write('    <td width=\"35\" height=\"186\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td width=\"138\" height=\"186\" align=\"right\" valign=\"top\"><div style="width:108px; height:130px; "><a href="index.jsp"><img src="img/layout/transparent.gif" border="0"></a></div></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"o_bellini.jsp\"><img src=\"img/menu/o_bellini.jpg\" name=\"o_bellini\" width=\"116\" height=\"17\" id=\"o_bellini\" onmouseover=MM_swapImage(\"o_bellini\",\"\",\"img/menu/o_bellini_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"o_ambiente.jsp\"><img src=\"img/menu/o_ambiente.jpg\" name=\"o_ambiente\" width=\"116\" height=\"18\" id=\"o_ambiente\" onmouseover=MM_swapImage(\"o_ambiente\",\"\",\"img/menu/o_ambiente_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"21\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"21\" align=\"left\" valign=\"top\"><a href=\"nossos_servicos.jsp\"><img src=\"img/menu/nossos_servicos.jpg\" name=\"nossos_servicos\" width=\"116\" height=\"21\" id=\"nossos_servicos\" onmouseover=MM_swapImage(\"nossos_servicos\",\"\",\"img/menu/nossos_servicos_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"eventos.jsp\"><img src=\"img/menu/eventos.jpg\" name=\"eventos\" width=\"116\" height=\"18\" id=\"eventos\" onmouseover=MM_swapImage(\"eventos\",\"\",\"img/menu/eventos_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"sobre_chef.jsp\"><img src=\"img/menu/sobre_o_chef.jpg\" name=\"sobre_o_chef\" width=\"116\" height=\"19\" id=\"sobre_o_chef\" onmouseover=MM_swapImage(\"sobre_o_chef\",\"\",\"img/menu/sobre_o_chef_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"receita_mes.jsp\"><img src=\"img/menu/receita_do_mes.jpg\" name=\"receita_do_mes\" width=\"116\" height=\"20\" id=\"receita_do_mes\" onmouseover=MM_swapImage(\"receita_do_mes\",\"\",\"img/menu/receita_do_mes_hover.jpg\",0) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"cardapio_a_la_carte.jsp\"><img src=\"img/menu/cardapio_a_la_carte.jpg\" name=\"cardapio_a_la_carte\" width=\"116\" height=\"20\" id=\"cardapio_a_la_carte\" onmouseover=MM_swapImage(\"cardapio_a_la_carte\",\"\",\"img/menu/cardapio_a_la_carte_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"reservas.jsp\"><img src=\"img/menu/reservas.jpg\" name=\"reservas\" width=\"116\" height=\"20\" id=\"reservas\" onmouseover=MM_swapImage(\"reservas\",\"\",\"img/menu/reservas_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"localizacao.jsp\"><img src=\"img/menu/localizacao.jpg\" name=\"localizacao\" width=\"116\" height=\"20\" id=\"localizacao\" onmouseover=MM_swapImage(\"localizacao\",\"\",\"img/menu/localizacao_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"35\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"35\" align=\"left\" valign=\"top\"><a href=\"contato.jsp\"><img src=\"img/menu/contato.jpg\" name=\"contato\" width=\"116\" height=\"19\" id=\"contato\" onmouseover=MM_swapImage(\"contato\",\"\",\"img/menu/contato_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('</table>');
}


function escreve_menu(){
  MM_preloadImages('img/menu/o_bellini_hover.jpg','img/menu/o_ambiente_hover.jpg','img/menu/nossos_servicos_hover.jpg','img/menu/eventos_hover.jpg','img/menu/sobre_o_chef_hover.jpg','img/menu/cardapio_a_la_carte_hover.jpg','img/menu/reservas_hover.jpg','img/menu/localizacao_hover.jpg','img/menu/contato_hover.jpg');
  document.write('<table width=\"173\" height=\"399\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"img/menu/menu_bellini.jpg\">');
  document.write('  <tr>');
  document.write('    <td width=\"35\" height=\"186\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td width=\"138\" height=\"186\" align=\"left\" valign=\"top\"><div style="width:108px; height:130px; "><a href="index.jsp"><img src="img/layout/transparent.gif" border="0"></a></div></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"o_bellini.jsp\"><img src=\"img/menu/o_bellini.jpg\" name=\"o_bellini\" width=\"116\" height=\"17\" id=\"o_bellini\" onmouseover=MM_swapImage(\"o_bellini\",\"\",\"img/menu/o_bellini_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"o_ambiente.jsp\"><img src=\"img/menu/o_ambiente.jpg\" name=\"o_ambiente\" width=\"116\" height=\"18\" id=\"o_ambiente\" onmouseover=MM_swapImage(\"o_ambiente\",\"\",\"img/menu/o_ambiente_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"21\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"21\" align=\"left\" valign=\"top\"><a href=\"nossos_servicos.jsp\"><img src=\"img/menu/nossos_servicos.jpg\" name=\"nossos_servicos\" width=\"116\" height=\"21\" id=\"nossos_servicos\" onmouseover=MM_swapImage(\"nossos_servicos\",\"\",\"img/menu/nossos_servicos_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"eventos.jsp\"><img src=\"img/menu/eventos.jpg\" name=\"eventos\" width=\"116\" height=\"18\" id=\"eventos\" onmouseover=MM_swapImage(\"eventos\",\"\",\"img/menu/eventos_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"sobre_chef.jsp\"><img src=\"img/menu/sobre_o_chef.jpg\" name=\"sobre_o_chef\" width=\"116\" height=\"19\" id=\"sobre_o_chef\" onmouseover=MM_swapImage(\"sobre_o_chef\",\"\",\"img/menu/sobre_o_chef_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"receita_mes.jsp\"><img src=\"img/menu/receita_do_mes.jpg\" name=\"receita_do_mes\" width=\"116\" height=\"20\" id=\"receita_do_mes\" onmouseover=MM_swapImage(\"receita_do_mes\",\"\",\"img/menu/receita_do_mes_hover.jpg\",0) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"cardapio_a_la_carte.jsp\"><img src=\"img/menu/cardapio_a_la_carte.jpg\" name=\"cardapio_a_la_carte\" width=\"116\" height=\"20\" id=\"cardapio_a_la_carte\" onmouseover=MM_swapImage(\"cardapio_a_la_carte\",\"\",\"img/menu/cardapio_a_la_carte_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"reservas.jsp\"><img src=\"img/menu/reservas.jpg\" name=\"reservas\" width=\"116\" height=\"20\" id=\"reservas\" onmouseover=MM_swapImage(\"reservas\",\"\",\"img/menu/reservas_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"19\" align=\"left\" valign=\"top\"><a href=\"localizacao.jsp\"><img src=\"img/menu/localizacao.jpg\" name=\"localizacao\" width=\"116\" height=\"20\" id=\"localizacao\" onmouseover=MM_swapImage(\"localizacao\",\"\",\"img/menu/localizacao_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('  <tr>');
  document.write('    <td height=\"35\" align=\"left\" valign=\"top\">&nbsp;</td>');
  document.write('    <td height=\"35\" align=\"left\" valign=\"top\"><a href=\"contato.jsp\"><img src=\"img/menu/contato.jpg\" name=\"contato\" width=\"116\" height=\"19\" id=\"contato\" onmouseover=MM_swapImage(\"contato\",\"\",\"img/menu/contato_hover.jpg\",1) onmouseout=\"MM_swapImgRestore()\" border=\"0\"/></a></td>');
  document.write('  </tr>');
  document.write('</table>');
}


//funções para formatação de data

function f_formata_data2(obj) {
  var sConteudo = obj.value;

  var sAux = SoNumerosBarra(sConteudo);
  if( sAux.length == 2 || sAux.length == 5 )
    sAux += '/';

  if (sAux.length > 10) sAux = sAux.substr(0,10);
    obj.value = sAux;
} 

function SoNumerosBarra(validar) {
  var strChar = "";

  for ( var intCont = 0 ; intCont <= validar.length ; intCont++ ) {
    if (((validar.charAt(intCont) >= "0") && (validar.charAt(intCont) <= "9")) || (validar.charAt(intCont) == "/")) {
      strChar = strChar + validar.charAt(intCont);
    }
  }
  return strChar;
}
function verificaData2(obj) {
  var sCadeia  = "0123456789/";
  var conteudo = obj.value;
  var data     = "";

  //***** Desformata data (se tiver formatada)
  for (x=0; x < conteudo.length; x++) {
    var sCarac = conteudo.charAt(x);
    if (sCadeia.indexOf(sCarac)!=-1) data += sCarac
  }

  //***** Checa data
  var dia = data.substr(0,2);
  var mes = data.substr(3,2);
  var ano = data.substr(6,4);

  if (mes < 0 || mes > 12) {
    alert("Mês inválido!");
    obj.focus();
    return false;
  }
  if (mes == 2 && dia > 29) {
    alert("Dia inválido!");
    obj.focus();
    return false;
  }
  if (mes != 2 && dia > 31) {
    alert("Dia inválido!");
    obj.focus();
    return false;
  }
  if (mes==4 || mes==6 || mes==9 || mes==11) {
    if (dia > 30) {
      alert("Dia inválido!");
      obj.focus();
      return false;
    }
  }

  //** Formata Data
  if (conteudo.length > 0) obj.value = dia + "/" + mes + "/" + ano;
  return true;
}