/*--------------------------------------- start of login validation form  function -------------------------------------------*/

function validateuserregisterform(typestr) 
{
	var theMessage = "Please fill up the following field(s): \n";
	var noErrors = theMessage;
	// make sure field is not blank
	if (document.userregisterform.UserRegisterUsername.value=="")
	{
		theMessage = theMessage + "\nUsername";
	}
	// make sure field is not blank
	if (document.userregisterform.UserRegisterICNo.value=="")
	{
		theMessage = theMessage + "\nNew I/C No";
	}
	// make sure field is not blank
	if (document.userregisterform.UserRegisterPassword.value=="")
	{
		theMessage = theMessage + "\nPassword";
	}
	// make sure field is not blank
	if (document.userregisterform.UserRegisterConfirmPassword.value=="")
	{
		theMessage = theMessage + "\nConfirm Password";
	}
	// make sure field is not blank
	if (document.userregisterform.UserRegisterFirstName.value=="")
	{
		theMessage = theMessage + "\nFirst Name";
	}
	// make sure field is not blank
	if (document.userregisterform.UserRegisterLastName.value=="")
	{
		theMessage = theMessage + "\nLast Name";
	}
	// make sure field is not blank
	if (document.userregisterform.UserRegisterAddress.value=="")
	{
		theMessage = theMessage + "\nAddress";
	}
	// make sure field is not blank
	if (document.userregisterform.UserRegisterEmail.value=="")
	{
		theMessage = theMessage + "\nEmail";
	}
	// make sure field is not blank
	if (document.userregisterform.UserRegisterTelephone.value=="")
	{
		theMessage = theMessage + "\nTelephone";
	}
	if(typestr == 1)
	{
		// make sure field is not blank
		if (document.userregisterform.UserRegisterJobTitle.value=="")
		{
			theMessage = theMessage + "\nJob Title";
		}
		// Make sure a selection list is used
		var listCheck = document.userregisterform.UserRegisterUnit.selectedIndex;
		if (document.userregisterform.UserRegisterUnit.options[listCheck].value=="none") {
		theMessage = theMessage + "\nUnit";
		}
		// Make sure a selection list is used
		var listCheck = document.userregisterform.UserRegisterRole.selectedIndex;
		if (document.userregisterform.UserRegisterRole.options[listCheck].value=="none") {
		theMessage = theMessage + "\nRole";
		}
		// Make sure a selection list is used
		var listCheck = document.userregisterform.UserRegisterStatus.selectedIndex;
		if (document.userregisterform.UserRegisterStatus.options[listCheck].value=="none") {
		theMessage = theMessage + "\nStatus";
		}
		// Make sure a selection list is used
		var listCheck = document.userregisterform.UserRegisterState.selectedIndex;
		if (document.userregisterform.UserRegisterState.options[listCheck].value=="none") {
		theMessage = theMessage + "\nState";
		}		
	}
	// If no errors, submit the form
	if (theMessage == noErrors) 
	{
		return true;
	} 
	// If errors were found, show alert message
	else 	
	{
		alert(theMessage);
		return false;
	}
}
// End -->

/*-------------------------------------------- end of login validation form  function ----------------------------------------------*/
/*--------------------------------------- start of login validation form  function -------------------------------------------*/

function validateuserupdateform(form) 
{
	var theMessage = "Please fill up the following field(s): \n";
	var noErrors = theMessage
	// make sure field is not blank
	if (document.userupdateform.ModifyUserRegisterUsername.value=="")
	{
		theMessage = theMessage + "\nUsername";
	}
	// make sure field is not blank
	if (document.userupdateform.ModifyUserRegisterICNo.value=="")
	{
		theMessage = theMessage + "\nNew I/C No";
	}
	// make sure field is not blank
	if (document.userupdateform.ModifyUserRegisterPassword.value=="")
	{
		theMessage = theMessage + "\nPassword";
	}
	// make sure field is not blank
	if (document.userupdateform.ModifyUserRegisterConfirmPassword.value=="")
	{
		theMessage = theMessage + "\nConfirm Password";
	}
	// make sure field is not blank
	if (document.userupdateform.ModifyUserRegisterFirstName.value=="")
	{
		theMessage = theMessage + "\nFirst Name";
	}
	// make sure field is not blank
	if (document.userupdateform.ModifyUserRegisterLastName.value=="")
	{
		theMessage = theMessage + "\nLast Name";
	}
	// make sure field is not blank
	if (document.userupdateform.ModifyUserRegisterJobTitle.value=="")
	{
		theMessage = theMessage + "\nJob Title";
	}
	// Make sure a selection list is used
	var listCheck = document.userupdateform.ModifyUserRegisterUnit.selectedIndex;
	if (document.userupdateform.ModifyUserRegisterUnit.options[listCheck].value=="none") {
	theMessage = theMessage + "\nUnit";
	}
	// Make sure a selection list is used
	var listCheck = document.userupdateform.ModifyUserRegisterRole.selectedIndex;
	if (document.userupdateform.ModifyUserRegisterRole.options[listCheck].value=="none") {
	theMessage = theMessage + "\nRole";
	}
	// Make sure a selection list is used
	var listCheck = document.userupdateform.ModifyUserRegisterState.selectedIndex;
	if (document.userupdateform.ModifyUserRegisterState.options[listCheck].value=="none") {
	theMessage = theMessage + "\nState";
	}
	// make sure field is not blank
	if (document.userupdateform.ModifyUserRegisterAddress.value=="")
	{
		theMessage = theMessage + "\nAddress";
	}
	// make sure field is not blank
	if (document.userupdateform.ModifyUserRegisterEmail.value=="")
	{
		theMessage = theMessage + "\nEmail";
	}
	// make sure field is not blank
	if (document.userupdateform.ModifyUserRegisterTelephone.value=="")
	{
		theMessage = theMessage + "\nTelephone";
	}
	// Make sure a selection list is used
	var listCheck = document.userupdateform.ModifyUserRegisterStatus.selectedIndex;
	if (document.userupdateform.ModifyUserRegisterStatus.options[listCheck].value=="none") {
	theMessage = theMessage + "\nStatus";
	}
	// If no errors, submit the form
	if (theMessage == noErrors) 
	{
		return true;
	} 
	// If errors were found, show alert message
	else 	
	{
		alert(theMessage);
		return false;
	}
}
// End -->

