intAddress = function () {
	new Effect.SwitchOff('address_row', {delay: 0, duration: 1});
	new Effect.Appear('address_row_2', {delay: 1, duration: 1});		
}

usAddress = function () {
	new Effect.SwitchOff('address_row_2', {delay: 0, duration: 1});
	new Effect.Appear('address_row', {delay: 1, duration: 1});		
}

editMeal = function(row_id) {
	new Effect.Appear('meal_row_' + row_id, {delay: 0, duration: 1});
}

closeMeal = function(row_id) {
	new Effect.Fade('meal_row_' + row_id, {delay: 0, duration: 1});
}

editDay = function(date,them,action) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row.php?action=' + action + '&d=' + date + '&t=' + them);
}

editDayMulti = function(date,multi,them,action) {
	new Ajax.Updater(('row_' + date + '_' + multi), '/files_includes/meals_table_row_ttam_multi.php?action=' + action + '&d=' + date + '&mu=' + multi + '&t=' + them);
}

addItem = function(date,them,action,item_counter) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row_pp.php?action=' + action + '&d=' + date + '&t=' + them + '&c=' + item_counter);
}

editItem = function(date,them,action,meal,item_counter) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row_pp.php?action=' + action + '&d=' + date + '&t=' + them + '&m=' + meal + '&c=' + item_counter);
}

closeMeal2 = function(date,them) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row.php?d=' + date + '&t=' + them);
}

closeMeal2Multi = function(date,multi,them) {
	new Ajax.Updater(('row_' + date + '_' + multi), '/files_includes/meals_table_row_ttam_multi.php?d=' + date + '&mu=' + multi + '&t=' + them);
}

closeMeal2pp = function(date,them,meal,item_counter) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row_pp.php?d=' + date + '&t=' + them + '&m=' + meal + '&c=' + item_counter);
}

closeMeal3 = function(date,them,add_custom) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row.php?d=' + date + '&t=' + them + '&add_custom=' + add_custom);
}

closeMeal3Multi = function(date,multi,them,add_custom) {
	new Ajax.Updater(('row_' + date + '_' + multi), '/files_includes/meals_table_row_ttam_multi.php?d=' + date + '&mu=' + multi + '&t=' + them + '&add_custom=' + add_custom);
}

submitMeal = function(date,them) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row.php?d=' + date + '&t=' + them, {parameters:Form.serialize('meal_' + date), method: 'POST', evalScripts: true});	
	new Ajax.Updater(('row_spacer_' + date), '/files_includes/meal_submitted.php?d=' + date + '&t=' + them, {parameters:Form.serialize('meal_' + date), method: 'POST', evalScripts: true});	
}

submitMealMulti = function(date,multi,them) {
	new Ajax.Updater(('row_' + date + '_' + multi), '/files_includes/meals_table_row_ttam_multi.php?d=' + date + '&mu=' + multi + '&t=' + them, {parameters:Form.serialize('meal_' + date + '_' + multi), method: 'POST', evalScripts: true});	
	new Ajax.Updater(('row_spacer_' + date + '_' + multi), '/files_includes/meal_submitted.php?multi=1&d=' + date + '&t=' + them, {parameters:Form.serialize('meal_' + date + '_' + multi), method: 'POST', evalScripts: true});	
}

submitItem = function(date,them,item_counter) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row_pp.php?d=' + date + '&t=' + them + '&c=' + item_counter, {parameters:Form.serialize('meal_' + date), method: 'POST', evalScripts: true});
}

confirmRemove = function(date,them,meal,action) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row.php?action=' + action + '&d=' + date + '&t=' + them + '&m=' + meal);
}

confirmRemoveMulti = function(date,multi,them,meal,action) {
	new Ajax.Updater(('row_' + date + '_' + multi), '/files_includes/meals_table_row_ttam_multi.php?action=' + action + '&d=' + date + '&mu=' + multi + '&t=' + them + '&m=' + meal);
}

confirmRemovePP = function(date,them,meal,action,item_counter) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row_pp.php?action=' + action + '&d=' + date + '&t=' + them + '&m=' + meal + '&c=' + item_counter);
}

reallyRemove = function(date,them,meal,action2) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row.php?action2=' + action2 + '&d=' + date + '&t=' + them + '&m=' + meal);
}

