
function outputLegend(json) {

legenditemList = "";

 tableHeader = '<table id="dataTable" class="legendTable">' +
		        '<tr>' +
			    '<th>Legend</th>' +
			    '<th></th>' +
		        '</tr>';

    for (i=0;i<json.count;i++) {
      legenditemList += make_legend(json.value.items[i], i);
    }

  tableFooter = '</table>';

  return tableHeader + legenditemList + tableFooter;
}

function make_legend(item, item_id) {

return '<tr>' +
         '<td>' + item.name +'</td>' +
         '<td><img src="' + item.icon +'" width="20px"/></td>' +
       '</tr>';

}



function outputTypemenu(json) {

menuitemList = "";

 menuHeader = '<select id="type" name="type">';

    for (i=0;i<json.count;i++) {
      menuitemList += make_menu(json.value.items[i], i);
    }

  menuFooter = '</select>';

  return menuHeader + menuitemList + menuFooter;
}

function make_menu(item, item_id) {
return '<option value="' + item.id + '">' + item.name + '</option>';
}