/*-------------------------------------------- end of login validation form  function ----------------------------------------------*/
/*------------------------------------------ start of delete comfirmation function ------------------------------------------------*/
function checkPembayaran(path)
{
	var message = confirm("Pastikan anda menyemak semua maklumat yang dipaparkan\nKlik butang 'OK' untuk teruskan proses pembayaran cukai\nKlik butang 'Cancel' untuk menyemak semula maklumat\n\nTeruskan dengan proses pembayaran cukai?")
	if (message)
	{
		document.formsemak.action = path + 'form/01_fpx_main.cfm';
		document.formsemak.target="_self";
		return true;
	}
	else
		return false;
}

function checkPembayaranNew(path)
{
	var message = confirm("Pastikan anda menyemak semua maklumat yang dipaparkan\nKlik butang 'OK' untuk teruskan proses pembayaran cukai\nKlik butang 'Cancel' untuk menyemak semula maklumat\n\nTeruskan dengan proses pembayaran cukai?")
	if (message)
	{
		document.formsemak.action = path + 'modules/epayment/setuju_bayar.cfm';
		document.formsemak.target="_self";
		return true;
	}
	else
		return false;
}
/*--------------------------------------------- end delete comfirmation function ---------------------------------------------------*/
/*----------------------------------------- start of Kad Kredit validation form function -------------------------------------------*/
function validateKadKredit()
{
	var theMessage = "Harap maaf, anda perlu mengisi maklumat berikut\nuntuk teruskan proses pembayaran cukai tanah:\n";
	var noErrors = theMessage;
	// make sure field is not blank
	// make sure field is not blank
	if (document.form1.vpc_CardNum.value=="")
	{
		theMessage = theMessage + "\nCard Number";
	}
	// make sure field is not blank
	if (document.form1.vpc_CardExp.value=="")
	{
		theMessage = theMessage + "\nCard Expiry Date";
	}
	// make sure field is not blank
	if (document.form1.vpc_CardSecurityCode.value=="")
	{
		theMessage = theMessage + "\nCard Security Code";
	}
	// If no errors, submit the form
	if (theMessage == noErrors) 
	{
		var message = confirm("Pastikan anda menyemak semua maklumat yang dimasukan\nKlik butang 'OK' untuk teruskan proses pembayaran cukai\nKlik butang 'Cancel' untuk menyemak semula maklumat\n\nTeruskan dengan proses pembayaran cukai?")
		if (message)
		{
			return true;
		}
		else
			return false;
		/*return true;*/
	} 
	// If errors were found, show alert message
	else 	
	{
		alert(theMessage);
		return false;
	}
}
/*------------------------------------------- end of Kad Kredit validation form function -------------------------------------------*/
/*------------------------------------------- start cetak maklumat cukai function --------------------------------------------------*/
function cetakMaklumatCukai(path, nohakmilikstr)
{
	/*alert(path + "" + nohakmilikstr);*/
	window.open(path + 'form/cetak_cukai.cfm?id=' + nohakmilikstr,'NewWin','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=800, height=600');
}
/*--------------------------------------------- end cetak maklumat cukai function --------------------------------------------------*/
/*------------------------------ start of login validation perumahan swasta district form function ----------------------------------*/
function validateformpembayaran(path,jumlahstr) 
{
	var theMessage = "Harap maaf, ";
	var noErrors = theMessage;

	// make sure a radio button is selected
	var radioCheck = false;
	for (i = 0; i < document.form2.CaraBayar.length; i++) 
	{
		if (document.form2.CaraBayar[i].checked)
		{
			typeofpayment = document.form2.CaraBayar[i].value;		
			/*alert('typeofpayment' + typeofpayment);	*/
			radioCheck = true; 
		}
	}
	if (!radioCheck) {
	theMessage = theMessage + "sila pilih cara bayaran yang ingin anda gunakan samaada\nBayaran Melalui Perbankan Elektronik atau Bayaran Melalui Kad Kredit";
	}
	// If errors were found, show alert message
	if (theMessage == noErrors) 
	{

		var mine = window.open("https://210.187.85.180/FPXMain/sellerB2CMesgRecv.jsp","test1","width=1,height=1,left=0,top=0,scrollbars=no");
		
		//var mine = window.open("","","width=1,height=1,left=0,top=0,scrollbars=no");

		if(mine)
			var popUpsBlocked = false;
		else
			var popUpsBlocked = true;
	
		mine.close();	
		
		/*alert(popUpsBlocked);*/
		
		if(popUpsBlocked)
		{
			alert('We have detected that you are using popup blocking software.\n This website needs to open a window to your internet Banking Website.\n Please disable your popup blocker.');
			return false;
		}
		else
		{
			var ss=document.form2.messageAmount.value;
			var errorstr = "errorfalse";

			// Make sure a selection list is used
			if (ss>5000) 
			{
				theMessage = theMessage + "Jumlah Perlu Bayar melebihi had maksima.\nHad maksima bayaran adalah kurang dari RM 5000.\nSila pilih kaedah bayaran yang lain.";
				errorstr = "errortrue";
				document.form2.Submit.disabled=true;
				// make sure a radio button is selected
				var radioCheck = false;
				for (i = 0; i < document.form2.CaraBayar.length; i++) 
				{
					document.form2.CaraBayar[i].disabled=true;
				}
			}
			if (ss=="" || ss==0) 
			{
				theMessage = theMessage + "sila pastikan jumlah bayaran yang ingin dijelaskan tidak\nkurang dari RM 1.00";
				errorstr = "errortrue";
			}
			if (ss>jumlahstr && ss<=5000) 
			{
				theMessage = theMessage + "sila pastikan jumlah bayaran yang ingin dijelaskan tidak\nmelebihi jumlah patut bayar. Jumlah perlu bayar ialah RM "+jumlahstr;
				errorstr = "errortrue";
			}
			
			if(errorstr == 'errorfalse')
			{
				if(typeofpayment=="FPX")
				{
		
					document.form2.action = path + 'form/02_fpx_confirm.php';
					document.form2.submit();
					document.form2.method="post";
					document.form2.target="_self";
					return true;
				}
				if(typeofpayment=="KadKredit")
				{
					document.form2.action = path + 'form/02_kadkredit_confirm.cfm';
					/*document.form2.action = path + 'form/vpc_php_serverhost.cfm';*/
					document.form2.submit();
					document.form2.method="post";
					document.form2.target="_self";
					return true;
				}	
			}
			else
			{
				alert(theMessage);
				return false;
			}
		}
	} 
	// If no errors, submit the form
	else 	
	{
		alert(theMessage);
		return false;
	}
}




