/**
 * Global JS
 * @author George Steel <george@net-glue.co.uk>
 * @copyright Copyright (c) 2011, Net Glue Ltd
 * @license http://opensource.org/licenses/mit-license.php MIT License
 * @version $Id: global.js 87 2011-03-28 13:26:23Z george $
 */

$(function() {
	$('ul.flashStack li').click(function() {
		$(this).slideUp("slow");
	});
	
	$('#bgSwitch ul li a').click(function(evt) {
		evt.preventDefault();
		$('#photoWrapper').css({
			'background-image': 'url(' + $(this).attr('href') + ')',
			'background-position': 'center bottom'
		});
		var name = $(this).attr('href').replace(/.*\/|\.[^.]*$/g, '');
		$.cookie('tadsurf_background', name);
		return false;
	});
	
	if($.cookie('tadsurf_background')) {
		$('body').addClass($.cookie('tadsurf_background'));
	}
	
	$("#twitterTabs").tabs({
		cache: true,
		cookie: { expires: 7 },
		ajaxOptions: {
			error: function( xhr, status, index, anchor ) {
				$( anchor.hash ).html("Sorry, I couldn\'t load this tab. We\'ll try to fix this as soon as possible. ");
			}
		}
	});

});
