<script type="text/javascript" src="<?php echo base_url();?>resources/js/jquery.simplePagination.js"></script>
<div id="popup_kurator_list" class="centering" style="width:100%;margin-top: 1%;background:white;">
	<div style="margin:3px;clear:both;"></div>
	<hr class="thick-line" style="clear:both;">
	<div id="left">
		<?php
		$attributes = array('id' => 'form_search_pihak');
		echo form_open(base_url().'kurator_list/searchPage',$attributes);
		?>
		<span class="custom-dropdown custom-dropdown--emerald" style='width:180px;'>
			<select name="search_field" id="search_field" style='width:180px;' class="custom-dropdown__select custom-dropdown__select--white">
					<option value="0">Semua Kolom</option>
					<option value="1">Nama</option>
					<option value="2">Alamat</option>
					<option value="3">Tempat Lahir</option>
					<option value="4">Tanggal Lahir</option>
					<option value="5">Pekerjaan</option>
			</select>
		</span>
		<?php
		$attributes = array('name' => 'keyword_pihak', 'id' => 'search-box', 'type' => 'text','size' => '50','placeholder'=>"  Ketik kata kunci  ");
		echo form_input($attributes);
		$data = array(
			'enc' => "enc"
		);
		echo form_hidden($data);
		echo "<span>  </span>";
		$attributes = array('value' => 'Search', 'class' => 'btn', 'id' => 'search-btn1', 'type' => 'submit');
		echo form_submit($attributes);
		echo form_close('');
		?>
	</div>
	<div id="left" style="margin-left:50px;">
	<?php 
	if($this->session->userdata('is_logged_in')){
		if($this->authorization->HasRuleAddPendaftaran('3')){ ?>
			<input type="button" id='addPihak' value="Tambah" class="btn"></div>
		<?php }
	} ?>
	<div id="pages" >
    	<div id="selector" style="padding: 4px 5px 5px 0;"></div>
    </div>
	<div class="cssTable">
		<table id="tablePerkaraAll">
			<col  width="5%" />
			<col  width="20%" />
			<col  width="23%" />
			<col  width="13%" />
			<col  width="10%" />
			<col  width="10%" />
			<col  width="13%" />
			<col  width="6%" />
        	<tbody>
				<tr>
					<td>No</td>
					<td onclick="sorting(1)">Nama</td>
					<td onclick="sorting(2)">Alamat</td>
					<td onclick="sorting(3)">Tanggal Ijin Menteri Kehakiman</td>
					<td onclick="sorting(4)">Nomor Ijin Menteri Kehakiman</td>
					<td onclick="sorting(5)">Tanggal Penyumpahan</td>
					<td onclick="sorting(6)">Tanggal Pendaftaran Di Pengadilan Negeri/Niaga</td>
					<td></td>
				</tr>
				<?php
				if($pihak!=''){
					$i=$counter+1;
					if($pihak->num_rows>0){
						foreach ($pihak->result() as $row) {

								#$ttl .= $this->tanggalhelper->convertDate($row->tanggal_lahir);						
							echo "<tr>";
							#echo "<td style='text-align:center;'><a href='#' onClick='pilih(\"".base64_encode($this->encrypt->encode($row->id))."\")'>[Pilih]</a></td>";
							#echo "<td style='text-align:center;'><a href='#' onClick='edit(\"".base64_encode($this->encrypt->encode($row->id))."\")'>[Edit]</a></td>";
								echo "<td>".$i."</td>";
								echo "<td style='text-overflow: ellipsis;white-space: nowrap;overflow: hidden;'>".$row->nama."</td>";
								echo "<td>".$row->alamat."</td>";
								echo "<td>".$this->tanggalhelper->convertDate($row->tanggal_ijin)."</td>";
								echo "<td>".$row->nomor_ijin."</td>";
								echo "<td>".$this->tanggalhelper->convertDate($row->tanggal_penyumpahan)."</td>";
								echo "<td>".$this->tanggalhelper->convertDate($row->tanggal_pendaftaran_pn)."</td>";
								echo "<td style='text-align:center;'><a href='#' onClick='edit(\"".base64_encode($this->encrypt->encode($row->id))."\")'>[Edit]</a></td>";
							echo "</tr>";
							$i++;
						}
					}
				}
				?>
			</tbody>
		</table>
	</div>
	<div id="pages_bottom" style="width:100%;padding-left:5px;padding-top:5px;">
    	<div id="selector_bottom"></div>
	</div>
	<div style="margin:bottom:5px;"></div>
