function LogOff(){
	var answer=confirm('Apakah anda yakin akan logout?');
    if (answer) {
		window.document.getElementById("txtCommand").value = "1";
		window.document.getElementById("frmLogOff").submit();
	}
	else
	{
		window.document.getElementById("txtCommand").value = "2";
		window.document.getElementById("frmLogOff").submit();
	}
}

function LogOff2(){
	var answer=confirm('Apakah anda yakin akan logout?');
	if (answer) window.location = '../logoff.aspx' ;
}

function PeriodeBayarUlang(){
	
	if (window.document.getElementById("cboPeriodeUlang").value=="Setiap Bulan"){
		//window.document.getElementById("cboBulan").style.visibility = "hidden"
		
	}else if(window.document.getElementById("cboPeriodeUlang").value=="Setiap Tahun"){
		//window.document.getElementById("cboBulan").style.visibility = "visible"
	}

}

function BayarUlangUI(){
	if (window.document.getElementById("chkBerulang").checked==true){
		window.document.getElementById("spanpilihbulan").style.visibility = "visible";
		window.document.getElementById("trulang1").style.visibility = "visible";
		window.document.getElementById("trulang2").style.visibility = "visible";
		window.document.getElementById("trulang3").style.visibility = "visible";
		//window.document.getElementById("cboPeriodeUlang").value = 0;
		Showcbobulan();
		KirimEmail();
		window.document.getElementById("trulang4").style.visibility = "visible";
		window.document.getElementById("trulang5").style.visibility = "visible";
		
		
	}else{
		//window.document.getElementById("cboPeriodeUlang").value = 0;
		window.document.getElementById("spanpilihbulan").style.visibility = "hidden";
		Showcbobulan();
		window.document.getElementById("chkEmail").checked=false;
		KirimEmail();
		window.document.getElementById("trulang1").style.visibility = "hidden";
		window.document.getElementById("trulang2").style.visibility = "hidden";
		window.document.getElementById("trulang3").style.visibility = "hidden";
		window.document.getElementById("trulang4").style.visibility = "hidden";
		window.document.getElementById("trulang5").style.visibility = "hidden";
		
		
	}
}



function Khusus(){
	if (window.document.getElementById("khusus").checked==true){
		window.document.getElementById("khusus1").style.visibility = "visible";
		
		
	}else{
		window.document.getElementById("khusus1").style.visibility = "hidden";
	}
}

function KhususTerencana(){
	
	if (window.document.getElementById("Khusus").checked==true){
		window.document.getElementById("KhususTerencana").style.visibility = "visible";
		
		
	}else{
		window.document.getElementById("KhususTerencana").style.visibility = "hidden";
		
		
	}
}

function GetKey(evt, toName){
	if(navigator.appName=="Netscape"){theKey=evt.which}
	if(navigator.appName.indexOf("Microsoft")!=-1){theKey=window.event.keyCode}
	
	if (theKey == 13 ) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
				window.document.getElementById(toName).focus();
				if ((toName == 'cboJk')||(toName == 'cboBank1')||(toName == 'cboBank2')  ||(toName == 'cboBank3') ||(toName == 'cboHint') 
					 || (toName == 'cboHint') ||(toName == 'cboAmil') ) {
				}
				else {
					window.document.getElementById(toName).select();
				}
	     	}
	}
}

function GetKey2(evt, obj, toName, len){
	if(navigator.appName=="Netscape"){theKey=evt.which}
	if(navigator.appName.indexOf("Microsoft")!=-1){theKey=window.event.keyCode}
	
	if (len != null ) {
		var iObj = window.document.getElementById(obj).value;
		if (len == iObj.length ) {
			window.document.getElementById(toName).focus();
			if (toName != 'ddlRekening') {
				window.document.getElementById(toName).select();
			}
		}
	}
	if (theKey == 13 ) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
				window.document.getElementById(toName).focus();
				if (toName != 'ddlRekening') {
					window.document.getElementById(toName).select();
				}
	     	}
	}
}

function GetKey2Alt(evt, obj, toName, AlttoName, len){
	if(navigator.appName=="Netscape"){theKey=evt.which}
	if(navigator.appName.indexOf("Microsoft")!=-1){theKey=window.event.keyCode}
	
	if (len != null ) {
		var iObj = window.document.getElementById(obj).value;
		if (len == iObj.length ) {
			if (window.document.getElementById(toName).disabled==true){
					window.document.getElementById(AlttoName).focus();
					window.document.getElementById(AlttoName).select();
			}else{
					window.document.getElementById(toName).focus();
					window.document.getElementById(toName).select();
			}
		}
	}
	if (theKey == 13 ) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
			
				if (window.document.getElementById(toName).disabled==true){
					window.document.getElementById(AlttoName).focus();
					window.document.getElementById(AlttoName).select();
				}else{
				
					window.document.getElementById(toName).focus();
					window.document.getElementById(toName).select();
				}
	     	}
	}
}


/*
Author: Robert Hashemian
http://www.hashemian.com/

You can use this code in any manner so long as the author's
name, Web address and this disclaimer is kept intact.
********************************************************
Usage Sample:

document.write(FormatNumberBy3("1234512345.12345", ".", ","));
*/

// function to format a number with separators. returns formatted number.
// num - the number to be formatted
// decpoint - the decimal point character. if skipped, "." is used
// sep - the separator character. if skipped, "," is used
function FormatNumberBy3(num, decpoint, sep) {
  // check for missing parameters and use defaults if so
  if (arguments.length == 2) {
    sep = ".";
  }
  if (arguments.length == 1) {
    sep = ".";
    decpoint = ",";
  }
  num=replace(num, '.', '');
  // need a string for operations
  num = num.toString();
  // separate the whole number and the fraction if possible
  a = num.split(decpoint);
  x = a[0]; // decimal
  y = a[1]; // fraction
  z = "";


  if (typeof(x) != "undefined") {
    // reverse the digits. regexp works from left to right.
    for (i=x.length-1;i>=0;i--)
      z += x.charAt(i);
    // add seperators. but undo the trailing one, if there
    z = z.replace(/(\d{3})/g, "$1" + sep);
    if (z.slice(-sep.length) == sep)
      z = z.slice(0, -sep.length);
    x = "";
    // reverse again to get back the number
    for (i=z.length-1;i>=0;i--)
      x += z.charAt(i);
    // add the fraction back in, if it was there
    if (typeof(y) != "undefined" && y.length > 0)
      x += decpoint + y;
  }
  return x;
}

