Advertisement
Guest User

unitconversion.org

a guest
Dec 13th, 2012
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function jx_N(s) {
  2.     '';
  3.     return s;
  4. }
  5. function jx_5() {
  6.     return document.getElementById
  7. }
  8. function jx_b() {
  9.     return navigator.userAgent.indexOf("Opera") >= 0 || window.aD
  10. }
  11. function jx_q() {
  12.     return navigator.userAgent.indexOf("Safari") >= 0
  13. }
  14. function jx_a() {
  15.     return navigator.appName == "Microsoft Internet Explorer" && !jx_b()
  16. }
  17. function jx_M(bK) {
  18.     return window.aD && window.aD.version && parseInt(window.aD.version()) >= bK
  19. }
  20. function jx_2(ch) {
  21.     return typeof ch != 'undefined' && (ch == ' ' || !ch.search(/\s/))
  22. }
  23. function jx_0(ch) {
  24.     return ch >= '0' && ch <= '9'
  25. }
  26. function jx_d(ch) {
  27.     return typeof ch != 'undefined' && ch.toLowerCase() >= 'a' && ch.toLowerCase() <= 'z'
  28. }
  29. function jx_r(ch) {
  30.     return jx_d(ch) || jx_0(ch)
  31. }
  32. function jx_f(ch) {
  33.     return jx_r(ch) || ch == '_'
  34. }
  35. function jx_B(ch) {
  36.     return ch >= 'A' && ch <= 'Z'
  37. }
  38. function jx_4(v) {
  39.     return typeof v == 'undefined'
  40. }
  41. function jx_9(v) {
  42.     return !jx_4(v)
  43. }
  44. function jx_L(bR) {
  45.     var aG = new Date();
  46.     aG.setDate(aG.getDate() + bR);
  47.     return aG.toGMTString()
  48. }
  49. function jx_i() {
  50.     if (typeof jx_7 == 'undefined') jx_7 = 0, jx_o = 0, jx_c = 0;
  51. }
  52. function jx_m(name, value, U, path, domain, ak) {
  53.     jx_i();
  54.     var s = name + '=' + escape(value),
  55.         av = jx_m.arguments,
  56.         ad = [";expires=", ";path=", ";domain=", ";secure="];
  57.     for (var a = 2; a < av.length; a++) if (av[a]) s += ad[a - 2] + av[a];
  58.     var start = new Date();
  59.     document.cookie = s;
  60.     jx_c = new Date() - start > 300
  61. }
  62. function jx_A(name, value, aQ, as, U, path, domain, ak) {
  63.     jx_i();
  64.     if (!jx_c && (!jx_7 || (!jx_o && (!U || as)))) return jx_z(name, value, aQ, as, jx_7 ? 0 : U, path, domain, ak);
  65.     return false
  66. }
  67. function jx_z(name, value, aQ, as, U, path, domain, ak) {
  68.     jx_i();
  69.     var c7 = jx_g(name);
  70.     if (aQ && c7 == value) return true;
  71.     for (;;) {
  72.         jx_m(name, value, U, path, domain, ak);
  73.         var ck = jx_g(name),
  74.             ag = ck == value;
  75.         jx_o = !ag;
  76.         if (U) jx_7 = !ag;
  77.         if (!ag && U && as && !jx_c) U = 0;
  78.         else return ag
  79.     }
  80. }
  81. function jx_g(name) {
  82.     var aH = document.cookie.split('; ');
  83.     for (var a = 0; aH && a < aH.length; a++) {
  84.         var aM = aH[a].split('=');
  85.         if (aM[0] == name) return aM[1] ? unescape(aM[1]) : ''
  86.     }
  87.     return null
  88. }
  89. function jx_p(v) {
  90.     return typeof v != 'string' ? '' + v : '"' + v.replace(/"/g, '\\\"') + '"'
  91. }
  92. function jx_6(i, s) {
  93.     if (jx_4(s)) {
  94.         if (!i || typeof i != 'object') return jx_p(i);
  95.         s = ""
  96.     }
  97.     if (i == null) return s + 'null';
  98.     var aZ = true,
  99.         af = i.constructor == Array;
  100.     s += af ? '[' : '{';
  101.     for (var a in i) {
  102.         if (af && parseInt(a) != a) continue;
  103.         if (!aZ) s += ',';
  104.         aZ = false;
  105.         if (!af) s += a + ':';
  106.         if (typeof i[a] != 'object') s += jx_p(i[a]);
  107.         else s = jx_6(i[a], s)
  108.     }
  109.     s += af ? ']' : '}';
  110.     return s
  111. }
  112. function jx_h(s, c5) {
  113.     var r;
  114.     if (jx_4(s) || !s || !s.length) return null;
  115.     if (jx_5()) {
  116.         eval("try { eval('r=' + s) } catch(e) { r = null }");
  117.         return r
  118.     }
  119.     c5 ? null : eval('r=' + s);
  120.     return r
  121. }
  122. function jx_8(s, bM) {
  123.     var r = "";
  124.     for (var a = 0; a < s.length;) {
  125.         if (s.charAt(a) == '%') {
  126.             var F = s.charAt(a + 1) == 'u' ? 6 : 3,
  127.                 am = s.substring(a + (F == 3 ? 1 : 2), a + F);
  128.             if ((F == 6 && am.length == 4) || (F == 3 && am.length == 2)) {
  129.                 if (bM) r += '&#' + parseInt(am, 16) + ';';
  130.                 else r += eval("'\\" + (F == 3 ? 'x' : 'u') + am + "'");
  131.                 a += F;
  132.                 continue
  133.             }
  134.         }
  135.         r += s.charAt(a++)
  136.     }
  137.     return r
  138. }
  139. function jx_e(s, separator, cg, ch, aV, bh, a6) {
  140.     var r = aV ? aV : [];
  141.     if (s) {
  142.         var j = s.split(separator);
  143.         for (var a = 0; a < j.length; a++) {
  144.             var aE = j[a].split('='),
  145.                 n = aE[0],
  146.                 v = aE[1];
  147.             if (aE.length == 1 && bh) v = n, n = bh;
  148.             if (cg) n = jx_8(n);
  149.             r[a6 && a6[n] ? a6[n] : n] = ch && v ? jx_8(v) : v
  150.         }
  151.     }
  152.     return r
  153. }
  154. function jx_J(a6) {
  155.     var aJ = document.location.search;
  156.     if (!aJ) aJ = "?";
  157.     return jx_e(aJ.substring(1), '&', true, true, 0, 0, a6)
  158. }
  159. function jx_n(s) {
  160.     return s.replace(/^\s+/, '').replace(/\s+$/, '')
  161. }
  162. function jx_3(s) {
  163.     return s.replace(/\s+/g, "")
  164. }
  165. function jx_x(n, S) {
  166.     for (var a = 0; a < n.length; a++) {
  167.         var ch = n.charAt(a).toLowerCase();
  168.         if (isNaN(parseInt(ch, S))) {
  169.             if (S == 16 && a == 1 && ch == 'x' && v.charAt(a - 1) == '0') {
  170.                 a++;
  171.                 continue
  172.             }
  173.             if (S == 16 && a == n.length - 1 && ch == 'h') continue;
  174.             if (S == 2 && a == n.length - 1 && ch == 'b') continue;
  175.             return NaN
  176.         }
  177.     }
  178.     return parseInt(n, S)
  179. }
  180. function jx_D(n, S) {
  181.     var s = "",
  182.         a_ = "0_1_2_3_4_5_6_7_8_9_A_B_C_D_E_F_G_H_I_J_K_L_M_N_O_P_Q_R_S_T_U_V_W_X_Y_Z".split('_');
  183.     while (n >= S) s = a_[n % S] + s, n = Math.floor(n / S);
  184.     return a_[n] + s
  185. }
  186. function jx_E(n, shift) {
  187.     n = String(n);
  188.     if (shift >= 0) {
  189.         while (shift--) n += '0';
  190.         return n
  191.     }
  192.     if (n.length + shift > 0) n = n.substring(0, n.length + shift) + '.' + n.substring(n.length + shift);
  193.     else {
  194.         while (n.length < -shift) n = '0' + n;
  195.         n = '0.' + n
  196.     }
  197.     var F = n.length;
  198.     for (; n.charAt(F - 1) == '0'; F--) {}
  199.     if (n.charAt(F - 1) == '.') F--;
  200.     return n.substring(0, F)
  201. }
  202. function jx_t(n) {
  203.     n = String(n).toLowerCase();
  204.     var exp = n.split('e')[1];
  205.     if (exp) return parseInt(exp, 10);
  206.     var j = n.split('.');
  207.     if (j[0] != '0') return j[0].length - 1;
  208.     else if (j[1]) {
  209.         var aP = 0;
  210.         for (; j[1].charAt(aP) == '0'; aP++);
  211.         return -aP - 1
  212.     } else return 0;
  213. }
  214. function jx_l(n, bj) {
  215.     var bo = n.indexOf('.') < 0,
  216.         aF = n.length - (bo ? 0 : 1);
  217.     if (bo && aF < bj) n += '.';
  218.     for (; aF < bj; aF++) n += '0';
  219.     return n
  220. }
  221. function jx_k(n, au, E, bm, bp, br, bw, cl) {
  222.     if (n == 0) return "0" + jx_k(1, au, E, bm, bp, br, bw).substring(1);
  223.     if (E > 15) E = 15;
  224.     var b0 = (n < 0 ? '-' : '');
  225.     n = Math.abs(n);
  226.     var exp = jx_t(n),
  227.         bc = exp <= bm && exp >= bp;
  228.     var bg = 1 + (bc ? br + exp : bw);
  229.     if (E > bg) E = bg;
  230.     var L = String(Math.round(n * Math.pow(10, E - exp - 1)));
  231.     exp += L.length - E;
  232.     E = L.length;
  233.     while (E && L.charAt(E - 1) == '0') E--;
  234.     L = L.substring(0, E);
  235.     if (!L.length) L = "0", E++;
  236.     if (bc) {
  237.         n = jx_E(L, 1 + exp - E);
  238.         return b0 + jx_l(n, au)
  239.     }
  240.     n = L.charAt(0) + (L.length > 1 ? ('.' + L.substring(1)) : '');
  241.     return b0 + jx_l(n, au) + (exp < 0 ? 'e-' : 'e+') + Math.abs(exp)
  242. }
  243. function jx_K(e) {
  244.     if (e.offsetParent) {
  245.         var be = 0;
  246.         while (e.offsetParent) be += e.offsetTop, e = e.offsetParent;
  247.         return be
  248.     }
  249.     if (e.y) return e.y;
  250.     return -1
  251. }
  252. function jx_v() {
  253.     for (var a in jx_1) jx_1[a]();
  254. }
  255. function jx_j() {
  256.     var c0 = document.readyState == 'complete' || window.cn == false || window.addEventListener ? 'jx_v' : 'jx_j';
  257.     setTimeout(c0 + '()', 10)
  258. }
  259. function jx_C(c6) {
  260.     if (typeof jx_1 == 'undefined') jx_1 = [];
  261.     jx_1[jx_1.length] = c6;
  262.     if (jx_1.length < 2) {
  263.         if (window.addEventListener) window.addEventListener("load", jx_j, false);
  264.         else setTimeout('jx_j' + '()', 10)
  265.     }
  266. }
  267. function jx_s(ac) {
  268.     if (!location.hostname || location.hostname == "localhost" || window != parent) return true;
  269.     var j = document.links;
  270.     for (var a = 0; a < j.length; a++) for (var h in ac) if (j[a].hostname == ac[h].hostname) {
  271.         if (jx_a() && jx_5() && typeof j[a].offsetWidth != 'undefined' && (j[a].offsetHeight < ac[h].bD || j[a].offsetWidth < ac[h].bG)) continue;
  272.         return true
  273.     }
  274.     return false
  275. }
  276. function jx_w() {
  277.     var s = '';
  278.     for (var a = 0; a < arguments.length; a++) s += 'a' + a + '=' + escape(arguments[a]) + '&';
  279.     if (jx_I++ < jx_H) {
  280.         var bW = new Image();
  281.         bW.src = jx_G + '/' + jx_F + '?' + s + 'd=' + escape(Date())
  282.     }
  283.     return true
  284. }
  285. function jx_u(bV, cc, bA) {
  286.     jx_F = bV;
  287.     jx_G = bA ? bA : 'http://' + location.hostname;
  288.     jx_H = cc;
  289.     jx_I = 0;
  290.     window.onerror = jx_w
  291. }
  292. if (typeof uc_e == 'undefined') uc_D = "2.0.4 (20-jun-06)", uc_C = "(c) 2005 unitconversion.org. All rights reserved. \n\nUse of the converter that does not conform to restrictions at http://www.unitconversion.org/privacy_and_terms.html is not permitted.", uc_6 = [], uc_7 = [], uc_3 = [], uc_t = 0, uc_e = 0, uc_5 = [], uc_0 = [], uc_4 = [], uc_k = null, uc_f = 0, uc_1 = 0, uc_d = [];
  293.  
  294. function uc_I(d, e) {
  295.     while (e) {
  296.         var i = uc_0[e._xname];
  297.         if (i && i.e == e && i.type == "form" && d == i) return true;
  298.         e = e.parentNode ? e.parentNode : e.parentElement
  299.     }
  300.     return false
  301. }
  302. function uc_s(d, aT, ah, ay, aA, bu) {
  303.     var P = [];
  304.     if (jx_5()) {
  305.         if (jx_4(aA)) aA = "";
  306.         var j = typeof aT == 'string' ? document.getElementsByName(aT) : [aT.e];
  307.         for (a = 0; a < j.length; a++) {
  308.             var e = j[a];
  309.             if (bu && bu.indexOf('_' + e.tagName.toLowerCase() + '_') < 0) continue;
  310.             if (e.tagName && aA.indexOf('_' + e.tagName.toLowerCase() + '_') < 0 && uc_I(d, e)) {
  311.                 P[P.length] = e;
  312.                 P[P.length] = ah;
  313.                 if (ah == "className") P[P.length] = e.className, e.className = ay;
  314.                 else P[P.length] = e.style[ah], e.style[ah] = ay
  315.             }
  316.         }
  317.     }
  318.     return P
  319. }
  320. function uc_W(j) {
  321.     for (var a = 0; j && a < j.length; a += 3) {
  322.         var e = j[a],
  323.             b3 = j[a + 1],
  324.             v = j[a + 2];
  325.         if (b3 == "className") e.className = ay;
  326.         else e.style[b3] = v
  327.     }
  328. }
  329. function uc_c(d) {
  330.     if (!--d.aa) {
  331.         if (d.bz || uc_u(d)) d.bz = 0, uc_2(d);
  332.         if (d.c9) uc_h(d, d.Z)
  333.     }
  334. }
  335. function uc_R(u, k, p) {
  336.     return p[0] / k[0] * u;
  337. }
  338. function uc_Q(u, k, p) {
  339.     var bY = k.length == 1 ? k[0] : k[1],
  340.         bZ = p.length == 1 ? p[0] : p[1];
  341.     return bY * bZ / u
  342. }
  343. function uc_X(u, k, p) {
  344.     var bf = k[1],
  345.         az = k[2],
  346.         bH = p[1],
  347.         b5 = p[2];
  348.     return ((u - az) * (bH - b5) + b5 * (bf - az)) / (bf - az)
  349. }
  350. function uc_L(u, k, p) {
  351.     return jx_D(u, p[1])
  352. }
  353. function uc_b(G, u, k, p, R) {
  354.     if (!p) return "unknown unit";
  355.     var v = 0,
  356.         a5 = k.length == 1 ? 0 : k[0],
  357.         c4 = p.length == 1 ? 0 : p[0];
  358.     if (a5 + c4 == 1) a5 = 1;
  359.     else if (a5 == 1) a5 = 0;
  360.     switch (a5) {
  361.         case 0:
  362.             v = uc_R(u, k, p);
  363.             break;
  364.         case 1:
  365.             v = uc_Q(u, k, p);
  366.             break;
  367.         case 2:
  368.             v = uc_X(u, k, p);
  369.             break;
  370.         case 3:
  371.             return uc_L(u, k, p)
  372.     }
  373.     if (!isFinite(v)) return String(v);
  374.     var r = jx_k(v, 0, 14, 9, -9, G, G);
  375.     return R ? r.replace(/\./, ',') : r
  376. }
  377. function uc_J(s) {
  378.     return s.length == uc_l(s)
  379. }
  380. function uc_l(s) {
  381.     var aY = s.match(/^\s*[+-]?[\d\s]*\.?[\d\s]*(e\s*[+-]?[\d\s]*)?/i);
  382.     if (!aY) return 0;
  383.     var ae = aY[0];
  384.     ae = ae.replace(/e\s*[+-]?\s*$/i, '');
  385.     if (!ae.search(/^\s*[+-]?\s*\.\s*(\D|$)/i)) return 0;
  386.     return ae.length
  387. }
  388. function uc_a(j, bQ, end) {
  389.     return s = jx_3(j.join('').substring(bQ, end))
  390. }
  391. function uc_B(s, b4) {
  392.     var a, a1 = 0,
  393.         aN = ["^\\(", 100000, "^\\)", -100000000, "^e\\d", -1000000, "^e[-+]\\d", 10000, "^e", 100000000];
  394.     aB = ["\\)$", 10000, "\\($", -100000000, "[a-z_]$", 100000000, "\\D$", 100];
  395.     for (a = b4 + 1; a < s.length && jx_2(s[a]); a++, a1++);
  396.     var bI = uc_a(s, a);
  397.     for (a = b4 - 1; a >= 0 && jx_2(s[a]); a--, a1++);
  398.     var bN = uc_a(s, 0, a + 1);
  399.     for (var h = 0; h < aN.length; h += 2) {
  400.         if (RegExp(aN[h]).test(bI)) {
  401.             a1 += parseInt(aN[h + 1]);
  402.             break
  403.         }
  404.     }
  405.     for (var h = 0; h < aB.length; h += 2) {
  406.         if (RegExp(aB[h]).test(bN)) {
  407.             a1 += parseInt(aB[h + 1]);
  408.             break
  409.         }
  410.     }
  411.     return a1
  412. }
  413. function uc_G(j, aC) {
  414.     while (jx_2(j[aC + 1])) aC++;
  415.     return jx_d(j[aC + 1])
  416. }
  417. function uc_H(s, c8) {
  418.     return s.substring(0, c8 + 1).search(/[\.\d]\s*e\s*$/) >= 0
  419. }
  420. function uc_z(b7, bb) {
  421.     if (b7.ai > bb.ai) return 1;
  422.     else if (b7.ai < bb.ai) return -1;
  423.     return 0
  424. }
  425. function uc_F(j, co, a0, ap) {
  426.     var s = uc_a(j, a0, ap),
  427.         aX;
  428.     while ((aX = s.replace(/\w*\([^()]*\)/g, "X")) != s) s = aX;
  429.     s = s.replace(/[a-z][a-z]\w*/g, "X");
  430.     s = s.replace(/0/g, "1");
  431.     var cm = 1,
  432.         x = 1,
  433.         f = true;
  434.     eval("try {eval(s)} catch(ex) {f = false}");
  435.     return f
  436. }
  437. function uc_i(s, C, O, c2, a0, ap) {
  438.     if (!O) return true;
  439.     for (var a = c2; a < C.length; a++) {
  440.         s[C[a].index] = '.';
  441.         if (uc_F(s, C[a].index, a0, ap) && uc_i(s, C, O - 1, a + 1, a0, ap)) return true;
  442.         else s[C[a].index] = ','
  443.     }
  444.     return false
  445. }
  446. function uc_p(s, cb, a) {
  447.     var a7 = "",
  448.         t = "on_chars",
  449.         C = [],
  450.         a0 = a;
  451.     for (; a <= s.s.length; a++) {
  452.         var ch = (a == s.s.length ? '' : s.s[a]);
  453.         if (a == s.s.length) t = "on_subexpr_end";
  454.         switch (t) {
  455.             case "on_chars":
  456.                 if (ch >= 'a' && ch <= 'z' && (ch != 'e' || uc_G(s, a))) a7 = ch, t = "on_fn_name";
  457.                 else if (ch == '(') t = "on_subexpr_start";
  458.                 else if (ch == ')') t = "on_subexpr_end";
  459.                 else if (ch == ',') C[C.length] = {
  460.                     index: a
  461.                 };
  462.                 break;
  463.             case "on_fn_name":
  464.                 if (jx_f(ch) || jx_2(ch)) a7 += ch;
  465.                 else if (ch == '(') t = "on_chars", a--;
  466.                 else a7 = "", t = "on_chars", a--;
  467.                 break;
  468.             case "on_subexpr_start":
  469.                 a = uc_p(s, a7, a);
  470.                 t = "on_chars", a7 = "";
  471.                 a--;
  472.                 break;
  473.             case "on_subexpr_end":
  474.                 var O = C.length,
  475.                     V = s.a8[jx_3(cb)];
  476.                 if (V && V == -1) O = 0;
  477.                 else if (V && V - 1 <= O) {
  478.                     for (var h = 0; h < O; h++) C[h].ai = uc_B(s.s, C[h].index);
  479.                     C.sort(uc_z);
  480.                     O -= V - 1
  481.                 }
  482.                 if (O != C.length) uc_i(s.s, C, O, 0, a0, a - 1);
  483.                 else for (var h = 0; h < O; h++) s.s[C[h].index] = '.';
  484.                 return a
  485.         }
  486.     }
  487. }
  488. function uc_U(bF) {
  489.     var bq = [],
  490.         a8 = "max_-1_min_-1_pow_2".split('_');
  491.     for (var a = 0; a < a8.length; a += 2) bq[a8[a]] = a8[a + 1];
  492.     var b1 = {
  493.         s: bF.split(''),
  494.         a8: bq
  495.     };
  496.     uc_p(b1, "", 0);
  497.     return b1.s.join('')
  498. }
  499. function uc_v(s) {
  500.     var Q = "",
  501.         r = "",
  502.         bd = "*LN2*LN10*LOG2E*LOG10E*PI*SQRT1_2*SQRT2*abs*acos*asin*atan*atan2*ceil*cos*exp*floor*log*max*min*pow*random*round*sin*sqrt*tan*",
  503.         bO = bd.toLowerCase(),
  504.         bs;
  505.     for (var a = 0; a <= s.length; a++) {
  506.         var ch = (a == s.length ? '' : s.charAt(a));
  507.         if (ch == ';' || jx_d(ch) || (Q.length && (jx_f(ch) || jx_2(ch)))) Q += ch;
  508.         else if (Q.length) {
  509.             var an = jx_3(Q);
  510.             if (an == 'e' && !uc_H(s, a - 1)) r += 'Math.' + Q.toUpperCase();
  511.             else if (an.charAt(0) == 'e' && an.search(/^e\d*$/) == 0) r += Q;
  512.             else if ((bs = bO.indexOf('*' + an + '*')) >= 0) r += 'Math.' + (jx_B(bd.charAt(bs + 1)) ? Q.toUpperCase() : Q);
  513.             else return r;
  514.             Q = "", a--
  515.         } else r += ch
  516.     }
  517.     return r
  518. }
  519. function jx_y(s) {
  520.     var r = '',
  521.         a4 = '',
  522.         ch, aj = 0;
  523.     for (var a = 0; a < s.length; a++) {
  524.         ch = s.charAt(a);
  525.         if (!jx_2(ch) && (ch != '0' || jx_f(a4) || a4 == '.')) {
  526.             if ((ch == '(' && jx_0(a4)) || (a4 == ')' && jx_0(ch))) r += '*';
  527.             if (aj && !jx_0(ch)) r += '0';
  528.             aj = 0;
  529.             r += ch;
  530.             a4 = ch
  531.         } else if (ch == '0') aj++
  532.     }
  533.     if (aj) r += '0';
  534.     return r
  535. }
  536. function uc_A(v) {
  537.     var r = NaN;
  538.     if (jx_5()) {
  539.         var a, K = uc_U(v.toLowerCase());
  540.         this.R = (v.indexOf('.') < 0 && K.indexOf('.') >= 0);
  541.         K = uc_v(K);
  542.         while (K.length && isNaN(r)) {
  543.             r = jx_y(K);
  544.             if (!r.length) {
  545.                 r = NaN;
  546.                 break
  547.             }
  548.             eval("try { r = eval(r) } catch(e) { r = NaN }");
  549.             if (isNaN(r)) K = K.substring(0, K.length - 1)
  550.         }
  551.         if (!isNaN(r)) {
  552.             K = K.replace(new RegExp("Math.", "ig"), "");
  553.             this.z = v.substring(0, K.length)
  554.         }
  555.     }
  556.     if (isNaN(r)) {
  557.         var aU = v.replace(/,/, '.');
  558.         this.R = v.indexOf('.') < 0 && aU.indexOf('.') >= 0;
  559.         r = parseFloat(jx_3(aU));
  560.         this.z = isNaN(r) ? "" : v.substring(0, uc_l(aU))
  561.     }
  562.     this.cf = r;
  563.     return this
  564. }
  565. function uc_2(d, c3) {
  566.     if (!d.T) {
  567.         alert("Nothing to update!");
  568.         return
  569.     }
  570.     if (!d.W) {
  571.         alert("Please select the source unit.");
  572.         return
  573.     }
  574.     uc_1 = 0;
  575.     var M = d.W,
  576.         v = jx_n(M.e.value),
  577.         k = uc_5[d.D + ':' + M.w],
  578.         u = NaN,
  579.         z = "",
  580.         R = false,
  581.         X = "";
  582.     if (v.toLowerCase() == "%version%") {
  583.         alert(uc_D);
  584.         return
  585.     }
  586.     if (v.toLowerCase() == "%copyright%") {
  587.         alert(uc_C);
  588.         return
  589.     }
  590.     if (!c3 && M.a3 == v) return;
  591.     if (d.bX) X = "link back to www.unitconversion.org is not found";
  592.     else if (d.aa) d.bz = 1, X = "loading, please wait...";
  593.     else if (!v.length);
  594.     else if (M.w == "") X = "source unit is not selected";
  595.     else if (!k) X = "unknown source unit";
  596.     else if (k.length > 1 && k[0] == 3) u = jx_x(v, k[1]), z = v;
  597.     else {
  598.         if (v == "loading, please wait...") M.e.value = v = "";
  599.         var r = uc_A(v);
  600.         R = r.R;
  601.         u = r.cf, z = r.z;
  602.     }
  603.     if (isNaN(u)) {
  604.         delete M.a3;
  605.         if (!X && v.length) X = "invalid input"
  606.     } else M.a3 = v;
  607.     for (var a in d.T) {
  608.         var i = d.T[a];
  609.         if (M != i) {
  610.             delete i.a3;
  611.             var p = uc_5[d.D + ':' + i.w],
  612.                 bT = uc_5[d.D + ':' + i.at];
  613.             if (isNaN(u)) i.e.value = X;
  614.             else if (i.type == "unit") i.a3 = i.e.value = i.w != "" ? uc_b(d.G, u, k, p, R) : "unit is not selected";
  615.             else if (i.type == "result") {
  616.                 if (i.w == "" || i.at == "") i.e.value = "unit is not selected";
  617.                 else {
  618.                     z = jx_n(z);
  619.                     if (z.charAt(0) != '(' && (!uc_J(z.replace(/,/, '.')) || z.search(/\s/) >= 0 || !jx_0(z.charAt(0)) || !jx_0(z.charAt(z.length - 1)))) z = '(' + z + ')';
  620.                     var b2 = uc_b(d.G, u, k, p, R),
  621.                         aW = uc_b(d.G, u, k, bT, R),
  622.                         aO = jx_8(i.w),
  623.                         aL = jx_8(i.at);
  624.                     if (M.B == i.B) i.e.value = z + ' ' + aO + ' = ' + aW + ' ' + aL;
  625.                     else if (M.B == i.al) i.e.value = z + ' ' + aL + ' = ' + b2 + ' ' + aO;
  626.                     else i.e.value = b2 + ' ' + aO + ' = ' + aW + ' ' + aL;
  627.                     i.a3 = i.e.value
  628.                 }
  629.             }
  630.         }
  631.     }
  632. }
  633. function uc_g(o, a2) {
  634.     var a = o.e.selectedIndex;
  635.     if (a2) o.cj = 1;
  636.     if (typeof o.b6 == 'undefined' || a != o.b6) {
  637.         o.b6 = a;
  638.         var w = a < 0 ? "" : o.e.options[a].value;
  639.         if (o.y) {
  640.             for (var h in o.y) {
  641.                 var i = o.y[h];
  642.                 if (i.B == o.B) i.w = w;
  643.                 if (i.al == o.B) i.at = w
  644.             }
  645.         }
  646.         if (a2) uc_h(o.d)
  647.     }
  648.     if (a2) uc_2(o.d, true)
  649. }
  650. function uc_o(g, a2) {
  651.     if (g.e.selectedIndex >= 0) {
  652.         var bl = parseInt(g.e.options[g.e.selectedIndex].value);
  653.         if (g.d.G != bl) {
  654.             g.d.G = bl;
  655.             if (a2) uc_2(g.d, true)
  656.         }
  657.     }
  658. }
  659. function uc_O(g) {
  660.     if (typeof g.bC == 'undefined' || g.bC != g.e.value) g.d.W = g, g.bC = g.e.value, uc_2(g.d)
  661. }
  662. function uc_j() {
  663.     if (typeof uc_0 != 'undefined') {
  664.         var g = uc_0[this._xname];
  665.         switch (g.type) {
  666.             case "select":
  667.                 uc_g(g, true);
  668.                 break;
  669.             case "precision":
  670.                 uc_o(g, true);
  671.                 break;
  672.             case "unit":
  673.                 uc_O(g)
  674.         }
  675.     }
  676. }
  677. function uc_M() {
  678.     uc_1 = 0
  679. }
  680. function uc_m(e) {
  681.     return e.value && "_unknown source unit_unknown unit_nan_infinity_invalid input_unit is not selected_source unit is not selected_loading, please wait..._".indexOf('_' + e.value.toLowerCase() + '_') >= 0
  682. }
  683. function uc_u(d) {
  684.     for (var a in d.ao) if (uc_m(d.ao[a].e)) return true;
  685.     return false
  686. }
  687. function uc_P() {
  688.     uc_1 = 0;
  689.     var g = uc_0[this._xname],
  690.         j = [];
  691.     uc_W(g.d.c1);
  692.     g.d.W = g;
  693.     uc_h(g.d, g);
  694.     if (uc_m(this)) {
  695.         this.value = "";
  696.         if (g.e.createTextRange) {
  697.             var r = g.e.createTextRange();
  698.             r.collapse();
  699.             r.select();
  700.         }
  701.         uc_2(g.d)
  702.     }
  703.     if (g.d.b9 && g.B == "") j = j.concat(uc_s(g.d, g.w, 'fontWeight', g.d.b9, '_input_'));
  704.     if (g.d.bv && g.B == "") j = j.concat(uc_s(g.d, g, 'color', g.d.bv, '', '_input_'));
  705.     g.d.c1 = j
  706. }
  707. function uc_on_factors_loaded(D, aw) {
  708.     var I = '$' + D;
  709.     for (var a = 0; a < aw.length;) {
  710.         var aS = aw[a].split(':'),
  711.             V = aS.length == 2 ? parseInt(aS[1]) : 1,
  712.             hash = D + ':' + aS[0];
  713.         if (typeof uc_5[hash] == 'undefined') {
  714.             var ad = uc_5[hash] = new Array();
  715.             for (var h = a + 1; h < a + 1 + V; h++) ad[ad.length] = aw[h]
  716.         }
  717.         a += V + 1
  718.     }
  719.     uc_6[I] = "loaded";
  720.     var l = uc_7[I];
  721.     for (var h = 0; l && h < l.length; h++) uc_c(l[h]);
  722.     uc_7[I] = []
  723. }
  724. function uc_S(d, x, type) {
  725.     var g = {
  726.         id: uc_0.length,
  727.         d: d,
  728.         e: x,
  729.         w: "",
  730.         at: "",
  731.         B: "",
  732.         al: "",
  733.         type: ""
  734.     };
  735.     uc_0[g.id] = g;
  736.     x._xname = g.id;
  737.     uc_8(x.name, g, type != 'text');
  738.     if (!g.type) g.type = type == 'text' ? 'unit' : 'select';
  739.     return g
  740. }
  741. function uc_9(y, g, id) {
  742.     if (id != "") {
  743.         var a = g.type == "select" ? 0 : 1;
  744.         if (typeof y[id] == 'undefined') y[id] = [];
  745.         if (typeof y[id][a] == 'undefined') y[id][a] = [];
  746.         var l = y[id][a];
  747.         l[l.length] = g
  748.     }
  749. }
  750. function uc_y(y) {
  751.     for (var a in y) {
  752.         var q = y[a][0],
  753.             T = y[a][1];
  754.         if (q && T) {
  755.             for (var h in q) q[h].y = T, uc_g(q[h])
  756.         }
  757.     }
  758. }
  759. function uc_8(name, b_, cd) {
  760.     return jx_e(name, ';', 0, 0, b_, cd ? 'B' : 'w', {
  761.         'bindid': 'B',
  762.         'bindid2': 'al',
  763.         'type': 'type',
  764.         'focus': 'focus',
  765.         'base': 'bL'
  766.     })
  767. }
  768. function uc_E() {
  769.     var data = jx_h(jx_g("uc_states")),
  770.         ax, H = uc_4.value;
  771.     if (jx_4(H)) H = null;
  772.     if (jx_9(uc_4.m)) data = jx_h(uc_4.m), ax = true;
  773.     if (jx_9(uc_4.w)) ax = true, data = [{
  774.         c: "",
  775.         l: [{
  776.             n: uc_4.w,
  777.             b: 1,
  778.             f: 1,
  779.             v: H
  780.         }]
  781.     }];
  782.     if (ax) uc_q(data);
  783.     else H = null;
  784.     for (var a in data) {
  785.         var m = data[a].l,
  786.             aR, a9, q = [];
  787.         for (var h in m) {
  788.             if (m[h].f && m[h].b) aR = m[h];
  789.             if (m[h].s && m[h].s[0]) q[q.length] = m[h]
  790.         }
  791.         if (aR) {
  792.             var u = uc_8(aR.n);
  793.             if (u.B) {
  794.                 for (var bx in q) {
  795.                     var s = uc_8(q[bx].n, 0, true);
  796.                     if (u.B == s.B) {
  797.                         a9 = q[bx].s[0];
  798.                         break
  799.                     }
  800.                 }
  801.             } else a9 = u.w
  802.         }
  803.         if (a9) {
  804.             m[m.length] = {
  805.                 n: "",
  806.                 s: [a9],
  807.                 v: H
  808.             };
  809.             if (u.B) m[m.length] = {
  810.                 n: a9,
  811.                 b: 1,
  812.                 f: 1,
  813.                 v: H
  814.             }
  815.         }
  816.     }
  817.     return data
  818. }
  819. function uc_q(data) {
  820.     if (uc_f) jx_A("uc_states", jx_6(data), true, true, jx_L(180), uc_f)
  821. }
  822. function uc_h(d, Z) {
  823.     d.Z = Z;
  824.     if (d.aa) {
  825.         d.c9 = 1;
  826.         return
  827.     }
  828.     if (Z && Z.type == "unit" && uc_d[d.D + '$' + Z.e.name] == Z) return;
  829.     uc_d = [];
  830.     var data = [{
  831.         c: d.D,
  832.         l: []
  833.     }],
  834.         m = data[0].l;
  835.     if (d.W) m[0] = {
  836.         n: d.W.e.name,
  837.         b: 1,
  838.         f: 1
  839.     };
  840.     for (var a = d.e._xname + 1; a < uc_0.length && uc_0[a].d == d; a++) {
  841.         var i = uc_0[a];
  842.         if (i.type == 'select') {
  843.             if (i.e.selectedIndex >= 0) {
  844.                 var w = i.e.options[i.e.selectedIndex].value;
  845.                 m[m.length] = {
  846.                     n: i.e.name,
  847.                     s: [w]
  848.                 }
  849.             }
  850.         }
  851.     }
  852.     uc_q(data)
  853. }
  854. function uc_x(d) {
  855.     var J = d.e,
  856.         x = J.elements;
  857.     for (var a = 0; a < J.length; a++) {
  858.         var e = x[a],
  859.             i = uc_0[e._xname];
  860.         if (i && i.type == 'select') for (var h = 0; h < e.options.length; h++) {
  861.             if (e.options[h].selected != e.options[h].defaultSelected) return true
  862.         }
  863.     }
  864.     return false
  865. }
  866. function uc_r(ci) {
  867.     var j = jx_h(ci),
  868.         o = uc_0[j[j.length - 1]];
  869.     for (var a = 0; a < j.length - 1 && !o.cj; a++) o.e.options[j[a]].selected = o.e.options[j[a]].defaultSelected = true;
  870.     uc_g(o);
  871.     uc_c(o.d)
  872. }
  873. function uc_V(o, Y, bB) {
  874.     if (bB) Y = [];
  875.     else if (typeof Y == 'undefined' || !Y.length) return;
  876.     var q = [],
  877.         a, A = o.e;
  878.     for (a = 0; a < A.options.length; a++) {
  879.         if (bB && A.options[a].selected) Y[Y.length] = A.options[a].value;
  880.         A.options[a].selected = A.options[a].defaultSelected = false;
  881.         for (var h in Y) if (A.options[a].value == Y[h]) q[q.length] = a
  882.     }
  883.     if (!q.length) return;
  884.     var bt = q[0],
  885.         bi = q[q.length - 1],
  886.         ba = A.size - (bi - bt + 1),
  887.         b8 = Math.ceil(ba / 2),
  888.         bP = ba - b8,
  889.         ab = Math.min(Math.max(b8 + bi, 0), A.options.length - 1),
  890.         ar = Math.min(Math.max(bt - bP, 0), A.options.length - 1);
  891.     A.options[ab].selected = A.options[ab].defaultSelected = true;
  892.     A.options[ab].selected = A.options[ab].defaultSelected = false;
  893.     A.options[ar].selected = A.options[ar].defaultSelected = true;
  894.     A.options[ar].selected = A.options[ar].defaultSelected = false;
  895.     q[q.length] = o.id;
  896.     o.d.aa++;
  897.     if (jx_a()) setTimeout('uc_r' + '("' + jx_6(q) + '")', 0);
  898.     else uc_r(jx_6(q))
  899. }
  900. function uc_w(d, data) {
  901.     if (data) {
  902.         var bJ = uc_x(d),
  903.             J = d.e,
  904.             m, x = J.elements;
  905.         for (var a = 0; a < data.length; a++) if (data[a].c == d.D || data[a].c == "") {
  906.             m = data[a].l;
  907.             break
  908.         }
  909.         if (m) {
  910.             for (var a = 0; a < J.length; a++) {
  911.                 var e = x[a],
  912.                     i = uc_0[e._xname];
  913.                 if (!i || !i.type) continue;
  914.                 var bU = uc_8(e.name, 0, i.type == "select");
  915.                 for (var h in m) {
  916.                     var t = m[h],
  917.                         ca = t.n == e.name || t.n == bU.w;
  918.                     if (ca || (!t.n && t.s && i.type == "select")) {
  919.                         if (t.b) d.W = i;
  920.                         if (t.f) d.bk = i;
  921.                         if (jx_9(t.v)) d.H = t.v;
  922.                         if (t.f && t.b && i.type == "unit") uc_d[d.D + '$' + e.name] = i;
  923.                         if (i.type == "select") uc_V(i, t.s, bJ);
  924.                         break
  925.                     }
  926.                 }
  927.             }
  928.         }
  929.     }
  930.     if (!uc_1) {
  931.         uc_1 = d.bk ? d.bk : d.bS;
  932.         if (uc_1) uc_1.H = d.H
  933.     }
  934. }
  935. function uc_N() {
  936.     var N = uc_1;
  937.     uc_1 = 0;
  938.     uc_t = 1;
  939.     if (!jx_s([{
  940.         bD: 12,
  941.         bG: 60,
  942.         hostname: "\x77\x77\x77\x2e\x75\x6e\x69\x74\x63\x6f\x6e\x76\x65\x72\x73\x69\x6f\x6e\x2e\x6f\x72\x67"
  943.     }])) for (var a in uc_0) uc_0[a].bX = true;
  944.     if (N && (typeof document.activeElement == 'undefined' || !document.activeElement || (document.activeElement.tagName && document.activeElement.tagName.toLowerCase() == 'body'))) {
  945.         var bn = jx_K(N.e);
  946.         if (!jx_b() && bn > 0 && document.body.clientHeight && N.e.offsetHeight) window.scrollTo(0, bn - (document.body.clientHeight - N.e.offsetHeight) / 2);
  947.         N.e.focus();
  948.         if (jx_9(N.H) && N.H != null) N.e.value = N.H, uc_2(N.d, true)
  949.     }
  950.     uc_n()
  951. }
  952. function uc_n(ce) {
  953.     uc_3[uc_3.length] = ce;
  954.     if (uc_t || !jx_a()) {
  955.         for (var a in uc_3) {
  956.             if (uc_3[a]) {
  957.                 var aI = document.createElement("script");
  958.                 aI.src = uc_3[a];
  959.                 uc_3[a] = 0;
  960.                 aI.defer = true;
  961.                 document.body.appendChild(aI)
  962.             }
  963.         }
  964.     }
  965. }
  966. function uc_K(d) {
  967.     var I = "$" + d.D;
  968.     if (uc_6[I] == "loaded") uc_c(d);
  969.     if (uc_6[I] != "loaded") {
  970.         if (typeof uc_7[I] == 'undefined') uc_7[I] = [];
  971.         var l = uc_7[I];
  972.         l[l.length] = d
  973.     }
  974.     if (typeof uc_6[I] == 'undefined') {
  975.         uc_6[I] = "loading";
  976.         var src = ((typeof uc_datapath != 'undefined' && uc_datapath.length) ? uc_datapath : "http://www.unitconversion.org/converter3/") + d.D + '.js';
  977.         if (jx_5() && (!jx_b() || jx_M(8)) && !jx_q()) uc_n(src);
  978.         else document.write('<s' + 'cript language=javascript src="' + src + '"></script>')
  979.     }
  980. }
  981. function uc_T() {
  982.     while (uc_e < document.forms.length) {
  983.         var J = document.forms[uc_e++],
  984.             s = J.name,
  985.             d = {
  986.                 type: "form",
  987.                 G: 9,
  988.                 T: [],
  989.                 ao: [],
  990.                 e: J,
  991.                 aa: 1,
  992.                 id: uc_0.length
  993.             };
  994.         if (s.indexOf("cat=") < 0) continue;
  995.         uc_0[d.id] = d;
  996.         J._xname = d.id;
  997.         jx_e(s, ';', 0, 0, d, 0, {
  998.             'cat': 'D',
  999.             'precision': 'G',
  1000.             'errfile': 'by',
  1001.             'focuscolor': 'bv',
  1002.             'focusweight': 'b9',
  1003.             'statescookiepath': 'bE'
  1004.         });
  1005.         if (d.by) jx_u(d.by, 5);
  1006.         if (typeof d.G == 'string') d.G = parseInt(d.G);
  1007.         var D = d.D = jx_3(d.D);
  1008.         var y = [],
  1009.             x = J.elements;
  1010.         for (var h = 0; h < J.length; h++) {
  1011.             var aq = x[h].type;
  1012.             if (typeof x[h].name == 'undefined' || x[h].name.indexOf('type=unknown') != -1 || (aq != "text" && aq != "select-one" && aq != "select-multiple")) continue;
  1013.             var g = uc_S(d, x[h], aq);
  1014.             d.ao[d.ao.length] = g;
  1015.             switch (g.type) {
  1016.                 case "precision":
  1017.                     uc_o(g, false);
  1018.                     break;
  1019.                 case "select":
  1020.                 case "unit":
  1021.                     uc_9(y, g, g.B);
  1022.                     break;
  1023.                 case "result":
  1024.                     uc_9(y, g, g.B);
  1025.                     uc_9(y, g, g.al)
  1026.             }
  1027.             if (g.bL && g.type == "unit") d.W = g;
  1028.             if (g.focus) d.bS = g;
  1029.             if (g.type) x[h].onfocus = g.type == "unit" ? uc_P : uc_M;
  1030.             if (g.type == "unit" || g.type == "result") d.T[d.T.length] = g;
  1031.             if (g.type != "result") {
  1032.                 if (typeof x[h].onpaste != 'undefined') x[h].onpaste = uc_j;
  1033.                 x[h].onchange = x[h].onkeyup = x[h].onkeydown = uc_j
  1034.             }
  1035.         }
  1036.         if (!d.id) {
  1037.             uc_4 = jx_J({
  1038.                 'value': 'value',
  1039.                 'states': 'm',
  1040.                 'unit': 'w'
  1041.             });
  1042.             uc_f = d.bE;
  1043.             uc_k = uc_E();
  1044.             jx_C(uc_N);
  1045.             if (document.layers) document.captureEvents(Event.KEYDOWN), document.onkeydown = function (aK) {
  1046.                 return aK.target.onkeydown ? aK.target.onkeydown(aK) : true
  1047.             }
  1048.         }
  1049.         uc_y(y);
  1050.         uc_w(d, uc_k);
  1051.         uc_K(d)
  1052.     }
  1053. }
  1054. uc_T();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement