
$(function(){
	var emj_map=[
		[58942,58943,58944,58945,58946,58947,58948,58949,58950,58951,58952,58953,58954,58955,58956,58957,58958,58959,58960,58961],
		[58962,58963,58964,58965,58966,58967,58968,58969,58970,58971,58972,58973,58974,58975,58976,58977,58978,58979,58980,58981],
		[58982,58983,58984,58985,58986,58987,58988,58989,58990,58991,58992,58993,58994,58995,58996,58997,58998,58999,59000,59001],
		[59002,59003,59004,59005,59006,59007,59008,59009,59010,59011,59012,59013,59014,59015,59016,59017,59018,59019,59020,59021],
		[59022,59023,59024,59025,59026,59027,59028,59029,59030,59031,59032,59033,59034,59035,59036,59037,59038,59039,59040,59041],
		[59042,59043,59044,59045,59086,59087,59088,59089,59090,59091,59092,59093,59094,59095,59096,59097,59098,59099,59100,59101],
		[59102,59103,59104,59105,59106,59107,59108,59109,59110,59111,59112,59113,59114,59115,59147,59116,59117,59118,59119,59120],
		[59121,59122,59123,59124,59125,59126,59127,59128,59129,59130,59131,59132,59133,59134,59135,59136,59137,59138,59139,59140],
		[59141,59142,59143,59144,59145,59146,59052,59053,59054,59057,59058,59059,59063,59064,59065,59066,59148,59149,59150,59151],
		[59152,59153,59154,59155,59156,59157,59158,59159,59160,59161,59162,59163,59164,59165,59166,59167,59168,59169,59170,59171],
		[59172,59173,59174,59175,59176,59177,59178,59179,59180,59181,59182,59183,59184,59185,59186,59187,59188,59189,59190,59191],
		[59192,59193,59194,59195,59196,59197,59198,59199,59200,59201,59202,59203,59204,59205,59206,59207,59208,59209,59210,59211],
		[59212,59213,59214,59215,59216,59217,59218,59219,59220,59221,59222,59223]
	];
	var box = $('#id_body').get(0);
	$("#emj_3").click(function(e){
		var em_x = Math.floor((e.pageX - $(this).offset().left)/20);
		var em_y = Math.floor((e.pageY - $(this).offset().top)/20);
		if(em_y in emj_map && em_x in emj_map[em_y]){
			var v=String.fromCharCode(emj_map[em_y][em_x]);
			box.focus();
			if (jQuery.browser.msie) {
				var r = document.selection.createRange();
				r.text = v;
				r.select();
			} else {
				var s = box.value;
				var p = box.selectionStart;
				var np = p + v.length;
				box.value = s.substr(0, p) + v + s.substr(p);
				box.setSelectionRange(np, np);
			}
			ta.keyup();
		}
	});
});




$(function(){
	$('#emj_1').click(function(){
		$(this).slideUp();
		$('#emj_2').slideDown();
		
	});
});


