﻿/// <reference path='jquery-1.3.2-vsdoc.js' />


(function($) {
    $.fn.editor = function() {
        $.editor(this);
    };
    var emots = ['^_^', '\:-P', '@_@', 'T_T', '-_-b', '-_-+', '=_="', '-O-', '-w-', '\(^o^)/', 'Orz', '囧rz'];
    $.editor = function(textarea) {
        var $editor = $(textarea);
        var ulEmots = new jQuery('<ul class="textEmots"></ul>');
        jQuery(emots).each(function(index, item) {
            var li = jQuery('<li>' + item + '</li>');
            li.mousemove(function() {
                jQuery(this).css("font-size", "18px");
            });
            li.mouseout(function() {
                jQuery(this).css("font-size", "13px");
            });
            li.mousedown(function() {
                jQuery(this).css("font-size", "13px");
                jQuery(textarea).val( jQuery(textarea).val() + jQuery(this).text());
            });
            li.appendTo(ulEmots);
        });
        ulEmots.appendTo(jQuery(textarea).parent("fieldset"));
    }
})(jQuery);
