function myToggle(source, target){
	$(target).slideToggle(400);
	
	$(source)
		.text($(source).text() == 'view this recipe' ? 'hide this recipe' : 'view this recipe')
		.toggleClass("collapse")
		.toggleClass("expand");
}

function disabler() {
	
}

$(document).ready(function() {
	// hides the slickbox as soon as the DOM is ready
	// (a little sooner than page load)
	$('div.details').hide();
	// Changes all checkboxes
	$('input').checkBox();
	
	$(".col-min-bot input.adding").datepicker();
	
	/* Disables friends/groups when everyone is checked
	$('#view-profile-everyone').bind("change", function(){
		if($('#view-profile-everyone').is(':checked')){ 
			$('#view-profile-groups').removeAttr("checked");
			$('#view-profile-groups').checkBox();
			$('#view-profile-groups-label').css({opacity:0.5});
			$('#view-profile-groups-img').css({opacity:0.5}).removeClass('ui-checkbox-state-checked');
			$('#view-profile-groups-text').css({opacity:0.5});
		} else {
			$('#view-profile-groups-label').css({opacity:1});
			$('#view-profile-groups-img').css({opacity:1})
			$('#view-profile-groups-text').css({opacity:1});
		}
	});
	$('#view-profile-groups').bind("change", function(){
		if($('#view-profile-groups').is(':checked')){
			$('#view-profile-everyone').removeAttr("checked");
			$('#view-profile-everyone').checkBox();
			$('#view-profile-everyone-img').removeClass('ui-checkbox-state-checked');
			$('#view-profile-groups-label').css({opacity:1});
			$('#view-profile-groups-img').css({opacity:1});
			$('#view-profile-groups-text').css({opacity:1});
/*		} else if ($('#view-profile-groups-text') != null){
			$('#view-profile-groups').addAttr("checked", "checked");
			$('#view-profile-everyone').removeAttr("checked").removeClass('ui-checkbox-state-checked');
			$('#view-profile-groups-label').css({opacity:1});
			$('#view-profile-groups-img').css({opacity:1}).addClass('ui-checkbox-state-checked');
			$('#view-profile-groups-text').css({opacity:1});
		} else if($('#view-profile-everyone').is(':checked')){
			$('#view-profile-groups-label').css({opacity:0.5});
			$('#view-profile-groups-img').css({opacity:0.5});
			$('#view-profile-groups-text').css({opacity:0.5});
		}
	});
	*/

	
	// toggles the slickbox on clicking the noted link  
	$('a.toggle-featured').click(function() {
		myToggle(this, '#recipe-det-featured');
		return false;
	});
	
	$('a.toggle-random').click(function() {
		myToggle(this, '#recipe-det-random');
		return false;
	});
		
	$('a.toggle-today').click(function() {
		myToggle(this, '#recipe-det-today');
		return false;
	});

});
