Isn't screen.availWidth just the same as 'device-width'? In which case, why not just hard-code the viewport meta tag to be 'width=device-width' on line 14 and do away with this javascript completely?