function bg_resize()
{
    var docheight	= document.documentElement.clientHeight;
    var docwidth	= document.documentElement.clientWidth;
    
    $("#bg").css("height",docheight).css("width",docwidth);
    $("#bg div").css("height",docheight).css("width",docwidth);
    $("#bg img").css("width",docwidth);
    $("#wrapper").css("height",docheight).css("width",docwidth);
    $("#persons").css("height",$("#bg img").attr("height"));
}

function bg_show()
{
    $("#bg").hide().fadeIn(100).children().hide().fadeIn(500);
    bg_resize();
}

$(document).ready(function(){
    bg_resize();
    
    $(window).resize(function(){
    	bg_resize();
    });
    
    $(document).mousemove(function(e){
    	$(".tooltip").css("top",e.pageY+15).css("left",e.pageX+15).show();
    }); 
    
    $(".person").mouseenter(function(){
    	var html = $(this).html().split(" - ");
    	
    	if(html.length == 1){
    		html[1] = '';
    	}
    	
    	var tooltip = '<div class="tooltip" style="display:none;"><strong>' + html[0] + '</strong>';
    	
    	if(html[1] !== ""){
    		tooltip = tooltip + "<p>" + html[1].replace('/','<br />') + "</p>";
    	}
    	
    	tooltip = tooltip + '</div>';
    	
    	$("#wrapper").prepend(tooltip);
    	$(".tooltip").fadeIn(100);
    	return false;
    }).mouseleave(function(){
    	$(".tooltip").fadeOut(100,function(){
    		$(this).remove();
    	});
    });
});
