function uTotal(inAmount, inItemName)
{
	document.getElementById('id_amount').value    = inAmount;
	document.getElementById('id_item_name').value = inItemName;
}

function validateForm()
{
	if (!(document.getElementById('id_amount').value > 0))
	{
		if (document.getElementById('id_other').checked == true)
		{
			if (!(document.getElementById('id_other_amount').value > 0))
			{
				// Other selected, but no amount entered
				alert ('Please enter an amount first.');
				return false;
			} else {
				document.getElementById('id_amount').value = document.getElementById('id_other_amount').value;
				return true;
			}
		} else if (document.getElementById('id_gush_katif').checked == true){
			if (!(document.getElementById('id_gush_katif_amount').value > 0))
			{
				// Gush Katif selected, but no amount entered
				alert ('Please enter an amount first.');
				return false;
			} else {
				document.getElementById('id_amount').value = document.getElementById('id_gush_katif_amount').value;
				return true;
			}
		
		} else if (document.getElementById('id_bar_mitzvha').checked == true){
			if (!(document.getElementById('id_bar_mitzvha_amount').value > 0))
			{
				// Bar Mitzvah selected, but no amount entered
				alert ('Please enter an amount first.');
				return false;
			} else {
				document.getElementById('id_amount').value = document.getElementById('id_bar_mitzvha_amount').value;
				return true;
			}


		} else if (document.getElementById('id_bat_mitzvha').checked == true){
			if (!(document.getElementById('id_bat_mitzvha_amount').value > 0))
			{
				// Bat Mitzvah selected, but no amount entered
				alert ('Please enter an amount first.');
				return false;
			} else {
				document.getElementById('id_amount').value = document.getElementById('id_bat_mitzvha_amount').value;
				return true;
			}

		} else if (document.getElementById('id_combat_tehillim').checked == true){
			if (!(document.getElementById('id_combat_tehillim_amount').value > 0))
			{
				// Combat Tehilllim selected, but no amount entered
				alert ('Please enter an amount first.');
				return false;
			} else {
				document.getElementById('id_amount').value = document.getElementById('id_combat_tehillim_amount').value;
				return true;
			}



		} else if (document.getElementById('id_lone_soldiers').checked == true){
			if (!(document.getElementById('id_lone_soldiers_amount').value > 0))
			{
				// Lone Soldiers selected, but no amount entered
				alert ('Please enter an amount first.');
				return false;
			} else {
				document.getElementById('id_amount').value = document.getElementById('id_lone_soldiers_amount').value;
				return true;
			}
		} else {
			// Nothing was selected
			alert ('Please make a selection before continuing');
			return false;
		}
	} else {
		return true;
	}
}

function ReadCookie(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return ""; 
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}

window.onload = function()
{
	document.getElementById('id_custom').value = ReadCookie('cIsrael');
}