function fdp(n,d){
	var xx = n.indexOf('.')
	var l = n.length
	var zstr = '0000000000000000000000'
	var theInt = ''
	var theFrac = ''
	var theNo = ''
	rfac = ''
	rfacx = 0
	nx = 0
	var xt = parseInt(d) + 1
	var rstr = '' + zstr.substring(1,xt)
	var rfac = '.' + rstr + '5'
	var rfacx = parseFloat(rfac)
	if (xx == -1 ) 	{    // No fraction
		theFrac = zstr
		theInt = "" + n
		return n
	}
	else if (xx == 0) {
		theInt = '0'
		nx = 0 + parseFloat(n) + parseFloat(rfacx)
		n = nx + zstr
		theFrac = '' + n.substring(1, n.length)
	}
	else {
		theInt = n.substring(0,xx)
		nx = parseFloat(n) + rfacx
		n = '' + nx + zstr
		theFrac = '' + n.substring(xx+1,xx + 1 + parseInt(d))
		var astr = 'd = ' + d
	}
	theFrac = theFrac.substring(0,parseInt(d))
	var ii = 0
	theNo = theInt + '.' + theFrac
	return theNo
}

function GetKeyNumericNotNull(evt, obj, toName, len){
	if(navigator.appName=="Netscape"){
		theKey=evt.which
		if((event.which < 48 || event.which > 57)) return false;
	}
	if(navigator.appName.indexOf("Microsoft")!=-1){
		theKey=window.event.keyCode
		if((event.keyCode < 48 || event.keyCode > 57)) event.returnValue = false;
	}
	
	if (len != null) {
		var iObj = window.document.getElementById(obj).value;
		if (len == iObj.length ) {
			if (window.document.getElementById(obj).value == "" ||
				window.document.getElementById(obj).value == 0) {
				window.document.getElementById(obj).value = 0;	
			}
			else{
				var value = fdp(replace(replace(trim(window.document.getElementById(obj).value), '.', ''), ',', '.'), 2);
				window.document.getElementById(obj).value = FormatNumberBy3(replace(value, '.', ','));
			}
			window.document.getElementById(toName).focus();
			if ((toName == 'ddlJnsTran')||(toName == 'ddlCurrCode')||(toName == 'ddlRekening')) {
			}
			else {
				window.document.getElementById(toName).select();
			}
		}
	}

	if (theKey == 13 ) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
				if (window.document.getElementById(obj).value == "" ||
					window.document.getElementById(obj).value == 0) {
					window.document.getElementById(obj).value = 0;	
				}
				else{
					var value = fdp(replace(replace(trim(window.document.getElementById(obj).value), '.', ''), ',', '.'), 2);
					window.document.getElementById(obj).value = FormatNumberBy3(replace(value, '.', ','));
				}
				window.document.getElementById(toName).focus();
				if ((toName == 'ddlJnsTran')||(toName == 'ddlCurrCode')||(toName == 'ddlRekening')) {
				}
				else {
					window.document.getElementById(toName).select();
				}
	     	}
	}

}	

function GetKeyNumeric(evt, obj, toName){
	if(navigator.appName=="Netscape"){
		theKey=evt.which
		if((event.which < 48 || event.which > 57)) return false;
	}
	if(navigator.appName.indexOf("Microsoft")!=-1){
		theKey=window.event.keyCode
		if((event.keyCode < 48 || event.keyCode > 57)) event.returnValue = false;
	}
	
	if (theKey == 13 ) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
				if (window.document.getElementById(obj).value != 0) {
					var value = fdp(replace(replace(trim(window.document.getElementById(obj).value), '.', ''), ',', '.'), 2);
					window.document.getElementById(obj).value = FormatNumberBy3(replace(value, '.', ','));
				}
				//return false;
				window.document.getElementById(toName).focus();
				window.document.getElementById(toName).select();
	     	}
	}
}	

function GetKeyAngka(evt, obj, toName, len){
	var bnum = false;
	
	if(navigator.appName=="Netscape"){
		theKey=evt.which
		if((event.which < 48 || event.which > 57)){
			 return false;
		}
		else
		{
			bnum = true;		
		}
	}
	if(navigator.appName.indexOf("Microsoft")!=-1){
		theKey=window.event.keyCode
		if((event.keyCode < 48 || event.keyCode > 57)) {
			event.returnValue = false;
		}
		else{
			bnum=true;
		}
	}
	if (len != null && bnum ==true) {
		var iObj = window.document.getElementById(obj).value;
		if (len == iObj.length ){
			window.document.getElementById(obj).focus();
			if ((toName == 'cboJk')||(toName == 'cboBank1')||(toName == 'cboBank2') ||(toName == 'cboBank3') ) {
			}
			else
			{
				window.document.getElementById(obj).select();
			}
		}
	}

	if (theKey == 13 ) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
				window.document.getElementById(toName).focus();
				if ((toName == 'cboJk')||(toName == 'cboBank1')||(toName == 'cboBank2') ||(toName == 'cboBank3') ) {
				}
				else
				{
					window.document.getElementById(toName).select();
				}	
			}
		}			

}


function GetKeyAngka2(evt, obj, toName, toNameAlt, len){

	var bNum = false;
	
	if(navigator.appName=="Netscape"){
		theKey=evt.which
		if((event.which < 48 || event.which > 57)) {
			return false;
		}
		else {
			bNum = true;
		}
	}
	if(navigator.appName.indexOf("Microsoft")!=-1){
		theKey=window.event.keyCode
		
		if((event.keyCode < 48) || (event.keyCode > 57 && event.keyCode < 96)|| (event.keyCode > 105)) {
			event.returnValue = false;
		}
		else {
			bNum = true;
		}
	}
	if (len != null && bNum == true) {
		var iObj = window.document.getElementById(obj).value;
		if (len == iObj.length ) {
			if (toName == 'ddlKP')
			{
				window.document.getElementById(toName).focus();
			}
			else
			{
				if (window.document.getElementById(toName).disabled==false){
				window.document.getElementById(toName).focus();
				window.document.getElementById(toName).select();
				}else{
				
				window.document.getElementById(toNameAlt).focus();
				window.document.getElementById(toNameAlt).select();
				}
			}
		}
	}

	if (theKey == 13 ) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
				if (toName == 'ddlKP')
				{
					window.document.getElementById(toName).focus();
				}
				else
				{
					if (window.document.getElementById(toName).disabled==false){
					window.document.getElementById(toName).focus();
					window.document.getElementById(toName).select();
					}else{
					
					window.document.getElementById(toNameAlt).focus();
					window.document.getElementById(toNameAlt).select();
					}
				}
	     	}
	}			

}

