git.iko.soy/typeable/pandoc
on 229b310 help sign in
typeable/pandoc/tests/s5.fancy.html
1701 lines 66 kB history raw
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2<html
3><head
4 ><title
5 >My S5 Document</title
6 ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
7 /><meta name="generator" content="pandoc"
8 /><meta name="author" content="Sam Smith"
9 /><meta name="author" content="Jen Jones"
10 /><meta name="date" content="July 15, 2006"
11 /><!-- configuration parameters -->
12<meta name="defaultView" content="slideshow" />
13<meta name="controlVis" content="hidden" />
14<style type="text/css" media="projection" id="slideProj">
15/* Do not edit or override these styles! The system will likely break if you do. */
17div#header, div#footer, div#controls, .slide {position: absolute;}
18html>body div#header, html>body div#footer,
19 html>body div#controls, html>body .slide {position: fixed;}
20.handout {display: none;}
21.layout {display: block;}
22.slide, .hideme, .incremental {visibility: hidden;}
23#slide0 {visibility: visible;}
25/* The following styles size, place, and layer the slide components.
26 Edit these if you want to change the overall slide layout.
27 The commented lines can be uncommented (and modified, if necessary)
28 to help you with the rearrangement process. */
30/* target = 1024x768 */
32div#header, div#footer, .slide {width: 100%; top: 0; left: 0;}
33div#header {top: 0; height: 3em; z-index: 1;}
34div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;}
35.slide {top: 0; width: 92%; padding: 3.5em 4% 4%; z-index: 2; list-style: none;}
36div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;}
37div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;
38 margin: 0;}
39#currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; z-index: 10;}
40html>body #currentSlide {position: fixed;}
42/*
43div#header {background: #FCC;}
44div#footer {background: #CCF;}
45div#controls {background: #BBD;}
46div#currentSlide {background: #FFC;}
47*/
49/* Following are the presentation styles -- edit away! */
51body {background: #FFF url(bodybg.gif) -16px 0 no-repeat; color: #000; font-size: 2em;}
52:link, :visited {text-decoration: none; color: #00C;}
53#controls :active {color: #88A !important;}
54#controls :focus {outline: 1px dotted #227;}
55h1, h2, h3, h4 {font-size: 100%; margin: 0; padding: 0; font-weight: inherit;}
56ul, pre {margin: 0; line-height: 1em;}
57html, body {margin: 0; padding: 0;}
59blockquote, q {font-style: italic;}
60blockquote {padding: 0 2em 0.5em; margin: 0 1.5em 0.5em; text-align: center; font-size: 1em;}
61blockquote p {margin: 0;}
62blockquote i {font-style: normal;}
63blockquote b {display: block; margin-top: 0.5em; font-weight: normal; font-size: smaller; font-style: normal;}
64blockquote b i {font-style: italic;}
66kbd {font-weight: bold; font-size: 1em;}
67sup {font-size: smaller; line-height: 1px;}
69.slide code {padding: 2px 0.25em; font-weight: bold; color: #533;}
70.slide code.bad, code del {color: red;}
71.slide code.old {color: silver;}
72.slide pre {padding: 0; margin: 0.25em 0 0.5em 0.5em; color: #533; font-size: 90%;}
73.slide pre code {display: block;}
74.slide ul {margin-left: 5%; margin-right: 7%; list-style: disc;}
75.slide li {margin-top: 0.75em; margin-right: 0;}
76.slide ul ul {line-height: 1;}
77.slide ul ul li {margin: .2em; font-size: 85%; list-style: square;}
78.slide img.leader {display: block; margin: 0 auto;}
80div#header, div#footer {background: #005; color: #AAB;
81 font-family: Verdana, Helvetica, sans-serif;}
82div#header {background: #005 url(bodybg.gif) -16px 0 no-repeat;
83 line-height: 1px;}
84div#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;}
85#footer h1, #footer h2 {display: block; padding: 0 1em;}
86#footer h2 {font-style: italic;}
88div.long {font-size: 0.75em;}
89.slide h1 {position: absolute; top: 0.7em; left: 87px; z-index: 1;
90 margin: 0; padding: 0.3em 0 0 50px; white-space: nowrap;
91 font: bold 150%/1em Helvetica, sans-serif; text-transform: capitalize;
92 color: #DDE; background: #005;}
93.slide h3 {font-size: 130%;}
94h1 abbr {font-variant: small-caps;}
96div#controls {position: absolute; left: 50%; bottom: 0;
97 width: 50%;
98 text-align: right; font: bold 0.9em Verdana, Helvetica, sans-serif;}
99html>body div#controls {position: fixed; padding: 0 0 1em 0;
100 top: auto;}
101div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;
102 margin: 0; padding: 0;}
103#controls #navLinks a {padding: 0; margin: 0 0.5em;
104 background: #005; border: none; color: #779;
105 cursor: pointer;}
106#controls #navList {height: 1em;}
107#controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #227;}
109#currentSlide {text-align: center; font-size: 0.5em; color: #449;}
111#slide0 {padding-top: 3.5em; font-size: 90%;}
112#slide0 h1 {position: static; margin: 1em 0 0; padding: 0;
113 font: bold 2em Helvetica, sans-serif; white-space: normal;
114 color: #000; background: transparent;}
115#slide0 h2 {font: bold italic 1em Helvetica, sans-serif; margin: 0.25em;}
116#slide0 h3 {margin-top: 1.5em; font-size: 1.5em;}
117#slide0 h4 {margin-top: 0; font-size: 1em;}
119ul.urls {list-style: none; display: inline; margin: 0;}
120.urls li {display: inline; margin: 0;}
121.note {display: none;}
122.external {border-bottom: 1px dotted gray;}
123html>body .external {border-bottom: none;}
124.external:after {content: " \274F"; font-size: smaller; color: #77B;}
126.incremental, .incremental *, .incremental *:after {color: #DDE; visibility: visible;}
127img.incremental {visibility: hidden;}
128.slide .current {color: #B02;}
131/* diagnostics
133li:after {content: " [" attr(class) "]"; color: #F88;}
134 */
135</style>
136<style type="text/css" media="projection" id="operaFix">
137/* DO NOT CHANGE THESE unless you really want to break Opera Show */
138.slide {
139 visibility: visible !important;
140 position: static !important;
141 page-break-before: always;
143#slide0 {page-break-before: avoid;}
145</style>
146<style type="text/css" media="screen" id="outlineStyle">
147/* don't change this unless you want the layout stuff to show up in the outline view! */
149.layout div, #footer *, #controlForm * {display: none;}
150#footer, #controls, #controlForm, #navLinks, #toggle {
151 display: block; visibility: visible; margin: 0; padding: 0;}
152#toggle {float: right; padding: 0.5em;}
153html>body #toggle {position: fixed; top: 0; right: 0;}
155/* making the outline look pretty-ish */
157#slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;}
158#slide0 h1 {padding-top: 1.5em;}
159.slide h1 {margin: 1.5em 0 0; padding-top: 0.25em;
160 border-top: 1px solid #888; border-bottom: 1px solid #AAA;}
161#toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;}
163</style>
164<style type="text/css" media="print" id="slidePrint">
165/* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */
166.slide, ul {page-break-inside: avoid; visibility: visible !important;}
167h1 {page-break-after: avoid;}
169body {font-size: 12pt; background: white;}
170* {color: black;}
172#slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;}
173#slide0 h3 {margin: 0; padding: 0;}
174#slide0 h4 {margin: 0 0 0.5em; padding: 0;}
175#slide0 {margin-bottom: 3em;}
177h1 {border-top: 2pt solid gray; border-bottom: 1px dotted silver;}
178.extra {background: transparent !important;}
179div.extra, pre.extra, .example {font-size: 10pt; color: #333;}
180ul.extra a {font-weight: bold;}
181p.example {display: none;}
183#header {display: none;}
184#footer h1 {margin: 0; border-bottom: 1px solid; color: gray; font-style: italic;}
185#footer h2, #controls {display: none;}
187/* The following rule keeps the layout stuff out of print. Remove at your own risk! */
188.layout, .layout * {display: none !important;}
190</style>
191<script type="text/javascript">
192// S5 v1.1 slides.js -- released into the Public Domain
193//
194// Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information
195// about all the wonderful and talented contributors to this code!
197var undef;
198var slideCSS = '';
199var snum = 0;
200var smax = 1;
201var incpos = 0;
202var number = undef;
203var s5mode = true;
204var defaultView = 'slideshow';
205var controlVis = 'visible';
207var isIE = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 1 ? 1 : 0;
208var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;
209var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;
211function hasClass(object, className) {
212 if (!object.className) return false;
213 return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);
216function hasValue(object, value) {
217 if (!object) return false;
218 return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);
221function removeClass(object,className) {
222 if (!object) return;
223 object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);
226function addClass(object,className) {
227 if (!object || hasClass(object, className)) return;
228 if (object.className) {
229 object.className += ' '+className;
230 } else {
231 object.className = className;
232 }
235function GetElementsWithClassName(elementName,className) {
236 var allElements = document.getElementsByTagName(elementName);
237 var elemColl = new Array();
238 for (var i = 0; i< allElements.length; i++) {
239 if (hasClass(allElements[i], className)) {
240 elemColl[elemColl.length] = allElements[i];
241 }
242 }
243 return elemColl;
246function isParentOrSelf(element, id) {
247 if (element == null || element.nodeName=='BODY') return false;
248 else if (element.id == id) return true;
249 else return isParentOrSelf(element.parentNode, id);
252function nodeValue(node) {
253 var result = "";
254 if (node.nodeType == 1) {
255 var children = node.childNodes;
256 for (var i = 0; i < children.length; ++i) {
257 result += nodeValue(children[i]);
258 }
259 }
260 else if (node.nodeType == 3) {
261 result = node.nodeValue;
262 }
263 return(result);
266function slideLabel() {
267 var slideColl = GetElementsWithClassName('*','slide');
268 var list = document.getElementById('jumplist');
269 smax = slideColl.length;
270 for (var n = 0; n < smax; n++) {
271 var obj = slideColl[n];
273 var did = 'slide' + n.toString();
274 obj.setAttribute('id',did);
275 if (isOp) continue;
277 var otext = '';
278 var menu = obj.firstChild;
279 if (!menu) continue; // to cope with empty slides
280 while (menu && menu.nodeType == 3) {
281 menu = menu.nextSibling;
282 }
283 if (!menu) continue; // to cope with slides with only text nodes
285 var menunodes = menu.childNodes;
286 for (var o = 0; o < menunodes.length; o++) {
287 otext += nodeValue(menunodes[o]);
288 }
289 list.options[list.length] = new Option(n + ' : ' + otext, n);
290 }
293function currentSlide() {
294 var cs;
295 if (document.getElementById) {
296 cs = document.getElementById('currentSlide');
297 } else {
298 cs = document.currentSlide;
299 }
300 cs.innerHTML = '<span id="csHere">' + snum + '<\/span> ' +
301 '<span id="csSep">\/<\/span> ' +
302 '<span id="csTotal">' + (smax-1) + '<\/span>';
303 if (snum == 0) {
304 cs.style.visibility = 'hidden';
305 } else {
306 cs.style.visibility = 'visible';
307 }
310function go(step) {
311 if (document.getElementById('slideProj').disabled || step == 0) return;
312 var jl = document.getElementById('jumplist');
313 var cid = 'slide' + snum;
314 var ce = document.getElementById(cid);
315 if (incrementals[snum].length > 0) {
316 for (var i = 0; i < incrementals[snum].length; i++) {
317 removeClass(incrementals[snum][i], 'current');
318 removeClass(incrementals[snum][i], 'incremental');
319 }
320 }
321 if (step != 'j') {
322 snum += step;
323 lmax = smax - 1;
324 if (snum > lmax) snum = lmax;
325 if (snum < 0) snum = 0;
326 } else
327 snum = parseInt(jl.value);
328 var nid = 'slide' + snum;
329 var ne = document.getElementById(nid);
330 if (!ne) {
331 ne = document.getElementById('slide0');
332 snum = 0;
333 }
334 if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}
335 if (incrementals[snum].length > 0 && incpos == 0) {
336 for (var i = 0; i < incrementals[snum].length; i++) {
337 if (hasClass(incrementals[snum][i], 'current'))
338 incpos = i + 1;
339 else
340 addClass(incrementals[snum][i], 'incremental');
341 }
342 }
343 if (incrementals[snum].length > 0 && incpos > 0)
344 addClass(incrementals[snum][incpos - 1], 'current');
345 ce.style.visibility = 'hidden';
346 ne.style.visibility = 'visible';
347 jl.selectedIndex = snum;
348 currentSlide();
349 number = 0;
352function goTo(target) {
353 if (target >= smax || target == snum) return;
354 go(target - snum);
357function subgo(step) {
358 if (step > 0) {
359 removeClass(incrementals[snum][incpos - 1],'current');
360 removeClass(incrementals[snum][incpos], 'incremental');
361 addClass(incrementals[snum][incpos],'current');
362 incpos++;
363 } else {
364 incpos--;
365 removeClass(incrementals[snum][incpos],'current');
366 addClass(incrementals[snum][incpos], 'incremental');
367 addClass(incrementals[snum][incpos - 1],'current');
368 }
371function toggle() {
372 var slideColl = GetElementsWithClassName('*','slide');
373 var slides = document.getElementById('slideProj');
374 var outline = document.getElementById('outlineStyle');
375 if (!slides.disabled) {
376 slides.disabled = true;
377 outline.disabled = false;
378 s5mode = false;
379 fontSize('1em');
380 for (var n = 0; n < smax; n++) {
381 var slide = slideColl[n];
382 slide.style.visibility = 'visible';
383 }
384 } else {
385 slides.disabled = false;
386 outline.disabled = true;
387 s5mode = true;
388 fontScale();
389 for (var n = 0; n < smax; n++) {
390 var slide = slideColl[n];
391 slide.style.visibility = 'hidden';
392 }
393 slideColl[snum].style.visibility = 'visible';
394 }
397function showHide(action) {
398 var obj = GetElementsWithClassName('*','hideme')[0];
399 switch (action) {
400 case 's': obj.style.visibility = 'visible'; break;
401 case 'h': obj.style.visibility = 'hidden'; break;
402 case 'k':
403 if (obj.style.visibility != 'visible') {
404 obj.style.visibility = 'visible';
405 } else {
406 obj.style.visibility = 'hidden';
407 }
408 break;
409 }
412// 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/)
413function keys(key) {
414 if (!key) {
415 key = event;
416 key.which = key.keyCode;
417 }
418 if (key.which == 84) {
419 toggle();
420 return;
421 }
422 if (s5mode) {
423 switch (key.which) {
424 case 10: // return
425 case 13: // enter
426 if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
427 if (key.target && isParentOrSelf(key.target, 'controls')) return;
428 if(number != undef) {
429 goTo(number);
430 break;
431 }
432 case 32: // spacebar
433 case 34: // page down
434 case 39: // rightkey
435 case 40: // downkey
436 if(number != undef) {
437 go(number);
438 } else if (!incrementals[snum] || incpos >= incrementals[snum].length) {
439 go(1);
440 } else {
441 subgo(1);
442 }
443 break;
444 case 33: // page up
445 case 37: // leftkey
446 case 38: // upkey
447 if(number != undef) {
448 go(-1 * number);
449 } else if (!incrementals[snum] || incpos <= 0) {
450 go(-1);
451 } else {
452 subgo(-1);
453 }
454 break;
455 case 36: // home
456 goTo(0);
457 break;
458 case 35: // end
459 goTo(smax-1);
460 break;
461 case 67: // c
462 showHide('k');
463 break;
464 }
465 if (key.which < 48 || key.which > 57) {
466 number = undef;
467 } else {
468 if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
469 if (key.target && isParentOrSelf(key.target, 'controls')) return;
470 number = (((number != undef) ? number : 0) * 10) + (key.which - 48);
471 }
472 }
473 return false;
476function clicker(e) {
477 number = undef;
478 var target;
479 if (window.event) {
480 target = window.event.srcElement;
481 e = window.event;
482 } else target = e.target;
483 if (target.getAttribute('href') != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target,'object')) return true;
484 if (!e.which || e.which == 1) {
485 if (!incrementals[snum] || incpos >= incrementals[snum].length) {
486 go(1);
487 } else {
488 subgo(1);
489 }
490 }
493function findSlide(hash) {
494 var target = null;
495 var slides = GetElementsWithClassName('*','slide');
496 for (var i = 0; i < slides.length; i++) {
497 var targetSlide = slides[i];
498 if ( (targetSlide.name && targetSlide.name == hash)
499 || (targetSlide.id && targetSlide.id == hash) ) {
500 target = targetSlide;
501 break;
502 }
503 }
504 while(target != null && target.nodeName != 'BODY') {
505 if (hasClass(target, 'slide')) {
506 return parseInt(target.id.slice(5));
507 }
508 target = target.parentNode;
509 }
510 return null;
513function slideJump() {
514 if (window.location.hash == null) return;
515 var sregex = /^#slide(\d+)$/;
516 var matches = sregex.exec(window.location.hash);
517 var dest = null;
518 if (matches != null) {
519 dest = parseInt(matches[1]);
520 } else {
521 dest = findSlide(window.location.hash.slice(1));
522 }
523 if (dest != null)
524 go(dest - snum);
527function fixLinks() {
528 var thisUri = window.location.href;
529 thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);
530 var aelements = document.getElementsByTagName('A');
531 for (var i = 0; i < aelements.length; i++) {
532 var a = aelements[i].href;
533 var slideID = a.match('\#slide[0-9]{1,2}');
534 if ((slideID) && (slideID[0].slice(0,1) == '#')) {
535 var dest = findSlide(slideID[0].slice(1));
536 if (dest != null) {
537 if (aelements[i].addEventListener) {
538 aelements[i].addEventListener("click", new Function("e",
539 "if (document.getElementById('slideProj').disabled) return;" +
540 "go("+dest+" - snum); " +
541 "if (e.preventDefault) e.preventDefault();"), true);
542 } else if (aelements[i].attachEvent) {
543 aelements[i].attachEvent("onclick", new Function("",
544 "if (document.getElementById('slideProj').disabled) return;" +
545 "go("+dest+" - snum); " +
546 "event.returnValue = false;"));
547 }
548 }
549 }
550 }
553function externalLinks() {
554 if (!document.getElementsByTagName) return;
555 var anchors = document.getElementsByTagName('a');
556 for (var i=0; i<anchors.length; i++) {
557 var anchor = anchors[i];
558 if (anchor.getAttribute('href') && hasValue(anchor.rel, 'external')) {
559 anchor.target = '_blank';
560 addClass(anchor,'external');
561 }
562 }
565function createControls() {
566 var controlsDiv = document.getElementById("controls");
567 if (!controlsDiv) return;
568 var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';
569 var hideDiv, hideList = '';
570 if (controlVis == 'hidden') {
571 hideDiv = hider;
572 } else {
573 hideList = hider;
574 }
575 controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +
576 '<div id="navLinks">' +
577 '<a accesskey="t" id="toggle" href="javascript:toggle();">&#216;<\/a>' +
578 '<a accesskey="z" id="prev" href="javascript:go(-1);">&laquo;<\/a>' +
579 '<a accesskey="x" id="next" href="javascript:go(1);">&raquo;<\/a>' +
580 '<div id="navList"' + hideList + '><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>' +
581 '<\/div><\/form>';
582 if (controlVis == 'hidden') {
583 var hidden = document.getElementById('navLinks');
584 } else {
585 var hidden = document.getElementById('jumplist');
586 }
587 addClass(hidden,'hideme');
590function fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers
591 if (!s5mode) return false;
592 var vScale = 22; // both yield 32 (after rounding) at 1024x768
593 var hScale = 32; // perhaps should auto-calculate based on theme's declared value?
594 if (window.innerHeight) {
595 var vSize = window.innerHeight;
596 var hSize = window.innerWidth;
597 } else if (document.documentElement.clientHeight) {
598 var vSize = document.documentElement.clientHeight;
599 var hSize = document.documentElement.clientWidth;
600 } else if (document.body.clientHeight) {
601 var vSize = document.body.clientHeight;
602 var hSize = document.body.clientWidth;
603 } else {
604 var vSize = 700; // assuming 1024x768, minus chrome and such
605 var hSize = 1024; // these do not account for kiosk mode or Opera Show
606 }
607 var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));
608 fontSize(newSize + 'px');
609 if (isGe) { // hack to counter incremental reflow bugs
610 var obj = document.getElementsByTagName('body')[0];
611 obj.style.display = 'none';
612 obj.style.display = 'block';
613 }
616function fontSize(value) {
617 if (!(s5ss = document.getElementById('s5ss'))) {
618 if (!isIE) {
619 document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));
620 s5ss.setAttribute('media','screen, projection');
621 s5ss.setAttribute('id','s5ss');
622 } else {
623 document.createStyleSheet();
624 document.s5ss = document.styleSheets[document.styleSheets.length - 1];
625 }
626 }
627 if (!isIE) {
628 while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);
629 s5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}'));
630 } else {
631 document.s5ss.addRule('body','font-size: ' + value + ' !important;');
632 }
635function notOperaFix() {
636 slideCSS = document.getElementById('slideProj').href;
637 var slides = document.getElementById('slideProj');
638 var outline = document.getElementById('outlineStyle');
639 slides.setAttribute('media','screen');
640 outline.disabled = true;
641 if (isGe) {
642 slides.setAttribute('href','null'); // Gecko fix
643 slides.setAttribute('href',slideCSS); // Gecko fix
644 }
645 if (isIE && document.styleSheets && document.styleSheets[0]) {
646 document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');
647 document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');
648 document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');
649 }
652function getIncrementals(obj) {
653 var incrementals = new Array();
654 if (!obj)
655 return incrementals;
656 var children = obj.childNodes;
657 for (var i = 0; i < children.length; i++) {
658 var child = children[i];
659 if (hasClass(child, 'incremental')) {
660 if (child.nodeName == 'OL' || child.nodeName == 'UL') {
661 removeClass(child, 'incremental');
662 for (var j = 0; j < child.childNodes.length; j++) {
663 if (child.childNodes[j].nodeType == 1) {
664 addClass(child.childNodes[j], 'incremental');
665 }
666 }
667 } else {
668 incrementals[incrementals.length] = child;
669 removeClass(child,'incremental');
670 }
671 }
672 if (hasClass(child, 'show-first')) {
673 if (child.nodeName == 'OL' || child.nodeName == 'UL') {
674 removeClass(child, 'show-first');
675 if (child.childNodes[isGe].nodeType == 1) {
676 removeClass(child.childNodes[isGe], 'incremental');
677 }
678 } else {
679 incrementals[incrementals.length] = child;
680 }
681 }
682 incrementals = incrementals.concat(getIncrementals(child));
683 }
684 return incrementals;
687function createIncrementals() {
688 var incrementals = new Array();
689 for (var i = 0; i < smax; i++) {
690 incrementals[i] = getIncrementals(document.getElementById('slide'+i));
691 }
692 return incrementals;
695function defaultCheck() {
696 var allMetas = document.getElementsByTagName('meta');
697 for (var i = 0; i< allMetas.length; i++) {
698 if (allMetas[i].name == 'defaultView') {
699 defaultView = allMetas[i].content;
700 }
701 if (allMetas[i].name == 'controlVis') {
702 controlVis = allMetas[i].content;
703 }
704 }
707// Key trap fix, new function body for trap()
708function trap(e) {
709 if (!e) {
710 e = event;
711 e.which = e.keyCode;
712 }
713 try {
714 modifierKey = e.ctrlKey || e.altKey || e.metaKey;
715 }
716 catch(e) {
717 modifierKey = false;
718 }
719 return modifierKey || e.which == 0;
722function startup() {
723 defaultCheck();
724 if (!isOp)
725 createControls();
726 slideLabel();
727 fixLinks();
728 externalLinks();
729 fontScale();
730 if (!isOp) {
731 notOperaFix();
732 incrementals = createIncrementals();
733 slideJump();
734 if (defaultView == 'outline') {
735 toggle();
736 }
737 document.onkeyup = keys;
738 document.onkeypress = trap;
739 document.onclick = clicker;
740 }
743window.onload = startup;
744window.onresize = function(){setTimeout('fontScale()', 50);}</script>
745<script type="text/javascript">
746/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
747See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */
749var checkForMathML = true; // check if browser can display MathML
750var notifyIfNoMathML = true; // display note if no MathML capability
751var alertIfNoMathML = false; // show alert box if no MathML capability
752var mathcolor = ""; // change it to "" (to inherit) or any other color
753var mathfontfamily = "serif"; // change to "" to inherit (works in IE)
754 // or another family (e.g. "arial")
755var displaystyle = true; // puts limits above and below large operators
756var showasciiformulaonhover = true; // helps students learn ASCIIMath
757var decimalsign = "."; // change to "," if you like, beware of `(1,2)`!
758var AMdelimiter1 = "`", AMescape1 = "\\\\`"; // can use other characters
759var AMdelimiter2 = "$", AMescape2 = "\\\\\\$", AMdelimiter2regexp = "\\$";
760var doubleblankmathdelimiter = false; // if true, x+1 is equal to `x+1`
761 // for IE this works only in <!-- -->
762//var separatetokens;// has been removed (email me if this is a problem)
763var isIE = document.createElementNS==null;
765if (document.getElementById==null)
766 alert("This webpage requires a recent browser such as\
767\nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer")
769// all further global variables start with "AM"
771function AMcreateElementXHTML(t) {
772 if (isIE) return document.createElement(t);
773 else return document.createElementNS("http://www.w3.org/1999/xhtml",t);
776function AMnoMathMLNote() {
777 var nd = AMcreateElementXHTML("h3");
778 nd.setAttribute("align","center")
779 nd.appendChild(AMcreateElementXHTML("p"));
780 nd.appendChild(document.createTextNode("To view the "));
781 var an = AMcreateElementXHTML("a");
782 an.appendChild(document.createTextNode("ASCIIMathML"));
783 an.setAttribute("href","http://www.chapman.edu/~jipsen/asciimath.html");
784 nd.appendChild(an);
785 nd.appendChild(document.createTextNode(" notation use Internet Explorer 6+"));
786 an = AMcreateElementXHTML("a");
787 an.appendChild(document.createTextNode("MathPlayer"));
788 an.setAttribute("href","http://www.dessci.com/en/products/mathplayer/download.htm");
789 nd.appendChild(an);
790 nd.appendChild(document.createTextNode(" or Netscape/Mozilla/Firefox"));
791 nd.appendChild(AMcreateElementXHTML("p"));
792 return nd;
795function AMisMathMLavailable() {
796 var regex = /KHTML/; /* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
797See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */
798 if (navigator.appName.slice(0,8)=="Netscape")
799 if (navigator.appVersion.slice(0,1)>="5" && !regex.test(navigator.userAgent)) return null;
800 else return AMnoMathMLNote();
801 else if (navigator.appName.slice(0,9)=="Microsoft")
802 try {
803 var ActiveX = new ActiveXObject("MathPlayer.Factory.1");
804 return null;
805 } catch (e) {
806 return AMnoMathMLNote();
807 }
808 else return AMnoMathMLNote();
811// character lists for Mozilla/Netscape fonts
812var AMcal = [0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];
813var AMfrk = [0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];
814var AMbbb = [0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];
816var CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4,
817 RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8,
818 LEFTRIGHT = 9, TEXT = 10; // token types
820var AMsqrt = {input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY},
821 AMroot = {input:"root", tag:"mroot", output:"root", tex:null, ttype:BINARY},
822 AMfrac = {input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY},
823 AMdiv = {input:"/", tag:"mfrac", output:"/", tex:null, ttype:INFIX},
824 AMover = {input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY},
825 AMsub = {input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX},
826 AMsup = {input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX},
827 AMtext = {input:"text", tag:"mtext", output:"text", tex:null, ttype:TEXT},
828 AMmbox = {input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:TEXT},
829 AMquote = {input:"\"", tag:"mtext", output:"mbox", tex:null, ttype:TEXT};
831var AMsymbols = [
832//some greek symbols
833{input:"alpha", tag:"mi", output:"\u03B1", tex:null, ttype:CONST},
834{input:"beta", tag:"mi", output:"\u03B2", tex:null, ttype:CONST},
835{input:"chi", tag:"mi", output:"\u03C7", tex:null, ttype:CONST},
836{input:"delta", tag:"mi", output:"\u03B4", tex:null, ttype:CONST},
837{input:"Delta", tag:"mo", output:"\u0394", tex:null, ttype:CONST},
838{input:"epsi", tag:"mi", output:"\u03B5", tex:"epsilon", ttype:CONST},
839{input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:CONST},
840{input:"eta", tag:"mi", output:"\u03B7", tex:null, ttype:CONST},
841{input:"gamma", tag:"mi", output:"\u03B3", tex:null, ttype:CONST},
842{input:"Gamma", tag:"mo", output:"\u0393", tex:null, ttype:CONST},
843{input:"iota", tag:"mi", output:"\u03B9", tex:null, ttype:CONST},
844{input:"kappa", tag:"mi", output:"\u03BA", tex:null, ttype:CONST},
845{input:"lambda", tag:"mi", output:"\u03BB", tex:null, ttype:CONST},
846{input:"Lambda", tag:"mo", output:"\u039B", tex:null, ttype:CONST},
847{input:"mu", tag:"mi", output:"\u03BC", tex:null, ttype:CONST},
848{input:"nu", tag:"mi", output:"\u03BD", tex:null, ttype:CONST},
849{input:"omega", tag:"mi", output:"\u03C9", tex:null, ttype:CONST},
850{input:"Omega", tag:"mo", output:"\u03A9", tex:null, ttype:CONST},
851{input:"phi", tag:"mi", output:"\u03C6", tex:null, ttype:CONST},
852{input:"varphi", tag:"mi", output:"\u03D5", tex:null, ttype:CONST},
853{input:"Phi", tag:"mo", output:"\u03A6", tex:null, ttype:CONST},
854{input:"pi", tag:"mi", output:"\u03C0", tex:null, ttype:CONST},
855{input:"Pi", tag:"mo", output:"\u03A0", tex:null, ttype:CONST},
856{input:"psi", tag:"mi", output:"\u03C8", tex:null, ttype:CONST},
857{input:"Psi", tag:"mi", output:"\u03A8", tex:null, ttype:CONST},
858{input:"rho", tag:"mi", output:"\u03C1", tex:null, ttype:CONST},
859{input:"sigma", tag:"mi", output:"\u03C3", tex:null, ttype:CONST},
860{input:"Sigma", tag:"mo", output:"\u03A3", tex:null, ttype:CONST},
861{input:"tau", tag:"mi", output:"\u03C4", tex:null, ttype:CONST},
862{input:"theta", tag:"mi", output:"\u03B8", tex:null, ttype:CONST},
863{input:"vartheta", tag:"mi", output:"\u03D1", tex:null, ttype:CONST},
864{input:"Theta", tag:"mo", output:"\u0398", tex:null, ttype:CONST},
865{input:"upsilon", tag:"mi", output:"\u03C5", tex:null, ttype:CONST},
866{input:"xi", tag:"mi", output:"\u03BE", tex:null, ttype:CONST},
867{input:"Xi", tag:"mo", output:"\u039E", tex:null, ttype:CONST},
868{input:"zeta", tag:"mi", output:"\u03B6", tex:null, ttype:CONST},
870//binary operation symbols
871{input:"*", tag:"mo", output:"\u22C5", tex:"cdot", ttype:CONST},
872{input:"**", tag:"mo", output:"\u22C6", tex:"star", ttype:CONST},
873{input:"//", tag:"mo", output:"/", tex:null, ttype:CONST},
874{input:"\\\\", tag:"mo", output:"\\", tex:"backslash", ttype:CONST},
875{input:"setminus", tag:"mo", output:"\\", tex:null, ttype:CONST},
876{input:"xx", tag:"mo", output:"\u00D7", tex:"times", ttype:CONST},
877{input:"-:", tag:"mo", output:"\u00F7", tex:"divide", ttype:CONST},
878{input:"@", tag:"mo", output:"\u2218", tex:"circ", ttype:CONST},
879{input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:CONST},
880{input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:CONST},
881{input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:CONST},
882{input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:UNDEROVER},
883{input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:UNDEROVER},
884{input:"^^", tag:"mo", output:"\u2227", tex:"wedge", ttype:CONST},
885{input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:UNDEROVER},
886{input:"vv", tag:"mo", output:"\u2228", tex:"vee", ttype:CONST},
887{input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:UNDEROVER},
888{input:"nn", tag:"mo", output:"\u2229", tex:"cap", ttype:CONST},
889{input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:UNDEROVER},
890{input:"uu", tag:"mo", output:"\u222A", tex:"cup", ttype:CONST},
891{input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:UNDEROVER},
893//binary relation symbols
894{input:"!=", tag:"mo", output:"\u2260", tex:"ne", ttype:CONST},
895{input:":=", tag:"mo", output:":=", tex:null, ttype:CONST},
896{input:"lt", tag:"mo", output:"<", tex:null, ttype:CONST},
897{input:"<=", tag:"mo", output:"\u2264", tex:"le", ttype:CONST},
898{input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:CONST},
899{input:">=", tag:"mo", output:"\u2265", tex:"ge", ttype:CONST},
900{input:"geq", tag:"mo", output:"\u2265", tex:null, ttype:CONST},
901{input:"-<", tag:"mo", output:"\u227A", tex:"prec", ttype:CONST},
902{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST},
903{input:">-", tag:"mo", output:"\u227B", tex:"succ", ttype:CONST},
904{input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:CONST},
905{input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:CONST},
906{input:"in", tag:"mo", output:"\u2208", tex:null, ttype:CONST},
907{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST},
908{input:"sub", tag:"mo", output:"\u2282", tex:"subset", ttype:CONST},
909{input:"sup", tag:"mo", output:"\u2283", tex:"supset", ttype:CONST},
910{input:"sube", tag:"mo", output:"\u2286", tex:"subseteq", ttype:CONST},
911{input:"supe", tag:"mo", output:"\u2287", tex:"supseteq", ttype:CONST},
912{input:"-=", tag:"mo", output:"\u2261", tex:"equiv", ttype:CONST},
913{input:"~=", tag:"mo", output:"\u2245", tex:"cong", ttype:CONST},
914{input:"~~", tag:"mo", output:"\u2248", tex:"approx", ttype:CONST},
915{input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:CONST},
917//logical symbols
918{input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE},
919{input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE},
920{input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:CONST},
921{input:"=>", tag:"mo", output:"\u21D2", tex:"implies", ttype:CONST},
922{input:"if", tag:"mo", output:"if", tex:null, ttype:SPACE},
923{input:"<=>", tag:"mo", output:"\u21D4", tex:"iff", ttype:CONST},
924{input:"AA", tag:"mo", output:"\u2200", tex:"forall", ttype:CONST},
925{input:"EE", tag:"mo", output:"\u2203", tex:"exists", ttype:CONST},
926{input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:CONST},
927{input:"TT", tag:"mo", output:"\u22A4", tex:"top", ttype:CONST},
928{input:"|--", tag:"mo", output:"\u22A2", tex:"vdash", ttype:CONST},
929{input:"|==", tag:"mo", output:"\u22A8", tex:"models", ttype:CONST},
931//grouping brackets
932{input:"(", tag:"mo", output:"(", tex:null, ttype:LEFTBRACKET},
933{input:")", tag:"mo", output:")", tex:null, ttype:RIGHTBRACKET},
934{input:"[", tag:"mo", output:"[", tex:null, ttype:LEFTBRACKET},
935{input:"]", tag:"mo", output:"]", tex:null, ttype:RIGHTBRACKET},
936{input:"{", tag:"mo", output:"{", tex:null, ttype:LEFTBRACKET},
937{input:"}", tag:"mo", output:"}", tex:null, ttype:RIGHTBRACKET},
938{input:"|", tag:"mo", output:"|", tex:null, ttype:LEFTRIGHT},
939//{input:"||", tag:"mo", output:"||", tex:null, ttype:LEFTRIGHT},
940{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET},
941{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET},
942{input:"<<", tag:"mo", output:"\u2329", tex:null, ttype:LEFTBRACKET},
943{input:">>", tag:"mo", output:"\u232A", tex:null, ttype:RIGHTBRACKET},
944{input:"{:", tag:"mo", output:"{:", tex:null, ttype:LEFTBRACKET, invisible:true},
945{input:":}", tag:"mo", output:":}", tex:null, ttype:RIGHTBRACKET, invisible:true},
947//miscellaneous symbols
948{input:"int", tag:"mo", output:"\u222B", tex:null, ttype:CONST},
949{input:"dx", tag:"mi", output:"{:d x:}", tex:null, ttype:DEFINITION},
950{input:"dy", tag:"mi", output:"{:d y:}", tex:null, ttype:DEFINITION},
951{input:"dz", tag:"mi", output:"{:d z:}", tex:null, ttype:DEFINITION},
952{input:"dt", tag:"mi", output:"{:d t:}", tex:null, ttype:DEFINITION},
953{input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:CONST},
954{input:"del", tag:"mo", output:"\u2202", tex:"partial", ttype:CONST},
955{input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:CONST},
956{input:"+-", tag:"mo", output:"\u00B1", tex:"pm", ttype:CONST},
957{input:"O/", tag:"mo", output:"\u2205", tex:"emptyset", ttype:CONST},
958{input:"oo", tag:"mo", output:"\u221E", tex:"infty", ttype:CONST},
959{input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:CONST},
960{input:"...", tag:"mo", output:"...", tex:"ldots", ttype:CONST},
961{input:":.", tag:"mo", output:"\u2234", tex:"therefore", ttype:CONST},
962{input:"/_", tag:"mo", output:"\u2220", tex:"angle", ttype:CONST},
963{input:"\\ ", tag:"mo", output:"\u00A0", tex:null, ttype:CONST},
964{input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:CONST},
965{input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:CONST},
966{input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:CONST},
967{input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:CONST},
968{input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:CONST},
969{input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:CONST},
970{input:"square", tag:"mo", output:"\u25A1", tex:null, ttype:CONST},
971{input:"|__", tag:"mo", output:"\u230A", tex:"lfloor", ttype:CONST},
972{input:"__|", tag:"mo", output:"\u230B", tex:"rfloor", ttype:CONST},
973{input:"|~", tag:"mo", output:"\u2308", tex:"lceiling", ttype:CONST},
974{input:"~|", tag:"mo", output:"\u2309", tex:"rceiling", ttype:CONST},
975{input:"CC", tag:"mo", output:"\u2102", tex:null, ttype:CONST},
976{input:"NN", tag:"mo", output:"\u2115", tex:null, ttype:CONST},
977{input:"QQ", tag:"mo", output:"\u211A", tex:null, ttype:CONST},
978{input:"RR", tag:"mo", output:"\u211D", tex:null, ttype:CONST},
979{input:"ZZ", tag:"mo", output:"\u2124", tex:null, ttype:CONST},
980{input:"f", tag:"mi", output:"f", tex:null, ttype:UNARY, func:true},
981{input:"g", tag:"mi", output:"g", tex:null, ttype:UNARY, func:true},
983//standard functions
984{input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER},
985{input:"Lim", tag:"mo", output:"Lim", tex:null, ttype:UNDEROVER},
986{input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true},
987{input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true},
988{input:"tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true},
989{input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true},
990{input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true},
991{input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true},
992{input:"cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true},
993{input:"sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true},
994{input:"csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true},
995{input:"log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true},
996{input:"ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true},
997{input:"det", tag:"mo", output:"det", tex:null, ttype:UNARY, func:true},
998{input:"dim", tag:"mo", output:"dim", tex:null, ttype:CONST},
999{input:"mod", tag:"mo", output:"mod", tex:null, ttype:CONST},
1000{input:"gcd", tag:"mo", output:"gcd", tex:null, ttype:UNARY, func:true},
1001{input:"lcm", tag:"mo", output:"lcm", tex:null, ttype:UNARY, func:true},
1002{input:"lub", tag:"mo", output:"lub", tex:null, ttype:CONST},
1003{input:"glb", tag:"mo", output:"glb", tex:null, ttype:CONST},
1004{input:"min", tag:"mo", output:"min", tex:null, ttype:UNDEROVER},
1005{input:"max", tag:"mo", output:"max", tex:null, ttype:UNDEROVER},
1007//arrows
1008{input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:CONST},
1009{input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:CONST},
1010{input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:CONST},
1011{input:"->", tag:"mo", output:"\u2192", tex:"to", ttype:CONST},
1012{input:"|->", tag:"mo", output:"\u21A6", tex:"mapsto", ttype:CONST},
1013{input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:CONST},
1014{input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:CONST},
1015{input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST},
1016{input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:CONST},
1017{input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST},
1019//commands with argument
1020AMsqrt, AMroot, AMfrac, AMdiv, AMover, AMsub, AMsup,
1021{input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:UNARY, acc:true},
1022{input:"bar", tag:"mover", output:"\u00AF", tex:"overline", ttype:UNARY, acc:true},
1023{input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:UNARY, acc:true},
1024{input:"dot", tag:"mover", output:".", tex:null, ttype:UNARY, acc:true},
1025{input:"ddot", tag:"mover", output:"..", tex:null, ttype:UNARY, acc:true},
1026{input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:UNARY, acc:true},
1027AMtext, AMmbox, AMquote,
1028{input:"bb", tag:"mstyle", atname:"fontweight", atval:"bold", output:"bb", tex:null, ttype:UNARY},
1029{input:"mathbf", tag:"mstyle", atname:"fontweight", atval:"bold", output:"mathbf", tex:null, ttype:UNARY},
1030{input:"sf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"sf", tex:null, ttype:UNARY},
1031{input:"mathsf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"mathsf", tex:null, ttype:UNARY},
1032{input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:null, ttype:UNARY, codes:AMbbb},
1033{input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:UNARY, codes:AMbbb},
1034{input:"cc", tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:null, ttype:UNARY, codes:AMcal},
1035{input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:UNARY, codes:AMcal},
1036{input:"tt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"tt", tex:null, ttype:UNARY},
1037{input:"mathtt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"mathtt", tex:null, ttype:UNARY},
1038{input:"fr", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:null, ttype:UNARY, codes:AMfrk},
1039{input:"mathfrak", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:UNARY, codes:AMfrk}
1042function compareNames(s1,s2) {
1043 if (s1.input > s2.input) return 1
1044 else return -1;
1047var AMnames = []; //list of input symbols
1049function AMinitSymbols() {
1050 var texsymbols = [], i;
1051 for (i=0; i<AMsymbols.length; i++)
1052 if (AMsymbols[i].tex)
1053 texsymbols[texsymbols.length] = {input:AMsymbols[i].tex,
1054 tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype};
1055 AMsymbols = AMsymbols.concat(texsymbols);
1056 AMsymbols.sort(compareNames);
1057 for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input;
1060var AMmathml = "http://www.w3.org/1998/Math/MathML";
1062function AMcreateElementMathML(t) {
1063 if (isIE) return document.createElement("m:"+t);
1064 else return document.createElementNS(AMmathml,t);
1067function AMcreateMmlNode(t,frag) {
1068// var node = AMcreateElementMathML(name);
1069 if (isIE) var node = document.createElement("m:"+t);
1070 else var node = document.createElementNS(AMmathml,t);
1071 node.appendChild(frag);
1072 return node;
1075function newcommand(oldstr,newstr) {
1076 AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr,
1077 tex:null, ttype:DEFINITION}]);
1080function AMremoveCharsAndBlanks(str,n) {
1081//remove n characters and any following blanks
1082 var st;
1083 if (str.charAt(n)=="\\" && str.charAt(n+1)!="\\" && str.charAt(n+1)!=" ")
1084 st = str.slice(n+1);
1085 else st = str.slice(n);
1086 for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);
1087 return st.slice(i);
1090function AMposition(arr, str, n) {
1091// return position >=n where str appears or would be inserted
1092// assumes arr is sorted
1093 if (n==0) {
1094 var h,m;
1095 n = -1;
1096 h = arr.length;
1097 while (n+1<h) {
1098 m = (n+h) >> 1;
1099 if (arr[m]<str) n = m; else h = m;
1101 return h;
1102 } else
1103 for (var i=n; i<arr.length && arr[i]<str; i++);
1104 return i; // i=arr.length || arr[i]>=str
1107function AMgetSymbol(str) {
1108//return maximal initial substring of str that appears in names
1109//return null if there is none
1110 var k = 0; //new pos
1111 var j = 0; //old pos
1112 var mk; //match pos
1113 var st;
1114 var tagst;
1115 var match = "";
1116 var more = true;
1117 for (var i=1; i<=str.length && more; i++) {
1118 st = str.slice(0,i); //initial substring of length i
1119 j = k;
1120 k = AMposition(AMnames, st, j);
1121 if (k<AMnames.length && str.slice(0,AMnames[k].length)==AMnames[k]){
1122 match = AMnames[k];
1123 mk = k;
1124 i = match.length;
1126 more = k<AMnames.length && str.slice(0,AMnames[k].length)>=AMnames[k];
1128 AMpreviousSymbol=AMcurrentSymbol;
1129 if (match!=""){
1130 AMcurrentSymbol=AMsymbols[mk].ttype;
1131 return AMsymbols[mk];
1133// if str[0] is a digit or - return maxsubstring of digits.digits
1134 AMcurrentSymbol=CONST;
1135 k = 1;
1136 st = str.slice(0,1);
1137 var integ = true;
1138 while ("0"<=st && st<="9" && k<=str.length) {
1139 st = str.slice(k,k+1);
1140 k++;
1142 if (st == decimalsign) {
1143 st = str.slice(k,k+1);
1144 if ("0"<=st && st<="9") {
1145 integ = false;
1146 k++;
1147 while ("0"<=st && st<="9" && k<=str.length) {
1148 st = str.slice(k,k+1);
1149 k++;
1153 if ((integ && k>1) || k>2) {
1154 st = str.slice(0,k-1);
1155 tagst = "mn";
1156 } else {
1157 k = 2;
1158 st = str.slice(0,1); //take 1 character
1159 tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");
1161 if (st=="-" && AMpreviousSymbol==INFIX) {
1162 AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse
1163 return {input:st, tag:tagst, output:st, ttype:UNARY, func:true};
1165 return {input:st, tag:tagst, output:st, ttype:CONST};
1168function AMremoveBrackets(node) {
1169 var st;
1170 if (node.nodeName=="mrow") {
1171 st = node.firstChild.firstChild.nodeValue;
1172 if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild);
1174 if (node.nodeName=="mrow") {
1175 st = node.lastChild.firstChild.nodeValue;
1176 if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild);
1180/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
1181See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */
1183var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol;
1185function AMparseSexpr(str) { //parses str and returns [node,tailstr]
1186 var symbol, node, result, i, st,// rightvert = false,
1187 newFrag = document.createDocumentFragment();
1188 str = AMremoveCharsAndBlanks(str,0);
1189 symbol = AMgetSymbol(str); //either a token or a bracket or empty
1190 if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) {
1191 return [null,str];
1193 if (symbol.ttype == DEFINITION) {
1194 str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length);
1195 symbol = AMgetSymbol(str);
1197 switch (symbol.ttype) {
1198 case UNDEROVER:
1199 case CONST:
1200 str = AMremoveCharsAndBlanks(str,symbol.input.length);
1201 return [AMcreateMmlNode(symbol.tag, //its a constant
1202 document.createTextNode(symbol.output)),str];
1203 case LEFTBRACKET: //read (expr+)
1204 AMnestingDepth++;
1205 str = AMremoveCharsAndBlanks(str,symbol.input.length);
1206 result = AMparseExpr(str,true);
1207 AMnestingDepth--;
1208 if (typeof symbol.invisible == "boolean" && symbol.invisible)
1209 node = AMcreateMmlNode("mrow",result[0]);
1210 else {
1211 node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
1212 node = AMcreateMmlNode("mrow",node);
1213 node.appendChild(result[0]);
1215 return [node,result[1]];
1216 case TEXT:
1217 if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length);
1218 if (str.charAt(0)=="{") i=str.indexOf("}");
1219 else if (str.charAt(0)=="(") i=str.indexOf(")");
1220 else if (str.charAt(0)=="[") i=str.indexOf("]");
1221 else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1;
1222 else i = 0;
1223 if (i==-1) i = str.length;
1224 st = str.slice(1,i);
1225 if (st.charAt(0) == " ") {
1226 node = AMcreateElementMathML("mspace");
1227 node.setAttribute("width","1ex");
1228 newFrag.appendChild(node);
1230 newFrag.appendChild(
1231 AMcreateMmlNode(symbol.tag,document.createTextNode(st)));
1232 if (st.charAt(st.length-1) == " ") {
1233 node = AMcreateElementMathML("mspace");
1234 node.setAttribute("width","1ex");
1235 newFrag.appendChild(node);
1237 str = AMremoveCharsAndBlanks(str,i+1);
1238 return [AMcreateMmlNode("mrow",newFrag),str];
1239 case UNARY:
1240 str = AMremoveCharsAndBlanks(str,symbol.input.length);
1241 result = AMparseSexpr(str);
1242 if (result[0]==null) return [AMcreateMmlNode(symbol.tag,
1243 document.createTextNode(symbol.output)),str];
1244 if (typeof symbol.func == "boolean" && symbol.func) { // functions hack
1245 st = str.charAt(0);
1246 if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {
1247 return [AMcreateMmlNode(symbol.tag,
1248 document.createTextNode(symbol.output)),str];
1249 } else {
1250 node = AMcreateMmlNode("mrow",
1251 AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)));
1252 node.appendChild(result[0]);
1253 return [node,result[1]];
1256 AMremoveBrackets(result[0]);
1257 if (symbol.input == "sqrt") { // sqrt
1258 return [AMcreateMmlNode(symbol.tag,result[0]),result[1]];
1259 } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent
1260 node = AMcreateMmlNode(symbol.tag,result[0]);
1261 node.appendChild(AMcreateMmlNode("mo",document.createTextNode(symbol.output)));
1262 return [node,result[1]];
1263 } else { // font change command
1264 if (!isIE && typeof symbol.codes != "undefined") {
1265 for (i=0; i<result[0].childNodes.length; i++)
1266 if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") {
1267 st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue:
1268 result[0].childNodes[i].firstChild.nodeValue);
1269 var newst = [];
1270 for (var j=0; j<st.length; j++)
1271 if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst +
1272 String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);
1273 else newst = newst + st.charAt(j);
1274 if (result[0].nodeName=="mi")
1275 result[0]=AMcreateElementMathML("mo").
1276 appendChild(document.createTextNode(newst));
1277 else result[0].replaceChild(AMcreateElementMathML("mo").
1278 appendChild(document.createTextNode(newst)),result[0].childNodes[i]);
1281 node = AMcreateMmlNode(symbol.tag,result[0]);
1282 node.setAttribute(symbol.atname,symbol.atval);
1283 return [node,result[1]];
1285 case BINARY:
1286 str = AMremoveCharsAndBlanks(str,symbol.input.length);
1287 result = AMparseSexpr(str);
1288 if (result[0]==null) return [AMcreateMmlNode("mo",
1289 document.createTextNode(symbol.input)),str];
1290 AMremoveBrackets(result[0]);
1291 var result2 = AMparseSexpr(result[1]);
1292 if (result2[0]==null) return [AMcreateMmlNode("mo",
1293 document.createTextNode(symbol.input)),str];
1294 AMremoveBrackets(result2[0]);
1295 if (symbol.input=="root" || symbol.input=="stackrel")
1296 newFrag.appendChild(result2[0]);
1297 newFrag.appendChild(result[0]);
1298 if (symbol.input=="frac") newFrag.appendChild(result2[0]);
1299 return [AMcreateMmlNode(symbol.tag,newFrag),result2[1]];
1300 case INFIX:
1301 str = AMremoveCharsAndBlanks(str,symbol.input.length);
1302 return [AMcreateMmlNode("mo",document.createTextNode(symbol.output)),str];
1303 case SPACE:
1304 str = AMremoveCharsAndBlanks(str,symbol.input.length);
1305 node = AMcreateElementMathML("mspace");
1306 node.setAttribute("width","1ex");
1307 newFrag.appendChild(node);
1308 newFrag.appendChild(
1309 AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)));
1310 node = AMcreateElementMathML("mspace");
1311 node.setAttribute("width","1ex");
1312 newFrag.appendChild(node);
1313 return [AMcreateMmlNode("mrow",newFrag),str];
1314 case LEFTRIGHT:
1315// if (rightvert) return [null,str]; else rightvert = true;
1316 AMnestingDepth++;
1317 str = AMremoveCharsAndBlanks(str,symbol.input.length);
1318 result = AMparseExpr(str,false);
1319 AMnestingDepth--;
1320 var st = "";
1321 if (result[0].lastChild!=null)
1322 st = result[0].lastChild.firstChild.nodeValue;
1323 if (st == "|") { // its an absolute value subterm
1324 node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
1325 node = AMcreateMmlNode("mrow",node);
1326 node.appendChild(result[0]);
1327 return [node,result[1]];
1328 } else { // the "|" is a \mid
1329 node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
1330 node = AMcreateMmlNode("mrow",node);
1331 return [node,str];
1333 default:
1334//alert("default");
1335 str = AMremoveCharsAndBlanks(str,symbol.input.length);
1336 return [AMcreateMmlNode(symbol.tag, //its a constant
1337 document.createTextNode(symbol.output)),str];
1341function AMparseIexpr(str) {
1342 var symbol, sym1, sym2, node, result, underover;
1343 str = AMremoveCharsAndBlanks(str,0);
1344 sym1 = AMgetSymbol(str);
1345 result = AMparseSexpr(str);
1346 node = result[0];
1347 str = result[1];
1348 symbol = AMgetSymbol(str);
1349 if (symbol.ttype == INFIX && symbol.input != "/") {
1350 str = AMremoveCharsAndBlanks(str,symbol.input.length);
1351// if (symbol.input == "/") result = AMparseIexpr(str); else ...
1352 result = AMparseSexpr(str);
1353 if (result[0] == null) // show box in place of missing argument
1354 result[0] = AMcreateMmlNode("mo",document.createTextNode("\u25A1"));
1355 else AMremoveBrackets(result[0]);
1356 str = result[1];
1357// if (symbol.input == "/") AMremoveBrackets(node);
1358 if (symbol.input == "_") {
1359 sym2 = AMgetSymbol(str);
1360 underover = (sym1.ttype == UNDEROVER);
1361 if (sym2.input == "^") {
1362 str = AMremoveCharsAndBlanks(str,sym2.input.length);
1363 var res2 = AMparseSexpr(str);
1364 AMremoveBrackets(res2[0]);
1365 str = res2[1];
1366 node = AMcreateMmlNode((underover?"munderover":"msubsup"),node);
1367 node.appendChild(result[0]);
1368 node.appendChild(res2[0]);
1369 node = AMcreateMmlNode("mrow",node); // so sum does not stretch
1370 } else {
1371 node = AMcreateMmlNode((underover?"munder":"msub"),node);
1372 node.appendChild(result[0]);
1374 } else {
1375 node = AMcreateMmlNode(symbol.tag,node);
1376 node.appendChild(result[0]);
1379 return [node,str];
1382function AMparseExpr(str,rightbracket) {
1383 var symbol, node, result, i, nodeList = [],
1384 newFrag = document.createDocumentFragment();
1385 do {
1386 str = AMremoveCharsAndBlanks(str,0);
1387 result = AMparseIexpr(str);
1388 node = result[0];
1389 str = result[1];
1390 symbol = AMgetSymbol(str);
1391 if (symbol.ttype == INFIX && symbol.input == "/") {
1392 str = AMremoveCharsAndBlanks(str,symbol.input.length);
1393 result = AMparseIexpr(str);
1394 if (result[0] == null) // show box in place of missing argument
1395 result[0] = AMcreateMmlNode("mo",document.createTextNode("\u25A1"));
1396 else AMremoveBrackets(result[0]);
1397 str = result[1];
1398 AMremoveBrackets(node);
1399 node = AMcreateMmlNode(symbol.tag,node);
1400 node.appendChild(result[0]);
1401 newFrag.appendChild(node);
1402 symbol = AMgetSymbol(str);
1403 }
1404 else if (node!=undefined) newFrag.appendChild(node);
1405 } while ((symbol.ttype != RIGHTBRACKET &&
1406 (symbol.ttype != LEFTRIGHT || rightbracket)
1407 || AMnestingDepth == 0) && symbol!=null && symbol.output!="");
1408 if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) {
1409// if (AMnestingDepth > 0) AMnestingDepth--;
1410 var len = newFrag.childNodes.length;
1411 if (len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&
1412 newFrag.childNodes[len-2].nodeName == "mo" &&
1413 newFrag.childNodes[len-2].firstChild.nodeValue == ",") { //matrix
1414 var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue;
1415 if (right==")" || right=="]") {
1416 var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue;
1417 if (left=="(" && right==")" && symbol.output != "}" ||
1418 left=="[" && right=="]") {
1419 var pos = []; // positions of commas
1420 var matrix = true;
1421 var m = newFrag.childNodes.length;
1422 for (i=0; matrix && i<m; i=i+2) {
1423 pos[i] = [];
1424 node = newFrag.childNodes[i];
1425 if (matrix) matrix = node.nodeName=="mrow" &&
1426 (i==m-1 || node.nextSibling.nodeName=="mo" &&
1427 node.nextSibling.firstChild.nodeValue==",")&&
1428 node.firstChild.firstChild.nodeValue==left &&
1429 node.lastChild.firstChild.nodeValue==right;
1430 if (matrix)
1431 for (var j=0; j<node.childNodes.length; j++)
1432 if (node.childNodes[j].firstChild.nodeValue==",")
1433 pos[i][pos[i].length]=j;
1434 if (matrix && i>1) matrix = pos[i].length == pos[i-2].length;
1436 if (matrix) {
1437 var row, frag, n, k, table = document.createDocumentFragment();
1438 for (i=0; i<m; i=i+2) {
1439 row = document.createDocumentFragment();
1440 frag = document.createDocumentFragment();
1441 node = newFrag.firstChild; // <mrow>(-,-,...,-,-)</mrow>
1442 n = node.childNodes.length;
1443 k = 0;
1444 node.removeChild(node.firstChild); //remove (
1445 for (j=1; j<n-1; j++) {
1446 if (typeof pos[i][k] != "undefined" && j==pos[i][k]){
1447 node.removeChild(node.firstChild); //remove ,
1448 row.appendChild(AMcreateMmlNode("mtd",frag));
1449 k++;
1450 } else frag.appendChild(node.firstChild);
1452 row.appendChild(AMcreateMmlNode("mtd",frag));
1453 if (newFrag.childNodes.length>2) {
1454 newFrag.removeChild(newFrag.firstChild); //remove <mrow>)</mrow>
1455 newFrag.removeChild(newFrag.firstChild); //remove <mo>,</mo>
1457 table.appendChild(AMcreateMmlNode("mtr",row));
1459 node = AMcreateMmlNode("mtable",table);
1460 if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left");
1461 newFrag.replaceChild(node,newFrag.firstChild);
1466 str = AMremoveCharsAndBlanks(str,symbol.input.length);
1467 if (typeof symbol.invisible != "boolean" || !symbol.invisible) {
1468 node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
1469 newFrag.appendChild(node);
1472 return [newFrag,str];
1475function AMparseMath(str) {
1476 var result, node = AMcreateElementMathML("mstyle");
1477 if (mathcolor != "") node.setAttribute("mathcolor",mathcolor);
1478 if (displaystyle) node.setAttribute("displaystyle","true");
1479 if (mathfontfamily != "") node.setAttribute("fontfamily",mathfontfamily);
1480 AMnestingDepth = 0;
1481 node.appendChild(AMparseExpr(str.replace(/^\s+/g,""),false)[0]);
1482 node = AMcreateMmlNode("math",node);
1483 if (showasciiformulaonhover) //fixed by djhsu so newline
1484 node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko
1485 if (mathfontfamily != "" && (isIE || mathfontfamily != "serif")) {
1486 var fnode = AMcreateElementXHTML("font");
1487 fnode.setAttribute("face",mathfontfamily);
1488 fnode.appendChild(node);
1489 return fnode;
1491 return node;
1494function AMstrarr2docFrag(arr, linebreaks) {
1495 var newFrag=document.createDocumentFragment();
1496 var expr = false;
1497 for (var i=0; i<arr.length; i++) {
1498 if (expr) newFrag.appendChild(AMparseMath(arr[i]));
1499 else {
1500 var arri = (linebreaks ? arr[i].split("\n\n") : [arr[i]]);
1501 newFrag.appendChild(AMcreateElementXHTML("span").
1502 appendChild(document.createTextNode(arri[0])));
1503 for (var j=1; j<arri.length; j++) {
1504 newFrag.appendChild(AMcreateElementXHTML("p"));
1505 newFrag.appendChild(AMcreateElementXHTML("span").
1506 appendChild(document.createTextNode(arri[j])));
1509 expr = !expr;
1511 return newFrag;
1514function AMprocessNodeR(n, linebreaks) {
1515 var mtch, str, arr, frg, i;
1516 if (n.childNodes.length == 0) {
1517 if ((n.nodeType!=8 || linebreaks) &&
1518 n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" &&
1519 n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" &&
1520 n.parentNode.nodeName!="code" && n.parentNode.nodeName!="CODE" && /* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
1521See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */
1522 n.parentNode.nodeName!="pre" && n.parentNode.nodeName!="PRE") {
1523 str = n.nodeValue;
1524 if (!(str == null)) {
1525 str = str.replace(/\r\n\r\n/g,"\n\n");
1526 if (doubleblankmathdelimiter) {
1527 str = str.replace(/\x20\x20\./g," "+AMdelimiter1+".");
1528 str = str.replace(/\x20\x20,/g," "+AMdelimiter1+",");
1529 str = str.replace(/\x20\x20/g," "+AMdelimiter1+" ");
1531 str = str.replace(/\x20+/g," ");
1532 str = str.replace(/\s*\r\n/g," ");
1533 mtch = false;
1534 str = str.replace(new RegExp(AMescape2, "g"),
1535 function(st){mtch=true;return "AMescape2"});
1536 str = str.replace(new RegExp(AMescape1, "g"),
1537 function(st){mtch=true;return "AMescape1"});
1538 str = str.replace(new RegExp(AMdelimiter2regexp, "g"),AMdelimiter1);
1539 arr = str.split(AMdelimiter1);
1540 for (i=0; i<arr.length; i++)
1541 arr[i]=arr[i].replace(/AMescape2/g,AMdelimiter2).
1542 replace(/AMescape1/g,AMdelimiter1);
1543 if (arr.length>1 || mtch) {
1544 if (checkForMathML) {
1545 checkForMathML = false;
1546 var nd = AMisMathMLavailable();
1547 AMnoMathML = nd != null;
1548 if (AMnoMathML && notifyIfNoMathML)
1549 if (alertIfNoMathML)
1550 alert("To view the ASCIIMathML notation use Internet Explorer 6 +\nMathPlayer (free from www.dessci.com)\n\
1551 or Firefox/Mozilla/Netscape");
1552 else AMbody.insertBefore(nd,AMbody.childNodes[0]);
1554 if (!AMnoMathML) {
1555 frg = AMstrarr2docFrag(arr,n.nodeType==8);
1556 var len = frg.childNodes.length;
1557 n.parentNode.replaceChild(frg,n);
1558 return len-1;
1559 } else return 0;
1562 } else return 0;
1563 } else if (n.nodeName!="math") {
1564 for (i=0; i<n.childNodes.length; i++)
1565 i += AMprocessNodeR(n.childNodes[i], linebreaks);
1567 return 0;
1570function AMprocessNode(n, linebreaks, spanclassAM) {
1571 var frag,st;
1572 if (spanclassAM!=null) {
1573 frag = document.getElementsByTagName("span")
1574 for (var i=0;i<frag.length;i++)
1575 if (frag[i].className == "AM")
1576 AMprocessNodeR(frag[i],linebreaks);
1577 } else {
1578 try {
1579 st = n.innerHTML;
1580 } catch(err) {}
1581 if (st==null ||
1582 st.indexOf(AMdelimiter1)!=-1 || st.indexOf(AMdelimiter2)!=-1)
1583 AMprocessNodeR(n,linebreaks);
1585 if (isIE) { //needed to match size and font of formula to surrounding text
1586 frag = document.getElementsByTagName('math');
1587 for (var i=0;i<frag.length;i++) frag[i].update()
1591var AMbody;
1592var AMnoMathML = false, AMtranslated = false;
1594function translate(spanclassAM) {
1595 if (!AMtranslated) { // run this only once
1596 AMtranslated = true;
1597 AMinitSymbols();
1598 AMbody = document.getElementsByTagName("body")[0];
1599 AMprocessNode(AMbody, false, spanclassAM);
1603if (isIE) { // avoid adding MathPlayer info explicitly to each webpage
1604 document.write("<object id=\"mathplayer\"\
1605 classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");
1606 document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");
1609// GO1.1 Generic onload by Brothercake
1610// http://www.brothercake.com/
1611//onload function (replaces the onload="translate()" in the <body> tag)
1612function generic()
1614 translate();
1616//setup onload function
1617if(typeof window.addEventListener != 'undefined')
1619 //.. gecko, safari, konqueror and standard
1620 window.addEventListener('load', generic, false);
1622else if(typeof document.addEventListener != 'undefined')
1624 //.. opera 7
1625 document.addEventListener('load', generic, false);
1627else if(typeof window.attachEvent != 'undefined')
1629 //.. win/ie
1630 window.attachEvent('onload', generic);
1632//** remove this condition to degrade older browsers
1633else
1635 //.. mac/ie5 and anything else that gets this far
1636 //if there's an existing onload function
1637 if(typeof window.onload == 'function')
1639 //store it
1640 var existing = onload;
1641 //add new onload handler
1642 window.onload = function()
1644 //call existing onload function
1645 existing();
1646 //call generic onload function
1647 generic();
1648 };
1650 else
1652 //setup onload function
1653 window.onload = generic;
1656</script>
1657</head
1658 ><body
1659 ><div class="layout">
1660<div id="controls"></div>
1661<div id="currentSlide"></div>
1662<div id="header"></div>
1663<div id="footer">
1664<h1 id="july-15-2006"
1665 >July 15, 2006</h1
1666 ><h2 id="my-s5-document"
1667 >My S5 Document</h2
1668 ></div>
1669</div>
1670<div class="presentation">
1672<div class="slide">
1673<h1 id="my-s5-document-1"
1674 >My S5 Document</h1
1675 ><h3 id="sam-smith-jen-jones"
1676 >Sam Smith, Jen Jones</h3
1677 ><h4 id="july-15-2006-1"
1678 >July 15, 2006</h4
1679 ></div>
1680<div class="slide">
1681<h1 id="first-slide"
1682 >First slide</h1
1683 ><ul class="incremental"
1684 ><li
1685 >first bullet</li
1686 ><li
1687 >second bullet</li
1688 ></ul
1689 ></div>
1690<div class="slide">
1691<h1 id="math"
1692 >Math</h1
1693 ><ul class="incremental"
1694 ><li
1695 >$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li
1696 ></ul
1697 ></div>
1698</div>
1699</body
1700 ></html