Imported several functions from piwik.js, translating them to PHP.  Refactored existing methods to take advantage of imported functions.
Replaced tabs with spaces.
Removed unnecessary code imported from piwik.js
Refactored and renamed cookie creation functions to better match piwik.js.
Fixed typos and added missing parameters to parallel piwik.js
Fixed typo