/*
* Cepat Sembuh v1.0
* Copyright 2016 Cepat Sembuh
*/

// Firebase go online whenever the application is open
document.addEventListener("deviceready", function () {
    Firebase.goOnline();
});

// Not available faskes
$('#not-available').on('click', function() {
	alert("Faskes is not available")
})

// Get no antrian function
function getNoAntri(tipe, username, name) {
  // Define firebase URL
  var faskesRef = new Firebase("https://cepatsembuh.firebaseio.com/" + tipe + "/faskes/" + username);

  // Log firebase URL
  console.log('Url :' + "https://cepatsembuh.firebaseio.com/" + tipe + "/faskes/" + username);

  // Warn user that this fiture need internet
	alert('Fitur ini membutuhkan internet untuk mengambil data');

  // Confirmation
  alert("Mohon konfirmasi ulang");
  var nama = prompt("Masukan nama"),
      nik = prompt("Masukan NIK:");

  if (nama != "" || nik.length != 16) {
      // Firebase
      var pasien = new Firebase("https://cepatsembuh.firebaseio.com/" + tipe + "/faskes/" + username + '/pasien/');

      // Get data
      faskesRef.on("value", function(snapshot) {
        // Print data
        alert('No antrian: ' + snapshot.val().antrian);

        // Push data to firebase
        pasien.push().set({
          nama: nama,
          nomor_antrian: snapshot.val().antrian
        })
      });
  } else {
    // Error message
    swal("Input anda tidak valid. ", "Anda tidak bisa mendapatkan nomor antrian", "error");
  }
}

function tempatTidur(tipe, username) {
  // Firebase
  brea = new Firebase("https://cepatsembuh.firebaseio.com/" + tipe + '/faskes/' + username + '/tempat_tidur');

  // Log
  wait = 'Getting data..';
  console.log(wait);
  alert(wait);

  // Get data
  brea.on("value", function(snapshot) {
    var satu = snapshot.val().satu,
        dua = snapshot.val().dua,
        tiga = snapshot.val().tiga,
        text = "<h2 style=\"font-weight: 300\">" + satu + "<br>" + dua + "<br>" + tiga + "</h2>";

    swal({
      title: "Jumlah Tempat Tidur",
      text: text,
      type: "success",
      html: true
    })
  })
}

function doctorProfile(nama, gambar, lulusan, tahun) {
  // Text
  giant = "Lulusan: " + lulusan + "<br>" + "Tahun: " + tahun;
  name = "dr. " + nama;
  image = "../../img/" + gambar;

  // Pop-up
  swal({
    title: name,
    imageUrl: image,
    text: giant,
    html: true
  })
}

@@ -1751,20 +1751,16 @@
 ) %7B%0A    
-var 
 satu = s
@@ -1777,26 +1777,22 @@
 l().satu
-,%0A  
+;%0A
     
-  
 dua = sn
@@ -1807,26 +1807,22 @@
 al().dua
-,%0A   
+;%0A
     
- 
 tiga = s
@@ -1843,73 +1843,52 @@
 tiga
-,%0A        text = %22%3Ch2 style=%5C%22font-weight: 300%5C%22%3E%22 + satu + %22%3Cbr%3E
+;%0A%0A    alert(%22Satu: %22 + satu + %22%5Cn%22 + %22Dua: 
 %22 + 
@@ -1898,44 +1898,47 @@
  + %22
-%3Cbr%3E
+%5Cn
 %22 + 
-tiga + %22%3C/h2%3E%22
+%22Tiga: %22 + tiga)
 ;%0A%0A   
+ /*
  swal(%7B%0A
     
@@ -1929,24 +1929,26 @@
   /* swal(%7B%0A
+  
       title:
@@ -1973,24 +1973,26 @@
 dur%22,%0A      
+  
 text: text,%0A
@@ -1991,16 +1991,18 @@
 : text,%0A
+  
       ty
@@ -2018,24 +2018,26 @@
 ess%22,%0A      
+  
 html: true%0A 
@@ -2039,18 +2039,23 @@
 rue%0A    
-%7D)
+  %7D) */
 %0A  %7D)%0A%7D%0A

Stop declaring variables, replace swal with alert