function cleanUp(){
	$(subcontent_div).html("").hide();
	$(maincontent_div).html("").show();
	return false;
}
function finishAjax(div_id, response, loader_div) {
	if (loader_div != "") $(loader_div).hide();
	$(div_id).html(unescape(response));
	$(div_id).fadeIn(1000);
	return false;
}
function changeTitle(this_id){
	$.ajax({
		data: "Action=PageTitle&ID=" + this_id + "",
		success: function(response){
			finishAjax(pagetitle_div, escape(response), "");
		}
	});
	return false;
}
function loadContent(which_div, loader, this_action, this_id, loader_div, passed_extra_vars){
	if (passed_extra_vars != ""){ extra_vars = "&extra_vars=" + passed_extra_vars + ""; } else { extra_vars = ""; }
	$(which_div).hide();
	if (loader_div != "") $(loader_div).html(loader).show();
	$.ajax({
		data: "Action=" + this_action + "&ID=" + this_id + extra_vars,
		success: function(response){
			if (which_div == "#menu") $(which_div).fadeIn(); else $(which_div).fadeOut();
			setTimeout("finishAjax('" + which_div + "', '" + escape(response) + "', '" + loader_div + "')", 400);
		}
	});
	return false;
}
function loadCaledarContent(which_div, loader, this_action, loader_div, this_year, this_month){
	$(which_div).hide();
	$(loader_div).html(loader).show();
	$.ajax({
		data: "Action=" + this_action + "&year=" + this_year + "&month=" + this_month + "",
		success: function(response){
			$(which_div).fadeOut();
			setTimeout("finishAjax('" + which_div + "', '" + escape(response) + "', '" + loader_div + "')", 400);
		}
	});
	return false;
}
function initMenu() {
	$("#admin_menu ul").hide();
	$("#admin_menu li a").click(
		function() {
			var checkElement = $(this).next();
			if((checkElement.is("ul")) && (checkElement.is(":visible"))) {
				return false;
			}
			if((checkElement.is("ul")) && (!checkElement.is(":visible"))) {
				$("#admin_menu ul:visible").slideUp("normal");
				checkElement.slideDown("normal");
				return false;
			}
		}
	);
	$("#content_menu ul").hide();
	$("#content_menu li a").click(
		function() {
			var checkElement = $(this).next();
			if((checkElement.is("ul")) && (checkElement.is(":visible"))) {
				return false;
			}
			if((checkElement.is("ul")) && (!checkElement.is(":visible"))) {
				$("#content_menu ul:visible").slideUp("normal");
				checkElement.slideDown("normal");
				return false;
			}
		}
	);
	return false;
}
function doRollOver(id_var, content_var) {
	$(id_var).ezpz_tooltip({
		contentId: content_var,
		showContent: function(content) {
			content.fadeIn("slow");
		},
		hideContent: function(content) {
			content.stop(true, true).fadeOut("slow");
		}
	});
	return false;
}
function openDialog(loader_id, this_title){
	$("#dialog_box").dialog({
		modal: true,
		open: function () { $(this).load('action.php?Action=FoodDay&ID=' + loader_id); },
		height: 180,
		width: 380,
		title: "Meal: " + this_title + ".",
		resizable: false
	});
	return false;
}
function displayOther(passed_value){
	//alert (passed_value);
	if (passed_value == "other")
		$("tr#other_dish").show();
	else
		$("tr#other_dish").hide();
}
$(document).ready(function() {
	initMenu();
});
