+};
+
+(function () {
+ var temp;
+
+ var style_props = {
+ width: 'width',
+ height: 'height',
+ padingLeft: 'padding-left',
+ paddingRight: 'padding-right',
+ paddingTop: 'padding-top',
+ paddintBottom: 'padding-bottom',
+ borderLeftStyle: 'border-left-style',
+ borderRightStyle: 'border-right-style',
+ borderTopStyle: 'border-top-style',
+ borderBottomStyle: 'border-bottom-style',
+ borderLeftWidth: 'border-left-width',
+ borderRightWidth: 'border-right-width',
+ borderTopWidth: 'border-top-width',
+ borderBottomWidth: 'border-bottom-width',
+ fontFamily: 'font-family',
+ fontSize: 'font-size',
+ lineHeight: 'line-height',
+ letterSpacing: 'letter-spacing',
+ wordSpacing: 'word-spacing' };
+
+ function copy_style (from, to)
+ {
+ var from_style = getComputedStyle(from,'');
+ for(var name in style_props)
+ to.style[name] = from_style.getPropertyValue (style_props[name]);
+ to.style.left = from.offsetLeft + 'px';
+ to.style.top = from.offsetTop + 'px';
+ to.style.width = from.offsetWidth;
+ to.style.height = from.offsetHeight;
+ }
+
+ MIM.get_preedit_pos = function (target, ic)
+ {
+ if (! temp)
+ {
+ temp = document.createElement ('div');
+ temp.style.visibility = 'hidden';
+ temp.style.position = 'absolute';
+ temp.appendChild (document.createElement ('span'));
+ temp.appendChild (document.createElement ('span'));
+ document.getElementsByTagName ('body')[0].appendChild (temp);
+ }
+ if (temp.ic != ic)
+ {
+ temp.ic = ic;
+ copy_style (target, temp);
+ ic.abs_top = 0;
+ ic.abs_left = 0;
+ for (var elm = target.offsetParent; elm; elm = elm.offsetParent)
+ {
+ ic.abs_top += elm.offsetTop;
+ ic.abs_left += elm.offsetLeft;
+ }
+ }
+ temp.firstChild.innerText = target.value.substr (0, ic.range[0]);
+ temp.lastChild.innerText = "." + target.value.substr (ic.range[0], ic.range[1]);
+ ic.abs_y = (ic.abs_top + temp.lastChild.offsetTop
+ + temp.lastChild.offsetHeight - target.scrollTop);
+ ic.abs_x0 = ic.abs_left + temp.lastChild.offsetLeft;
+ ic.abs_x1 = ic.abs_x0 + temp.lastChild.offsetWidth;
+ }
+}) ();