//the bday array data can be generated from server-side







var arrBday = [







  ['Sami Bin', '9/18'],



  ['Camila Pocz', '5/5'],


  ['Xumi', '4/15'],



  ['Rafa Roithmann', '4/5'],



  ['Paula Grin.', '8/25'],



  ['Papaléo', '3/20'],



  ['Carlitos', '3/18'],



  ['Laura Lewinsohn', '3/18'],



  ['Pedrinho', '3/25'],



  ['Laura Kaufmann', '1/19'],



  ['Julia Scheirr', '9/6'],



  ['Lu P.V.', '9/3'],



  ['Salsa', '7/17'],



  ['Nathalie', '4/18'],



  ['Ian', '7/7'],



  ['Carol Barth', '7/15'],



  ['Dan Grinplastch', '4/15'],



  ['Fernando Zatz', '7/18'],



  ['Marcelo Zatz', '8/8'],



  ['Fe Engelman', '7/18'],



  ['Diana', '6/12'],



  ['Eduardo', '7/28'],



  ['Márcio T.', '3/21'],



  ['Blochtein.', '5/13'],



  ['Pablo', '3/30'],



  ['Korman', '3/31'],



  ['Liu', '5/11'],



  ['Julia Alves', '12/20'],



  ['Rafaela', '2/19'],



  ['Laura P.', '11/24'],



  ['Lucas K.', '9/13'],



  ['Lucas Cohen', '10/29'],



  ['Gabriel W.', '1/8'],



  ['Marina', '8/21'],



  ['Deby Aspesi', '2/25'],



  ['Gabi Baggio', '2/10'],



  ['Beta', '3/16'],



  ['Fritz', '7/9'],



  ['Brunão', '12/28'],



  ['Ricky', '9/10'],



  ['Alice Silveira', '1/17'],



  ['Joana Sondermann', '11/29'],



  ['Luquinhas', '4/15'],



  ['Jonas', '4/10'],



  ['Julia', '3/12'],



  ['Flavia Gurski', '6/9'],



  ['Beto Lejdermann', '12/6'],



  ['Laura Krimberg', '3/8'],



  ['Débora S', '5/8'],



  ['Guto', '8/13'],



  ['Manita', '10/27'],



  ['Chester', '12/24'],



  ['Leila', '12/28'],



  ['Eduardo', '4/13'],



  ['Joana Burd', '1/6'],



  ['Azeitona', '1/25'],



  ['Mathias', '2/22'],



  ['Vicky', '5/2'],



  ['Kiko Raskin', '8/19'],

  

  ['Pedrinho (Solelim)', '8/17'],



  ['Julinha', '1/23'],



  ['Juliana Engelman', '10/18'],



  ['Paty Lembert', '9/29'],



  ['Zé Love', '1/22'],



  ['Ricardo Hekman', '8/30'],



  ['Dodi', '2/24'],



  ['Ilana Bonder', '3/5'],



  ['Dan', '1/2'],



  ['Kika', '5/15'],



  ['Gabi Cohen', '4/29'],



  ['Gabí', '10/4'],



  ['Fernando Asniz', '9/29'],



  ['Leonardo Krimberg', '7/22'],



  ['Mama', '11/29'],



  ['Fabio S.', '12/30'],



  ['Déia', '5/6'],



  ['Cathy Isdra', '5/12'],



  ['Marina Alves', '8/14'],



  ['Rafa Hess', '12/19'],



  ['Elisa Hauser', '12/10'],



  ['Tiago Knijnik', '2/15'],



  ['Rafael Hekman', '13/9'],



  ['Guilherme B.', '3/12'],



  ['Dudu Mattos', '11/27'],



  ['Pedro O.', '2/8'],



  ['Renata Halperin', '4/17'],



  ['Fernanda Halpern', '2/19'],



  ['Aline', '9/7'],



  ['Daniela Eilberg', '2/5'],



  ['Ju Hz', '5/18'],



  ['Thais A.', '4/13'],



  ['Thais B.', '5/5'],



  ['Júlia Galperim', '1/14'],



  ['Sabrina', '10/12'],



  ['Laura Kunzler', '10/22'],



  ['Adam', '11/20'],



  ['Bruna Engelman', '11/30'],



  ['Bruna Sibem', '8/30'],



  ['Biel', '6/13'],



  ['Ricardo Rossi', '1/11'],



  ['Laura Sibemberg', '1/19'],  



  ['Camila S.', '1/20'],  



  ['Ariela Kessler', '5/5'],  



  ['Rachel', '12/28'],  



  ['Pedrão', '7/29'],  



  ['Renata', '8/26'],  



  ['Fernanda R.', '11/2'],  



  ['Camila F.', '7/10'],



  ['Luiza Lermann', '3/24'],  



  ['Carlitus', '12/1'],



  ['Paula P.', '4/11'],  



  ['Manuella', '3/9'],  



  ['Jayme', '5/6'],  



  ['Leon', '8/8'],



  ['Leonardo', '9/21'],  



  ['Ana Luiza', '9/23'],  



  ['Débora Gontow', '8/15'],  



  ['Marina T.', '2/13'],  



  ['Carolina Rossi', '4/6'],



  ['Cathy', '1/11'],  



  ['Kim', '8/31'],



  ['Bruna Schwartz', '8/27'],  



  ['Pires', '7/16'],  



  ['Daniela Saffer', '11/6'],  



  ['Dani Didio', '10/25'], 



  ['Matheus Rachewsky', '7/8'],



  ['Piras', '10/7'],



  ['Litwin', '6/2'],  



  ['Eduardo Roithmann', '9/27'],  



  ['Fernanda Faertes', '12/19'],  



  ['Goibe', '9/21'],  



  ['Gabriela Medvedovsky', '6/29'],  



  ['Ilana Bochernitsan', '8/29'],



  ['Isadora', '11/12'],



  ['Laura Frandjlich', '12/3'],



  ['Luly', '3/24'],  



  ['Maira', '12/9'],  



  ['Marcela Torikachvili', '3/19'],  



  ['Cecelo', '6/2'],  



  ['Philips', '12/1'],  



  ['Ricardinho', '2/5'],  



  ['Dinho', '10/30'],



  ['V.Gordo', '6/18'],  



  ['Marco Meimes', '2/10'],



  ['Raquel Henkin', '8/14'],



  ['Tosco', '5/18'],



  ['Mendes', '8/31'],



  ['Jhon', '10/22'],



  ['Engelman', '6/23'],



  ['Amanda', '3/17'],



  ['Sissi', '5/14'],



  ['Rê Axelrud', '10/20'],



  ['Lennys', '12/17'],



  ['Bru Zouvi', '11/20'],



  ['Ju Bugin', '8/23'],



  ['Gui Rucatti', '6/11'],



  ['Kiko', '8/26'],



  ['Sabriel', '6/10'],  



  ['Rubinho', '11/15'],



  ['Binho', '7/23'],



  ['Gus', '4/10'],  



  ['Bictor', '9/1'],



  ['Anipe', '8/17'],



  ['João Sóbis', '9/23'],  



  ['Pedro Bacaltchuk', '6/7'],



  ['Phantom', '5/21'],



  ['Yafá', '10/21'],



  ['Pirula', '10/18'],



  ['Rê Saffer', '4/15'],  



  ['Rê Gitz', '6/7'],



  ['Maya', '1/9'],



  ['Pri', '7/13'],



  ['Chanin', '9/18'],



  ['Roger', '5/20'],



  ['Aliti', '5/8'],



  ['Salomão', '4/27'],  



  ['Guido', '4/27'],



  ['Matheus W.', '9/18'],



  ['Artur Franco', '12/19'],  



  ['Rebeca', '2/18'],  



  ['Gabi Maltz', '5/9'],



  ['Cami Roithmann', '4/18'],



  ['Natan', '10/10'],



  ['Jéssica', '8/20'],



  ['Débora Maltz', '1/7'],



  ['Júlia Bergman', '10/25'],  



  ['Alice', '4/5'], //??? 



  ['Sibem', '5/11'],  



  ['Fábio Iuchno', '4/28'],  



  ['Aloísio', '7/14'],



  ['Luísa Chwartzmann', '7/18']

  

      //...and so on (last entry must not have a trailing comma)







];