function validateformpembayaranMEPS(path,jumlahstr) 
{
	var theMessage = "Harap maaf, ";
	var noErrors = theMessage;

	// make sure a radio button is selected
	var typeofpayment = document.form1.carabyr1.value;
		   
	if (typeofpayment == "error") {
	theMessage = theMessage + "sila pilih cara bayaran yang ingin anda gunakan samaada\nBayaran Melalui Perbankan Elektronik atau Bayaran Melalui Kad Kredit";
	}
	// If errors were found, show alert message
	if (theMessage == noErrors) 
	{

		var mine = window.open("https://210.187.85.180/FPXMain/sellerB2CMesgRecv.jsp","test1","width=1,height=1,left=0,top=0,scrollbars=no");
		
		//var mine = window.open("","","width=1,height=1,left=0,top=0,scrollbars=no");

		if(mine)
			var popUpsBlocked = false;
		else
			var popUpsBlocked = true;
	
		mine.close();	
		
		/*alert(popUpsBlocked);*/
		
		if(popUpsBlocked)
		{
			alert('We have detected that you are using popup blocking software.\n This website needs to open a window to your internet Banking Website.\n Please disable your popup blocker.');
			return false;
		}
		else
		{
			var ss=document.form1.messageAmount.value;
			var errorstr = "errorfalse";

			// Make sure a selection list is used
			if (ss>5000) 
			{
				theMessage = theMessage + "Jumlah Perlu Bayar melebihi had maksima.\nHad maksima bayaran adalah kurang dari RM 5000.\nSila pilih kaedah bayaran yang lain.";
				errorstr = "errortrue";
				document.form1.Submit.disabled=true;
			}
			if (ss=="" || ss==0) 
			{
				theMessage = theMessage + "sila pastikan jumlah bayaran yang ingin dijelaskan tidak\nkurang dari RM 1.00";
				errorstr = "errortrue";
			}
			if (ss>jumlahstr && ss<=5000) 
			{
				theMessage = theMessage + "sila pastikan jumlah bayaran yang ingin dijelaskan tidak\nmelebihi jumlah patut bayar. Jumlah perlu bayar ialah RM "+jumlahstr;
				errorstr = "errortrue";
			}
			
			if(errorstr == 'errorfalse')
			{
				if(typeofpayment=="MEPSFPX")
				{
		
					document.form1.action = path + 'modules/epayment/mepsfpx_indirect_to.php';
					document.form1.submit();
					document.form1.method="post";
					document.form1.target="_self";
					return true;
				}
				else
				{
					return false;
				}	
			}
			else
			{
				alert(theMessage);
				return false;
			}
		}
	} 
	// If no errors, submit the form
	else 	
	{
		alert(theMessage);
		return false;
	}
}



function validateformpembayaranMIGS(path,jumlahstr) 
{
	var theMessage = "Harap maaf, ";
	var noErrors = theMessage;

	// make sure a radio button is selected
	var typeofpayment = document.form2.carabyr2.value;
	
	alert(typeofpayment);
	return false;
	
	if (typeofpayment == "error") {
	theMessage = theMessage + "sila pilih cara bayaran yang ingin anda gunakan samaada\nBayaran Melalui Perbankan Elektronik atau Bayaran Melalui Kad Kredit";
	}
	// If errors were found, show alert message
	if (theMessage == noErrors) 
	{

		var mine = window.open("https://210.187.85.180/FPXMain/sellerB2CMesgRecv.jsp","test1","width=1,height=1,left=0,top=0,scrollbars=no");
		
		//var mine = window.open("","","width=1,height=1,left=0,top=0,scrollbars=no");

		if(mine)
			var popUpsBlocked = false;
		else
			var popUpsBlocked = true;
	
		mine.close();	
		
		/*alert(popUpsBlocked);*/
		
		if(popUpsBlocked)
		{
			alert('We have detected that you are using popup blocking software.\n This website needs to open a window to your internet Banking Website.\n Please disable your popup blocker.');
			return false;
		}
		else
		{
			var ss=document.form2.messageAmount.value;
			var errorstr = "errorfalse";

			// Make sure a selection list is used
			if (ss>5000) 
			{
				theMessage = theMessage + "Jumlah Perlu Bayar melebihi had maksima.\nHad maksima bayaran adalah kurang dari RM 5000.\nSila pilih kaedah bayaran yang lain.";
				errorstr = "errortrue";
				document.form2.Submit.disabled=true;
				// make sure a radio button is selected
				var radioCheck = false;
				for (i = 0; i < document.form2.CaraBayar.length; i++) 
				{
					document.form2.CaraBayar[i].disabled=true;
				}
			}
			if (ss=="" || ss==0) 
			{
				theMessage = theMessage + "sila pastikan jumlah bayaran yang ingin dijelaskan tidak\nkurang dari RM 1.00";
				errorstr = "errortrue";
			}
			if (ss>jumlahstr && ss<=5000) 
			{
				theMessage = theMessage + "sila pastikan jumlah bayaran yang ingin dijelaskan tidak\nmelebihi jumlah patut bayar. Jumlah perlu bayar ialah RM "+jumlahstr;
				errorstr = "errortrue";
			}
			
			if(errorstr == 'errorfalse')
			{
				if(typeofpayment=="FPX")
				{
		
					document.form2.action = path + 'modules/epayment/mepsfpx_proses.php';
					document.form2.submit();
					document.form2.method="post";
					document.form2.target="_self";
					return true;
				}
				if(typeofpayment=="KadKredit")
				{
					document.form2.action = path + 'modules/epayment/kadkredit_proses.cfm';
					/*document.form2.action = path + 'form/vpc_php_serverhost.cfm';*/
					document.form2.submit();
					document.form2.method="post";
					document.form2.target="_self";
					return true;
				}	
			}
			else
			{
				alert(theMessage);
				return false;
			}
		}
	} 
	// If no errors, submit the form
	else 	
	{
		alert(theMessage);
		return false;
	}
}