function GetKeyAngkaMasa(evt, obj, toName, toOther){
	if(navigator.appName=="Netscape"){
		theKey=evt.which
		if((event.which < 48 || event.which > 57)) return false;
	}
	if(navigator.appName.indexOf("Microsoft")!=-1){
		theKey=window.event.keyCode
		if((event.keyCode < 48 || event.keyCode > 57)) event.returnValue = false;
	}
	
	if (theKey == 13 ) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
				if (window.document.getElementById(toName) != null) {
					window.document.getElementById(toName).focus();
				}
				else{
					window.document.getElementById(toOther).focus();
				}
	     	}
	}
}

function setFocus(toName, toFocus, toOther){
	if (window.document.getElementById(toName).value == "" ){
		window.document.getElementById(toFocus).focus();
		window.document.getElementById(toFocus).select();
	}
	else
	{
		window.document.getElementById(toOther).focus();
		window.document.getElementById(toOther).select();
	}
}

function setFocus2(evt, toName, toOther){
	if(navigator.appName=="Netscape"){
		theKey=evt.which
		if((event.which < 48 || event.which > 57)) return false;
	}
	if(navigator.appName.indexOf("Microsoft")!=-1){
		theKey=window.event.keyCode
		if((event.keyCode < 48 || event.keyCode > 57)) event.returnValue = false;
	}
	
	if (theKey == 0 || theKey == 9 ) {
		if (toName == 'txtNoRekNasabah1'&& toOther == 'ddlRekening')
		{
			if (window.document.getElementById(toName).disabled) {
				window.document.getElementById(toOther).focus();
				if (toOther != 'ddlRekening') {
					window.document.getElementById(toOther).select();
				}
			}
			else
			{
				window.document.getElementById(toName).focus();
				if (toOther != 'ddlRekening') {
					window.document.getElementById(toName).select();
				}
			}
		}
		else
		{
			if (window.document.getElementById(toName).readOnly) {
				window.document.getElementById(toOther).focus();
				if (toOther != 'ddlRekening') {
					window.document.getElementById(toOther).select();
				}
			}
			else
			{
				window.document.getElementById(toName).focus();
				window.document.getElementById(toName).select();
			}
		}
	}
}

function setFocusRO(toName, toFocus, toOther){
	if (window.document.getElementById(toName).disabled == true ){
		if (window.document.getElementById(toOther) != null) {
			window.document.getElementById(toOther).focus();
		}
		else{
			window.document.getElementById("txtNoBukti").focus();
		}
	}
	else
	{window.document.getElementById(toFocus).focus();}
}

function setFocusMs(toName, toFocus, toOther){
	if (window.document.getElementById(toName).disabled == true ){
		if (window.document.getElementById(toOther) != null) {
			window.document.getElementById(toOther).focus();
			//alert("a");
		}
		else{
			//alert("b");
			window.document.getElementById("txtMPTahun").focus();
		}
	}
	else
	{window.document.getElementById(toFocus).focus(); alert("c");}
}

function GetKeyTgl(evt, obj, toName, len){
	if(navigator.appName=="Netscape"){theKey=evt.which}
	if(navigator.appName.indexOf("Microsoft")!=-1){theKey=window.event.keyCode}

	
	if (len != null) {
		var iObj = window.document.getElementById(obj).value;
		if (len == iObj.length ) {
			if (window.document.getElementById(obj).value=="") {
				window.document.getElementById(toName).focus();
				if (toName != 'ddlRekening') {
					window.document.getElementById(toName).select();
				}
			}
			else {
				if (validasiTanggal(obj) == "1")
				{
					/*if (toName == 'ddlRekening')
					{
						window.document.getElementById(toName).focus();
					}
					else
					{
						window.document.getElementById(toName).focus();
						window.document.getElementById(toName).select();
					}*/ 
					
					window.document.getElementById(obj).focus();
					window.document.getElementById(obj).select();
				}
			}
		}
	}

	if ((theKey == 13)) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
				if (window.document.getElementById(obj).value=="") 
				{
					window.document.getElementById(toName).focus();
					if (toName != "ddlRekening") {
						window.document.getElementById(toName).select();
					}
				}
				else {
					if (validasiTanggal(obj) == "1"){
						window.document.getElementById(toName).focus();
						if (toName != 'ddlRekening') {
							window.document.getElementById(toName).select();
						} 
					}
				}
	     	}
	}
}		

function GetKeyTglRencanaAwal(evt, obj, toName, len){
	if(navigator.appName=="Netscape"){theKey=evt.which}
	if(navigator.appName.indexOf("Microsoft")!=-1){theKey=window.event.keyCode}
	
	if (len != null) {
		var iObj = window.document.getElementById(obj).value;
		if (len == iObj.length ) {
			if (window.document.getElementById(obj).value=="") {
				window.document.getElementById(toName).focus();
				if (toName != 'ddlRekening') {
					window.document.getElementById(toName).select();
				}
			}
			else {
				if (validasiTanggalRencanaAwal(obj) == true)
				{
					/*if (toName == 'ddlRekening')
					{
						window.document.getElementById(toName).focus();
					}
					else
					{
						window.document.getElementById(toName).focus();
						window.document.getElementById(toName).select();
					}*/ 
					
					window.document.getElementById(toName).focus();
					window.document.getElementById(toName).select();
				}
			}
		}
	}

	if ((theKey == 13)) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
				if (window.document.getElementById(obj).value=="") 
				{
					window.document.getElementById(toName).focus();
					if (toName != "ddlRekening") {
						window.document.getElementById(toName).select();
					}
				}
				else {
					if (validasiTanggalRencana(obj,'tbTglByrAkhir') == "1"){
						window.document.getElementById(toName).focus();
						if (toName != 'ddlRekening') {
							window.document.getElementById(toName).select();
						} 
					}
				}
	     	}
	}
}	

