function slideshow(prefix, number) {
	var current = 1;
	function transition() {
		current = current % number + 1;
		$(prefix + "-bottom").firstChild.src = "images/" + prefix + "-" + current + ".jpg";
		new Effect.Opacity(prefix + "-top", {
			duration: 5.0, from: 1.0, to: 0.0,
			afterFinish: function() {
				$(prefix + "-top").firstChild.src = "images/" + prefix + "-" + current + ".jpg";
				Element.setOpacity(prefix + "-top", 1.0);
			}
		});
	}
	transition();
	new PeriodicalExecuter(transition, 10.0);
}

function print_recipe(obj) {
	var content = obj.parentNode.parentNode.innerHTML;
	var title = /<h1>([^<]*)<\/h1>/i.exec(content);
	if (title) title = title[1]; else title = 'Untitled';
	var recipe_window = window.open();
	recipe_window.document.open();
	recipe_window.document.write('<html><head>');
	recipe_window.document.write('<title>' + title + '</title>');
	recipe_window.document.write('<link rel="stylesheet" href="http://antoniotahhan.com/wp-content/themes/antoni5_wp/recipe.css" />');
	recipe_window.document.write('</head><body>');
	recipe_window.document.write(content);
	recipe_window.document.write('</body></html>');
	recipe_window.document.close();
	recipe_window.onload = function() { recipe_window.print(); }
}

function subscribe() {
	window.open('http://www.feedburner.com/fb/a/emailverifySubmit?feedId=2019464', 'popupwindow', 'scrollbars=yes,width=550,height=520');
	var form = document.createElement("form");
	form.action = 'http://www.feedburner.com/fb/a/emailverify';
	form.method = 'post';
	form.target = 'popupwindow';
	form.style.display = 'none';
	form.innerHTML = '<input type="hidden" value="http://feeds.feedburner.com/~e?ffid=2019464" name="url"/>' +
		'<input type="hidden" value="Tony Tahhan" name="title"/>' + 
		'<input type="hidden" name="loc" value="en_US"/>';
	var email = document.createElement("input");
	email.name = 'email';
	email.type = 'text';
	email.value = $F('email');
	form.appendChild(email);
	$('all').appendChild(form);
	form.submit();
}

/**
 * Returns the value of the selected radio button in the radio group
 * 
 * @param {radio Object} or {radio id} el
 * OR
 * @param {form Object} or {form id} el
 * @param {radio group name} radioGroup
 */
function $RF(el, radioGroup) {
	if($(el).type == 'radio') {
		var el = $(el).form;
		var radioGroup = $(el).name;
	} else if ($(el).tagName.toLowerCase() != 'form') {
		return false;
	}
	return $F($(el).getInputs('radio', radioGroup).find(
		function(re) {return re.checked;}
	));
}