// End -->
/*------------------------------ end of login validation perumahan swasta district form function -----------------------------------*/
/*------------------------------ start of login validation perumahan swasta district form function ----------------------------------*/
function validateformpembayarancukai(path,jumlahstr) 
{
		alert('jumlahstr: '+jumlahstr);
		var theMessage = "Harap maaf, ";
		var noErrors = theMessage;
		var ss=document.form2.messageAmount.value;

		var mine = window.open("https://210.187.85.180/FPXMain/sellerB2CMesgRecv.jsp","test1","width=1,height=1,left=0,top=0,scrollbars=no");
		
		//var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
		
		if(mine)
			var popUpsBlocked = false;
		else
			var popUpsBlocked = true;
	
		mine.close();	
		
		/*alert(popUpsBlocked);*/
		
		if(popUpsBlocked)
		{
			alert('We have detected that you are using popup blocking software.\n This website needs to open a window to your internet Banking Website.\n Please disable your popup blocker.');
			return false;
		}

		// Make sure a selection list is used
		if (ss>5000) 
		{
			theMessage = theMessage + "Jumlah Perlu Bayar melebihi had maksima\nFPX hanya menerima bayaran kurang dari RM 5000.\nSila pilih kaedah bayaran yang lain.";
		}
		if (ss=="" || ss==0) 
		{
			theMessage = theMessage + "sila pastikan jumlah bayaran yang ingin dijelaskan tidak\nkurang dari RM 1.00";
		}
		if (ss>jumlahstr && ss<=5000) 
		{
			theMessage = theMessage + "sila pastikan jumlah bayaran yang ingin dijelaskan tidak\nmelebihi jumlah patut bayar. Jumlah perlu bayar ialah RM "+jumlahstr;
		}

		// If errors were found, show alert message
		if (theMessage == noErrors) 
		{
			document.form2.action = path + 'form/02_fpx_confirm.php';
			document.form2.submit();
			return true;
		}
		// If no errors, submit the form
		else
		{
			alert(theMessage);
			return false;
		}
}
// End -->
/*------------------------------ end of login validation perumahan swasta district form function -----------------------------------*/

/*----------------------------------------- start of pop up blocker validation form function -------------------------------------*/
function openPopupBlocker() {

	var mine = window.open("https://210.187.85.180/FPXMain/sellerB2CMesgRecv.jsp","test1","width=1,height=1,left=0,top=0,scrollbars=no");
	
	if(mine)
		var popUpsBlocked = false;
	else
		var popUpsBlocked = true;

	mine.close();	
	
	/*alert(popUpsBlocked);*/
	
	if(popUpsBlocked)
	{
		alert('We have detected that you are using popup blocking software.\n This website needs to open a window to your internet Banking Website.\n Please disable your popup blocker.');
		return false;
	}
	
}
/*----------------------------------------- end of pop up blocker validation form function -------------------------------------*/
/*--------------------------------------- start of carian cukai validation form function ------------------------------------------*/
function validateformcariancukai() 
{

	var theMessage = "Untuk membuat semakan bagi pembayaran cukai yang\nperlu anda jelaskan, anda perlu lengkapkan kesemua\nmaklumat yang berikut";
	var noErrors = theMessage
	var listCheckDaerah = document.myform.DaerahSelectBox.selectedIndex;
	var listCheckMukim = document.myform.MukimSelectBox.selectedIndex;
	var listCheckJenisHakmilik = document.myform.JenisHakmilikSelectbox.selectedIndex;
	
	// make sure field is not blank
	if (document.myform.DaerahSelectBox.options[listCheckDaerah].value=="none" || document.myform.MukimSelectBox.options[listCheckMukim].value=="none" || document.myform.JenisHakmilikSelectbox.options[listCheckJenisHakmilik].value=="none" || document.myform.nohakmilik.value=="") {
	/*theMessage = theMessage + "\nNo Lot\nNo Hakmilik\nNo Kad Pengenalan";*/
	theMessage = theMessage + " ";
	}
	
	// If no errors, submit the form
	if (theMessage == noErrors) {
	return true;
	
	} else {
	
	// If errors were found, show alert message
	alert(theMessage);
	return false;
	}
}
/*------------------------------------------ end of carian cukai validation form function -----------------------------------------*/