function GetKeyTglRencanaAkhir(evt, obj, toName, len){
	if(navigator.appName=="Netscape"){theKey=evt.which}
	if(navigator.appName.indexOf("Microsoft")!=-1){theKey=window.event.keyCode}
	
	if (len != null) {
		var iObj = window.document.getElementById(obj).value;
		if (len == iObj.length ) {
			if (window.document.getElementById(obj).value=="") {
				window.document.getElementById(toName).focus();
				if (toName != 'ddlRekening') {
					window.document.getElementById(toName).select();
				}
			}
			else {
				if (validasiTanggalRencanaAkhir(obj) == true)
				{
					/*if (toName == 'ddlRekening')
					{
						window.document.getElementById(toName).focus();
					}
					else
					{
						window.document.getElementById(toName).focus();
						window.document.getElementById(toName).select();
					}*/ 
					
					window.document.getElementById(toName).focus();
					window.document.getElementById(toName).select();
				}
			}
		}
	}

	if ((theKey == 13)) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
				if (window.document.getElementById(obj).value=="") 
				{
					window.document.getElementById(toName).focus();
					if (toName != "ddlRekening") {
						window.document.getElementById(toName).select();
					}
				}
				else {
					if (validasiTanggalRencana('tbTglByrAwal',obj) == "1"){
						window.document.getElementById(toName).focus();
						if (toName != 'ddlRekening') {
							window.document.getElementById(toName).select();
						} 
					}
				}
	     	}
	}
}	

function GetKeyTgl2(evt, obj, toName, toNameAlt, len){
	if(navigator.appName=="Netscape"){theKey=evt.which}
	if(navigator.appName.indexOf("Microsoft")!=-1){theKey=window.event.keyCode}
	
	if (len != null) {
		var iObj = window.document.getElementById(obj).value;
		if (len == iObj.length ) {
			if (window.document.getElementById(obj).value=="") {
				window.document.getElementById(toName).focus();
				if (toName != 'ddlRekening') {
					window.document.getElementById(toName).select();
				}
			}
			else {
				if (validasiTanggal(obj) == "1")
				{
					/*if (toName == 'ddlRekening')
					{
						window.document.getElementById(toName).focus();
					}
					else
					{
						window.document.getElementById(toName).focus();
						window.document.getElementById(toName).select();
					}*/ 
					
					window.document.getElementById(obj).focus();
					window.document.getElementById(obj).select();
				}
			}
		}
	}

	if ((theKey == 13)) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
				if (window.document.getElementById(obj).value=="") 
				{
					if (toName == "ddlRekening") {
						window.document.getElementById(toName).focus();
					}
					else {
						if (window.document.getElementById(toName).disabled==false){
							window.document.getElementById(toName).focus();
							window.document.getElementById(toName).select();
							}else{
							
							window.document.getElementById(toNameAlt).focus();
							window.document.getElementById(toNameAlt).select();
							}
					}
				}
				else {
					if (validasiTanggal(obj) == "1"){
						if (toName == 'ddlRekening') {
							window.document.getElementById(toName).focus();
						}
						else {
							if (window.document.getElementById(toName).disabled==false){
								window.document.getElementById(toName).focus();
								window.document.getElementById(toName).select();
								}else{
								
								window.document.getElementById(toNameAlt).focus();
								window.document.getElementById(toNameAlt).select();
								}
						} 
					}
				}
	     	}
	}
}		

function validasiTahun(evt, toVal, toFocus){
	if(navigator.appName=="Netscape"){theKey=evt.which}
	if(navigator.appName.indexOf("Microsoft")!=-1){theKey=window.event.keyCode}
	
	if (theKey == 13 ) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36)){
			var strYear=window.document.getElementById(toVal).value;;
			var minYear=1900;
			var maxYear=2100;
			year=parseInt(strYear);
			if (strYear.length != 4 || year==0 || year< minYear || year > maxYear){
				alert("Tahun yang anda masukkan salah, input yang diizinkan antara tahun "+minYear+" dan "+maxYear);
				window.document.getElementById(toVal).focus();
				window.document.getElementById(toVal).select();
			}
			else{
				window.document.getElementById(toFocus).focus();
				window.document.getElementById(toFocus).select();
			}
		}
	}
}

function validasiTanggalRencanaAwal(obj)
{
	var right_now=new Date();
	var the_year=parseInt(right_now.getYear());
	var the_month=parseInt(right_now.getMonth()) + 1;
	var tanggal_periksa=window.document.getElementById(obj).value;
	
	var bulan=parseInt(tanggal_periksa.substr(3,2));
	var tahun=parseInt(tanggal_periksa.substr(6,4));
	
	if (tahun!=the_year)
	{
		alert("Tahun rencana tidak valid.");
		window.document.getElementById(obj).focus();
		window.document.getElementById(obj).select();
		return false;
	}
	else
	{
		if (bulan<the_month)
		{	
			alert("Bulan Rencana tidak valid");
			window.document.getElementById(obj).focus();
			window.document.getElementById(obj).select();
			return false;
		}
	}
		
	return true;
}

function validasiTanggalRencanaAkhir(obj)
{
	var right_now=new Date();
	var the_year=parseInt(right_now.getYear());
	var the_month=parseInt(right_now.getMonth()) + 1;
	var tanggal_periksa=window.document.getElementById(obj).value;
	var tanggal_awal = window.document.getElementById('tbTglByrAwal').value;
	
	var bulan=parseInt(tanggal_periksa.substr(3,2));
	var tahun=parseInt(tanggal_periksa.substr(6,4));
	
	var bulanawal = parseInt(tanggal_awal.substr(3,2));
	
	if (tahun!=the_year)
	{
		alert("Tahun rencana tidak valid, akhir rencana maksimal adalah bulan Desember tahun ini");
		window.document.getElementById(obj).focus();
		window.document.getElementById(obj).select();
		return false;
	}
	else
	{
		if ((bulan<the_month) || (bulan < bulanawal))
		{	
			alert("Bulan Rencana tidak valid");
			window.document.getElementById(obj).focus();
			window.document.getElementById(obj).select();
			return false;
		}
	}
		
	return true;
}


