
// Position an object at a specific pixel coordinate
function shiftTo(selector, x, y) {
	$(selector).css({"left" : x, "top" : y});
}


// Center a positionable element whose name is passed as 
// a parameter in the current window/frame, and show it
function centerxy(id, width, height) {
		
		id = '#' + id;
    
    var x = Math.round(($(window).width()/2) - (width/2));
    var y = Math.round(($(window).height()/2) - (height/2));
    	
    shiftTo(id, x, y);
    $(id).css("visibility","visible");
}


$(document).ready(function(){
	// assume that the first child <div> within the document
	// <body> is the main container, which is to be centered
	var target = $('body div:first-child').attr("id");
	var width = 1061;
	var height = 426;
	
	centerxy(target, width, height);
	
	$(window).resize(function() {
		centerxy(target, width, height);
	});
});

