﻿
Core = function() {
    return {
        ToolTipSetup: function() {
            $('.AddReminderToolTip').qtip({
                content: 'Add Reminder',
                style:
				{
				    name: 'light',
				    tip: 'bottomLeft'
				},
                position: {
                    corner: {
                        target: 'topRight',
                        tooltip: 'bottomLeft'
                    }
                }
            });

            Core.RemoveActiveToolTip();
        },
        RemoveActiveToolTip: function() {
            //Sometimes the tooltip remains active.  Just hide the ones that are active
            $('.qtip-active').hide();
        },
        SetupNameSplit: function() {
            $('.doNameSplitField').blur(function() {
                var fullName = $(this).val().trim();

                if (fullName != '') {
                    var displayName = fullName;
                    var nameValues = fullName.split(' ');

                    if (nameValues.length > 1) {
                        var lastName = nameValues.pop();

                        displayName = lastName + ', ' + nameValues.join(' ');
                    }

                    $('.displayNameField').val(displayName);
                }
            });
        }
    }
} ();
