$(document).ready(function(){
	var setUp = function(){
		$('section').css('marginTop',($(document).height() - $('section').height()) / 2).css('marginLeft',($(document).width() - $('section').width()) / 2);
	}
	$(window).resize(function(){
		setUp();
	});
	(function(){
		if($('#pedigree').width() > 0){
			$('.pedigreewraper').each(function (){
				$(this).css('top',($(this).parent().height()-$(this).height()) / 2);
			});
			$('.dayza').each(function(){
				$(this).bind('click',function(event){
					event.preventDefault();
					var tar=$(event.target).html().split('.');
					window.open('week'+tar[0]+'.php', 'Week ' + tar[0], 'scrollbars=1,width=480,height=500');
				});
			});
			$('#pedigreelink, #pedigreelinkstatic').bind('click',function(){
				$('#pedigree').css('display','block');
			});
			$('.closepedi').bind('click',function(){
				$('#pedigree').css('display','none');
			});
			$('.closepic').bind('click',function(){
				$('#pictures').css('display','none');
			});
			$('#picst').bind('click',function(){
				$('#pictures').css('display','block');
			});
		
			$('#pedigree').draggable({
				handle: '#pedimover'
			});
			$('#pictures').draggable({
				handle: '#picmover'
			});
		};
		setUp();
	})();
});