/*--------------------------------------- start of carian perserahan validation form function ------------------------------------------*/
function validateformcarianpsrh() 
{

	var theMessage = "Untuk membuat semakan perserahan, \nsila lengkapkan maklumat yang berikut";
	var noErrors = theMessage
	var listCheckDaerah = document.myform.DaerahSelectBox.selectedIndex;
//	var listCheckPsrh	= document.myform.JnsPsrhSelectBox.selectedIndex;
//	var listCheckUrusan = document.myform.UrusanSelectBox.selectedIndex;
	
	// make sure field is not blank
	if (document.myform.DaerahSelectBox.options[listCheckDaerah].value=="none" || document.myform.iDurusan.value=="" || document.myform.noperserahan.value=="") {
	/*theMessage = theMessage + "\nNo Lot\nNo Hakmilik\nNo Kad Pengenalan";*/
	theMessage = theMessage + " ";
	}
	
	// If no errors, submit the form
	if (theMessage == noErrors) {
	return true;
	
	} else {
	
	// If errors were found, show alert message
	alert(theMessage);
	return false;
	}
}
/*------------------------------------------ end of carian cukai validation form function -----------------------------------------*/


/*------------------------------ start of login validation perumahan swasta district form function ----------------------------------*/
function validateformmukim(form) 
{
	var theMessage = "Sila pilih Daerah bagi Mukim yang ingin\nanda pilih";
	var noErrors = theMessage;
	var listCheckDaerah = document.myform.DaerahSelectBox.selectedIndex;
	// Make sure a selection list is used
	if (document.myform.DaerahSelectBox.options[listCheckDaerah].value=="none") 
	{
		theMessage = theMessage + " ";
	}
	// If errors were found, show alert message
	if (theMessage == noErrors) 
	{
		return true;
	} 
	// If no errors, submit the form
	else 	
	{
		alert(theMessage);
		document.myform.DaerahSelectBox.focus();
		return false;
	}
}
// End -->

/*------------------------------ end of login validation perumahan swasta district form function -----------------------------------*/
/*------------------------------ query urusan for SPTB ----------------------------------*/
function validateformurusan(form) 
{
	var theMessage = "Sila pilih jenis perserahan bagi urusan yang ingin\nanda pilih";
	var noErrors = theMessage;
	var listCheckPsrh = document.myform.JnsPsrhSelectBox.selectedIndex;
	
	// Make sure a selection list is used
	if (document.myform.JnsPsrhSelectBox.options[listCheckPsrh].value=="none") 
	{
		theMessage = theMessage + " ";
	}
	// If errors were found, show alert message
	if (theMessage == noErrors) 
	{
		return true;
	} 
	// If no errors, submit the form
	else 	
	{
		alert(theMessage);
		document.myform.JnsPsrhSelectBox.focus();
		return false;
	}
}
// End -->

/*------------------------------ end of query urusan sptb -----------------------------------*/

/*------------------------------ start of login validation perumahan swasta district form function ----------------------------------*/
function validateformnohakmiliklength(form) 
{
	var theMessage = "Sila pastikan No Hakmilik adalah 8 digit";
	var noErrors = theMessage;
	var ss=document.myform.nohakmilik.value;
	result = ss.length;

	// Make sure a selection list is used
	if (ss!= "" && result<1) 
	{
		document.myform.cari.disabled=true;	
		theMessage = theMessage + " ";
	}
	// If errors were found, show alert message
	if (theMessage == noErrors) 
	{
		document.myform.cari.disabled=false;	
		return true;
	} 
	// If no errors, submit the form
	else 	
	{
		alert(theMessage);		
		return false;
	}
}
// End -->
/*------------------------------ end of login validation perumahan swasta district form function -----------------------------------*/
/*------------------------------ start of check validation perserahan number form function ----------------------------------*/
function validateformnopsrhlength(form) 
{
	var theMessage = "Sila pastikan No Perserahan adalah 6 hingga 11 digit";
	var noErrors = theMessage;
	var ss=document.myform.noperserahan.value;
	result = ss.length;

	// Make sure a selection list is used
	if (ss!= "" && result<6) 
	{
		document.myform.cari.disabled=true;	
		theMessage = theMessage + " ";
	}
	// If errors were found, show alert message
	if (theMessage == noErrors) 
	{
		document.myform.cari.disabled=false;	
		return true;
	} 
	// If no errors, submit the form
	else 	
	{
		alert(theMessage);
		return false;
	}
}
// End -->
/*------------------------------ end of login validation perumahan swasta district form function -----------------------------------*/
/*------------------------------------------- start of polls validation form function ---------------------------------------------*/
function validatepolls(form,path) {
	var theMessage = "Harap maaf, anda perlu memilih salah satu dari jawapan yang disediakan\nSila pilih jawapan bagi undian anda";
	// make sure a radio button is selected
	var radioCheck = false;
	for (i = 0; i < document.poolform.p_ansvers_number.length; i++) {
	if (document.poolform.p_ansvers_number[i].checked)
	{
	poolform.action= path + 'undian/keputusan_undian.cfm';
	radioCheck = true; 
	}
	}
	if (!radioCheck) {
	alert(theMessage);
	return false;
	}
}
/*-------------------------------------------- end of polls validation form function ----------------------------------------------*/
/*------------------------------------------ start of delete comfirmation function ------------------------------------------------*/

function confirmaction(url)
{
	var message = confirm("Pastikan anda telah memilih data yang betul untuk dihapuskan\nKlik butang 'OK' untuk teruskan proses menghapuskan data\nKlik butang 'Cancel' untuk memilih data yang lain\n\nTeruskan dengan proses menghapuskan data?")
	if (message)
		window.location = url;
}

