added common php

added common php functions
changed the way of loading scripts
cleaned up footer and header