function showBalloon(path)
{
	new Ajax.Request(
		path,
		{
			method: 'get',
			onSuccess: function(transport) {
				//alert(transport.responseText.replace(/'/g, ""));
				foo = transport.responseText.replace(/'/g, "");
				foo = foo.replace(/<i>/g, "");
				foo = foo.replace(/<\/i>/g, "");
				Tip(
					foo,
					BALLOON, true, ABOVE, true, OFFSETX, -10, WIDTH, 360, TEXTALIGN,
					'left', 0, 500, 0, 500, PADDING, 8
				);
			}
		}
	);
}

function ajaxUpdateUseful(reviewID, useful)
{
	var serialized = Form.serialize('frm_useful_' + reviewID);
	
	if (useful == 'useful')
	{
		serialized = serialized.replace(/\&notuseful=1/, '');
	}
	else if (useful == 'notuseful')
	{
		serialized = serialized.replace(/\&useful=1/, '');
	}
	else
	{
		return false;
	}
	
	new Ajax.Updater(
		'useful_' + reviewID,
		'/review/useful/update',
		{
			method: 'post',
			parameters: serialized
		}
	);
	
	return false;
}

function clickInnerTab(elemID)
{
	// TODO: Figure out a way to do this
}

// The ajax function call to render an inner tab on a detail page
function renderInnerTab(elem)
{
	// For now, don't execute an ajax call for the at a glance tab - problems with the media gallery -- Matt
	if (elem.id && elem.id == 'at_a_glance_tab') return true;
	
	var path = elem.href;
	// Get all <li> elements that are descendants of the info_nav element
	var navItems = $('info_nav').getElementsBySelector('li');
	
	// First de-select the currently selected tab
	for (var i = 0; i < navItems.length ; i++)
	{
		if ($(navItems[i]).hasClassName('selected'))
		{
			$(navItems[i]).removeClassName('selected');
			break;
		}
	}
	
	// Now select the clicked tab, this swaps the image to a selected tab
	$(elem).ancestors()[0].addClassName('selected');
	
	// The additional_info <ul> tag is the target to be updated
	new Ajax.Updater('additional_info', path, { method: 'get', evalScripts: true });
	return false;
}

/*
// ATTN: The event selectors code doesn't seem to be working always...  For now, nobody is using it
// but the code will remain here in case we can figure out how to make it work.  The code that was in
// here is now copied above in the renderInnerTab function.  -- Matt
// Set up the rules for when an inner tab is clicked
var InnerTabRules =
{
	'#info_nav a:click': function(elem)
	{
		// Get all <li> elements that are descendants of the info_nav element
		var navItems = $('info_nav').getElementsBySelector('li');
		
		// First de-select the currently selected tab
		for (var i = 0; i < navItems.length ; i++)
		{
			if ($(navItems[i]).hasClassName('selected'))
			{
				$(navItems[i]).removeClassName('selected');
				break;
			}
		}
		
		// Now select the clicked tab, this swaps the image to a selected tab
		$(elem).ancestors()[0].addClassName('selected');
		
		// Now render the inner tab by calling an AJAX request
		renderInnerTab($(elem).href);
	}
}

// Fire the inner tab rules after the page is loaded
Event.observe(window, 'load', function() {
	EventSelectors.start(InnerTabRules);
});
*/