function validasiTanggalRencana(obj1,obj2)
{
	var right_now=new Date();
	var the_year=parseInt(right_now.getYear(),10);
	var the_month=parseInt(right_now.getMonth(),10) + 1 ;
	var tanggal_periksa1=window.document.getElementById(obj1).value;
	var tanggal_periksa2=window.document.getElementById(obj2).value;
	
	var bulan1=parseInt(tanggal_periksa1.substr(3,2),10);
	var tahun1=parseInt(tanggal_periksa1.substr(6,4),10);
	
	if (tanggal_periksa1 != "")
	{
		if (tahun1!=the_year)
		{
			alert("Tahun rencana tidak valid.");
			window.document.getElementById(obj1).focus();
			window.document.getElementById(obj1).select();
			return false;
		}
		else
		{
			if (bulan1<the_month)
			{	
				alert("Bulan Rencana tidak valid");
				window.document.getElementById(obj1).focus();
				window.document.getElementById(obj1).select();
				return false;
			}
		}
	}
	
	if (tanggal_periksa2 != "")
		{
		var bulan2=parseInt(tanggal_periksa2.substr(3,2),10);
		var tahun2=parseInt(tanggal_periksa2.substr(6,4),10);
		
		if (tahun2!=the_year)
		{
			alert("Tahun rencana tidak valid, akhir rencana maksimal adalah bulan Desember tahun ini");
			window.document.getElementById(obj2).focus();
			window.document.getElementById(obj2).select();
			return false;
		}
		else
		{
			if ((bulan2<the_month) || (bulan2<bulan1))
			{	
				alert("Bulan Rencana tidak valid");
				window.document.getElementById(obj2).focus();
				window.document.getElementById(obj2).select();
				return false;
			}
		}
	}	
	
	return true;
}

function validasiTanggal(obj)
{
	var panjang_periksa=0;
	var a=0;
	kelas=(window.document.getElementById(obj).className).toUpperCase();
	tanggal_periksa=window.document.getElementById(obj).value;
	panjang_periksa=tanggal_periksa.length;
		if (panjang_periksa < 8)
		{
			alert("Input tanggal tidak diijinkan, format yang sesuai adalah (dd-mm-yyyy)")
			var right_now=new Date();
			var the_year=right_now.getYear();
			var the_month=right_now.getMonth();
			var the_date=right_now.getDate();
			
			if (the_date.toString().length == 1) the_date = '0' + the_date;
			if (the_month.toString().length == 1) the_month = '0' + the_month;
						
			var tgl = the_date + '-' + the_month + '-' + the_year ;
			window.document.getElementById(obj).value=tgl;
			window.document.getElementById(obj).focus();
			window.document.getElementById(obj).select();
		}
		else
		{
			var kata="";
			for (i=0;i<panjang_periksa;i++)
			{
				cari_strip=tanggal_periksa.substr(i,1);
					if (cari_strip=='-')
						{
							a++;	
							if (i<3)
								{
									temp1=tanggal_periksa.substr(0,i);
									strip1=i;
									if (temp1.length<2) 
										{
											temp1='0'+temp1;

										}
									kata=kata+temp1+'-';
								}
							else
								{
									temp1=tanggal_periksa.substr(strip1+1,i-(strip1+1))

									if (temp1.length<2) 
										{
											temp1='0'+temp1;
										}
									kata=kata+temp1+'-';
								}
						}
			}
			tahun=tanggal_periksa.substr(panjang_periksa-4,4);
			kata=kata+tahun;
			if (a==2)
			{			
				window.document.getElementById(obj).value=kata;
			}
			else
			{
				temp1=tanggal_periksa.substr(0,2);
				temp2=tanggal_periksa.substr(2,2);
				temp3=tanggal_periksa.substr(4,4);
				window.document.getElementById(obj).value=temp1+"-"+temp2+"-"+temp3;
				
			}
			if (isDate(window.document.getElementById(obj).value) == true){
				return ("1");
			}
			else{
				return ("0");
			}
		}		
}



/**
 * DHTML date validation script for dd/mm/yyyy. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var dtCh= "-";
	var minYear=1900;
	var maxYear=2100;

	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("Input tanggal tidak diijinkan, format yang sesuai adalah (dd-mm-yyyy)")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Bulan yang anda masukkan salah")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Tanggal yang anda masukkan salah")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Tahun yang anda masukkan salah, input yang diizinkan antara tahun "+minYear+" dan "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Input tanggal tidak diijinkan, format yang sesuai adalah (dd-mm-yyyy)")
		return false
	}
return true
}

function ValidateAngka(evt){
	if(navigator.appName=="Netscape"){
		theKey=evt.which
		if((event.which < 48 || event.which > 57)) return false;
	}
	if(navigator.appName.indexOf("Microsoft")!=-1){
		theKey=window.event.keyCode
		if((event.keyCode < 48 || event.keyCode > 57)) event.returnValue = false;
	}
}

function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function

function ShowButton(obj){
	window.document.getElementById(obj).disabled=true;
	window.document.getElementById(obj).bgcolor='#ABB4CC';
	window.document.getElementById(obj).value='Tunggu ...';
}

function GetKeyNumericAndDash(evt, obj, toName){
	
	/*
	 * TODO: Test validation routine for netscape
	 */
	if(navigator.appName=="Netscape"){
		theKey=evt.which
		var text = window.document.getElementById(obj).value;
		if(text.indexOf('-') > 0 && event.which==45) return false;
		if((event.which < 48 || event.which > 57) && event.which != 45) return false;
	}

	if(navigator.appName.indexOf("Microsoft")!=-1){
		theKey=window.event.keyCode;
		var text = window.document.getElementById(obj).value;
		if(text.indexOf('-') > 0 && event.keyCode==45) event.returnValue = false;
		if((event.keyCode < 48 || event.keyCode > 57) && event.keyCode != 45) event.returnValue = false;
	}
	
	if (theKey == 13 ) {
		window.document.getElementById(toName).focus();
		window.document.getElementById(toName).select();
	}
}	

function replace(s, t, u) {
  /*
  **  Replace a token in a string
  **    s  string to be processed
  **    t  token to be found and removed
  **    u  token to be inserted
  **  returns new String
  */
  s=trim(s + " ");
  
  i = s.indexOf(t);
  r = "";
  if (i == -1) return s;
  r += s.substring(0,i) + u;
  if ( i + t.length < s.length)
    r += replace(s.substring(i + t.length, s.length), t, u);
  return r;
  }

function GetKeyNpwp(evt, obj, toName){
	if(navigator.appName=="Netscape"){
		theKey=evt.which
		if((event.which < 48 || event.which > 57)) return false;
	}
	if(navigator.appName.indexOf("Microsoft")!=-1){
		theKey=window.event.keyCode
		if((event.keyCode < 48 || event.keyCode > 57)) event.returnValue = false;
	}
	if (theKey == 13 ) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
				if (window.document.getElementById(obj).value=="") {
					window.document.getElementById(toName).focus();
					window.document.getElementById(toName).select();
				}
				else if (window.document.getElementById(obj).value=="000000000") {
					window.document.getElementById(toName).focus();
					window.document.getElementById(toName).select();
				}
				else {
					if (ValidateNpwp(obj) == true){
						window.document.getElementById(toName).focus();
						window.document.getElementById(toName).select();
					}
				}
	     	}
	}
	
}

