//* Language Java Script *//
//*ataptado exclusivamente para o site da Família Chacur por Uiliam Cruz - Web Design da Transfira*//
//*Início dos Scripts*//


//*data das páginas*//
//*chamada na(s) pág(s): contas.htm, agenda.htm *//
function dia() {
      var DATA   = new Date();
      var SEM    = DATA.getDay();
      var DIA    = DATA.getDate();
      var MES    = DATA.getMonth();
      var ANO    = DATA.getYear();
      var MESES  = new Array(11);
      var SEMANA = new Array(6);

      SEMANA[0] = 'Domingo';      
      SEMANA[1] = 'Segunda';      
      SEMANA[2] = 'Terça';      
      SEMANA[3] = 'Quarta';      
      SEMANA[4] = 'Quinta';      
      SEMANA[5] = 'Sexta';      
      SEMANA[6] = 'Sábado';

      MESES[0]  = '01';
      MESES[1]  = '02';
      MESES[2]  = '03';
      MESES[3]  = '04';
      MESES[4]  = '05';
      MESES[5]  = '06';
      MESES[6]  = '07';
      MESES[7]  = '08';
      MESES[8]  = '09';
      MESES[9]  = '10';
      MESES[10] = '11';
      MESES[11] = '12';

      if (ANO < 1000) {
        ANO += 1900;
      }
      document.write(SEMANA[SEM] +', '+ DIA +'/'+ MESES[MES] +'/'+ ANO);
}
// fim dia //

//*chamada na(s) pág(s): lista_contato.htm*//
function Alerta()
{alert('Para uma melhor impressão recomendamos: usar o papel no modo paisagem.');}
//*fim do pop up*//	  


//*abre pop up*//
//*chamada na(s) pág(s): contas.htm*//
function popup()
{chacur=window.open('calcularora.htm', 'popup', 'width=154,height=106,screenX=350,screenY=235,left=350,top=235,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizeable=no,copyhistory=no')}
//*fim do pop up*//

//*chamada na(s) pág(s): nossa_familia.htm*//
function Lista_contato()
{chacur=window.open('lista_contato.htm', 'popup2', 'width=766,height=250,screenX=10,screenY=255,left=10,top=255,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizeable=no,copyhistory=no')}
//*fim do pop up*//

//*chamada na(s) pág(s): agenda.htm*//
function Churrasco()
{chacur=window.open('churrasco_fotos.htm', 'popup3', 'width=685,height=375,screenX=10,screenY=255,left=10,top=255,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizeable=no,copyhistory=no')}
//*fim do pop up*//

//*chamada na(s) pág(s): historia_conta.htm*//
function SaibamaisNucleos()
{chacur=window.open('saiba_mais_nucelos.htm', 'popup4', 'width=680,height=325,screenX=10,screenY=255,left=10,top=255,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizeable=no,copyhistory=no')}
//*fim do pop up*//

//*chamada na(s) pág(s): historia_conta.htm*//
function TextoFohad()
{chacur=window.open('texto_fohad.htm', 'popup5', 'width=680,height=325,screenX=10,screenY=255,left=10,top=255,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizeable=no,copyhistory=no')}
//*fim do pop up*//
                                                                                   
//*Calendário Recados*//
//*chamada na(s) pág(s): agenda.htm*//
function encode (str) 
{ 
  var dest = ""; 
  var len = str.length; 
  var index = 0; 
  var code = null; 
  for (var i = 0; i < len; i++) { 
  var ch = str.charAt(i); 
  if (ch == " ") code = "%20"; 
    else if (ch == "%") code = "%25"; 
    else if (ch == ",") code = "%2C"; 
    else if (ch == ";") code = "%3B"; 
    else if (ch == "\b") code = "%08"; 
    else if (ch == "\t") code = "%09"; 
    else if (ch == "\n") code = "%0A"; 
    else if (ch == "\f") code = "%0C"; 
    else if (ch == "\r") code = "%0D"; 
    if (code != null) { 
      dest += str.substring(index,i) + code; 
      index = i + 1; 
      code = null; 
    } 
  } 
  if (index < len) 
    dest += str.substring(index, len); 
  return dest; 
} 
  function decode (str) 
{ 
  var dest = ""; 
  var len = str.length; 
  var index = 0; 
  var code = null; 
  var i = 0; 
  while (i < len) { 
    i = str.indexOf ("%", i); 
    if (i == -1) 
      break; 
    if (index < i) 
      dest += str.substring(index, i); 
    code = str.substring (i+1,i+3); 
    i += 3; 
    index = i; 
    if (code == "20") dest += " "; 
    else if (code == "25") dest += "%"; 
    else if (code == "2C") dest += ","; 
    else if (code == "3B") dest += ";"; 
    else if (code == "08") dest += "\b"; 
    else if (code == "09") dest += "\t"; 
    else if (code == "0A") dest += "\n"; 
    else if (code == "0C") dest += "\f"; 
    else if (code == "0D") dest += "\r"; 
    else { 
      i -= 2; 
      index -= 3; 
    } 
  } 
 if (index < len) 
    dest += str.substring(index, len); 
  return dest; 
} 
  function getCookieVal (offset) 
{ 
  var endstr = document.cookie.indexOf (";", offset); 
  if (endstr == -1) 
    endstr = document.cookie.length; 
  return decode(document.cookie.substring(offset, endstr)); 
} 
  function GetCookie (name) 
{ 
  var arg = name + "="; 
  var alen = arg.length; 
  var clen = document.cookie.length; 
  var i = 0; 
  while (i < clen) { 
    var j = i + alen; 
    if (document.cookie.substring(i, j) == arg) 
      return getCookieVal (j); 
    i = document.cookie.indexOf(" ", i) + 1; 
    if (i == 0) break; 
  } 
  return null; 
} 
  
