// register an onchange behaviour
Behaviour.register({
   '#Form_EditForm_ExistingTags': {
      onchange: function() {
         Tags = document.getElementById("Form_EditForm_Tags");
         var comma = '';

         // the first option in the dropdown list is the text 'select a tag', so ignore this option
         if (this.selectedIndex > 0) {

            // add the selected tag, separated with a comma (if necessary)
            if (Tags.value != '') {
               comma = ', ';
            }
            Tags.value += comma + this.options[this.selectedIndex].innerHTML;
            
            // after the tag has been added to the blog entry remove it from the dropdown list
            this.options[this.selectedIndex] = null;
         }
      },
      initialize: function() {
         this.onchange();
      }
   }
}); 

// register an onchange behaviour
Behaviour.register({
   '#MultiUserBlogEntry_Form_MultiUserBlogEntryForm_ExistingTags': {
      onchange: function() {
         Tags = document.getElementById("MultiUserBlogEntry_Form_MultiUserBlogEntryForm_Tags");

         // the first option in the dropdown list is the text 'select a tag', so ignore this option
         if (this.selectedIndex > 0) {

            
            Tags.value = this.options[this.selectedIndex].innerHTML;
            
            // after the tag has been added to the blog entry remove it from the dropdown list
            //this.options[this.selectedIndex] = null;
         }
      },
      initialize: function() {
         this.onchange();
      }
   }
}); 
// register an onchange behaviour
Behaviour.register({
   '#Form_MultiUserBlogTagsForm_ExistingTags': {
      onchange: function() {
         

         // the first option in the dropdown list is the text 'select a tag', so ignore this option
         if (this.selectedIndex > 0) {
			location.href =  "multiuserblog/tag/" + this.options[this.selectedIndex].innerHTML;
			
         }
      },
      initialize: function() {
         this.onchange();
      }
   }
}); 