function GetKeyDecimal(evt, obj, toName){
	if(navigator.appName=="Netscape"){
		theKey=evt.which
		var text = window.document.getElementById(obj).value;
		if(text.indexOf(',') > 0 && event.which==44) return false;
		if((event.which < 48 || event.which > 57) && event.which != 44) return false;
	}
	if(navigator.appName.indexOf("Microsoft")!=-1){
		theKey=window.event.keyCode
		var text = window.document.getElementById(obj).value;
		if(text.indexOf(',') > 0 && event.keyCode==44) event.returnValue = false;
		if((event.keyCode < 48 || event.keyCode > 57) && event.keyCode != 44) event.returnValue = false;
	}
	
	if (theKey == 13 ) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36)){
			if (trim(window.document.getElementById(obj).value) == "" ||
				trim(window.document.getElementById(obj).value) == 0) {
				window.document.getElementById(obj).value = 0;	
			}
			var value = fdp(replace(replace(trim(window.document.getElementById(obj).value), '.', ''), ',', '.'), 2);
			window.document.getElementById(obj).value = FormatNumberBy3(replace(value, '.', ','));
			window.document.getElementById(toName).focus();
			window.document.getElementById(toName).select();
		}
	}
}	

function validasitgl(obj)
{
	var right_now=new Date();
	var the_year=right_now.getYear();
	var the_month=parseInt(right_now.getMonth()) + 1;
	
	var dtCh= "-";
	
	var dtStr = window.document.getElementById(obj).value;
	var daysInMonth = DaysArray(12);
	var pos1=dtStr.indexOf(dtCh);
	var pos2=dtStr.indexOf(dtCh,pos1+1);
	//var strDay=dtStr.substring(0,pos1);
	var strMonth=dtStr.substring(pos1+1,pos2);
	var strYear=dtStr.substring(pos2+1);
	var strYr=strYear
	
	//if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1);
	}
	var month=parseInt(strMonth);
	//var day=parseInt(strDay);
	var year=parseInt(strYr);
	
	if ( the_year != year || the_month != month){
		alert('Tgl potong tidak valid');
		window.document.getElementById(obj).focus();
		window.document.getElementById(obj).select();
		return false;
	}
	return true;
}

function validasiTglPemotongan(objTglPot,objMasa,objTahun){
        
        var masaPjk= trim(window.document.getElementById(objMasa).selectedIndex)+1;
        var tahunPjk= trim(window.document.getElementById(objTahun).value);
        	
		var dtCh= "-";
        var dtStr = window.document.getElementById(objTglPot).value;
        var daysInMonth = DaysArray(12);
        var pos1=dtStr.indexOf(dtCh);
        var pos2=dtStr.indexOf(dtCh,pos1+1);
        var strTgl=dtStr.substring(0,pos1);
        var strMonth=dtStr.substring(pos1+1,pos2);
        var strYear=dtStr.substring(pos2+1);
        var strYr=strYear
        
        if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
        for (var i = 1; i <= 3; i++) {
                if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1);
        }
        var iBlnPot=parseInt(strMonth);
        var iThnPot=parseInt(strYr);
        
        var iMasa=parseInt(masaPjk);
        var iTahun=parseInt(tahunPjk);
        
        //Khusus Faktur
		var objStatus = window.document.getElementById('cboStatus');
        //
        
        if (objStatus != null){
			var status = window.document.getElementById('cboStatus').value;
			if (status == '31' || status == '43' || status == '44' || status == '62'){
				return isValidDate(iMasa - 1, iTahun, iBlnPot - 1, iThnPot, 3, status, objTglPot, strTgl)
			}
        }
        
        if (iThnPot != iTahun ){
			    alert('Tanggal tidak valid! (harus dalam masa pajak yang dipilih)');
                window.document.getElementById(objTglPot).focus();
                window.document.getElementById(objTglPot).select();
                return false;
		}
        else if (iBlnPot != iMasa){
                alert('Tanggal tidak valid! (harus dalam masa pajak yang dipilih)');
                window.document.getElementById(objTglPot).focus();
                window.document.getElementById(objTglPot).select();
                return false;
        }
        else {
			return true;
        }
}

function GetKeyTglPajak(evt, obj, toName, objMasa, objTahun){
	if(navigator.appName=="Netscape"){theKey=evt.which}
	if(navigator.appName.indexOf("Microsoft")!=-1){theKey=window.event.keyCode}
	
	if (theKey == 13 ) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
				if (window.document.getElementById(obj).value=="") {
					window.document.getElementById(toName).focus();
					window.document.getElementById(toName).select();
				}
				else {
					if (validasiTanggal(obj) == "1"){
						if (validasiTglPemotongan(obj, objMasa, objTahun) == true){
							window.document.getElementById(toName).focus();
							window.document.getElementById(toName).select();
						}
					}
				}
	     	}
	}
}

function isValidDate(msPajak, thPajak, iBlnPot, iThnPot, validLength, status, objTglPot, strTgl){
	
	/*if (iThnPot > thPajak ){
			alert('Tanggal tidak valid! (harus dalam masa pajak yang dipilih)');
            window.document.getElementById(objTglPot).focus();
            return false;
	}
    else if (iBlnPot > msPajak){
            alert('Tanggal tidak valid! (harus dalam masa pajak yang dipilih)');
            window.document.getElementById(objTglPot).focus();
            return false;
    }*/

	if (status != '31' && msPajak == iBlnPot && thPajak == iThnPot){
        alert('Tanggal tidak boleh dalam masa pajak dipilih!');
        window.document.getElementById(objTglPot).focus();
        return false;
	}
	
	var validThPajakBw = thPajak;		
	var validMsPajakBw = msPajak - validLength;
	if (validMsPajakBw < 0){
		validMsPajakBw = 12 + validMsPajakBw;
		validThPajakBw = thPajak - 1
	}
	
	var validThPajakAt = thPajak;		
	var validMsPajakAt = msPajak + 1;
	if (validMsPajakAt > 11){
		validMsPajakAt = validMsPajakAt - 12;
		validThPajakAt = thPajak + 1;
	}
	
	var dtBatasAtas = new Date(validThPajakAt, validMsPajakAt, 1);
	var dtBatasBawah = new Date(validThPajakBw, validMsPajakBw, 1);
	var dtTglInput = new Date(iThnPot, iBlnPot, strTgl);
	
	if (dtTglInput >= dtBatasAtas){
        alert('Tanggal tidak boleh melebihi masa pajak dipilih!');
        window.document.getElementById(objTglPot).focus();
        window.document.getElementById(objTglPot).select();
        return false;
	}
	else if ((status == '43' || status == '44') && dtTglInput < dtBatasBawah){
        alert('Tanggal tidak boleh lebih kecil ' + validLength + ' bulan dari masa pajak dipilih!');
        window.document.getElementById(objTglPot).focus();
        window.document.getElementById(objTglPot).select();
        return false;
	}
	
	return true;
}

