$(function(){ bhPage.init(); }) var bhPage = { init: function(){ this.fixPage(); }, fixPage: function(){ $('#player_container').css('left', Math.round(($(window).width() - 950) / 2)); $('#main_container').css('margin-left', Math.round(($(window).width() - 950) / 2)); } }