1(function() {
2
3	var font = (window.opener.urlParams['math-font'] != null) ?
4		decodeURIComponent(window.opener.urlParams['math-font']) : 'TeX';
5
6	window.MathJax = {
7		showMathMenu: false,
8		messageStyle: 'none',
9		AuthorInit: function () {
10			MathJax.Hub.Config({
11				jax: ['input/TeX', 'input/MathML', 'input/AsciiMath'].concat(
12				[(window.opener.urlParams['math-output'] == 'html') ?
13					'output/HTML-CSS' : 'output/SVG']),
14				extensions: ['tex2jax.js', 'mml2jax.js', 'asciimath2jax.js'],
15				TeX: {
16					extensions:['AMSmath.js', 'AMSsymbols.js', 'noErrors.js', 'noUndefined.js']
17				},
18				'HTML-CSS': {
19					availableFonts: [font],
20					imageFont: null
21				},
22				SVG: {
23					font: font,
24					useFontCache: false
25				},
26				tex2jax: {
27					ignoreClass: 'geDisableMathJax'
28				},
29				asciimath2jax: {
30					ignoreClass: 'geDisableMathJax'
31				}
32			});
33		}
34	};
35
36	var s = document.createElement('script');
37	s.setAttribute('type', 'text/javascript');
38	s.setAttribute('src', window.opener.DRAW_MATH_URL + '/MathJax.js');
39
40	// Waits for the Math to be rendered and then calls window.print
41	if (window.IMMEDIATE_PRINT)
42    {
43		var r = false;
44
45		s.onload = s.onreadystatechange = function()
46		{
47			if (!r && (!this.readyState || this.readyState == 'complete'))
48			{
49	      		MathJax.Hub.Queue(function ()
50	      		{
51	      			window.print();
52	      		});
53			}
54		};
55    }
56
57	var t = document.getElementsByTagName('script')[0];
58
59  	if (t != null)
60  	{
61  		t.parentNode.insertBefore(s, t);
62  	}
63})();