﻿function initTaging(element)
{
    $.ajax(
    {
        type: "POST",
        url: APP_ROOT_PATH + "/Ajax/GetTags",
        data: "",
        success: function(result)
        {
            if (result.toString() != "")
            {
                var tagList = $.evalJSON(result);

                var autocomplete = new Array();
                $.each(tagList, function(i, tag)
                {
                    autocomplete.push(tag.Value);
                });

                element.autocomplete(autocomplete, {
                    multiple: true,
                    autoFill: true,
                    scroll: true
                });
            }
        },
        error: function(req, status, error)
        {
            //todo: handle error
        }
    });
}
