
function checkForm(form) {
	var all_ok = true;
	$(".required", form).each(function() {
		var ok = true;
		// TODO TRIM TEXT FIELDS
		if ($(this).is("select")) {
			if ($(this).attr("selectedIndex") == 0) ok = false;
		} else if ($(this).is("input[type='text']") || $(this).is("textarea")) {
			if ($(this).val() == "") ok = false;
		}
		if (!ok) {
			$(this).focus();
			alert("Bitte Feld \""+$(this).attr("title")+"\" ausfüllen!");
			all_ok = false;
			return false;
		}
	});
	return all_ok;
}

$(document).ready(function() {
	$(".fancybox").fancybox({ 'titleShow': true, 'titlePosition': 'inside', 'hideOnContentClick': true, 'overlayShow': true, 'enableEscapeButton': true });
	$('.imagefade').innerfade({ animationtype: 'fade', speed: 'slow', timeout: 3000, type: 'sequence', containerheight: '390px' });
	$("a.confirm").click(function() { return confirm("Diese Aktion kann nicht rueckgaengig gemacht werden! Trotzdem fortfahren?"); });
});

