David: now retrieves and passes all details to javascript for gaphs. clientid is hard coded to 1
David: all functions now take user,campaign,event ids etc etc.
changed some variable names to make them clearer, tidied table data retrieval for case 30