<script type="text/javascript" src="<?php echo base_url();?>resources/js/jquery.simplePagination.js"></script>
<div id="popup_pemkes_list"  class="centering" style="width:93%;margin-top: 1%;">
	<div style="border: 1px solid #ffffff;">
	<div class="detil" style="padding: 2px;background-color: white;">
	<div style="text-align:center;background-color:#fff;color:#5fb85c;border:2px solid #fff;margin:;font-size:20px;height:35px;"><span style="position: relative;top: 15%;transform: translateY(-15%);">REFERENSI PIHAK DIVERSI</span></div>
	<div style="margin:3px;clear:both;"></div>
	<hr class="thick-line" style="clear:both;">
	<div id="left">
		<?php
		$attributes = array('id' => 'form_search_pemkes');
		echo form_open(base_url().'pemkes_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_pemkes', '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="right" style="margin-top: 0px;margin-right: 6px;"><input type="button" id='addpemkes' value="Tambah" class="btn"> <input type="button" id='close_form_2nd' value="Kembali" class="btn btn-danger"></div>
	<div id="pages" >
    	<div id="selector" style="padding: 4px 5px 5px 0;"></div>
    </div>
	<div class="cssTable">
		<table id="tablePerkaraAll">
			<col  width="4%" />
			<col  width="4%" />
			<col  width="3%" />
			<col  width="23%" />
			<col  width="30%" />
			<col  width="13%" />
			<col  width="10%" />
			<col  width="13%" />
        	<tbody>
				<tr>
					<td></td>
					<td></td>
					<td>No</td>
					<td onclick="sorting(1)">Nama</td>
					<td onclick="sorting(2)">Alamat</td>
					<td onclick="sorting(7)">Tempat/Tanggal Lahir</td>
					<td onclick="sorting(5)">Jenis Kelamin</td>
					<td onclick="sorting(6)">Pekerjaan</td>
				</tr>
				<?php
				if($pemkes!=''){
					$i=$counter+1;
					if($pemkes->num_rows>0){
						foreach ($pemkes->result() as $row) {
							if($row->jenis_kelamin=='L'){
								$sex = 'Laki-Laki';
							}elseif ($row->jenis_kelamin=='P') {
								$sex = 'Perempuan';
							}else{
								$sex='';
							}
							$ttl = $row->tempat_lahir;
							if(!empty($row->tanggal_lahir)){
								$ttl .= ', ';
								$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>".$ttl."</td>";
							echo "<td>".$sex."</td>";
							echo "<td>".$row->pekerjaan."</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_pemkes" class="popup">
	<div style="margin: 0 auto;top: 50%;margin-top: 1%;margin-bottom: 25px;">
		<div style="border: 1px solid #ffffff;width: 30%;margin: 0 auto;">
		<div class="detil" style="padding: 2px;background-color: white;">
			<form id="frm_ref_pemkes" style="background:white;margin:0;" method="post" action="<?php echo base_url().'pemkes_list/validateInput';?>">
				<table id="tableDetilPerkara" style="font-size:14px;">
				<col width="40%">
				<col width="60%">
					<tbody>
						<tr>
							<td colspan="2" style='text-align:center;background:#fff;color:#5fb85c;border:2px solid #fff;margin-bottom:10px;font-size: 20px;'>TAMBAH REFERENSI DATA PIHAK DIVERSI</td>
						</tr>
						<tr>
							<td>Nama <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='pemkes_fullname' name='pemkes_fullname' value="" class="standard-input" maxlength="200">
							</td>
						</tr>
						<tr>
							<td>Tempat Lahir <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='pemkes_tempat_lahir' name='pemkes_tempat_lahir' value="" class="standard-input" maxlength="255">
							</td>
						</tr>
						<tr>
							<td>Tanggal Lahir <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input id="pemkes_tgl_lahir" name="pemkes_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='pemkes_umur' name='pemkes_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="pemkes_jenis_identitas" id="pemkes_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="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='pemkes_no_identitas' name='pemkes_no_identitas' value="" class="standard-input" maxlength="200">
							</td>
						</tr>
						<tr>
							<td>No Telepon</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='pemkes_no_tlp' name='pemkes_no_tlp' value="" class="standard-input" maxlength="200">
							</td>
						</tr>
						<tr>
							<td>Alamat Email</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='pemkes_email' name='pemkes_email' value="" class="standard-input" maxlength="200">
							</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="pemkes_jenis_kelamin" id="pemkes_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="pemkes_agama" id="pemkes_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>Warga Negara <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<span class="custom-dropdown custom-dropdown--emerald" style='width:150px;'>
									<select name="pemkes_warga_negara" id="pemkes_warga_negara" style='width:150px;' class="custom-dropdown__select custom-dropdown__select--white">
										<?php
										if($country!=''){
											if($country->num_rows()>0){
												foreach ($country->result() as $row) {
													$select = ($row->nama=='Indonesia')? 'selected':'';
													echo '<option value="'.$row->id.'" '.$select.'>'.$row->nama.'</option>';
												}
											}
										}
										?>
									</select>
								</span>
							</td>
						</tr>
						<tr>
							<td>Alamat <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<textarea id="pemkes_alamat" name="pemkes_alamat" class="standard-input" style="width: 245px; height: 70px;resize: none;"></textarea>
							</td>
						</tr>
						<tr class="tr_perorangan">
							<td>Pekerjaan<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">								
								<input type="text"  id='pemkes_pekerjaan' name='pemkes_pekerjaan' value="" class="standard-input" maxlength="255" placeholder="Isikan Pekerjaan Di Sini">
							</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="pemkes_status_kawin" id="pemkes_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='keyword_pemkes' name="keyword_pemkes" value="<?php echo $keyword;?>">
							<input type="hidden" id='pemkes_id_frm_ref_pemkes' name="pemkes_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="pemkes_pendidikan" id="pemkes_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_frm_ref_pemkes" 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="pemkes_gol_darah" id="pemkes_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>Nama Instansi </td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='nama_instansi' name='nama_instansi' value="" class="standard-input" maxlength="200">
							</td>
						</tr>
						<tr>
							<td>Alamat Instansi</td>
							<td style="padding:0px;padding-left:5px;">
								<textarea id="pemkes_alamat_instansi" name="pemkes_alamat_instansi" class="standard-input" style="width: 245px; height: 70px;resize: none;"></textarea>
							</td>
						</tr>
						<tr>
							<td>Keterangan</td>
							<td style="padding:0px;padding-left:5px;border:0px;">
								<textarea id="pemkes_keterangan" name="pemkes_keterangan" 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_pemkes' 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();
$('#close_form_2nd').<?php echo $popup==5?'closingForm5thWin':'closingForm2ndWin'; ?>();

$("#pemkes_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{
		$('#pemkes_umur').val(age);
		$(this).css("background-color", "#dedbdb");
	}
	error = 0;
});

$("#pemkes_umur").change(function() {
	var age = $('#pemkes_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;
		$("#pemkes_tgl_lahir").val(tglLahir)
		$(this).css("background-color", "#dedbdb");
	}
});

$("#addpemkes").click(function() {
	clearAll();
	// $('#popup_pemkes_list').fadeOut();
	$('#popup_pemkes').fadeIn();
	$('#edit_btn').hide();
	$('#act_frm_ref_pemkes').val('add');
    $("body").css({overflow: 'hidden'});
});

$("#back_pemkes").click(function() {
	$('#popup_pemkes_list').fadeIn();
	$('#popup_pemkes').fadeOut();
    $("body").css({overflow: 'hidden'});
    if($("#refresh").val()==1){
    	refreshpemkesList();
    }
});


$('#frm_ref_pemkes').SubmitHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#pihak_pilih',
	clicked:1,
	btnClicked:'#back_pemkes',
	whenStatus:1,
	next_step:1
});

function clearAll(){
	$('#popup_pemkes :input').not('.btn').not('#curr_date').val('');
	$('#popup_pemkes .hidden').hide();
	$('#pemkes_jenis_pemkes').val(1);
	$('#pemkes_warga_negara').val(98);
}

function pilih(val){
	if(val==""){
		message_show("Error <br/> Refresh Browser Anda");
		return;
	}
	openLoadingDialog()
	$.post('<?php echo base_url()?>pemkes_list/fetchpemkes', {
		val:val
	}, function(response){
		var json = jQuery.parseJSON(response);
		closeLoading();
		if(json.isLengkap==0){
			message_show("Data pemkes Tidak Lengkap, Data "+json.notFill+" Tidak Ada. Silahkan Lengkapi terlebih dahulu. Klik Edit.");
			return;
		}else if(json.st==1){
			$('#enc_pemkes').val(json.enc_pemkes);
			$('#enc_pihak').val(json.enc_pemkes);
			$('#fullname').val(json.nama);
			$('#tempat_lahir').val(json.tempatLahir);
			$('#tgl_lahir').val(json.tglLahir);
			$('#umur').val(json.umur);
			$('#jenis_kelamin').val(json.sex);
			$('#warga_negara').val(json.wargaNegara);
			$('#alamat').val(json.alamat);
			$('#pekerjaan').val(json.pekerjaan);
			$('#pendidikan').val(json.pendidikan);
			$('#keterangan').val(json.keterangan);
			$('#statusKawin').val(json.statusKawin);
			if(json.enc_pemkes=="" || json.nama=="" || json.tempatLahir=="" || json.tglLahir=="" || json.umur=="" || json.sex=="" || json.wargaNegara=="" || json.alamat=="" || json.pekerjaan=="" || json.pendidikan=="" || json.statusKawin==""){
				message_show("Data pemkes Tidak Lengkap, Data "+json.notFill+" Tidak Ada. Silahkan Lengkapi terlebih dahulu. Klik Edit.");
				return;
			}else{
				$('#close_form_2nd').click();
			}
		}else if(json.st==0){
			message_show(json.msg);
		}
	});
}

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

	openLoadingDialog()
	$.post('<?php echo base_url()?>pemkes_list/fetchpemkes', {
		val:val
	}, function(response){
		var json = jQuery.parseJSON(response);
		closeLoading()
		if(json.st==1){
			$('#pemkes_id_frm_ref_pemkes').val(json.enc_pemkes);
			$('#pemkes_jenis_pemkes').val(json.IDJenispemkes);
			$('#pemkes_fullname').val(json.nama);
			$('#pemkes_tempat_lahir').val(json.tempatLahir);
			$('#pemkes_tgl_lahir').val(json.tglLahir);
			$('#pemkes_umur').val(json.umur);
			$('#pemkes_jenis_kelamin').val(json.IDSex);
			$('#pemkes_warga_negara').val(json.IDWargaNegara);
			$('#pemkes_alamat').val(json.alamat);
			$('#pemkes_pekerjaan').val(json.pekerjaan);
			$('#pemkes_pendidikan').val(json.IDPendidikan);
			$('#pemkes_keterangan').val(json.keterangan);
			$('#pemkes_no_tlp').val(json.telepon);
			$('#pemkes_jenis_identitas').val(json.jenisIdentitas);
			$('#pemkes_no_identitas').val(json.noIdentitas);
			$('#pemkes_gol_darah').val(json.golDarah);
			$('#pemkes_agama').val(json.IDAgama);
			$('#pemkes_email').val(json.email);
			$('#pemkes_status_kawin').val(json.IDStatusKawin);

			
			$('#nama_instansi').val(json.nama_instansi);
			$('#pemkes_alamat_instansi').val(json.alamat_instansi);

			
			$('#popup_pemkes').fadeIn();
			$('#edit_btn').show();
			$('#act_frm_ref_pemkes').val('updt');
			$("body").css({overflow: 'hidden'});
		}else if(json.st==0){
			message_show(json.msg);
		}
	});
	
}
$('#form_search_pemkes').submit(function(event){
	openLoadingDialog()
    $.post($(this).attr('action'),$(this).serialize(), function(json){
    	closeLoading()
    	if(json.st==1){
    		refreshpemkesList()
    	}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()?>pemkes_list/setPage', {
        		pageNumber:pageNumber,
        		keyword:$('#keyword_pemkes').val()
			}, function(response){
				var json = jQuery.parseJSON(response);
				closeLoading()
				if(json.st==1){
					refreshpemkesList()
				}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()?>pemkes_list/setPage', {
        		pageNumber:pageNumber,
        		keyword:$('#keyword_pemkes').val()
			}, function(response){
				var json = jQuery.parseJSON(response);
				closeLoading()
				if(json.st==1){
					refreshpemkesList()
				}else{
					message_show("Error, Tutup Browser anda kemudian login kembali");
				}
			});
            
        	}
        });
    $('#pemkes_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;
        	}
      	});
    
	$('#tgl_sk_menteri').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            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_pn').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            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_pt').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            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>
