Used getComputedStyle instead of homemade function. Updated sample page.