how do i get the page width?

i think its window.width .. but it dont seem to be working

maybe its the synax?

var initX = (window.width / 2) - 300;


cheers
si