reallyRemoveMulti = function(date,multi,them,meal,action2) {
	new Ajax.Updater(('row_' + date + '_' + multi), '/files_includes/meals_table_row_ttam_multi.php?action2=' + action2 + '&d=' + date + '&mu=' + multi + '&t=' + them + '&m=' + meal);
}

reallyRemovePP = function(date,them,meal,action2,item_counter) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row_pp.php?action2=' + action2 + '&d=' + date + '&t=' + them + '&m=' + meal + '&c=' + item_counter);
}

confirmCancel = function(date,them,action,add_custom) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row.php?action=' + action + '&d=' + date + '&t=' + them + '&add_custom=' + add_custom);
}

confirmCancelMulti = function(date,multi,them,action,add_custom) {
	new Ajax.Updater(('row_' + date + '_' + multi), '/files_includes/meals_table_row_ttam_multi.php?action=' + action + '&d=' + date + '&mu=' + multi + '&t=' + them + '&add_custom=' + add_custom);
}

reallyCancel = function(date,them,action2) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row.php?action2=' + action2 + '&d=' + date + '&t=' + them);
	new Effect.SwitchOff('row_spacer_' + date, {delay: 0, duration: 0});
}

reallyCancelMulti = function(date,multi,them,action2) {
	new Ajax.Updater(('row_' + date + '_' + multi), '/files_includes/meals_table_row_ttam_multi.php?action2=' + action2 + '&d=' + date + '&mu=' + multi + '&t=' + them);
	new Effect.SwitchOff('row_spacer_' + date + '_' + multi, {delay: 0, duration: 0});
}

reallyCancel2 = function(date,them,action3) {
	document.getElementById("row_" + date).className = "content_cell2"
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row.php?action3=' + action3 + '&d=' + date + '&t=' + them);
}

reallyCancel2Multi = function(date,multi,them,action3) {
	document.getElementById("row_" + date + '_' + multi).className = "content_cell2"
	new Ajax.Updater(('row_' + date + '_' + multi), '/files_includes/meals_table_row_ttam_multi.php?action3=' + action3 + '&d=' + date + '&mu=' + multi + '&t=' + them);
}

addCustom = function(date,them,action2) {
	new Ajax.Updater(('row_' + date), '/files_includes/meals_table_row.php?add_custom=1&action2=' + action2 + '&d=' + date + '&t=' + them);
	document.getElementById("row_" + date).className = "content_cell"
}

addCustomMulti = function(date,multi,them,action2) {
	new Ajax.Updater(('row_' + date + '_' + multi), '/files_includes/meals_table_row_ttam_multi.php?add_custom=1&action2=' + action2 + '&d=' + date + '&mu=' + multi + '&t=' + them);
	document.getElementById("row_" + date + '_' + multi).className = "content_cell"
}

showFriends = function(them) {
	new Ajax.Updater(('friends_form'), '/files_includes/friends_table.php', {parameters:Form.serialize('friends_form'), method: 'POST', evalScripts: true});
}

hideFriends = function() {
	new Effect.Fade('friends_table', {delay: 0, duration: 1});
}

addFriend = function() {
	new Ajax.Updater(('friends_form'), '/files_includes/friends_table.php', {parameters:Form.serialize('friends_form'), method: 'POST', evalScripts: true});	
}

addOldFriend = function(old_friend,id_them) {
	new Ajax.Updater(('friends_table_shell'), '/files_includes/friends_table.php', {parameters:{'old_friend': old_friend, 'id_them': id_them}, method: 'POST', evalScripts: true});	
}

addAllOldFriends = function(id_them) {
	new Ajax.Updater(('friends_table_shell'), '/files_includes/friends_table.php', {parameters:{'all_old_friends': "1", 'id_them': id_them}, method: 'POST', evalScripts: true});	
}

delOldFriend = function(old_friend,id_them) {
	new Ajax.Updater(('friends_table_shell'), '/files_includes/friends_table.php', {parameters:{'del_old_friend': old_friend, 'id_them': id_them}, method: 'POST', evalScripts: true});	
}

delFriend = function(friend,id_them) {
	new Ajax.Updater(('friends_table_shell'), '/files_includes/friends_table.php', {parameters:{'del_friend': friend, 'id_them': id_them}, method: 'POST', evalScripts: true});	
}

