function submitReg(){
	document.product.submit();
}
function addtocart(joinid){
 formel = eval("document.product.amt_"+joinid);
num = formel.value;
        if (!num || isNaN(num)){
                alert("Please enter an amount");
        }
        else {
        document.location = "https://www.childcareworldwide.ca/index.html?action=catview_add_to_cart&Join_ID="+joinid+"&amt="+num;
        }
}
function checkForm(form) {
	form.amt.required = true;
	form.amt.requiredError = 'The numbers-only  field must be filled in.';
	form.amt.pattern = 'numeric';
	form.amt.patternError = 'The numbers-only field accepts only numbers.';
        var errors = getFormErrors(form);
        if (errors.length > 0) {
                var errorMessage = 'The form was not submitted due to the following problem' + ((errors.length > 1) ? 's' : '') + ':\n\n';
                for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) {
                errorMessage += '* ' + errors[errorIndex] + '\n';
                }
                errorMessage += '\nPlease fix ' + ((errors.length > 1) ? 'these' : 'this') + ' problem' + ((errors.length > 1) ? 's' : '') + ' and resubmit the form.';
                alert(errorMessage);
                return false;
        }
        // no errors: return true
        return true;
}
function getDesc(id){
        newWindow = window.open('/?action=view_catalog&show_child_chars=1&Join_ID=' + id + '&template=project_desc.htm7','newWin','width=425,height=250,status=no,resizable=yes,scrollbars=yes,menubar=no,toolbar=no,location=no');//,'_blank', 'scrollbars=no,width=300,height=400,resizable=no'
        newWindow.focus();
}
function showDonationAmounts(Join_ID, price, rawAmounts) {
	if (rawAmounts == "") {
		if (price == "") {
			var amounts = new Array("100", "50", "25", "Other...");
		} else {
			var amounts = new Array(price);
		}
	} else {
		var amounts = rawAmounts.split(String.fromCharCode(254));
		amounts.push("Other...");
	}
	document.write('$<select name="amt_'+Join_ID+'" id="amt_'+Join_ID+'" onChange="addOtherAmount(this.id)">')
	document.write('<option value="0"></option>');
	for(i=0; i<amounts.length; i++) { 
		document.write('<option value="'+amounts[i]+'">'+amounts[i]+'</option>'); 
	}
	document.write('</select>');
}
function addOtherAmount(selectID) {
	var selectElement = document.getElementById(selectID);
	if(selectElement.options[selectElement.selectedIndex].text == "Other...") {
		var newOption = prompt("How much would you like to donate?", "");
		selectElement.options[selectElement.options.length-1] = new Option(newOption);
		selectElement.options[selectElement.options.length] = new Option("Other...");
		selectElement.selectedIndex = selectElement.options.length-2;
	}
}