$(function() {

	// Lightbox
	$("a.lightbox").lightBox();
	
	$(".quicklink").each(function() {
		$(this).mouseover(function() {
			$(this).addClass('over');
		});
		$(this).mouseout(function() {
			$(this).removeClass('over');
		});
	});
	
	$('img[alt="read more"]').each(function() {
		$(this).mouseover(function() {
			$(this).attr('src', '/img/read_more_button_over.png');
		});
		$(this).mouseout(function() {
			$(this).attr('src', '/img/read_more_button.png');
		});
	});
	
	$('img[alt="Read more"]').each(function() {
		$(this).mouseover(function() {
			$(this).attr('src', '/img/blog_read_more_button_over.png');
		});
		$(this).mouseout(function() {
			$(this).attr('src', '/img/blog_read_more_button.png');
		});
	});
	
	setTimeout(embedBalls, 1200); // Can only set the balls movie after sifr has updated the layout
	
	$('div#back-to-top').click(function() {
		$('body').scrollTo(1000);
		return false;
	});
	$(window).scroll(function() {
		var $offset = $(window).scrollTop();
		if($offset > 1300) {
			$('div#back-to-top').fadeIn();
		}
		else {
			$('div#back-to-top').fadeOut();
		}
	});
	
	$(".member-location:odd").css("marginRight",0);
});

function embedBalls() {
	var $selectedPrimary = $('#menu li.selected').position().top - 35;
	$('#menu-flash').css('padding-top', $selectedPrimary + 'px');
	swfobject.embedSWF("/flash/balls.swf", "balls", "30", "30", "9.0.0", false, null, {wmode:'transparent'});
}