function GetKeyTglPemotongan(evt,objTglPot,toName,objMasa,objTahun){
	if(navigator.appName=="Netscape"){theKey=evt.which}
	if(navigator.appName.indexOf("Microsoft")!=-1){theKey=window.event.keyCode}
	
	if (theKey == 13 ) {
		if (theKey!=8 && theKey!=46  && (theKey < 41 || theKey > 36))
			{
				if (window.document.getElementById(objTglPot).value=="") {
					alert('Tgl potong harus di isi');
					window.document.getElementById(objTglPot).focus();
					window.document.getElementById(objTglPot).select();
				}
				else {
					if (validasiTanggal(objTglPot) == "1"){
						if (validasiTglPemotongan(objTglPot,objMasa,objTahun)==false) {
							window.document.getElementById(objTglPot).focus();
							window.document.getElementById(objTglPot).select();
						}
						else {
							window.document.getElementById(toName).focus();
							window.document.getElementById(toName).select();
						}
					}
				}
	     	}
	}
}

function HitungSspcp(){
	var nil01 = replace(replace(trim(window.document.getElementById("tb412111").value), '.', ''), ',', '.');
	var nil02 = replace(replace(trim(window.document.getElementById("tb412112").value), '.', ''), ',', '.');
	var nil03 = replace(replace(trim(window.document.getElementById("tb412113").value), '.', ''), ',', '.');
	var nil04 = replace(replace(trim(window.document.getElementById("tb412119").value), '.', ''), ',', '.');
	var nil05 = replace(replace(trim(window.document.getElementById("tb411511").value), '.', ''), ',', '.');
	var nil06 = replace(replace(trim(window.document.getElementById("tb411512").value), '.', ''), ',', '.');
	var nil07 = replace(replace(trim(window.document.getElementById("tb411513").value), '.', ''), ',', '.');
	var nil08 = replace(replace(trim(window.document.getElementById("tb411519").value), '.', ''), ',', '.');
	var nil09 = replace(replace(trim(window.document.getElementById("tb423146").value), '.', ''), ',', '.');
	var nil10 = replace(replace(trim(window.document.getElementById("tb411212").value), '.', ''), ',', '.');
	var nil11 = replace(replace(trim(window.document.getElementById("tb411222").value), '.', ''), ',', '.');
	var nil12 = replace(replace(trim(window.document.getElementById("tb411223").value), '.', ''), ',', '.');
	var total = 0;
	
	if (nil01 == '') {nil01 = '0'};
	if (nil02 == '') {nil02 = '0'};
	if (nil03 == '') {nil03 = '0'};
	if (nil04 == '') {nil04 = '0'};
	if (nil05 == '') {nil05 = '0'};
	if (nil06 == '') {nil06 = '0'};
	if (nil07 == '') {nil07 = '0'};
	if (nil08 == '') {nil08 = '0'};
	if (nil09 == '') {nil09 = '0'};
	if (nil10 == '') {nil10 = '0'};
	if (nil11 == '') {nil11 = '0'};
	if (nil12 == '') {nil12 = '0'};
	total = parseInt(nil01) + parseInt(nil02) +
			  parseInt(nil03) + parseInt(nil04) +
			  parseInt(nil05) + parseInt(nil06) +
			  parseInt(nil07) + parseInt(nil08) +
			  parseInt(nil09) + parseInt(nil10) +
			  parseInt(nil11) + parseInt(nil12);
	window.document.getElementById("tbTotal").value = FormatNumberBy3(replace(total, '.', ','));
}

function HitungSscp(){
	var nil01 = replace(replace(trim(window.document.getElementById("tb411511").value), '.', ''), ',', '.');
	var nil02 = replace(replace(trim(window.document.getElementById("tb411512").value), '.', ''), ',', '.');
	var nil03 = replace(replace(trim(window.document.getElementById("tb411513").value), '.', ''), ',', '.');
	var nil04 = replace(replace(trim(window.document.getElementById("tb411514").value), '.', ''), ',', '.');
	var nil05 = replace(replace(trim(window.document.getElementById("tb411519").value), '.', ''), ',', '.');
	var nil06 = replace(replace(trim(window.document.getElementById("tb423146").value), '.', ''), ',', '.');
	var nil07 = replace(replace(trim(window.document.getElementById("tb411211").value), '.', ''), ',', '.');
	var total = 0;
	
	if (nil01 == '') {nil01 = '0'};
	if (nil02 == '') {nil02 = '0'};
	if (nil03 == '') {nil03 = '0'};
	if (nil04 == '') {nil04 = '0'};
	if (nil05 == '') {nil05 = '0'};
	if (nil06 == '') {nil06 = '0'};
	if (nil07 == '') {nil07 = '0'};
	total = parseInt(nil01) + parseInt(nil02) +
			  parseInt(nil03) + parseInt(nil04) +
			  parseInt(nil05) + parseInt(nil06) +
			  parseInt(nil07);
	window.document.getElementById("tbTotal").value = FormatNumberBy3(replace(total, '.', ','));
}

