/*
* Author: Timothy Bourke, NICTA
*/
var utf8 = new Object();
utf8['\\<supseteq>'] = 'โ';
utf8['\\<KK>'] = '๐';
utf8['\\<up>'] = 'โ';
utf8['\\<otimes>'] = 'โ';
utf8['\\<aa>'] = '๐';
utf8['\\<dagger>'] = 'โ ';
utf8['\\<frown>'] = 'โข';
utf8['\\<guillemotleft>'] = 'ยซ';
utf8['\\<qq>'] = '๐ฎ';
utf8['\\<X>'] = '๐ณ';
utf8['\\<triangleright>'] = 'โน';
utf8['\\<guillemotright>'] = 'ยป';
utf8['\\<nu>'] = 'ฮฝ';
utf8['\\<sim>'] = 'โผ';
utf8['\\<rightharpoondown>'] = 'โ';
utf8['\\<p>'] = '๐';
utf8['\\<Up>'] = 'โ';
utf8['\\<triangleq>'] = 'โ';
utf8['\\<nine>'] = '๐ต';
utf8['\\<preceq>'] = 'โผ';
utf8['\\<nabla>'] = 'โ';
utf8['\\<FF>'] = '๐';
utf8['\\<II>'] = 'โ';
utf8['\\<VV>'] = '๐';
utf8['\\<and>'] = 'โง';
utf8['\\<mapsto>'] = 'โฆ';
utf8['\\<ll>'] = '๐ฉ';
utf8['\\<F>'] = 'โฑ';
utf8['\\<degree>'] = 'ยฐ';
utf8['\\<beta>'] = 'ฮฒ';
utf8['\\<Colon>'] = 'โท';
utf8['\\<bool>'] = '๐น';
utf8['\\<e>'] = '๐พ';
utf8['\\<lozenge>'] = 'โ';
utf8['\\<u>'] = '๐';
utf8['\\<sharp>'] = 'โฏ';
utf8['\\<Longleftrightarrow>'] = 'โบ';
utf8['\\<Otimes>'] = 'โจ';
utf8['\\<EE>'] = '๐';
utf8['\\<I>'] = 'โ';
utf8['\\<UU>'] = '๐';
utf8['\\<exclamdown>'] = 'ยก';
utf8['\\<dots>'] = 'โฆ';
utf8['\\<N>'] = '๐ฉ';
utf8['\\<kk>'] = '๐จ';
utf8['\\<plusminus>'] = 'ยฑ';
utf8['\\<E>'] = 'โฐ';
utf8['\\<triangle>'] = 'โณ';
utf8['\\<eta>'] = 'ฮท';
utf8['\\<triangleleft>'] = 'โ';
utf8['\\<chi>'] = 'ฯ';
utf8['\\<z>'] = '๐';
utf8['\\<hungarumlaut>'] = 'ห';
utf8['\\<partial>'] = 'โ';
utf8['\\<three>'] = '๐ฏ';
utf8['\\<lesssim>'] = 'โฒ';
utf8['\\<subset>'] = 'โ';
utf8['\\<H>'] = 'โ';
utf8['\\<leftarrow>'] = 'โ';
utf8['\\<PP>'] = '๐';
utf8['\\<sqsupseteq>'] = 'โ';
utf8['\\<R>'] = 'โ';
utf8['\\<bowtie>'] = 'โจ';
utf8['\\<C>'] = '๐';
utf8['\\<ddagger>'] = 'โก';
utf8['\\<ff>'] = '๐ฃ';
utf8['\\<turnstile>'] = 'โข';
utf8['\\<bar>'] = 'ยฆ';
utf8['\\<propto>'] = 'โ';
utf8['\\<S>'] = '๐ฎ';
utf8['\\<vv>'] = '๐ณ';
utf8['\\<lhd>'] = 'โฒ';
utf8['\\<paragraph>'] = 'ยถ';
utf8['\\<mu>'] = 'ฮผ';
utf8['\\<rightharpoonup>'] = 'โ';
utf8['\\<Inter>'] = 'โ';
utf8['\\<o>'] = '๐';
utf8['\\<asymp>'] = 'โ';
utf8['\\<Leftarrow>'] = 'โ';
utf8['\\<Sqinter>'] = 'โจ
';
utf8['\\<eight>'] = '๐ด';
utf8['\\<succeq>'] = 'โฝ';
utf8['\\<forall>'] = 'โ';
utf8['\\<complex>'] = 'โ';
utf8['\\<GG>'] = '๐';
utf8['\\<Coprod>'] = 'โ';
utf8['\\<L>'] = 'โ';
utf8['\\<WW>'] = '๐';
utf8['\\<leadsto>'] = 'โ';
utf8['\\<D>'] = '๐';
utf8['\\<angle>'] = 'โ ';
utf8['\\<section>'] = 'ยง';
utf8['\\<TTurnstile>'] = 'โซ';
utf8['\\<mm>'] = '๐ช';
utf8['\\<T>'] = '๐ฏ';
utf8['\\<alpha>'] = 'ฮฑ';
utf8['\\<leftharpoondown>'] = 'โฝ';
utf8['\\<rho>'] = 'ฯ';
utf8['\\<wrong>'] = 'โ';
utf8['\\<l>'] = '๐
';
utf8['\\<doteq>'] = 'โ';
utf8['\\<times>'] = 'ร';
utf8['\\<noteq>'] = 'โ ';
utf8['\\<rangle>'] = 'โฉ';
utf8['\\<div>'] = 'รท';
utf8['\\<Longrightarrow>'] = 'โน';
utf8['\\<BB>'] = '๐
';
utf8['\\<sqsupset>'] = 'โ';
utf8['\\<rightarrow>'] = 'โ';
utf8['\\<real>'] = 'โ';
utf8['\\<hh>'] = '๐ฅ';
utf8['\\<Phi>'] = 'ฮฆ';
utf8['\\<integral>'] = 'โซ';
utf8['\\<CC>'] = 'โญ';
utf8['\\<euro>'] = 'โฌ';
utf8['\\<xx>'] = '๐ต';
utf8['\\<Y>'] = '๐ด';
utf8['\\<zeta>'] = 'ฮถ';
utf8['\\<longleftarrow>'] = 'โต';
utf8['\\<a>'] = '๐บ';
utf8['\\<onequarter>'] = 'ยผ';
utf8['\\<And>'] = 'โ';
utf8['\\<downharpoonright>'] = 'โ';
utf8['\\<phi>'] = 'ฯ';
utf8['\\<q>'] = '๐';
utf8['\\<Rightarrow>'] = 'โ';
utf8['\\<clubsuit>'] = 'โฃ';
utf8['\\<ggreater>'] = 'โซ';
utf8['\\<two>'] = '๐ฎ';
utf8['\\<succ>'] = 'โป';
utf8['\\<AA>'] = '๐';
utf8['\\<lparr>'] = 'โฆ';
utf8['\\<Squnion>'] = 'โจ';
utf8['\\<HH>'] = 'โ';
utf8['\\<sqsubseteq>'] = 'โ';
utf8['\\<QQ>'] = '๐';
utf8['\\<setminus>'] = 'โ';
utf8['\\<Lambda>'] = 'ฮ';
utf8['\\<RR>'] = 'โ';
utf8['\\<J>'] = '๐ฅ';
utf8['\\<gg>'] = '๐ค';
utf8['\\<hyphen>'] = 'ยญ';
utf8['\\<B>'] = 'โฌ';
utf8['\\<Z>'] = '๐ต';
utf8['\\<ww>'] = '๐ด';
utf8['\\<lambda>'] = 'ฮป';
utf8['\\<onehalf>'] = 'ยฝ';
utf8['\\<f>'] = '๐ฟ';
utf8['\\<Or>'] = 'โ';
utf8['\\<v>'] = '๐';
utf8['\\<natural>'] = 'โฎ';
utf8['\\<seven>'] = '๐ณ';
utf8['\\<Oplus>'] = 'โจ';
utf8['\\<subseteq>'] = 'โ';
utf8['\\<rfloor>'] = 'โ';
utf8['\\<LL>'] = '๐';
utf8['\\<Sum>'] = 'โ';
utf8['\\<ominus>'] = 'โ';
utf8['\\<bb>'] = '๐';
utf8['\\<Pi>'] = 'ฮ ';
utf8['\\<cent>'] = 'ยข';
utf8['\\<diamond>'] = 'โ';
utf8['\\<mho>'] = 'โง';
utf8['\\<O>'] = '๐ช';
utf8['\\<rr>'] = '๐ฏ';
utf8['\\<twosuperior>'] = 'ยฒ';
utf8['\\<leftharpoonup>'] = 'โผ';
utf8['\\<pi>'] = 'ฯ';
utf8['\\<k>'] = '๐';
utf8['\\<star>'] = 'โ';
utf8['\\<rightleftharpoons>'] = 'โ';
utf8['\\<equiv>'] = 'โก';
utf8['\\<langle>'] = 'โจ';
utf8['\\<Longleftarrow>'] = 'โธ';
utf8['\\<nexists>'] = 'โ';
utf8['\\<Odot>'] = 'โจ';
utf8['\\<lfloor>'] = 'โ';
utf8['\\<sqsubset>'] = 'โ';
utf8['\\<SS>'] = '๐';
utf8['\\<box>'] = 'โก';
utf8['\\<index>'] = 'ฤฑ';
utf8['\\<pounds>'] = 'ยฃ';
utf8['\\<Upsilon>'] = 'ฮฅ';
utf8['\\<ii>'] = '๐ฆ';
utf8['\\<hookleftarrow>'] = 'โฉ';
utf8['\\<P>'] = '๐ซ';
utf8['\\<threesuperior>'] = 'ยณ';
utf8['\\<epsilon>'] = 'ฮต';
utf8['\\<yy>'] = '๐ถ';
utf8['\\<h>'] = '๐';
utf8['\\<upsilon>'] = 'ฯ
';
utf8['\\<x>'] = '๐';
utf8['\\<not>'] = 'ยฌ';
utf8['\\<le>'] = 'โค';
utf8['\\<one>'] = '๐ญ';
utf8['\\<cdots>'] = 'โฏ';
utf8['\\<some>'] = 'ฯต';
utf8['\\<Prod>'] = 'โ';
utf8['\\<NN>'] = '๐';
utf8['\\<squnion>'] = 'โ';
utf8['\\<dd>'] = '๐ก';
utf8['\\<top>'] = 'โค';
utf8['\\<dieresis>'] = 'ยจ';
utf8['\\<tt>'] = '๐ฑ';
utf8['\\<U>'] = '๐ฐ';
utf8['\\<unlhd>'] = 'โด';
utf8['\\<cedilla>'] = 'ยธ';
utf8['\\<kappa>'] = 'ฮบ';
utf8['\\<amalg>'] = 'โจฟ';
utf8['\\<restriction>'] = 'โพ';
utf8['\\<struct>'] = 'โ';
utf8['\\<m>'] = '๐';
utf8['\\<six>'] = '๐ฒ';
utf8['\\<midarrow>'] = 'โ';
utf8['\\<lbrace>'] = 'โฆ';
utf8['\\<lessapprox>'] = 'โช
';
utf8['\\<MM>'] = '๐';
utf8['\\<down>'] = 'โ';
utf8['\\<oplus>'] = 'โ';
utf8['\\<wp>'] = 'โ';
utf8['\\<surd>'] = 'โ';
utf8['\\<cc>'] = '๐ ';
utf8['\\<bottom>'] = 'โฅ';
utf8['\\<copyright>'] = 'ยฉ';
utf8['\\<ZZ>'] = 'โจ';
utf8['\\<union>'] = 'โช';
utf8['\\<V>'] = '๐ฑ';
utf8['\\<ss>'] = '๐ฐ';
utf8['\\<unrhd>'] = 'โต';
utf8['\\<onesuperior>'] = 'ยน';
utf8['\\<b>'] = '๐ป';
utf8['\\<downharpoonleft>'] = 'โ';
utf8['\\<cdot>'] = 'โ
';
utf8['\\<r>'] = '๐';
utf8['\\<Midarrow>'] = 'โ';
utf8['\\<Down>'] = 'โ';
utf8['\\<diamondsuit>'] = 'โข';
utf8['\\<rbrakk>'] = 'โง';
utf8['\\<lless>'] = 'โช';
utf8['\\<longleftrightarrow>'] = 'โท';
utf8['\\<prec>'] = 'โบ';
utf8['\\<emptyset>'] = 'โ
';
utf8['\\<rparr>'] = 'โฆ';
utf8['\\<Delta>'] = 'ฮ';
utf8['\\<XX>'] = '๐';
utf8['\\<parallel>'] = 'โฅ';
utf8['\\<K>'] = '๐ฆ';
utf8['\\<nn>'] = '๐ซ';
utf8['\\<registered>'] = 'ยฎ';
utf8['\\<M>'] = 'โณ';
utf8['\\<delta>'] = 'ฮด';
utf8['\\<threequarters>'] = 'ยพ';
utf8['\\<g>'] = '๐';
utf8['\\<cong>'] = 'โ
';
utf8['\\<tau>'] = 'ฯ';
utf8['\\<w>'] = '๐';
utf8['\\<ge>'] = 'โฅ';
utf8['\\<flat>'] = 'โญ';
utf8['\\<zero>'] = '๐ฌ';
utf8['\\<Uplus>'] = 'โจ';
utf8['\\<longmapsto>'] = 'โผ';
utf8['\\<supset>'] = 'โ';
utf8['\\<in>'] = 'โ';
utf8['\\<sqinter>'] = 'โ';
utf8['\\<OO>'] = '๐';
utf8['\\<updown>'] = 'โ';
utf8['\\<circ>'] = 'โ';
utf8['\\<rat>'] = 'โ';
utf8['\\<stileturn>'] = 'โฃ';
utf8['\\<ee>'] = '๐ข';
utf8['\\<Omega>'] = 'ฮฉ';
utf8['\\<or>'] = 'โจ';
utf8['\\<inverse>'] = 'ยฏ';
utf8['\\<rhd>'] = 'โณ';
utf8['\\<uu>'] = '๐ฒ';
utf8['\\<iota>'] = 'ฮน';
utf8['\\<d>'] = '๐ฝ';
utf8['\\<questiondown>'] = 'ยฟ';
utf8['\\<Union>'] = 'โ';
utf8['\\<omega>'] = 'ฯ';
utf8['\\<approx>'] = 'โ';
utf8['\\<t>'] = '๐';
utf8['\\<Updown>'] = 'โ';
utf8['\\<spadesuit>'] = 'โ ';
utf8['\\<five>'] = '๐ฑ';
utf8['\\<exists>'] = 'โ';
utf8['\\<rceil>'] = 'โ';
utf8['\\<JJ>'] = '๐';
utf8['\\<minusplus>'] = 'โ';
utf8['\\<nat>'] = 'โ';
utf8['\\<oslash>'] = 'โ';
utf8['\\<A>'] = '๐';
utf8['\\<Xi>'] = 'ฮ';
utf8['\\<currency>'] = 'ยค';
utf8['\\<Turnstile>'] = 'โจ';
utf8['\\<hookrightarrow>'] = 'โช';
utf8['\\<pp>'] = '๐ญ';
utf8['\\<Q>'] = '๐ฌ';
utf8['\\<aleph>'] = 'โต';
utf8['\\<acute>'] = 'ยด';
utf8['\\<xi>'] = 'ฮพ';
utf8['\\<simeq>'] = 'โ';
utf8['\\<i>'] = '๐';
utf8['\\<Join>'] = 'โ';
utf8['\\<y>'] = '๐';
utf8['\\<lbrakk>'] = 'โฆ';
utf8['\\<greatersim>'] = 'โณ';
utf8['\\<greaterapprox>'] = 'โช';
utf8['\\<longrightarrow>'] = 'โถ';
utf8['\\<lceil>'] = 'โ';
utf8['\\<Gamma>'] = 'ฮ';
utf8['\\<odot>'] = 'โ';
utf8['\\<YY>'] = '๐';
utf8['\\<infinity>'] = 'โ';
utf8['\\<Sigma>'] = 'ฮฃ';
utf8['\\<yen>'] = 'ยฅ';
utf8['\\<int>'] = 'โค';
utf8['\\<tturnstile>'] = 'โฉ';
utf8['\\<oo>'] = '๐ฌ';
utf8['\\<ointegral>'] = 'โฎ';
utf8['\\<gamma>'] = 'ฮณ';
utf8['\\<upharpoonleft>'] = 'โฟ';
utf8['\\<sigma>'] = 'ฯ';
utf8['\\<n>'] = '๐';
utf8['\\<rbrace>'] = 'โฆ';
utf8['\\<DD>'] = '๐';
utf8['\\<notin>'] = 'โ';
utf8['\\<j>'] = '๐';
utf8['\\<uplus>'] = 'โ';
utf8['\\<leftrightarrow>'] = 'โ';
utf8['\\<TT>'] = '๐';
utf8['\\<bullet>'] = 'โ';
utf8['\\<Theta>'] = 'ฮ';
utf8['\\<smile>'] = 'โฃ';
utf8['\\<G>'] = '๐ข';
utf8['\\<jj>'] = '๐ง';
utf8['\\<inter>'] = 'โฉ';
utf8['\\<Psi>'] = 'ฮจ';
utf8['\\<ordfeminine>'] = 'ยช';
utf8['\\<W>'] = '๐ฒ';
utf8['\\<zz>'] = '๐ท';
utf8['\\<theta>'] = 'ฮธ';
utf8['\\<ordmasculine>'] = 'ยบ';
utf8['\\<c>'] = '๐ผ';
utf8['\\<psi>'] = 'ฯ';
utf8['\\<s>'] = '๐';
utf8['\\<Leftrightarrow>'] = 'โ';
utf8['\\<heartsuit>'] = 'โก';
utf8['\\<four>'] = '๐ฐ';
var re_xsymbol = /\\<.*?>/g;
function encodequery(ele) {
var text = ele.value;
var otext = text;
var pos = getCaret(ele);
xsymbols = text.match(re_xsymbol);
for (i in xsymbols) {
var repl = utf8[xsymbols[i]];
if (repl) {
text = text.replace(xsymbols[i], repl, "g");
}
}
if (text != otext) {
ele.value = text;
if (pos != -1) {
pos = pos - (otext.length - text.length);
setCaret(ele, pos);
}
}
}
/* from: http://www.webdeveloper.com/forum/showthread.php?t=74982 */
function getCaret(obj) {
var pos = -1;
if (document.selection) { // IE
obj.focus ();
var sel = document.selection.createRange();
var sellen = document.selection.createRange().text.length;
sel.moveStart ('character', -obj.value.length);
pos = sel.text.length - sellen;
} else if (obj.selectionStart || obj.selectionStart == '0') { // Gecko
pos = obj.selectionStart;
}
return pos;
}
/* from: http://parentnode.org/javascript/working-with-the-cursor-position/ */
function setCaret(obj, pos) {
if (obj.createTextRange) {
var range = obj.createTextRange();
range.move("character", pos);
range.select();
} else if (obj.selectionStart) {
obj.focus();
obj.setSelectionRange(pos, pos);
}
}