function submitemail() {
	var form = document.frontendForm;
	if (form.email.value == "" || form.youremail.value == "") {
		alert( '<?php echo addslashes( _EMAIL_ERR_NOINFO ); ?>' );
		return false;
	}

	xajax_doSubmitEmail(form.email.value, form.youremail.value, form.yourname.value, form.recipe_id.value, form.subject.value);
}

function addtoshoppinglist(recipeid,myid) {
	xajax_doAddRecipeToShoppingList(recipeid,myid);
}

function addtofavourites(recipeid,myid) {
	xajax_doAddToFavourites(recipeid,myid);
}

function submitvote() {
	var form = document.rr_vote;
	var vote;
	
	vote = rrgetCheckedValue(form.vote);
	if (vote == "" && form.comment.value == "") {
		alert( 'Please fill in the vote or the comment or both');
		return false;
	}

	xajax_doSubmitVoteComment(vote, form.comment.value, form.recipe_id.value);
}

function rrgetCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}



window.addEvent('domready', function() {
		
	//slider variables for making things easier below
	var itemsHolder = $('container');
	if(itemsHolder != null) {
		var myItems = $$(itemsHolder.getElements('.item'));
		
		
		//create instance of the slider, and start it up		
		var mySlider = new SL_Slider({
			slideTimer: 5000,
			orientation: 'none',      //vertical, horizontal, or none: None will create a fading in/out transition.
			fade: true,                    //if true will fade the outgoing slide - only used if orientation is != None
			isPaused: false,
			container: itemsHolder,
			items: myItems
		});
		mySlider.start();

	} else {
		var mySlide = new Fx.Slide($('vid'));
		var btn = new Fx.Slide($('watchVideo'));

	
		$('watchVideo').addEvent('click', function(e){
			e = new Event(e);
			$('vid').setStyle('display','block');
			mySlide.slideIn();
			$('watchVideo').setStyle('display','none');
			btn.slideOut();
			e.stop();
		});
		
		$('closeVideo').addEvent('click', function(e){
			e = new Event(e);
			mySlide.slideOut();
			
			$('watchVideo').setStyle('display','block');
			btn.slideIn();
			$('vid').setStyle('display','none');
			e.stop();
		});
	}
					 
});