
/*
INPUT PARAMETERS 
area = the div to be updated
categoryName = the prefix checkbox element id for the category checkboxes
labelName = the prefix label element id for labels
*/
function updateCategories(area, categoryName, labelName, category_ids)
{
  var updateArea = $(area);
  var output = "";
  var category = "";
  var label = "";
  
  if (updateArea) 
  {

    for( idx in category_ids )
	  {
	     category = document.getElementById(categoryName + category_ids[idx]);
	     
	     if ((category) && (category.checked))
	     {
	        label = document.getElementById(labelName + category_ids[idx]); 
	            
	        if (label) output = output + label.title + ", ";
       }
    }

    output == "" ? output = "no categories selected" : "";
    updateArea.innerHTML = output;
  }
}
