- get rid of depecated calls to ad_header and ad_footer- adjust size of parameter default value depending on type- more sane quoting- produce more valid HTML
- fixing a wierd interaction between a db_foreach and db_transaction, which leads to wierd values in parameters. Moving from db_foreach to db_list_of_lists repairs the test case.