Changed base url and path generation

Dynamically find the port the server is listening to and include in
server name if different from port 80. Use $_SERVER variables
REQUEST_URI to get base uri to determine location of the css file etc.