function memorize(memoID, expires) {
	var isChecked = document.memoForm["memo" + memoID].checked;
	if(document.memoForm["memoTip" + memoID]) {
		document.memoForm["memoTip" + memoID].checked = isChecked;
	}
	if(isChecked) {
		new Ajax.Updater('memoNumber', '/programmvorschau/memorize.php?eventID=' + memoID + '&expires=' + expires, {asynchronous:true, evalScripts:true, onComplete:function(request){ajax_complete(memoID);}, onLoading:function(request){ajax_loading(memoID);}});
	} else {
		new Ajax.Updater('memoNumber', '/programmvorschau/dememorize.php?eventID=' + memoID, {asynchronous:true, evalScripts:true, evalScripts:true, onComplete:function(request){ajax_complete(memoID);}, onLoading:function(request){ajax_loading(memoID);}});
	}
	return true;
}

function memorizeTip(memoID, expires) {
	var isChecked = document.memoForm["memoTip" + memoID].checked;
	if(document.memoForm["memo" + memoID]) {
		document.memoForm["memo" + memoID].checked = isChecked;
	}
	if(isChecked) {
		new Ajax.Updater('memoNumber', '/programmvorschau/memorize.php?eventID=' + memoID + '&expires=' + expires, {asynchronous:true, evalScripts:true, onComplete:function(request){ajax_complete(memoID);}, onLoading:function(request){ajax_loading(memoID);}});
	} else {
		new Ajax.Updater('memoNumber', '/programmvorschau/dememorize.php?eventID=' + memoID, {asynchronous:true, evalScripts:true, evalScripts:true, onComplete:function(request){ajax_complete(memoID);}, onLoading:function(request){ajax_loading(memoID);}});
	}
	return true;
}

function countMemorized() {
	new Ajax.Updater('memoNumber', '/programmvorschau/countMemorized.php', {asynchronous:true, evalScripts:true});
	return true;	
}

function ajax_loading(memoID) {
	if(document.getElementById("check" + memoID)) {
		document.getElementById("check" + memoID).style.display = 'none';
		document.getElementById("indicator" + memoID).style.display = 'inline';
	}
	if(document.getElementById("checkTip" + memoID)) {
		document.getElementById("checkTip" + memoID).style.display = 'none';
		document.getElementById("indicatorTip" + memoID).style.display = 'inline';
	}
}

function ajax_complete(memoID) {
	if(document.getElementById("check" + memoID)) {
		document.getElementById("check" + memoID).style.display = 'inline';
		document.getElementById("indicator" + memoID).style.display = 'none';
	}
	if(document.getElementById("checkTip" + memoID)) {
		document.getElementById("checkTip" + memoID).style.display = 'inline';
		document.getElementById("indicatorTip" + memoID).style.display = 'none';
	}
}

