<style type="text/css">
	.notif_delegasi{
		display: block;
		background-color:red;
	    border:1px solid red;
	    color:white;
	    font:12px/13px Verdana;
	    min-height:16px;
	    max-height: 20px;
	    min-width:12px;
	    max-height: 16px;
	    padding:2px 3px 0 3px;
	    text-align:center;
	    position:absolute;
	    border-radius:19%;
	    z-index:999;
	    right: 10px;
	    top:-10px;
	     animation: mendal 1s infinite;
		 -webkit-animation: mendal 1s infinite;
		 -moz-animation: mendal 1s infinite;
		 -o-animation: mendal 1s infinite;
	}
	.hidden{
		display: none;
	}

	@-webkit-keyframes mendal {
	 0%, 20%, 50%, 80%, 100% {-webkit-transform: translateY(0);} 
	 40% {-webkit-transform: translateY(-18px);}
	 60% {-webkit-transform: translateY(-15px);}
	}
	 
	@-moz-keyframes mendal {
	 0%, 20%, 50%, 80%, 100% {-moz-transform: translateY(0);}
	 40% {-moz-transform: translateY(-18px);}
	 60% {-moz-transform: translateY(-15px);}
	}
	 

	@keyframes mendal {
	 0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
	 40% {transform: translateY(-18px);}
	 60% {transform: translateY(-15px);}
	}
</style>

<script type="text/javascript">
$( document ).ready(function() {
	var cek_delegasi="<?php echo $this->session->userdata('cek_delegasi') ?>";
	//set datetime format RFC3339
	var tc = new Date("<?php echo date("Y-m-d\TH:i:s\Z", strtotime($this->session->userdata('timer_cek_delegasi'))) ?>");
	var today = new Date();
	var timer = 60 * 60 * 1000 - (today-tc);
	
    $("body").css({ overflow: 'inherit' })
	$('#loading').hide();
	$('a').click(function(event){
		var id = $(this).attr('id');
		if($(this).attr('href')!='#' && $(this).attr('href').substring(1,0)!='#' && id !='noLoading'){
			openLoadingDialog();
		}
	});
	if (cek_delegasi==1) {
		if (timer < 0 ){
		    $.ajax({
				url: '<?php echo base_url('manage_delegasi_perkara/get_delegasi_masuk');?>',
				dataType: 'json',
			});
			$.ajax({
			     type: "POST",
			     url: "<?php echo base_url();?>"+'manage_delegasi_perkara/reset_session_delegasi',
			});
		}
	}
	var notifikasi=setInterval(function(){
			$.ajax({
			     url:"<?php echo base_url('manage_delegasi_perkara/cek_delegasi_server_lokal');?>",
			     dataType:'json',
			     success: function(json) {
			     		if (json.st==1){
			     			$('.notif_delegasi').empty();
			     			$('.notif_delegasi').append(json.value);
			     			$('.notif_delegasi').removeClass('hidden');
			     		}else{
			     			$('.notif_delegasi').empty();
			     			$('.notif_delegasi').addClass('hidden');
			     		}
		         },
		     })
	}, 10000);
});
</script>