function showDonation()
{
	var obj = document.getElementById('donations');
	var obj1 = document.getElementById('amount_other');
	if(document.frm.chk_donation.checked == true)
	{	
		obj.style.visibility='visible';
		obj.style.display='block';
		if(document.frm.otheramount.checked == true)
		obj1.style.visibility='visible';
	}
	else
	{
		obj.style.visibility='hidden';
		obj.style.display='none';
		obj1.style.visibility='hidden';
	}	
}
function showAmount()
{
	var obj = document.getElementById('amount_other');
	if(document.frm.otheramount.checked == true)
		obj.style.visibility='visible';
	else
		obj.style.visibility='hidden';
}
function hideAmount()
{
	var obj = document.getElementById('amount_other');
	obj.style.visibility='hidden';
}
function validateDonation()
{
	if(document.frm.chk_donation.checked != true)
	{
		alert("Please enter donation amount");
		document.frm.chk_donation.focus();
		return false;
	}

	if(document.frm.chk_donation.checked == true)
	{
		if(document.frm.otheramount.checked == true)
		{
			if(document.frm.other_giftamount.value == "" || document.frm.other_giftamount.value == "0.00" || !isNumeric(document.frm.other_giftamount.value))
			{
				alert("Please enter donation amount");
				document.frm.other_giftamount.focus();
				return false;
			}
		}
	}
	

	var amount = "";
	if(document.frm.otheramount.checked == true)
	{
		amount = document.frm.other_giftamount.value;
	}
	else if(document.frm.amount1.checked == true)
	{
		amount = document.frm.amount1.value;
	}
	else if(document.frm.amount2.checked == true)
	{
		amount = document.frm.amount2.value;
	}
	else if(document.frm.amount3.checked == true)
	{
		amount = document.frm.amount3.value;
	}
	
	document.frm.action = "https://www.donateforislam.com/index.php";
	//document.frm.action = "http://localhost/donate/site/index.php";
	document.frm.target = "_blank";
	document.frm.submit();
	
	return false;
}
function formatDecimal() {
	var number = document.frm["other_giftamount"].value;
	
	if (number == '') {
		document.frm["other_giftamount"].value = '0.00';
	} else {
		if (number.indexOf('.') == -1) {
			document.frm["other_giftamount"].value = number + '.00';
		}
	}
}
function isNumeric(strString)
{
   var strValidChars = "0123456789.";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   for (i = 0; i < strString.length && blnResult == true; i++)
   {
	  strChar = strString.charAt(i);
	  if (strValidChars.indexOf(strChar) == -1)
	  {
		 blnResult = false;
	  }
   }
   return blnResult;
}
