<!-- Dynamic Version by: Nannette Thacker -->
<!-- http://www.shiningstar.net -->
<!-- Original by :  Ronnie T. Moore -->
<!-- Web Site:  The JavaScript Source -->
<!-- Use one function for multiple text areas on a page -->
<!-- Limit the number of characters per textarea -->
<!-- Begin
function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}

function doSubmit_PetParade()
{
	frmPetParade.method = "POST";
	frmPetParade.action = "https://checkout.google.com/cws/v2/Merchant/465631769365985/checkoutForm";
	frmPetParade.submit();
	return true;
}

function doSubmit_ParentAd()
{
	frmProudParent.method = "POST";
	frmProudParent.action = "https://checkout.google.com/cws/v2/Merchant/465631769365985/checkoutForm";
	frmProudParent.submit();
	return true;
}

function doSubmit()
{
	if (validForm())
	{
		setHiddenFields();
		frmDonate.method = "POST";
		frmDonate.action = "https://checkout.google.com/cws/v2/Merchant/465631769365985/checkoutForm";
		frmDonate.submit();
		return true;
	} else {
		return false;
	}
}

function validForm()
{
	if ( document.getElementById("amtOther").checked  ) {
		if ( isNaN(document.getElementById("item_price_input").value) || !parseInt(document.getElementById("item_price_input").value) )
		{
			setInputStyle(document.getElementById("item_price_input"),"#F9CFCF");
			document.getElementById("item_price_input").focus();
			return false;
		} 
	}
	return true;
}

function setHiddenFields()
{
	var nrMedalions = 0;

	if ( document.getElementById("itm1").checked ) {
		document.getElementById("item_name_1").value = "General Operations Donation";
		document.getElementById("item_description_1").value = "We appreciate your donation towards the general operations of the Mastodon Fair.";

	} else if ( document.getElementById("itm2").checked ) 	{
		document.getElementById("item_name_1").value = "Endowment Donation";
		document.getElementById("item_description_1").value = "We appreciate your donation which will be deposited in the endowment account.";

	} else if ( document.getElementById("itm3").checked ) 	{
		document.getElementById("item_name_1").value = "Medallion Donation";
		document.getElementById("item_description_1").value = "We appreciate your donation which will purchase ### medallions for winners of the Mastodon Fair.";

	} else if ( document.getElementById("itm4").checked ) 	{
		document.getElementById("item_name_1").value = "Scholarship Donation";
		document.getElementById("item_description_1").value = "We appreciate your donation towards the Mastodon Fair college scholarship fund.";
	} else {
		alert('Rut Ro...');
		return false;
	}


	if ( document.getElementById("amt25").checked ) {
		document.getElementById("item_price_1").value = '25';
		if ( document.getElementById("itm3").checked ) {
			document.getElementById("item_description_1").value = "We appreciate your donation which will purchase 3 medallions for winners of the Mastodon Fair.";
		}

	} else if ( document.getElementById("amt50").checked ) {
		document.getElementById("item_price_1").value = '50';
		if ( document.getElementById("itm3").checked ) {
			document.getElementById("item_description_1").value = "We appreciate your donation which will purchase 16 medallions for winners of the Mastodon Fair.";
		}

	} else if ( document.getElementById("amt100").checked )	{
		document.getElementById("item_price_1").value = '100';
		if ( document.getElementById("itm3").checked ) {
			document.getElementById("item_description_1").value = "We appreciate your donation which will purchase 33 medallions for winners of the Mastodon Fair.";
		}

	} else if ( document.getElementById("amt500").checked )	{
		document.getElementById("item_price_1").value = '500';
		if ( document.getElementById("itm3").checked ) {
			document.getElementById("item_description_1").value = "We appreciate your donation which will purchase 166 medallions for winners of the Mastodon Fair.";
		}

	} else if ( document.getElementById("amtOther").checked  ) {
		document.getElementById("item_price_1").value = parseInt(document.getElementById("item_price_input").value);
		if ( document.getElementById("itm3").checked ) {
			var nrMedalions = parseInt(parseInt(document.getElementById("item_price_input").value)/3);
			document.getElementById("item_description_1").value = "We appreciate your donation which will purchase " + nrMedalions + " medallions for winners of the Mastodon Fair.";
		}
	}


	return true;

}

function toggleAmt(op)
{
	if (op == 1) {
		document.getElementById("item_price_input").disabled = false;
		document.getElementById("item_price_input").focus();
	} else {
		document.getElementById("item_price_input").disabled = true;
	}
	return true;
}

function keyUpPrice()
{
	if ( isNaN(document.getElementById("item_price_input").value) )
	{
		setInputStyle(document.getElementById("item_price_input"),"#F9CFCF");
		document.getElementById("item_price_input").focus();
		return false;
	} else {
		setInputStyle(document.getElementById("item_price_input"),"#E1D6A8");
		return true;
	}
}

function setInputStyle(obj,bgColor)
{
    obj.style.backgroundColor = bgColor;
    obj.style.fontFamily = "Verdana,Tahoma,Arial"; 
    obj.style.fontWeight = "normal";
    obj.style.color = "black"; 
    obj.style.fontSize = "10px"; 
    obj.style.border = "solid 1px #bbbbbb";
    obj.style.height = "20px";
    obj.style.padding = "2px";
    
}

// ------------------------------------------------------------------------

