// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function updateTag(tag) {
  tags = document.getElementById("page_tag_list").value;
  tagsArray = tags.split(', ');
  tagsString = tagsArray.join(',');
  tagsArray = tagsString.split(',');
  if(tagsArray.include(tag)) {
    tagsArray = removeItems(tagsArray, tag);
    $('tag_' + tag).removeClassName('selected'); 
  }
  else {
    tagsArray.push(tag);
    $('tag_' + tag).addClassName('selected'); 
    // alert(document.getElementById());
  }
  
  tags = document.getElementById("page_tag_list").value = tagsArray.join(', ');
}