function HitungTotalZakat(){
	var zMal = replace(replace(trim(window.document.getElementById("txtzMall").value), '.', ''), ',', '.');
	var zFitrah = replace(replace(trim(window.document.getElementById("txtzFitrah").value), '.', ''), ',', '.');
	var Infaq = replace(replace(trim(window.document.getElementById("txtInfaq").value), '.', ''), ',', '.');
	var Wakaf = replace(replace(trim(window.document.getElementById("txtWaqaf").value), '.', ''), ',', '.');
	var Qurban = replace(replace(trim(window.document.getElementById("txtQurban").value), '.', ''), ',', '.');
	var Kemanusiaan = replace(replace(trim(window.document.getElementById("txtKemanusiaan").value), '.', ''), ',', '.');
	
	var total = 0;
	
	if (zMal == '') {zMal = '0'};
	if (zFitrah == '') {zFitrah = '0'};
	if (Infaq == '') {Infaq = '0'};
	if (Wakaf == '') {Wakaf = '0'};
	if (Qurban == '') {Qurban = '0'};
	if (Kemanusiaan == '') {Kemanusiaan = '0'};
	
	total = parseInt(zMal) + parseInt(zFitrah) +
			  parseInt(Infaq) + parseInt(Wakaf) + parseInt(Qurban) +
			  parseInt(Kemanusiaan);
	window.document.getElementById("txtTotal").value = FormatNumberBy3(replace(total, '.', ','));
}
function HitungTotalQurban(){
	var Qurban = replace(replace(trim(window.document.getElementById("txtQurban").value), '.', ''), ',', '.');
	
	var total = 0;
	
	if (Qurban == '') {Qurban = '0'};
	
	total = parseInt(Qurban) ;
	window.document.getElementById("txtTotal").value = FormatNumberBy3(replace(total, '.', ','));
}
function toAscii (chrInput)  {
	var symbols = " !\"#$%&'()*+'-./0123456789:;<=>?@";
	var loAZ = "abcdefghijklmnopqrstuvwxyz";
	symbols+= loAZ.toUpperCase();
	symbols+= "[\\]^_`";
	symbols+= loAZ;
	symbols+= "{|}~";
	var loc;
	loc = symbols.indexOf(chrInput);
	if (loc >-1) { 
		Ascii_Decimal = 32 + loc;
		return (32 + loc);
	}
	return(0);  // If not in range 32-126 return ZERO
}

// copyright 1999 Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place
function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;

// decimal point jump
else if (dec && (keychar == "."))
   {
   myfield.form.elements[dec].focus();
   return false;
   }
else
   return false;
}


function stringAndnumbersonly(myfield, e)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;
else if ((("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ").indexOf(keychar) > -1))
   return true;

else
   return false;
}

function DateOnly(myfield, e)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;
// numbers
else if ((("-").indexOf(keychar) > -1))
   return true;

else
   return false;
}

function toAscii (chrInput)  {
	var symbols = " !\"#$%&'()*+'-./0123456789:;<=>?@";
	var loAZ = "abcdefghijklmnopqrstuvwxyz";
	symbols+= loAZ.toUpperCase();
	symbols+= "[\\]^_`";
	symbols+= loAZ;
	symbols+= "{|}~";
	var loc;
	loc = symbols.indexOf(chrInput);
	if (loc >-1) { 
		Ascii_Decimal = 32 + loc;
		return (32 + loc);
	}
	return(0);  // If not in range 32-126 return ZERO
}

function formatNum(obj){
	var value = fdp(replace(replace(trim(window.document.getElementById(obj).value), '.', ''), ',', '.'), 2);
	window.document.getElementById(obj).value = FormatNumberBy3(replace(value, '.', ','));
}

function ShowTooltip(oTxKet)
{
	document.getElementById("ttKeterangan").innerText=oTxKet;
    x = event.clientX + document.body.scrollLeft - 150;
    y = event.clientY + document.body.scrollTop + 10 - 110;
    Popup.style.display="block";
    Popup.style.left = x;
    Popup.style.top = y;
 }
 function ShowTooltipnorencana(oTxzisbid,oTxNama, oTxAlamat, oTxTelp)
{
	document.getElementById("ttZISBID").innerText=oTxzisbid;
	document.getElementById("ttNama").innerText=oTxNama;
	document.getElementById("ttAlamat").innerText=oTxAlamat;
	document.getElementById("ttTelp").innerText=oTxTelp;
    x = event.clientX + document.body.scrollLeft - 150;
    y = event.clientY + document.body.scrollTop + 10 - 110;
    Popup.style.display="block";
    Popup.style.left = x;
    Popup.style.top = y;
 }
function ShowTooltipNama(oTxNama, oTxAlamat, oTxTelp)
{
	document.getElementById("ttNama").innerText=oTxNama;
	document.getElementById("ttAlamat").innerText=oTxAlamat;
	document.getElementById("ttTelp").innerText=oTxTelp;
    x = event.clientX + document.body.scrollLeft - 150;
    y = event.clientY + document.body.scrollTop + 10 - 110;
    Popup.style.display="block";
    Popup.style.left = x;
    Popup.style.top = y;
 }
 
 function ShowTooltipKetRekap(oKet, oAmil)
{
	document.getElementById("ttket").innerText=oKet;
	document.getElementById("ttamil").innerText=oAmil;
    x = event.clientX + document.body.scrollLeft - 150;
    y = event.clientY + document.body.scrollTop + 10 - 110;
    Popup.style.display="block";
    Popup.style.left = x;
    Popup.style.top = y;
 }

function HideTooltip()
{
    Popup.style.display="none";
}

function HideTooltipZakat()
{
    Popupzakat.style.display="none";
}

function ShowTooltipZakat(oTxnrp, oTxAmil, oTxZmaal, oTxZfitrah,
	 oTxKetzakat, oTxInfaq, oTxKetInfaq, oTxWakaf, oTxQurban, oTxKetQurban, oTxKemanusiaan, oTxKetKemanusiaan)
{
	document.getElementById("ttnrp").innerText=oTxnrp;
	document.getElementById("ttamil").innerText=oTxAmil;
	document.getElementById("ttzmaal").innerText=oTxZmaal;
	document.getElementById("ttzfitrah").innerText=oTxZfitrah;
	document.getElementById("ttketzakat").innerText=oTxKetzakat;
	document.getElementById("ttinfaq").innerText=oTxInfaq;
	document.getElementById("ttketinfaq").innerText=oTxKetInfaq;
	document.getElementById("ttwakaf").innerText=oTxWakaf;
	document.getElementById("ttqurban").innerText=oTxQurban;
	document.getElementById("ttketqurban").innerText=oTxKetQurban;
	document.getElementById("ttkemanusiaan").innerText=oTxKemanusiaan;
	document.getElementById("ttketkemanusiaan").innerText=oTxKetKemanusiaan;

    x = event.clientX + document.body.scrollLeft - 150;
    y = event.clientY + document.body.scrollTop + 10 - 110;
    Popupzakat.style.display="block";
    Popupzakat.style.left = x;
    Popupzakat.style.top = y;
 }