</div>
<div id="popup_pihak" class="popup">
	<div style="margin: 0 auto;top: 50%;margin-top: 1%;margin-bottom: 25px;">
		<div class="detil" style="background-color:white;border-color: white;font-size:14px;margin-top:25px;width: 40%;margin: 0 auto;">
			<div id="sub_title" style="padding:10px;color:#5FB85C;text-align:center;">TAMBAH REFERENSI DATA KURATOR</div>
			<form id="frm_ref_pihak" style="background:white;margin:0;" method="post" action="<?php echo base_url().'kurator_list/validateInput';?>">
				<table id="tableDetilPerkara" style="font-size:14px;width:100%;">
				<col width="40%">
				<col width="60%">
					<tbody>
						<tr>
							<td>Nama <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='kurator_fullname' name='kurator_fullname' value="" class="standard-input" maxlength="500">
							</td>
						</tr>
						<tr>
							<td>Tempat Lahir <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='kurator_tempat_lahir' name='kurator_tempat_lahir' value="" class="standard-input" maxlength="50">
							</td>
						</tr>
						<tr>
							<td>Tanggal Lahir <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input id="kurator_tgl_lahir" name="kurator_tgl_lahir" value="<?php echo date('d/m/Y');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr>
							<td>Umur</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='kurator_umur' name='kurator_umur' value="" class="standard-input" maxlength="2" style="width:50px;">
							</td>
						</tr>
						<tr>
							<td>Jenis Identitas</td>
							<td style="padding:0px;padding-left:5px;">
								<span class="custom-dropdown custom-dropdown--emerald" style='width:150px;'>
									<select name="kurator_jenis_identitas" id="kurator_jenis_identitas" style='width:150px;' class="custom-dropdown__select custom-dropdown__select--white">
										<option value="">Pilih Identitas</option>
										<option value="1">Kartu BPJS</option>
										<option value="2">Kartu Keluarga</option>
										<option value="3">Kartu Pelajar</option>
										<option value="4">KTP</option>
										<option value="5">Paspor</option>
										<option value="6">SIM</option>
									</select>
								</span>
							</td>
						</tr>
						<tr>
							<td>No Identitas</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='kurator_no_identitas' name='kurator_no_identitas' value="" class="standard-input" maxlength="50">
							</td>
						</tr>
						<tr>
							<td>No Telepon</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='kurator_no_tlp' name='kurator_no_tlp' value="" class="standard-input" maxlength="50">
							</td>
						</tr>
						<tr>
							<td>Alamat Email</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='kurator_email' name='kurator_email' value="" class="standard-input" maxlength="50">
							</td>
						</tr>
						<tr>
							<td>Jenis Kelamin <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<span class="custom-dropdown custom-dropdown--emerald" style='width:150px;'>
									<select name="kurator_jenis_kelamin" id="kurator_jenis_kelamin" style='width:150px;' class="custom-dropdown__select custom-dropdown__select--white">
										<option value="">Pilih Jenis Kelamin</option>
										<option value="1">Laki Laki</option>
										<option value="2">Perempuan</option>
									</select>
								</span>
							</td>
						</tr>
						<tr>
							<td>Agama <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<span class="custom-dropdown custom-dropdown--emerald" style='width:150px;'>
									<select name="kurator_agama" id="kurator_agama" style='width:150px;' class="custom-dropdown__select custom-dropdown__select--white">
										<option value="">Pilih Agama</option>
										<?php
										if($agama!=''){
											if($agama->num_rows()>0){
												foreach ($agama->result() as $row) {
													echo '<option value="'.$row->id.'">'.$row->nama.'</option>';
												}
											}
										}
										?>
									</select>
								</span>
							</td>
						</tr>
						<tr>
							<td>Alamat <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<textarea id="kurator_alamat" name="kurator_alamat" class="standard-input" style="width: 245px; height: 70px;resize: none;"></textarea>
							</td>
						</tr>
						<tr>
							<td>Alamat Kantor<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<textarea id="kurator_alamat_kantor" name="kurator_alamat_kantor" class="standard-input" style="width: 245px; height: 70px;resize: none;"></textarea>
							</td>
						</tr>
						<tr>
							<td>No Telepon Kantor</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='kurator_no_tlp_office' name='kurator_no_tlp_office' value="" class="standard-input" maxlength="50">
							</td>
						</tr>
						<tr>
							<td>No Fax</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='kurator_no_fax' name='kurator_no_fax' value="" class="standard-input" maxlength="50">
								<input type="hidden" id='keyword_pihak' name="keyword_pihak" value="<?php echo $keyword;?>">
							</td>
						</tr>
						<tr>
							<td>Status Kawin <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<span class="custom-dropdown custom-dropdown--emerald" style='width:150px;'>
									<select name="kurator_status_kawin" id="kurator_status_kawin" style='width:150px;' class="custom-dropdown__select custom-dropdown__select--white">
										<option value="">Pilih Status Kawin</option>
										<option value="1">Kawin</option>
										<option value="2">Belum Kawin</option>
										<option value="3">Duda</option>
										<option value="4">Janda</option>
									</select>
								</span>
							</td>
							<input type="hidden" id='kurator_id_frm_ref_pihak' name="kurator_id" value="">
						</tr>
						<tr>
							<td>Pendidikan <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<span class="custom-dropdown custom-dropdown--emerald" style='width:150px;'>
									<select name="kurator_pendidikan" id="kurator_pendidikan" style='width:150px;' class="custom-dropdown__select custom-dropdown__select--white">
										<option value="">Pilih Pendidikan</option>
										<?php
										if($pendidikan!=''){
											if($pendidikan->num_rows()>0){
												foreach ($pendidikan->result() as $row) {
													echo '<option value="'.$row->id.'">'.$row->nama.'</option>';
												}
											}
										}
										?>
									</select>
								</span>
							</td>
							<input type="hidden" id="act" name="act" value="">
						</tr>
						<tr>
							<td>Golongan Darah</td>
							<td style="padding:0px;padding-left:5px;">
								<span class="custom-dropdown custom-dropdown--emerald" style='width:170px;'>
									<select name="kurator_gol_darah" id="kurator_gol_darah" style='width:170px;' class="custom-dropdown__select custom-dropdown__select--white">
										<option value="">Pilih Golongan Darah</option>
										<option value="A">A</option>
										<option value="AB">AB</option>
										<option value="B">B</option>
										<option value="O">O</option>
									</select>
								</span>
							</td>
							<input type="hidden" id="curr_date" value="<?php echo $current_date;?>">
						</tr>
						<tr>
							<td>Nomor Ijin Menteri Kehakiman</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='kurator_no_induk' name='kurator_no_induk' value="" class="standard-input" maxlength="50">
							</td>
						</tr>
						<tr>
							<td>Tanggal ijin</td>
							<td style="padding:0px;padding-left:5px;">
								<input id="tgl_izin" name="tgl_izin" value="" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr>
							<td>Mulai Berlaku ijin</td>
							<td style="padding:0px;padding-left:5px;">
								<input id="mulai_izin" name="mulai_izin" value="" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr>
							<td>Berakhir Ijin</td>
							<td style="padding:0px;padding-left:5px;">
								<input id="end_izin" name="end_izin" value="" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr>
							<td>Tanggal Penyumpahan</td>
							<td style="padding:0px;padding-left:5px;">
								<input id="tgl_sumpah" name="tgl_sumpah" value="" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr>
							<td>Tanggal Pendaftaran Di Pengadilan Negeri/Niaga</td>
							<td style="padding:0px;padding-left:5px;">
								<input id="tgl_pendaftaran_pn" name="tgl_pendaftaran_pn" value="" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr>
							<td>Keterangan</td>
							<td style="padding:0px;padding-left:5px;border:0px;">
								<textarea id="kurator_keterangan" name="kurator_keterangan" maxlength="255" class="standard-input" style="width: 245px; height: 70px;resize: none;"></textarea>
							</td>
						</tr>
						<tr>
							<td colspan="2" style="background:white;" align="center">
								<input type="button" id='back_pihak' value="Kembali" class="btn">
								<input type="submit" id="simpan_btn" value="Simpan" class="btn">
							</td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript">
	$('#close_form_2nd').closingForm2ndWin();



