Altered Javascript

Made javascript generic so it can be used on all pages