//--------------------------------
//  Hari dan Tanggal
//--------------------------------

function MakeArray(n) {
  this.length = n
  return this
}

monthNames = new MakeArray(12)
monthNames[1] = "Januari"
monthNames[2] = "Februari"
monthNames[3] = "Maret"
monthNames[4] = "April"
monthNames[5] = "Mei"
monthNames[6] = "Juni"
monthNames[7] = "Juli"
monthNames[8] = "Agustus"
monthNames[9] = "September"
monthNames[10] = "Oktober"
monthNames[11] = "November"
monthNames[12] = "Desember"
dayNames = new MakeArray(7)
dayNames[1] = "Minggu"
dayNames[2] = "Senin"
dayNames[3] = "Selasa"
dayNames[4] = "Rabu"
dayNames[5] = "Kamis"
dayNames[6] = "Jumat"
dayNames[7] = "Sabtu"

function customDateString() {
  currentDate = new Date()
  var theDay = dayNames[currentDate.getDay() + 1]
  var theMonth = monthNames[currentDate.getMonth() + 1]
  msie4 = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 ));
  if (msie4) {
    var theYear = currentDate.getYear()
  }
  else {
    var theYear = currentDate.getYear() +1900
  }
  return theDay + ", &nbsp;" + currentDate.getDate() + " &nbsp;" + theMonth + " &nbsp;" + theYear
}

//--------------------------------
//  Reservation
//--------------------------------

var today = new Date();
var year  = today.getYear();
if (year < 2000)   
year = year + 1900;
var month = today.getMonth() + 1;
var date  = today.getDate();
var day = today.getDay();

function FormCheck(thisform) {
// check nama
  if (thisform.email1.value.indexOf("@")<1) {
	alert("I'm sorry. This email address seems wrong. Please"
	+" check the prefix and '@' sign.");
	thisform.email1.focus()
	return false
  }
  if (thisform.email2.value.indexOf("@")<1) {
	alert("I'm sorry. This email address seems wrong. Please"
	+" check the prefix and '@' sign.");
	thisform.email2.focus()
	return false
  }
  if (thisform.email1.value != thisform.email2.value) {
	alert("Please check again your email.")
	thisform.email1.focus()
	return false
  }
if (thisform.airport[0].checked) {
	
  if (thisform.inflightno.value == "") {
	alert("Please fill your flight / train details in")
	thisform.inflightno.focus()
	return false
  }
  if (thisform.intime.value == "") {
	alert("Please fill your flight / train time")
	thisform.intime.focus()
	return false
  }
  if (thisform.outflightno.value == "") {
	alert("Please fill your flight / train details out")
	thisform.outflightno.focus()
	return false
  }
  if (thisform.outtime.value == "") {
	alert("Please fill your flight / train time")
	thisform.outtime.focus()
	return false
  }
}
  if (thisform.qty.value == "") {
	alert("Please fill qty rooms")
	thisform.qty.focus()
	return false
  }
  if (thisform.name.value == "") {
	alert("Please fill your name")
	thisform.name.focus()
	return false
  }
  if (thisform.phone.value == "") {
	alert("Please fill your phone")
	thisform.phone.focus()
	return false
  }

// untuk ngecek tgl cek in sebelum cek out
  thn=parseInt(thisform.inyear.value)
  bln=parseInt(thisform.inmonth.value)-1	
  tgl=parseInt(thisform.indate.value)
  thnout=parseInt(thisform.outyear.value)
  blnout=parseInt(thisform.outmonth.value)-1	
  tglout=parseInt(thisform.outdate.value)
  
  var cekin=new Date(thn,bln,tgl)
  var cekout=new Date(thnout,blnout,tglout)
  if(cekin >= cekout) {
  	alert("Please check in and check out date")
  	thisform.indate.focus()
	return false
  }
}