$("#kurator_tgl_lahir").change(function() {
	var error = 0;
	var tmp = $(this).val().split("/");
	var tmp2 = $('#curr_date').val().split("/");
	dob = new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00");
	var today = new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00");
	var age = Math.floor((today-dob) / (365.25 * 24 * 60 * 60 * 1000));
	if(age<5 || age >100){
		message = 'Tanggal Lahir Tidak Valid. Silahkan Periksa Kembali';
		error = 1
	}
	if(error==1){
		message_show(message);
		$(this).css("background-color", "red");
	}else{
		$('#kurator_umur').val(age);
		$(this).css("background-color", "#dedbdb");
	}
	error = 0;
});

$("#kurator_umur").change(function() {
	var age = $('#kurator_umur').val();
	var error = 0;
	var tmp2 = $('#curr_date').val().split("/");
	var year = tmp2[2]-age;
	if(age<5 || age >100){
		message_show('Tanggal Lahir Tidak Valid. Silahkan Periksa Kembali');
		$(this).css("background-color", "red");
	}else{
		var tglLahir = tmp2[0]+'/'+tmp2[1]+'/'+year;
		$("#kurator_tgl_lahir").val(tglLahir)
		$(this).css("background-color", "#dedbdb");
	}
});

$("#back_pihak").click(function() {
	$('#popup_kurator_list').fadeIn();
	$('#popup_pihak').fadeOut();
    $("body").css({overflow: 'hidden'});
    if($("#refresh").val()==1){
    	//refreshPihakList();
    }
    $("#refresh").remove();
});


