/* Top-list conditions code */
TopList = {
	init: function() {
		this.addConditionLink();
	}, 

	addConditionLink: function() {
		
		var box = $('<div id="top-list-conditions-box"></div>').appendTo('body').hide();
		var contentId = 105;
		
/*		$('<div><a href="#" class="red conditions">Conditions</a></div>').insertAfter('#top-list.top-list-2693 a.red').find('a').click(function() {
			$.post('/ajax/fetch/review.php', {contentId: contentId}, function(data) {
				box.html(data).show().center().hide().fadeIn(300);

				$('<div><a href="#" class="close">Close</a></div>').prependTo(box).click(function() {
					box.fadeOut(300);

					return false;
				});
			});

			return false;
		});*/
	}
};

function showConditions( contentId )
{
	var box = $('<div id="top-list-conditions-box"></div>').appendTo('body').hide();
	var content = contentId;
	$.post('/ajax/fetch/review.php', {contentId: content}, function(data) {
		box.html(data).show().center().hide().fadeIn(300);

		$('<div><a href="#" class="close">Close</a></div>').prependTo(box).click(function() {
			box.fadeOut(300);

			return false;
		});
	});
	return false;
}

/* Onload */
$(document).ready(function()
{
	
	$('body').SimpleImageViewer();

	TopList.init();

	// Tooltips
	$('img[@src$="tip.gif"]').Tooltip(
	{
		delay: 0,
		track: true, 
		showURL: false 
	}).css({cursor: 'help'});

	// Remove submit and auto-submit onchange
	$('#sub-navigation form p input').remove();
	$('#sub-navigation select').change(function()
	{
		window.location = $(this).val();
	});

	// Newsletter Signup Form
	$('input[@alt]').each(function()
	{
		$(this).val($(this).attr('alt'));
	}).focus(function()
	{
		if($(this).val() == $(this).attr('alt'))
		{
			$(this).val('');
		}
	}).blur(function()
	{
		if($(this).val() == '')
		{
			$(this).val($(this).attr('alt'));
		}
	});

});