function getBdaysThisWeek(){







  var arrMonth = new Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12");







  var bday, idx;







  var bdayList = new Array();







  var today = new Date();











  for (var i=0;i<arrBday.length;i++){







    var bday = new Date(arrBday[i][1] + '/' + today.getFullYear());







    if (isNaN(bday)) continue;











    if ( isBdayInRange(bday, 5) ){







       idx = bdayList.length;







       bdayList[idx] = new Object();







       bdayList[idx].name = arrBday[i][0];







       bdayList[idx].bday = bday;







       bdayList[idx].month = arrMonth[bday.getMonth()];      







    }







  }







  if (bdayList.length > 0){ //sort asc by birthdate







     bdayList.sort(







       function(a, b){







         if (a.bday < b.bday) return -1







         if (a.bday > b.bday) return 1;







         return 0;







       }







     );







  }







  return bdayList;







}











function isBdayInRange(bday, interval){







//credit for this function goes to:







//-Rob (@slingfive) Eberhardt, Slingshot Solutions







//http://slingfive.com/pages/code/jsDate/jsDate.html











  var today = new Date(); 







  //have to override time so entire day will be valid







  today.setHours(0,0,0,0);







  //if the birthday has already occurred in the year, increment to the next year







  if (bday < today)







    bday.setFullYear(bday.getFullYear() + 1);















  // get ms between dates (UTC) and make into "difference" date







  var iDiffMS = bday.valueOf() - today.valueOf();







  //divide iDiffMS by 1000, Seconds, Minutes, Hours







  nDays = parseInt(iDiffMS / 1000 / 60 / 60 / 24);



 











  if(parseInt(nDays) <= parseInt(interval))







    return true;







  else







    return false;







}











function displayBdayList(){







  var date = new Date().getDate();	







  var bdayList = getBdaysThisWeek();







  var len = bdayList.length;







  var s = "";







  if (len>0){







    s += '';







    for (var i=0; i<len; i++){







       //be mindful of the string-line continuation character (\) at the end of the first line







		s += '<tr><td class="menu" align="center"><font size="2" face="Arial, Helvetica, sans-serif">' + bdayList[i].name + ' - ' + bdayList[i].bday.getDate() + '/' + bdayList[i].month + '</font></td><tr>'      







    }







    s += '';







  }







  else{







    s += "";







  }







  document.write(s);







}