/*--------------------------------------------- end delete comfirmation function ---------------------------------------------------*/
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
function validateadminpolls(form,path) 
{
	var theMessage = "Sila isikan semua maklumat berikut: \n";
	var noErrors = theMessage;
	// make sure field is not blank
	var listCheckQuestion = document.fAdminUndian.selectQuestion.selectedIndex;
	// Make sure a selection list is used
	if (document.fAdminUndian.selectQuestion.options[listCheckQuestion].value=="0") 
	{
		theMessage = theMessage + "\nSoalan Undian";
	}
	// make sure field is not blank
	if (document.fAdminUndian.P_ANSVER.value=="")
	{
		theMessage = theMessage + "\nJawapan Undian";
	}
	// If no errors, submit the form
	if (theMessage == noErrors) 
	{
	/*fAdminUndian.action= path + 'admin/poll_admin_process.cfm?task=daftar';*/
		return true;
	} 
	// If errors were found, show alert message
	else 	
	{
		alert(theMessage);
		return false;
	}
}
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
function validateadminpolluestions(form,path) 
{
	var theMessage = "Sila isikan maklumat berikut: \n";
	var noErrors = theMessage;
	// make sure field is not blank
	// make sure field is not blank
	if (document.fAdminSoalanUndian.fPollQuestions.value=="")
	{
		theMessage = theMessage + "\nSoalan Undian";
	}
	// If no errors, submit the form
	if (theMessage == noErrors) 
	{
		return true;
	} 
	// If errors were found, show alert message
	else 	
	{
		alert(theMessage);
		return false;
	}
}
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
function validateadminnews(form,path) 
{
	var theMessage = "Sila isikan maklumat berikut: \n";
	var noErrors = theMessage;
	// make sure field is not blank
	if (document.fAdminNews.fNewsTitle.value=="")
	{
		theMessage = theMessage + "\nTajuk";
	}
	// make sure field is not blank
	if (document.fAdminNews.fNewsDetails.value=="")
	{
		theMessage = theMessage + "\nBerita";
	}
	// If no errors, submit the form
	if (theMessage == noErrors) 
	{
		return true;
	} 
	// If errors were found, show alert message
	else 	
	{
		alert(theMessage);
		return false;
	}
}
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
function validateadminunit(form,path) 
{
	var theMessage = "Sila isikan maklumat berikut: \n";
	var noErrors = theMessage;
	// make sure field is not blank
	if (document.fAdminUnit.fUnitTitle.value=="")
	{
		theMessage = theMessage + "\nUnit";
	}
	// make sure field is not blank
	if (document.fAdminUnit.fUnitDetails.value=="")
	{
		theMessage = theMessage + "\nKeterangan";
	}
	// If no errors, submit the form
	if (theMessage == noErrors) 
	{
		return true;
	} 
	// If errors were found, show alert message
	else 	
	{
		alert(theMessage);
		return false;
	}
}
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
function validateadmingaleri(form, path, file) 
{
	var theMessage = "Sila isikan maklumat berikut: \n";
	var noErrors = theMessage;
	// make sure field is not blank
	if (document.fAdminGaleri.fGaleriTitle.value=="")
	{
		theMessage = theMessage + "\nTajuk";
	}
	// make sure field is not blank
	if (document.fAdminGaleri.fGaleriDetails.value=="")
	{
		theMessage = theMessage + "\nKeterangan";
	}
	// make sure field is not blank
	if (document.fAdminGaleri.fFiletoUpload.value=="")
	{
		theMessage = theMessage + "\nImej (.gif, .jpg, .png sahaja)";
	}
	// make sure field is not blank
	if (document.fAdminGaleri.fFiletoUpload.value!="")
	{
		extArray = new Array(".gif", ".jpg", ".png");	
		allowSubmit = false;
		if (!file) return;
		while (file.indexOf("\\") != -1)
		file = file.slice(file.indexOf("\\") + 1);
		ext = file.slice(file.indexOf(".")).toLowerCase();
		for (var i = 0; i < extArray.length; i++) {
		if (extArray[i] == ext) 
		{ 
		allowSubmit = true; break; 
		}
		}
		if (!allowSubmit) 
		theMessage = theMessage + "\nImej dengan 'file extension' berikut tidak dibenarkan";
	}		
	// If no errors, submit the form
	if (theMessage == noErrors) 
	{
		return true;
	} 
	// If errors were found, show alert message
	else 	
	{
		alert(theMessage);
		return false;
	}
}
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
function validateadminstaff(form,path) 
{
	var theMessage = "Sila isikan semua maklumat berikut: \n";
	var noErrors = theMessage;
	// make sure field is not blank
	var listCheckUnit = document.fAdminStaff.fStaffUnit.selectedIndex;
	// Make sure a selection list is used
	if (document.fAdminStaff.fStaffUnit.options[listCheckUnit].value=="0") 
	{
		theMessage = theMessage + "\nUnit";
	}
	// make sure field is not blank
	if (document.fAdminStaff.fStaffNama.value=="")
	{
		theMessage = theMessage + "\nNama";
	}
	// make sure field is not blank
	if (document.fAdminStaff.fStaffJawatan.value=="")
	{
		theMessage = theMessage + "\nJawatan";
	}
	// make sure field is not blank
	if (document.fAdminStaff.fStaffGred.value=="")
	{
		theMessage = theMessage + "\nGred";
	}
	// make sure field is not blank
	if (document.fAdminStaff.fStaffGredNo.value=="")
	{
		theMessage = theMessage + "\nGred No";
	}
	// make sure field is not blank
	/*if (document.fAdminStaff.fStaffEmail.value=="")
	{
		theMessage = theMessage + "\nEmail";
	}*/
	// If no errors, submit the form
	if (theMessage == noErrors) 
	{
	/*fAdminUndian.action= path + 'admin/poll_admin_process.cfm?task=daftar';*/
		return true;
	} 
	// If errors were found, show alert message
	else 	
	{
		alert(theMessage);
		return false;
	}
}
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
function validateadminmakluman(form,path) 
{
	var theMessage = "Sila isikan maklumat berikut: \n";
	var noErrors = theMessage;
	// make sure field is not blank
	if (document.fAdminMakluman.fMaklumanTitle.value=="")
	{
		theMessage = theMessage + "\nTajuk";
	}
	// make sure field is not blank
	if (document.fAdminMakluman.fMaklumanDetails.value=="")
	{
		theMessage = theMessage + "\nMakluman";
	}
	// If no errors, submit the form
	if (theMessage == noErrors) 
	{
		return true;
	} 
	// If errors were found, show alert message
	else 	
	{
		alert(theMessage);
		return false;
	}
}
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
function validateadminsoalanlazim(form,path) 
{
	var theMessage = "Sila isikan maklumat berikut: \n";
	var noErrors = theMessage;
	// make sure field is not blank
	if (document.fAdminSoalanLazim.fSoalanLazim.value=="")
	{
		theMessage = theMessage + "\nSoalan Lazim";
	}
	// make sure field is not blank
	if (document.fAdminSoalanLazim.fJawapanSoalanlazim.value=="")
	{
		theMessage = theMessage + "\nJawapan Soalan Lazim";
	}
	// If no errors, submit the form
	if (theMessage == noErrors) 
	{
		return true;
	} 
	// If errors were found, show alert message
	else 	
	{
		alert(theMessage);
		return false;
	}
}
/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
/*--------------------------------------- start of login validation form function -------------------------------------------*/

