function asf_bidrag_submit(form) {
	
	// Amount
	amount = parseInt(form.dibs_amount.value);
	if (typeof(form.dibs_amount_radio) == "object") {
		var amount_radio = 0;
		for(i=0; i<form.dibs_amount_radio.length; i++) {
			if (form.dibs_amount_radio[i].checked == true)
			amount_radio = form.dibs_amount_radio[i].value;
		}
		if (amount_radio > 0) { amount = amount_radio; }
	}
	
	// Field validation
	missing = "";
	if (form.dibs_amount.value == "" || amount == 0) { missing += "\n- beløb"; }
	if (form.dibs_regcheck.checked || form.dibs_regcheck.value != "") {
		if (form.dibs_name.value == "") { missing += "\n- navn/virksomhed"; }
		//if (form.dibs_cpr_cvr.value == "" && form.dibs_regcheck.value == "1") { missing += "\n- CPR- eller CVR-nummer"; }
		if (form.dibs_adresse.value == "") { missing += "\n- adresse"; }
		if (form.dibs_by.value == "") { missing += "\n- postnr. og by"; }
		if (form.dibs_telefon.value == "") { missing += "\n- telefon"; }
	}
	if (typeof(form.pbs_betaling) == "object" && form.pbs_betaling.checked == true) {
	//if (typeof(form.ktonr) == "object" && form.ktonr.value != "") {
		//alert('Vi beklager - betalingen er midlertidigt sat på stand-by pga. systemopdateringer.');
		if (form.dibs_cpr_cvr.value == "") { missing += "\n- CPR- eller CVR-nummer"; }
		if (form.regnr.value == "") { missing += "\n- bankens reg.-nr."; }
		if (form.ktonr.value == "") { missing += "\n- dit kontonummer"; }
	}
	
	// Form submit
	if (missing == "" && amount > 0) {
		form.amount.value = amount * 100;
		return true;
	} else {
		alert("Indtast venligst "+missing+".");
		return false;
	}
	
}


function tip_en_ven() {
	q = jQuery("#f_asf_bidrag_tipenven").serialize();
	jQuery("#asf_bidrag_tipenven").load("http://folkehjaelp.dk/wp/wp-content/plugins/asf_bidrag/tip_en_ven.ajax.php?"+q);
}

function asf_bidrag_post_hide(id) {
	jQuery("#asf_bidrag_post_toggle_display_"+id).load("http://folkehjaelp.dk/wp/wp-content/plugins/asf_bidrag/bidrag_toggle.ajax.php?action=hide&id="+id);
	jQuery("tr#asf_bidrag_post_"+id+" td").addClass("asf_bidrag_post_to_hide");
}

function asf_bidrag_post_show(id) {
	jQuery("#asf_bidrag_post_toggle_display_"+id).load("http://folkehjaelp.dk/wp/wp-content/plugins/asf_bidrag/bidrag_toggle.ajax.php?action=show&id="+id);
	jQuery("tr#asf_bidrag_post_"+id+" td").removeClass("asf_bidrag_post_to_hide");
}