
  google.load("jquery", "1");
  google.setOnLoadCallback(function() {
  	$('.left-nav li').bind('mouseover',function() {
  		if($(this).hasClass('selected')) {
  			$(this).addClass('selected');
  			$(this).attr('selected',1);
  		}
  		$(this).addClass('selected');
  	}).bind('mouseout',function() {
  		if($(this).attr('selected')!=1)
			$(this).removeClass('selected');
  	});
  	
  	$(".theFocus").bind('focus',function(){
  		var el = $(this);
  		if(el.val()==el.attr('alt'))
  			el.val('');
  	}).bind('blur',function(){
  		var el = $(this);
  		if(el.val()=='')
  			el.val(el.attr('alt'));
  	});
  	
  	$(".biogs-bar").bind("mouseover",function() {
  		var el = $(this);
  		el.css("background","#d3f0f4");
  	});
  	
  	$(".biogs-bar").bind("mouseout",function() {
  		var el = $(this);
  		el.css("background","");
  	});
  	
  	$(".biogs-bar").bind("click",function() {
  		var el = $(this);
  		var id = el.attr('id').replace('blink','');
  		$.get("/biographies/"+id, function(data){
			attachPopup(data);
		});
  	});
  	
  });
  
function attachPopup(data) {
	$('.popup-window').remove();
	if(!$('.popupBackground').size())
		$('body').append('<div class="popupBackground closePopup"></div>');
	$('body').append(data);
	$('.closePopup').bind('click',function() {
		$('.popup-window').remove();
		$('.popupBackground').remove();
	});
  	
  	$(".popupLink").bind("click",function() {
  		var el = $(this);
  		var id = el.attr('id').replace('blink','');
  		$.get("/biographies/"+id, function(data){
			attachPopup(data);
		});
  	});
}
