function other_amt_changed() {
        var $thisprmpt = window.document.getElementById("other-amount");
        var $thisamt = $thisprmpt.value;
        //alert('len: ' + $thisamt.length);
        if (!isNaN($thisamt)) {
            $thisamtNum = parseFloat($thisamt);
            //alert($thisamtNum);
            if ($thisamtNum > 0) {
                $thisamtNum = $thisamtNum.toFixed(2);
                set_amount($thisamtNum.toString());
            } else {
                set_amount("");
            }
        } else {
            alert("Please enter a valid amount.");
        }
}
function select_item($item_number, $item_name, $amt) {
	  set_item_number($item_number);
	  set_item_name($item_name);
	  set_amount($amt);
	  set_on0("Membership Level");
	  set_os0($item_name);
}
function check_other() {
	var $radOther = window.document.getElementById("donate-other");
	$radOther.checked=true;
	other_amt_changed();
}
function set_amount($amt) {
        var $prmpt = window.document.getElementById("amount");
        //alert($prmpt.value+"\n"+$amt);
        $prmpt.value = $amt;
}
function set_item_name($item_name) {
        $prmpt = window.document.getElementById("item_name");
        //alert($prmpt.value+"\n"+$amt);
        $prmpt.value = $item_name;
	  set_on0($item_name);
}
function set_item_number($item_number) {
        var $prmpt = window.document.getElementById("item_number");
        //alert($prmpt.value+"\n"+$amt);
        $prmpt.value = $item_number;
	  set_os0($item_number);
}
function set_os0($option_id) {
        var $prmpt = window.document.getElementById("os0");
        //alert($prmpt.value+"\n"+$amt);
        $prmpt.value = $option_id;
}
function set_on0($option_name) {
        var $prmpt = window.document.getElementById("on0");
        //alert($prmpt.value+"\n"+$amt);
        $prmpt.value = $option_name;
}
function store_custom($fieldname, $fieldvalue) {
      //alert($fieldname, $fieldvalue);
      var $prmpt = window.document.getElementById("custom");
      var $customText = $prmpt.value.toString();
      var $customNew = String.fromCharCode(60)+$fieldname+String.fromCharCode(62)+$fieldvalue+String.fromCharCode(60,47)+$fieldname+String.fromCharCode(62);
	var $xmlPtr1 = $customText.indexOf(String.fromCharCode(60)+$fieldname+String.fromCharCode(62),0); 
	if ($xmlPtr1 > -1) {
               var $xmlPtr2 = $customText.indexOf(String.fromCharCode(60,47)+$fieldname+String.fromCharCode(62),0); 
              if ($xmlPtr2 > -1)
                   $xmlPtr2 += $fieldname.length+3;
              //alert($customNew+' '+$xmlPtr1+' '+$xmlPtr2);
              //$customText.substring($xmlPtr1,$xmlPtr2) = $customNew;
              $customText = $customText.substring(0,$xmlPtr1)+$customNew+$customText.substring($xmlPtr2)
              $prmpt.value = $customText;
        } else {
            $prmpt.value = $customNew+'\n'+$customText;
        }
}

