function setCheckedIngredientCheckBoxes(recipeSeo)
{
	var ingredientContainer = document.getElementById('ingredients-form');
	var checkboxes = ingredientContainer.getElementsByTagName('input');
	var selectedIngredientsId = "";
	for (index=0; index < checkboxes.length; index++)
	{
		if (checkboxes[index].checked)
		{
			selectedIngredientsId += checkboxes[index].value + "+";
		}
	}

	selectedIngredientsId = selectedIngredientsId.substring(0, selectedIngredientsId.length - 1);
	call_email_lightbox(recipeSeo, selectedIngredientsId);
}

function sendRecipeToFriend(recipeSeo)
{
	call_send_recipe_lightbox(recipeSeo);
}

function call_send_recipe_lightbox(recipeSeo)
{
	url = '/recipes/ajax/send-recipe.html?seo='+escape(recipeSeo);

	document.getElementById('email_lightbox').innerHTML = build_iframe_for_lightbox(url, 380, 'hide_send_recipe_lightbox');
	
	var _obj = '#email_lightbox';
	var _overlay  = '#lightbox_overlay';
	var _duration = 150;
	var _opacity = .65; 

	display_lightbox(_obj, _overlay, _duration, _opacity);
}

function hide_send_recipe_lightbox()
{
	var _obj = '#email_lightbox';
	var _overlay  = '#lightbox_overlay';
	var _duration = 150;

	close_lightbox(_obj, _overlay, _duration);
}

function call_email_lightbox(recipeSeo, selectedIngredientsId)
{
	url = '/recipes/ajax/send-ingredients.html?seo='+escape(recipeSeo)+'&selected='+selectedIngredientsId;

	document.getElementById('email_lightbox').innerHTML = build_iframe_for_lightbox(url, 380, 'hide_email_lightbox');
	
	var _obj = '#email_lightbox';
	var _overlay  = '#lightbox_overlay';
	var _duration = 150;
	var _opacity = .65; 

	display_lightbox(_obj, _overlay, _duration, _opacity);
}

function hide_email_lightbox()
{
	var _obj = '#email_lightbox';
	var _overlay  = '#lightbox_overlay';
	var _duration = 150;

	close_lightbox(_obj, _overlay, _duration);
}

function call_signin_lightbox()
{

	var response = new Request({
		url: '/ajax-sign-in.html',
		method: 'get',
		onSuccess: function(jsonResponse) { call_signin_lightbox_DELEGATE(jsonResponse); }
	}).send();
}

function call_signin_lightbox_DELEGATE(jsonResponse)
{

	document.getElementById('signin_lightbox').innerHTML = jsonResponse;
	
	var _obj = '#signin_lightbox';
	var _overlay  = '#lightbox_overlay';
	var _duration = 150;
	var _opacity = .65; 

	display_lightbox(_obj, _overlay, _duration, _opacity);
}

function hide_signin_lightbox()
{
	var _obj = '#signin_lightbox';
	var _overlay  = '#lightbox_overlay';
	var _duration = 150;

	close_lightbox(_obj, _overlay, _duration);
}

var call_on_tv_carousel = function() {
	var options = {
		 item_width: 137,
		 duration: 500,
		 transition: Fx.Transitions.Pow.easeOut,
		 next_btn_id: 'next_on_tv', 
		 prev_btn_id: 'prev_on_tv',
		 event: 'click'
	}
	var carousel_id = 'on_tv_carousel';
	var carousel = new Carousel(carousel_id, options);
}

var call_chefs_a_to_z_carousel = function() {
	var options = {
		 item_width: 137,
		 duration: 500,
		 transition: Fx.Transitions.Pow.easeOut,
		 next_btn_id: 'next_chefs_a_to_z', 
		 prev_btn_id: 'prev_chefs_a_to_z',
		 event: 'click'
	}
	var carousel_id = 'chefs_a_to_z_carousel';
	var carousel = new Carousel(carousel_id, options);
}

function jumpToLink(targ,selObj,restore){
	eval(targ+".location=\'"+selObj.options[selObj.selectedIndex].value+"\'");
	if (restore) selObj.selectedIndex=0;
}

