cb.center = function(x, y) { var c = $('#'+ cb.o.id); var newX; var newY; x = x || 0; y = y || 0; // Handle aligning. if (cb.o.verticalAlign) { var h = self.innerHeight || document.documentElement.clientHeight || $('body')[0].clientHeight || 0; newY = ((h - $('#'+ cb.o.craqboxId).height()) / 2) + y; } else { newY = (cb.o.padding + window.scrollY); } c.css('top', newY +'px'); // Handle aligning. if (cb.o.horizontalAlign) { var w = $(document.body).width(); newX = ((w + window.scrollX - cb.o.width) / 2) + x; } else { newX = (cb.o.padding + window.scrollX); } c.css('left', newX +'px'); // Reset the hiders size. cb.hider(); };