function SetCookie (name, value, expires) 
{ 
  document.cookie = name + "=" + encode(value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())); 
} 
function DeleteCookie (name) 
{ 
  var exp = new Date(); 
  var cval = GetCookie (name); 
  document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); 
} 
function arrayOfDaysInMonths(isLeapYear) 
{ 
   this[0] = 31; 
   this[1] = 28; 
if (isLeapYear) 
   this[1] = 29; 
   this[2] = 31; 
   this[3] = 30; 
   this[4] = 31; 
   this[5] = 30; 
   this[6] = 31; 
   this[7] = 31; 
   this[8] = 30; 
   this[9] = 31; 
   this[10] = 30; 
   this[11] = 31; 
} 
function daysInMonth(month, year) 
{ 
   var isLeapYear = (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)); 
   var monthDays  = new arrayOfDaysInMonths(isLeapYear); 
   return monthDays[month]; 
} 
function calendar() 
{ 
   var monthNames = "JanFevMarAbrMaiJunJulAgoSetOutNovDez"; 
   var today      = new Date(); 
   var day        = today.getDate(); 
   var month      = today.getMonth(); 
   var year       = today.getYear(); 
   var numDays    = daysInMonth(month, year+1); 
   var firstDay   = today; 
       firstDay.setDate(2); 
   var startDay = firstDay.getDay(); 
   var column = 0; 
   document.write("<left>"); 
   document.write("<TABLE width=151 height=50 BORDER=0 bgcolor=#f8f8f8>"); 
   document.write("<TR><td background=images/agenda_09b.jpg width=151 height=16 COLSPAN=7><strong>&nbsp;"); 
   document.write(monthNames.substring(3*month, 3*(month + 1)) + " " + year); 
   document.write("<TR><td>D<td>S<td>T<td>Q<td>Q<td>S<td>S"); 
   document.write("<TR bgcolor=#ffffff>"); 
   for (i=1; i < startDay; i++) 
   { 
      document.write("<TD>"); 
      column++; 
	     } 
   for (i=1; i <= numDays; i++) 
   { 
      var s = "" + i; 

      if ((GetCookie("d"+i) != null)) 
        s = s.fontcolor("#FF0000"); 
      s = s.link("javascript:dayClick(" + i + ")") 
          document.write("<TD bgcolor=#ffffff>" + s); 
      if (++column == 7) 
      { 
         document.write("<TR>"); 
         column = 0; 
      } 
   } 
   document.write("</TABLE>"); 
   document.writeln("</left>"); 
} 
function dayClick(day) 
{
        var expdate = new Date (); 
          expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000)); 
        var prefix                = "d"; 
        var theCookieName         = prefix + day; 
        var theDayclickedReminder = GetCookie(theCookieName); 
    if (theDayclickedReminder != null) { 
//* seu alerta aqui *//
        alert("O lembrete para o dia " + day + " é:"  + theDayclickedReminder); 
      } 
//* você coloca sua mensagem aqui *//
        if (confirm("Você deseja colocar um lembrete para o dia " + day + " deste mês?")) 
        { 
                x = prompt("Coloque seu lembrete para o dia "+ day + " deste mês", theDayclickedReminder); 
        SetCookie (theCookieName, x, expdate); 
        } 
} 
//*fim do Calendário Recados*//