$('#frm_ref_pihak').SubmitHandling({
	refresh:'1',
	clicked:1,
	btnClicked:'#back_pihak',
	whenStatus:1
});

function clearAll(){
	$('#popup_pihak :input').not('.btn').not('#curr_date').val('');
	$('#popup_pihak .hidden').hide();
	$('#kurator_jenis_pihak').val(1);
	$('#kurator_warga_negara').val(98);
}


function edit(val){
	if(val==""){
		message_show("Error <br/> Refresh Browser Anda");
		return;
	}

	openLoadingDialog()
	$.post('<?php echo base_url()?>kurator_list/fetchPihak', {
		val:val
	}, function(response){
		var json = jQuery.parseJSON(response);
		closeLoading()
		if(json.st==1){
			$('#kurator_id_frm_ref_pihak').val(json.enc_pihak);
			$('#kurator_jenis_pihak').val(json.IDJenisPihak);
			$('#kurator_fullname').val(json.nama);
			$('#kurator_tempat_lahir').val(json.tempatLahir);
			$('#kurator_tgl_lahir').val(json.tglLahir);
			$('#kurator_umur').val(json.umur);
			$('#kurator_jenis_kelamin').val(json.IDSex);
			$('#kurator_warga_negara').val(json.IDWargaNegara);
			$('#kurator_alamat').val(json.alamat);
			$('#kurator_pekerjaan').val(json.pekerjaan);
			$('#kurator_pendidikan').val(json.IDPendidikan);
			$('#kurator_keterangan').val(json.keterangan);
			$('#kurator_no_tlp').val(json.noTlp);
			$('#kurator_jenis_identitas').val(json.jenisIdentitas);
			$('#kurator_no_identitas').val(json.noIdentitas);
			$('#kurator_gol_darah').val(json.golDarah);
			$('#kurator_agama').val(json.IDAgama);
			$('#kurator_email').val(json.email);
			$('#kurator_status_kawin').val(json.IDStatusKawin);

			$('#tgl_izin').val(json.tglIzin);
			$('#kurator_no_induk').val(json.noIzin);
			$('#tgl_sumpah').val(json.tglSumpah);
			$('#tgl_pendaftaran_pn').val(json.tglPendaftaran);
			$('#kurator_alamat_kantor').val(json.alamatKantor);
			$('#kurator_no_tlp_office').val(json.noTlpKantor);
			$('#kurator_no_fax').val(json.faxKantor);
			$('#mulai_izin').val(json.mulaiIzin);
			$('#end_izin').val(json.endIzin);

			$('#popup_kurator_list').fadeOut();
			$('#popup_pihak').fadeIn();
			$('#edit_btn').show();
			$('#act').val('updt');
			$("body").css({overflow: 'hidden'});
		}else if(json.st==0){
			message_show(json.msg);
		}
	});
	
}
$("#addPihak").click(function() {
	clearAll();
	$('#popup_kurator_list').fadeOut();
	$('#popup_pihak').fadeIn();
	$('#edit_btn').hide();
	$('#act').val('add');
    $("body").css({overflow: 'hidden'});
});

