var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
const monthday = ["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"];
const f = new Date();
let month1 = monthday[f.getMonth()]
var yyyy = today.getFullYear();
const waktu = document.getElementById('waktu');
const d = new Date();
const weekday = ["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"];
let day1 = weekday[d.getDay()];

today = day1 + ', ' + dd + ' ' + month1 + ' ' + yyyy;
waktu.innerHTML = today;


let shio = ['Harimau', 'Kerbau', 'Tikus', 'Babi', 'Anjing', 'Ayam', 'Monyet', 'Kambing', 'Kuda', 'Ular', 'Naga', 'Kelinci'];
  for(let i =0;i<50;i++){
  let skrip1 = [167,36,18,654,829,674,419,753,574,753,305,741,884,872,997,664,414,848,260,140,495,807,225,652];
  let skrip2 = [85,228,549,172,61,876,62,836,679,338,13,54,846,938,986,335,162,317,786,43,189,746,145,965];
  let skrip3 = [178,981,276,520,257,539,103,138,944,195,833,437,876,189,946,654,473,88,725,684,675,242,427,629];
  let skrip4 = [28,763,644,453,736,886,467,481,92,267,805,856,836,652,978,629,695,867,245,887,434,868,280,594];
  const d = new Date();
  let hour = d.getHours();
  let num1 = ((skrip1[i]+hour)%7);
  let num2 = ((skrip2[i]+hour)%7);
  let num3 = ((skrip3[i]+hour)%7);
  let num4 = ((skrip4[i]+hour)%7);
  let z = document.querySelector('#info'+i); 
  let angkaMain = document.querySelector('#angkaMain'+i);
  let tebakShio = document.querySelector('#tebakShio'+i);
  let ekor = document.querySelector('#ekor'+i);
  let macau = document.querySelector('#macau'+i);
  let colokBebas = document.querySelector('#colokBebas'+i);
  let angka2D = document.querySelector('#angka2D'+i);
  let bolakBalik = document.querySelector('#bolakBalik'+i);
  let angka = `${num1}${num2}${num3}${num4}`;
  let angkaDepan = `${num1}${num2}`;
  let angkaBelakang = `${num3}${num4}`;
  z.innerHTML = angka;
  angkaMain.innerHTML = angka;
  let hasilShio = `${num3}`+`${num4}`;
  let hitungShio = (hasilShio%12)-1;
  let outputShio = shio[hitungShio];
  tebakShio.innerHTML = outputShio;
  ekor.innerHTML = hasilShio;
  macau.innerHTML = `${angkaDepan}, ${angkaBelakang}`;
 let chars = [num1, num2, num3, num4];
 let uniqueChars = [...new Set(chars)];
 colokBebas.innerHTML = '';
 for(let y=0;y<uniqueChars.length;y++){
    colokBebas.innerHTML += `${uniqueChars[y]}, `;
  }
 let angka1 = `${num1}${num2}`;
 let angka2 = `${num1}${num3}`;
 let angka3 = `${num1}${num4}`;
 let angka4 = `${num2}${num3}`;
 let angka5 = `${num2}${num4}`;
 let angka6 = `${num3}${num4}`;
 let angka7 = `${num4}${num3}`;
 let angka8 = `${num4}${num2}`;
 let angka9 = `${num4}${num1}`;
 let angka10 = `${num3}${num2}`;
 let angka11 = `${num3}${num1}`;
 let angka12 = `${num2}${num1}`;
 let chars1 = [angka1, angka2, angka3, angka4, angka5];
 let uniqueChars1 = [...new Set(chars1)];
 angka2D.innerHTML = ``;
 for(let y=0;y<uniqueChars1.length;y++){
    angka2D.innerHTML += `${uniqueChars1[y]}, `;
  }
  
  bolakBalik.innerHTML = `${num4}${num3}${num2}${num1}, ${num2}${num1}${num4}${num3}, ${num3}${num1}${num4}${num2}`; 
};

let sin1 = document.getElementById('angkaMain50');
let sin2 = document.getElementById('info50');
let sin3 = document.getElementById('tebakShio50');
let sin4 = document.getElementById('ekor50');
let sin5 = document.getElementById('macau50');
let sin6 = document.getElementById('colokBebas50');
let sin7 = document.getElementById('angka2D50');
let sin8 = document.getElementById('bolakBalik50');
let sin9 = document.getElementById('link50');

let pcso1 = document.getElementById('angkaMain50');
let pcso2 = document.getElementById('info50');
let pcso3 = document.getElementById('tebakShio50');
let pcso4 = document.getElementById('ekor50');
let pcso5 = document.getElementById('macau50');
let pcso6 = document.getElementById('colokBebas50');
let pcso7 = document.getElementById('angka2D50');
let pcso8 = document.getElementById('bolakBalik50');
let pcso9 = document.getElementById('link50');


if (day1 == "Selasa" || day1 == "Jumat" ){
     sin1.innerHTML = 'Close';
     sin2.innerHTML = 'Close';
     sin3.innerHTML = 'Close';
     sin4.innerHTML = 'Close';
     sin5.innerHTML = 'Close';
     sin6.innerHTML = 'Close';
     sin7.innerHTML = 'Close';
     sin8.innerHTML = 'Close';
     sin9.innerHTML = 'Close';
}

if (day1 == "Minggu"){
  pcso1.innerHTML = 'Close';
  pcso2.innerHTML = 'Close';
  pcso3.innerHTML = 'Close';
  pcso4.innerHTML = 'Close';
  pcso5.innerHTML = 'Close';
  pcso6.innerHTML = 'Close';
  pcso7.innerHTML = 'Close';
  pcso8.innerHTML = 'Close';
  pcso9.innerHTML = 'Close';
}