﻿(function ($) {
    $.fn.sexyInput = function (options) {
        this.each(function (index) {
            $(this).unbind('mouseover');
            $(this).unbind('mouseout');
            $(this).unbind('mouseup');
            $(this).unbind('outerClick');
            var oc = $(this).attr('sexyInput');
            var nc = $(this).attr('sexyInput');
            nc = nc + '_sexyInput';
            $(this).bind({
                'mouseover': function () {
                    if ($(this).attr('sexy_Input') != 'true') {
                        if ($(this).hasClass(oc)) {
                            $(this).removeClass(oc);
                            $(this).addClass(nc);
                        }
                    }
                },
                'mouseout': function () {
                    if ($(this).attr('sexy_Input') != 'true') {
                        if ($(this).hasClass(nc)) {
                            $(this).removeClass(nc);
                            $(this).addClass(oc);
                        }
                    }
                },
                'mouseup': function () {
                    $(this).attr('sexy_Input', 'true');
                    if ($(this).hasClass(oc)) {
                        $(this).removeClass(oc);
                        $(this).addClass(nc);
                    }
                },
                'outerClick': function () {
                    $(this).removeAttr('sexy_Input');
                    if ($(this).hasClass(nc)) {
                        $(this).removeClass(nc);
                        $(this).addClass(oc);
                    }
                }
            });
        });
    }
})(jQuery);