function validateloginform(form) 
{
	var theMessage = "Sila isikan yang berikut: \n";
	var noErrors = theMessage;
	// make sure field is not blank
	if (document.fAdminPTG.fKatanama.value=="")
	{
		theMessage = theMessage + "\nKata Nama";
	}
	// make sure field is not blank
	if (document.fAdminPTG.fKatalaluan.value=="")
	{
		theMessage = theMessage + "\nKata Laluan";
	}
	// If no errors, submit the form
	if (theMessage == noErrors) 
	{
		return true;
	} 
	// If errors were found, show alert message
	else 	
	{
		alert(theMessage);
		return false;
	}
}
// End -->

/*-------------------------------------------- end of login validation form function ----------------------------------------------*/
/*---------------------------------------------- start of FAQ validation form function --------------------------------------------*/

function validateformfaq() 
{

	/*var theMessage = "Sila isikan maklumat berikut: \n";*/
	var theMessage = "Harap maaf, anda perlu kesemua maklumat berikut";
	var noErrors = theMessage
	
	// make sure field is not blank
	if (document.myform.nama.value=="") {
	/*theMessage = theMessage + "\nNama";*/
	theMessage = theMessage + " ";
	}
	
	// validate an e-mail address
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.myform.email.value)){
	/*theMessage = theMessage + "\nEmail";*/
	theMessage = theMessage + " ";
	}
	
	// make sure field is not blank
	if (document.myform.tajuk.value=="") {
	/*theMessage = theMessage + "\nTajuk";*/
	theMessage = theMessage + " ";
	}
	
	// make sure field is not blank
	if (document.myform.telefon.value=="") {
	/*theMessage = theMessage + "\nTelefon";*/
	theMessage = theMessage + " ";
	}
	
	// make sure field is not blank
	if (document.myform.ulasan.value=="") {
	/*theMessage = theMessage + "\nSoalan";*/
	theMessage = theMessage + " ";
	}
	
	// If no errors, submit the form
	if (theMessage == noErrors) {
	return true;
	
	} else {
	
	// If errors were found, show alert message
	alert(theMessage);
	return false;
	}
}
// End -->
/*---------------------------------------------- end of FAQ validation form function --------------------------------------------*
/*--------------------------------------- start of aduan & cadangan validation form function -------------------------------------*/

function validateformaduancadangan() 
{

	/*var theMessage = "Sila isikan maklumat berikut: \n";*/
	var theMessage = "Harap maaf, anda perlu kesemua maklumat berikut";
	var noErrors = theMessage
	
	// make sure field is not blank
	if (document.myform.nama.value=="") {
	/*theMessage = theMessage + "\nNama";*/
	theMessage = theMessage + " ";
	}
	
	// validate an e-mail address
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.myform.email.value)){
	/*theMessage = theMessage + "\nEmail";*/
	theMessage = theMessage + " ";
	}
	
	// make sure field is not blank
	if (document.myform.tajuk.value=="") {
	/*theMessage = theMessage + "\nTajuk";*/
	theMessage = theMessage + " ";
	}
	
	var listCheckKategori = document.myform.selectKategori.selectedIndex;
	// Make sure a selection list is used
	if (document.myform.selectKategori.options[listCheckKategori].value=="none") 
	{
		/*theMessage = theMessage + "\nKategori Ulasan";*/
		theMessage = theMessage + " ";
	}
	
	// make sure field is not blank
	if (document.myform.ulasan.value=="") {
	/*theMessage = theMessage + "\nUlasan";*/
	theMessage = theMessage + " ";
	}
	
	// If no errors, submit the form
	if (theMessage == noErrors) {
	return true;
	
	} else {
	
	// If errors were found, show alert message
	alert(theMessage);
	return false;
	}
}
/*----------------------------------------- end of aduan & cadangan validation form function -------------------------------------*/
/*--------------------------------------- start of papar laporan kemajuan validation form function ------------------------------------------*/
function validateformpaparlaporan() 
{

	var theMessage = "Untuk paparan laporan bulanan atau tahunan\nsila pilih maklumat berikut";
	var noErrors = theMessage
	var listChecktahun = document.myform.YearSelectBox.selectedIndex;
	var listCheckbulan = document.myform.BulanSelectBox.selectedIndex;
	
	// make sure field is not blank
	if (document.myform.YearSelectBox.options[listChecktahun].value=="none" || document.myform.BulanSelectBox.options[listCheckbulan].value=="none") {
	theMessage = theMessage + " ";
	}
	
	// If no errors, submit the form
	if (theMessage == noErrors) {
	return true;
	
	} else {
	
	// If errors were found, show alert message
	alert(theMessage);
	return false;
	}
}
/*------------------------------------------ end of papar laporan kemajuan validation form function -----------------------------------------*/
/*------------------------------ start of choose monthly validate form function ----------------------------------*/
function validateformbulan(form) 
{
	var theMessage = "Sila pilih tahun bagi bulan yang ingin anda pilih!";
	var noErrors = theMessage;
	var listCheckYear = document.myform.YearSelectBox.selectedIndex;
	// Make sure a selection list is used
	if (document.myform.YearSelectBox.options[listCheckYear].value=="none") 
	{
		theMessage = theMessage + " ";
	}
	// If errors were found, show alert message
	if (theMessage == noErrors) 
	{
		return true;
	} 
	// If no errors, submit the form
	else 	
	{
		alert(theMessage);
		document.myform.YearSelectBox.focus();
		return false;
	}
}

