function initialiseEditor() {
    tinyMCE.init({
        editor_selector: "tiny_mce",
        mode: "textareas",
        readonly: false,
        theme: "advanced",
        theme_advanced_buttons1: "bold, italic, underline, formatselect, cut, copy, paste, pastetext, pasteword, link, unlink, bullist, numlist,code",
        theme_advanced_buttons2: "",
        theme_advanced_buttons3: "",
        theme_advanced_buttons4: "",
        theme_advanced_toolbar_align: "center",
        theme_advanced_toolbar_location: "top",
        theme_advanced_resizing: false
    });
}

function initialiseAutoComplete() {
    $("#Business_TownCity").autocomplete('/Pet-Directory/Town/LookupTowns', {
        dataType: 'json',
        parse: function (data) {
            var rows = new Array();

            for (var i = 0; i < data.length; i++) {
                rows[i] = {
                    data: data[i],
                    value: data[i].Town,
                    result: data[i].Town
                };
            }

            return rows;
        }, formatItem: function (row, i, max) {
            return row.Town;
        }, delay: 100,
        highlight: false,
        limit: 10,
        minChars: 2,
        multiple: false,
        width: 300
    });

    $("#Business_TownCity").result(function (event, data, formatted) {
        if (data) $("#Business_County").val(data["County"]);
    });
}