function confirm_remove(link) {
	var answer = confirm ("Are you sure you would like to remove this person from the meal schedule?")
	if (answer) {
		window.location=(link)
	}
}

function confirm_cancel(link) {
	var answer = confirm ("Are you sure you would like to cancel the need for a meal on this day?")
	if (answer) {
		window.location=(link)
	}	
}

function confirm_disable(link) {
	var answer = confirm ("Do you really want to disable this schedule?  Nobody will be able to access it!  If you DO want to disable it, please click OK below.")
	if (answer) {
		window.location=(link)
	}	
}

function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
	}
}

showPros = function() {
	new Effect.Appear('pros_table', {delay: 0, duration: 1});
}


hideScroll = function() {
	new Effect.Fade('scroll_down', {delay: 4, duration: 2});
}

showHTMLcode1 = function() {
	new Effect.SwitchOff('htmlcode2', {delay: 0, duration: 0});
	new Effect.SwitchOff('htmlcode3', {delay: 0, duration: 0});
	new Effect.Appear('htmlcode1', {delay: 0, duration: 1});
}

showHTMLcode2 = function() {
	new Effect.SwitchOff('htmlcode1', {delay: 0, duration: 0});
	new Effect.SwitchOff('htmlcode3', {delay: 0, duration: 0});
	new Effect.Appear('htmlcode2', {delay: 0, duration: 1});
}

showHTMLcode3 = function() {
	new Effect.SwitchOff('htmlcode1', {delay: 0, duration: 0});
	new Effect.SwitchOff('htmlcode2', {delay: 0, duration: 0});
	new Effect.Appear('htmlcode3', {delay: 0, duration: 1});
}

pointTakeOn = function(date) {
	document.getElementById('meal_cell_' + date).innerHTML = '<font color="#B02B2C"><b>click "Take" to sign up > > ></b></font>';
}

pointTakeOff = function(date) {
	document.getElementById('meal_cell_' + date).innerHTML = '';
}

pointTakeOnMulti = function(date,multi) {
	document.getElementById('meal_cell_' + date + '_' + multi).innerHTML = '<font color="#B02B2C"><b>click "Take" to sign up > > ></b></font>';
}

pointTakeOffMulti = function(date,multi) {
	document.getElementById('meal_cell_' + date + '_' + multi).innerHTML = '';
}

showMultiMeal = function() {
	new Ajax.Updater(('multi_meals_span'), '/files_includes/setup_multi.php?show=1');	
}

hideMultiMeal = function() {
	new Ajax.Updater(('multi_meals_span'), '/files_includes/setup_multi.php');	
}

showRecipes= function() {
	new Ajax.Updater(('recipe_block'), '/files_includes/recipes/list.php');
	new Ajax.Updater(('recipe_menu'), '/files_includes/recipes/hide.php');
}

hideRecipes= function() {
	new Effect.Fade('recipe_block', {delay: 0, duration: 1});
	new Ajax.Updater(('recipe_menu'), '/files_includes/recipes/show.php');
}

showRecipesAgain= function() {
	new Effect.Appear('recipe_block', {delay: 0, duration: 1});
	new Ajax.Updater(('recipe_menu'), '/files_includes/recipes/hide.php');
}

showFeatures = function() {
	new Effect.BlindDown('features', {delay: 0, duration: 1});
	_gaq._getAsyncTracker()._trackPageview('/async/show_features/');
	document.getElementById('feature_button').innerHTML = '<a href="#" onclick="hideFeatures(); return false;"><span class="button">HIDE FEATURES</span></a>';
}

hideFeatures = function() {
	new Effect.BlindUp('features', {delay: 0, duration: 1});
	document.getElementById('feature_button').innerHTML = '<a href="#" onclick="showFeatures(); return false;"><span class="button">SHOW FEATURES</span></a>';
}

facebookShare = function() {
	_gaq._getAsyncTracker()._trackPageview('/async/share/facebook/');	
	window.location = 'https://www.facebook.com/sharer.php?u=http://www.takethemameal.com/index.php?share=facebook';
}

showAdminHint = function() {
	document.getElementById('admin_password_label').innerHTML = '<b><font color="#B02B2C">If you are the <u>meal coordinator</u>, enter your Admin Password above to log in.</font></b><br>&nbsp;<br>';
}

hideAdminHint = function() {
	document.getElementById('admin_password_label').innerHTML = '';
}