$('#form_search_pihak').submit(function(event){
	openLoadingDialog()
    $.post($(this).attr('action'),$(this).serialize(), function(json){
    	closeLoading()
    	if(json.st==1){
    		window.open('<?php echo base_url()?>kurator_list','_self');
    	}else{
    		message_show("Error, Tutup Browser anda kemudian login kembali");
    	}
    	event.preventDefault()
	},'json');
	event.preventDefault()
});
</script>
<script language="javascript">
$(function() {
    var totalPage = '<?php echo $total_rows; ?>';
    var page = '<?php echo $page_number;?>';
    $('#selector').pagination({
        items: totalPage,
        itemsOnPage: 50,
        displayedPages: 3,
        cssStyle: 'light-theme',
        currentPage:page,
        onPageClick: function(pageNumber){
        	openLoadingDialog()
        	$.post('<?php echo base_url()?>kurator_list/setPage', {
        		pageNumber:pageNumber,
        		keyword:$('#keyword_pihak').val()
			}, function(response){
				var json = jQuery.parseJSON(response);
				closeLoading()
				if(json.st==1){
					refreshPihakList()
				}else{
					message_show("Error, Tutup Browser anda kemudian login kembali");
				}
			});
            
        	}
        });
    $('#selector_bottom').pagination({
        items: totalPage,
        itemsOnPage: 50,
        displayedPages: 3,
        cssStyle: 'light-theme',
        currentPage:page,
        onPageClick: function(pageNumber){
            openLoadingDialog()
        	$.post('<?php echo base_url()?>kurator_list/setPage', {
        		pageNumber:pageNumber,
        		keyword:$('#keyword_pihak').val()
			}, function(response){
				var json = jQuery.parseJSON(response);
				closeLoading()
				if(json.st==1){
					refreshPihakList()
				}else{
					message_show("Error, Tutup Browser anda kemudian login kembali");
				}
			});
            
        	}
        });
    $('#kurator_tgl_lahir').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            onSelect: function(dateText, inst) {
            	var error = 0;
				
				var tmp = $(this).val().split("/");
				var tmp2 = $('#curr_date').val().split("/");
				if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
					message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
					error = 1
				}

				dob = new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00");
				var today = new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00");
				var age = Math.floor((today-dob) / (365.25 * 24 * 60 * 60 * 1000));
				if(age<5 || age >100){
					message = 'Tanggal Lahir Tidak Valid. Silahkan Periksa Kembali';
					error = 1
				}
				if(error==1){
					message_show(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
				error = 0;
        	}
      	});

    });
	
	$('#mulai_izin').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            beforeShowDay: $.datepicker.noWeekends,
            onSelect: function(dateText, inst) {
            	var error = 0;
				
				var tmp = $(this).val().split("/");
				var tmp2 = $('#curr_date').val().split("/");
				if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
					message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
					message_show(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
        	}
      });
	$('#end_izin').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            beforeShowDay: $.datepicker.noWeekends,
      });
	$('#tgl_pendaftaran_pn').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            beforeShowDay: $.datepicker.noWeekends,
            onSelect: function(dateText, inst) {
            	var tmp = $(this).val().split("/");
				var tmp2 = $('#curr_date').val().split("/");
				if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
					message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
					message_show(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
        	}
        });
	$('#tgl_izin').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            beforeShowDay: $.datepicker.noWeekends,
            onSelect: function(dateText, inst) {
            	var tmp = $(this).val().split("/");
				var tmp2 = $('#curr_date').val().split("/");
				if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
					message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
					message_show(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
        	}
        });
	$('#tgl_sumpah').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            beforeShowDay: $.datepicker.noWeekends,
            onSelect: function(dateText, inst) {
            	var tmp = $(this).val().split("/");
				var tmp2 = $('#curr_date').val().split("/");
				if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
					message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
					message_show(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
        	}
        });

$('.datepicker').ValidateDateInput();

</script>