/*------------------------------ end of choose monthly validate form function -----------------------------------*/
/*------------------------------------------- start cetak laporan kemajuan bulanan function --------------------------------------------------*/
function cetakKemajuanBulanan(path, tahun, bulan, descbulan)
{
	window.open(path + 'admin/cetakBulan_kemajuan.cfm?tahun=' + tahun + '&bulan=' + bulan + '&descbulan=' + descbulan,'NewWin','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=800, height=600');
}
/*--------------------------------------------- end cetak laporan kemajuan bulanan function --------------------------------------------------*/

/*------------------------------ start of choose monthly validate form function for insert laporan kemajuan ----------------------------------*/
function validateformbulanlaporan(form) 
{
	var theMessage = "Sila pilih tahun bagi bulan yang ingin anda pilih!";
	var noErrors = theMessage;
	var listCheckYear = document.myform.qTahun.selectedIndex;
	// Make sure a selection list is used
	if (document.myform.qTahun.options[listCheckYear].value=="none") 
	{
		theMessage = theMessage + " ";
	}
	// If errors were found, show alert message
	if (theMessage == noErrors) 
	{
		return true;
	} 
	// If no errors, submit the form
	else 	
	{
		alert(theMessage);
		document.myform.qTahun.focus();
		return false;
	}
}

/*------------------------------ start of choose validate to submit form ins laporan kemajuan ----------------------------------*/
function validateformkemajuan(form) 
{
	var theMessage = "Sila lengkapkan maklumat berikut: \n";
	var noErrors = theMessage;
	
	var ol_jkutipan = document.insertform.ol_jkutipan.value;
	var ol_capaian  = document.insertform.ol_capaian.value;
	var ol_bilangan = document.insertform.ol_bilangan.value;
	var ol_pterlibat= document.insertform.ol_pterlibat.value;
	
	var ml_jkutipan = document.insertform.ml_jkutipan.value;
	var ml_capaian  = document.insertform.ml_capaian.value;
	var ml_bilangan = document.insertform.ml_bilangan.value;
	var ml_pterlibat= document.insertform.ml_pterlibat.value;
	
	// Make sure all fields not null
	if (ol_jkutipan == "" || ml_jkutipan == "")
	{
		theMessage = theMessage + "\nJumlah Kutipan";
	}
	if (ol_capaian == "" || ml_capaian == "")
	{
		theMessage = theMessage + "\nPeratusan Pencapaian";
	}
	if (ol_bilangan == "" || ml_bilangan == "")
	{
		theMessage = theMessage + "\nBilangan Hakmilik Terlibat";
	}
	if (ol_pterlibat == "" || ml_pterlibat == "")
	{
		theMessage = theMessage + "\nPeratusan Hakmilik Terlibat";
	}
	if (ol_capaian !== "" && ol_capaian > 100 || ml_capaian !== "" && ml_capaian > 100 || 
		ol_pterlibat !== "" && ol_pterlibat > 100 || ml_pterlibat !== "" && ml_pterlibat > 100)
	{
		theMessage = theMessage + "\nNilai Peratusan Tidak Sah > 100%";
		if (ol_capaian > 100)
		{
			document.insertform.ol_capaian.focus();
		}
		else if (ol_pterlibat > 100)
		{
			document.insertform.ol_pterlibat.focus();
		}
		else if (ml_capaian > 100)
		{
			document.insertform.ml_capaian.focus();
		}
		else
		{
			document.insertform.ml_pterlibat.focus();
		}
	}
	
	// If errors were found, show alert message
	if (theMessage == noErrors) 
	{
		return true;
	} 
	// If no errors, submit the form
	else 	
	{
		alert(theMessage);
		return false;
	}
}
/*------------------------------ start of validate the textarea must be insert numberic only ----------------------------------*/
function checkNumberic(field)
     {
		  var theMessage = "Maaf, kemasukkan anda tidak sah (nombor shj)!";
		  var noErrors   = theMessage;
          var check = true;
          var value = field.value.replace(",",""); //get characters and remove comma if available
		  var value = value.replace(".",""); //remove pointer if available
          //check that all characters are digits, ., -, or ""
          for(var i=0;i < field.value.length; ++i)
          {
               var new_key = value.charAt(i); //cycle through characters
               if(((new_key < "0") || (new_key > "9")) && 
                    !(new_key == ""))
               {
                    check = false;
					
                    break;
               }
          }
          //apply appropriate colour based on value
          if(!check)
          {
			   alert(theMessage);
			   return check;
          }
     }
/****************** check numeric direct key in in field ************************************/
function checkNumeric(filed,evt) {

    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode :
        ((evt.which) ? evt.which : 0));
        //alert("check"+charCode);
        if (charCode > 31 && (charCode < 48 || charCode > 57 ) && charCode!= 46  && charCode!= 44) 
		{   // && charCode!=45
       		 alert("Nombor sahaja dibenarkan");
            return false;
        }
		else
		{
            return true;
        }
}
/*************************** end of checking the field *****************************************/