1 // S5 1.3beta7 (18-Apr-2007) advanced version by C. Effenberger
2 // Please see http://s5.netzgesta.de/ for more information
3 // based on S5 v1.2a1 slides.js -- released into the Public Domain
4 // Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information
5 // about all the wonderful and talented contributors to this code!
6 // audio extension: soundmanager2 is NOT Public Domain
7 // Please see http://www.schillmania.com/projects/soundmanager2/ for information
18 var defaultView = 'slideshow'; //outline
19 var controlVis = 'visible';
21 // scalable images extension
23 var images = new Array();
24 var canvas = new Array();
25 var medias = new Array();
26 var piecharts = new Array();
27 var barcharts = new Array();
28 var linecharts = new Array();
29 // scalable images extension
31 // transition extension
32 var tranSitions = false;
33 var fadeModus = false;
34 var fadeDuration = 500;
35 var incrDuration = 250;
41 // transition extension
44 var autoMatic = false;
46 var playPause = false;
\r
54 var sound = new Array();
55 var audioSupport = false;
56 var audioVolume = 100;
57 var audioError = false;
58 var swfUnloaded = true;
59 var bgSoundItem = 9999;
64 var highLight = "rgb(255, 204, 0)";
67 // canvas chart extension
68 var canvasSupport = false;
69 var ChartData = new Array();
70 var colorSlice = new Array();
71 var font = document.createElement("img");
72 font.setAttribute("src", "ui/graphic_support/numeric.png");
74 '0': {sx: 0, sy: 0, sw: 48, sh: 64},
75 '1': {sx: 48, sy: 0, sw: 48, sh: 64},
76 '2': {sx: 96, sy: 0, sw: 48, sh: 64},
77 '3': {sx: 144, sy: 0, sw: 48, sh: 64},
78 '4': {sx: 192, sy: 0, sw: 48, sh: 64},
79 '5': {sx: 240, sy: 0, sw: 48, sh: 64},
80 '6': {sx: 288, sy: 0, sw: 48, sh: 64},
81 '7': {sx: 336, sy: 0, sw: 48, sh: 64},
82 '8': {sx: 384, sy: 0, sw: 48, sh: 64},
83 '9': {sx: 432, sy: 0, sw: 48, sh: 64},
84 '%': {sx: 480, sy: 0, sw: 48, sh: 64},
85 '.': {sx: 528, sy: 0, sw: 24, sh: 64}
87 var colorNames= new Array();
88 colorNames["black"]="#000000"; colorNames["maroon"]="#800000";
\rcolorNames["green"]="#008000"; colorNames["olive"]="#808000";
\rcolorNames["navy"]="#000080"; colorNames["purple"]="#800080";
\rcolorNames["teal"]="#008080"; colorNames["gray"]="#808080";
\rcolorNames["silver"]="#C0C0C0"; colorNames["red"]="#FF0000";
\rcolorNames["lime"]="#00FF00"; colorNames["yellow"]="#FFFF00";
\rcolorNames["blue"]="#0000FF"; colorNames["fuchsia"]="#FF00FF";
\rcolorNames["aqua"]="#00FFFF"; colorNames["white"]="#FFFFFF";
\rcolorNames["aliceblue"]="#F0F8FF"; colorNames["antiquewhite"]="#FAEBD7";
\rcolorNames["aquamarine"]="#7FFFD4"; colorNames["azure"]="#F0FFFF";
\rcolorNames["beige"]="#F5F5DC"; colorNames["blueviolet"]="#8A2BE2";
\rcolorNames["brown"]="#A52A2A"; colorNames["burlywood"]="#DEB887";
\rcolorNames["cadetblue"]="#5F9EA0"; colorNames["chartreuse"]="#7FFF00";
\rcolorNames["chocolate"]="#D2691E"; colorNames["coral"]="#FF7F50";
\rcolorNames["cornflowerblue"]="#6495ED"; colorNames["cornsilk"]="#FFF8DC";
\rcolorNames["crimson"]="#DC143C"; colorNames["darkblue"]="#00008B";
\rcolorNames["darkcyan"]="#008B8B"; colorNames["darkgoldenrod"]="#B8860B";
\rcolorNames["darkgray"]="#A9A9A9"; colorNames["darkgreen"]="#006400";
\rcolorNames["darkkhaki"]="#BDB76B"; colorNames["darkmagenta"]="#8B008B";
\rcolorNames["darkolivegreen"]="#556B2F"; colorNames["darkorange"]="#FF8C00";
\rcolorNames["darkorchid"]="#9932CC"; colorNames["darkred"]="#8B0000";
\rcolorNames["darksalmon"]="#E9967A"; colorNames["darkseagreen"]="#8FBC8F";
\rcolorNames["darkslateblue"]="#483D8B"; colorNames["darkslategray"]="#2F4F4F";
\rcolorNames["darkturquoise"]="#00CED1"; colorNames["darkviolet"]="#9400D3";
\rcolorNames["deeppink"]="#FF1493"; colorNames["deepskyblue"]="#00BFFF";
\rcolorNames["dimgray"]="#696969"; colorNames["dodgerblue"]="#1E90FF";
\rcolorNames["firebrick"]="#B22222"; colorNames["floralwhite"]="#FFFAF0";
\rcolorNames["forestgreen"]="#228B22"; colorNames["gainsboro"]="#DCDCDC";
\rcolorNames["ghostwhite"]="#F8F8FF"; colorNames["gold"]="#FFD700";
\rcolorNames["goldenrod"]="#DAA520"; colorNames["greenyellow"]="#ADFF2F";
\rcolorNames["honeydew"]="#F0FFF0"; colorNames["hotpink"]="#FF69B4";
\rcolorNames["indianred"]="#CD5C5C"; colorNames["indigo"]="#4B0082";
\rcolorNames["ivory"]="#FFFFF0"; colorNames["khaki"]="#F0E68C";
\rcolorNames["lavender"]="#E6E6FA"; colorNames["lavenderblush"]="#FFF0F5";
\rcolorNames["lawngreen"]="#7CFC00"; colorNames["lemonchiffon"]="#FFFACD";
\rcolorNames["lightblue"]="#ADD8E6"; colorNames["lightcoral"]="#F08080";
\rcolorNames["lightcyan"]="#E0FFFF"; colorNames["lightgoldenrodyellow"]="#FAFAD2";
\rcolorNames["lightgreen"]="#90EE90"; colorNames["lightgrey"]="#D3D3D3";
\rcolorNames["lightpink"]="#FFB6C1"; colorNames["lightsalmon"]="#FFA07A";
\rcolorNames["lightseagreen"]="#20B2AA"; colorNames["lightskyblue"]="#87CEFA";
\rcolorNames["lightslategray"]="#778899"; colorNames["lightsteelblue"]="#B0C4DE";
\rcolorNames["lightyellow"]="#FFFFE0"; colorNames["limegreen"]="#32CD32";
\rcolorNames["linen"]="#FAF0E6"; colorNames["mediumaquamarine"]="#66CDAA";
\rcolorNames["mediumblue"]="#0000CD"; colorNames["mediumorchid"]="#BA55D3";
\rcolorNames["ediumpurple"]="#9370D"; colorNames["mediumseagreen"]="#3CB371";
\rcolorNames["mediumslateblue"]="#7B68EE"; colorNames["mediumspringgreen"]="#00FA9A";
\rcolorNames["mediumturquoise"]="#48D1CC"; colorNames["mediumvioletred"]="#C71585";
\rcolorNames["midnightblue"]="#191970"; colorNames["mintcream"]="#F5FFFA";
\rcolorNames["mistyrose"]="#FFE4E1"; colorNames["moccasin"]="#FFE4B5";
\rcolorNames["navajowhite"]="#FFDEAD"; colorNames["oldlace"]="#FDF5E6";
\rcolorNames["olivedrab"]="#6B8E23"; colorNames["orange"]="#FFA500";
\rcolorNames["orangered"]="#FF4500"; colorNames["orchid"]="#DA70D6";
\rcolorNames["palegoldenrod"]="#EEE8AA"; colorNames["palegreen"]="#98FB98";
\rcolorNames["paleturquoise"]="#AFEEEE"; colorNames["palevioletred"]="#DB7093";
\rcolorNames["papayawhip"]="#FFEFD5"; colorNames["peachpuff"]="#FFDAB9";
\rcolorNames["peru"]="#CD853F"; colorNames["pink"]="#FFC0CB";
\rcolorNames["plum"]="#DDA0DD"; colorNames["powderblue"]="#B0E0E6";
\rcolorNames["rosybrown"]="#BC8F8F"; colorNames["royalblue"]="#4169E1";
\rcolorNames["saddlebrown"]="#8B4513"; colorNames["salmon"]="#FA8072";
\rcolorNames["sandybrown"]="#F4A460"; colorNames["seagreen"]="#2E8B57";
\rcolorNames["seashell"]="#FFF5EE"; colorNames["sienna"]="#A0522D";
\rcolorNames["skyblue"]="#87CEEB"; colorNames["slateblue"]="#6A5ACD";
\rcolorNames["slategray"]="#708090"; colorNames["snow"]="#FFFAFA";
\rcolorNames["springgreen"]="#00FF7F"; colorNames["steelblue"]="#4682B4";
\rcolorNames["tan"]="#D2B48C"; colorNames["thistle"]="#D8BFD8";
\rcolorNames["tomato"]="#FF6347"; colorNames["turquoise"]="#40E0D0";
\rcolorNames["violet"]="#EE82EE"; colorNames["wheat"]="#F5DEB3";
\rcolorNames["whitesmoke"]="#F5F5F5"; colorNames["yellowgreen"]="#9ACD32";
89 var canvas_bgcolor = "";
90 var canvas_width = 200;
91 var canvas_height = 200;
92 var canvas_noshade = 0;
93 var canvas_nofill = 0;
94 var canvas_noshadow = 0;
95 var canvas_htmltext = 0;
96 var canvas_imgtext = 0;
97 var canvas_notext = 0;
98 // canvas chart extension
101 var s5NotesWindowLoaded = false;
102 var previousSlide = 0;
103 var presentationStart = new Date();
104 var slideStart = new Date();
114 var isIE = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 1 ? 1 : 0;
115 if(isIE) var notIE7 = parseInt(navigator.appVersion) < 7 ? 1 : 0;
116 var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;
117 var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;
118 var isS2 = navigator.userAgent.indexOf('Safari') >= 2 ? 1 : 0;
120 function hasClass(object, className) {
121 if (!object.className) return false;
122 return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);
125 function hasValue(object, value) {
126 if (!object) return false;
127 return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);
130 function removeClass(object,className) {
131 if (!object || !hasClass(object,className)) return;
132 object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);
135 function addClass(object,className) {
136 if (!object || hasClass(object, className)) return;
137 if (object.className) {
138 object.className += ' '+className;
140 object.className = className;
144 function changeClass(object,className) {
146 object.firstChild.className = className;
149 function GetElementsWithClassName(elementName,className) {
150 var allElements = document.getElementsByTagName(elementName);
151 var elemColl = new Array();
152 for (var i = 0; i< allElements.length; i++) {
153 if (hasClass(allElements[i], className)) {
154 elemColl[elemColl.length] = allElements[i];
160 function isParentOrSelf(element, id) {
161 if (element == null || element.nodeName=='BODY') return false;
162 else if (element.id == id) return true;
163 else return isParentOrSelf(element.parentNode, id);
166 function nodeValue(node) {
168 if (node.nodeType == 1) {
169 var children = node.childNodes;
170 for (var i = 0; i < children.length; ++i) {
171 result += nodeValue(children[i]);
174 else if (node.nodeType == 3) {
175 result = node.nodeValue;
180 function slideLabel() {
181 var slideColl = GetElementsWithClassName('*','slide');
182 var list = document.getElementById('jumplist');
183 smax = slideColl.length;
184 for (var n = 0; n < smax; n++) {
185 var obj = slideColl[n];
186 var did = 'slide' + n.toString();
187 obj.setAttribute('id',did);
189 var menu = obj.firstChild;
190 if (!menu) continue; // to cope with empty slides
191 while (menu && menu.nodeType == 3) {
192 menu = menu.nextSibling;
194 if (!menu) continue; // to cope with slides with only text nodes
195 var menunodes = menu.childNodes;
196 for (var o = 0; o < menunodes.length; o++) {
197 otext += nodeValue(menunodes[o]);
199 list.options[list.length] = new Option(n + ' : ' + otext, n);
203 function currentSlide() {
205 if (document.getElementById) {
206 cs = document.getElementById('currentSlide');
208 cs = document.currentSlide;
210 fd = fadeModus?"F":"–";
211 ss = audioSupport?"S":"–";
212 at = (autoMatic?(playPause?"||":(playLoop?">0":">|")):"––");
213 cs.innerHTML = '<div id="plink" nowrap="nowrap">' +
214 '<span id="csFade">[' + fd + ss + ']<\/span> ' +
215 '<span id="csHere"><strong>' + snum + '<\/strong><\/span>' +
216 '<span id="csSep">\/<\/span>' +
217 '<span id="csTotal">' + (smax-1) + '<\/span> ' +
218 '<span id="csAuto">[' + at + ']<\/span>' +
222 cs.style.visibility = 'hidden';
224 cs.style.visibility = 'visible';
229 if (document.getElementById('slideProj').disabled || step == 0) return;
230 jl = document.getElementById('jumplist');
231 cid = 'slide' + snum;
232 var ce = document.getElementById(cid);
233 if (incrementals[snum].length > 0) {
234 for (var i = 0; i < incrementals[snum].length; i++) {
235 removeClass(incrementals[snum][i], 'current');
236 removeClass(incrementals[snum][i], 'incremental');
242 if (snum > lmax) snum = lmax;
243 if (snum < 0) snum = 0;
245 snum = parseInt(jl.value);
247 nid = 'slide' + snum;
248 var ne = document.getElementById(nid);
250 ne = document.getElementById('slide0');
255 incpos = incrementals[snum].length
259 if (incrementals[snum].length > 0 && incpos == 0) {
260 for (var i = 0; i < incrementals[snum].length; i++) {
261 if (hasClass(incrementals[snum][i], 'current')) {
264 addClass(incrementals[snum][i], 'incremental');
268 if (incrementals[snum].length > 0 && incpos > 0) {
269 addClass(incrementals[snum][incpos - 1], 'current');
271 var guru = document.getElementById('guru');
272 if(guru && snum==0) {
273 guru.style.visibility = 'visible';
274 }else if(guru && snum>0) {
275 guru.style.visibility = 'hidden';
277 if(tranSitions && s5mode && fadeModus) {
278 if(curSoundID != getSoundID(nid)) {
279 if(curSoundID == bgSoundItem && !sound[getSoundID(nid)]) {
280 }else {fadeoutSound(curSoundID,true); } // audio support
284 ce.style.visibility = 'visible';
285 shiftOpacity(cid,fadeDuration);
286 window.setTimeout("changeSlides()",fadeDuration);
288 if(curSoundID != getSoundID(nid)) {
289 if(curSoundID == bgSoundItem && !sound[getSoundID(nid)]) {
290 }else {stopSound(curSoundID); } // audio support
292 ce.style.visibility = 'hidden';
293 if (isOp) location.hash = nid;
294 ne.style.visibility = 'visible';
299 function changeSlides() {
300 if(nid != cid) changeOpac(100,cid);
301 document.getElementById(cid).style.visibility = 'hidden';
302 document.getElementById(nid).style.visibility = 'visible';
303 if (isOp) location.hash = nid;
304 shiftOpacity(nid,fadeDuration);
305 window.setTimeout("finishSlides()",fadeDuration);
308 function finishSlides() {
309 jl.selectedIndex = snum;
314 if(sound[getSoundID(nid)]) {
315 playSound(nid); // audio support
316 }else if(sound[bgSoundItem] && curSoundID != bgSoundItem) {
317 playSound(bgSoundItem); // audio support
321 function goTo(target) {
322 if (target >= smax || target == snum) return;
326 function subgo(step) {
328 removeClass(incrementals[snum][incpos - 1],'current');
329 removeClass(incrementals[snum][incpos], 'incremental');
330 if(tranSitions && s5mode && fadeModus) {
331 if(!incrementals[snum][incpos].id) {
332 var tmp = new Date(); tid = "inc" + String(tmp.getTime());
333 incrementals[snum][incpos].id = tid;
335 tid = incrementals[snum][incpos].id;
337 if(typeof(incrementals[snum][incpos].src) != "undefined" || incrementals[snum][incpos].getContext) {
339 addClass(incrementals[snum][incpos],'current');
340 shiftOpacity(tid,incrDuration);
341 setTimeout("nextInc()",incrDuration);
343 addClass(incrementals[snum][incpos],'current');
347 addClass(incrementals[snum][incpos],'current');
352 removeClass(incrementals[snum][incpos],'current');
353 addClass(incrementals[snum][incpos], 'incremental');
354 addClass(incrementals[snum][incpos - 1],'current');
365 var slideColl = GetElementsWithClassName('*','slide');
366 var slides = document.getElementById('slideProj');
367 var outline = document.getElementById('outlineStyle');
368 var guru = document.getElementById('guru');
369 if (!slides.disabled) {
371 if(audioSupport && !swfUnloaded) stopAllSounds();
372 slides.disabled = true;
373 outline.disabled = false;
376 for (var n = 0; n < smax; n++) {
377 var slide = slideColl[n];
378 slide.style.visibility = 'visible';
380 if(guru) guru.style.visibility = 'hidden';
382 slides.disabled = false;
383 outline.disabled = true;
386 for (var n = 0; n < smax; n++) {
387 var slide = slideColl[n];
388 slide.style.visibility = 'hidden';
390 slideColl[snum].style.visibility = 'visible';
391 if(guru && snum==0) guru.style.visibility = 'visible';
395 function showHide(action) {
396 var obj = GetElementsWithClassName('*','hideme')[0];
399 obj.style.visibility = 'visible';
402 obj.style.visibility = 'hidden';
405 if (obj.style.visibility != 'visible') {
406 obj.style.visibility = 'visible';
408 obj.style.visibility = 'hidden';
417 key.which = key.keyCode;
423 if (key.which == 84 && !isOp) {
430 case 70: // f/ading on/off
433 case 83: // s/ound on/off
439 case 65: // a/utoplay on/off
442 case 76: // l/ooping on/off
452 case 8: // backspace = HELP
457 if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
458 if (key.target && isParentOrSelf(key.target, 'controls')) return;
459 if(number != undef) {
464 case 34: // page down
467 if(number != undef) {
469 } else if (!incrementals[snum] || incpos >= incrementals[snum].length) {
478 if(number != undef) {
480 } else if (!incrementals[snum] || incpos <= 0) {
486 case 65: // a/utoplay
497 case 70: // f/ade transitions on/off
500 case 76: // l/ooping on/off
503 case 83: // s/ound support on/off
517 if (key.which < 48 || key.which > 57) {
520 if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
521 if (key.target && isParentOrSelf(key.target, 'controls')) return;
522 number = (((number != undef) ? number : 0) * 10) + (key.which - 48);
529 function clicker(e) {
533 target = window.event.srcElement;
538 if (target.href != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target,'object')) return true;
540 if (!e.which || e.which == 1) {
541 if (!incrementals[snum] || incpos >= incrementals[snum].length) {
552 function findSlide(hash) {
554 var slides = GetElementsWithClassName('*','slide');
555 for (var i = 0; i < slides.length; i++) {
556 var targetSlide = slides[i];
557 if ( (targetSlide.name && targetSlide.name == hash)
558 || (targetSlide.id && targetSlide.id == hash) ) {
559 target = targetSlide;
563 while(target != null && target.nodeName != 'BODY') {
564 if (hasClass(target, 'slide')) {
565 return parseInt(target.id.slice(5));
567 target = target.parentNode;
572 function slideJump() {
573 if (window.location.hash == null) return;
574 var sregex = /^#slide(\d+)$/;
575 var matches = sregex.exec(window.location.hash);
577 if (matches != null) {
578 dest = parseInt(matches[1]);
580 dest = findSlide(window.location.hash.slice(1));
586 function fixLinks() {
587 var thisUri = window.location.href;
588 thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);
589 var aelements = document.getElementsByTagName('A');
590 for (var i = 0; i < aelements.length; i++) {
591 var a = aelements[i].href;
592 var slideID = a.match('\#slide[0-9]{1,2}');
593 if ((slideID) && (slideID[0].slice(0,1) == '#')) {
594 var dest = findSlide(slideID[0].slice(1));
596 if (aelements[i].addEventListener) {
597 aelements[i].addEventListener("click", new Function("e",
598 "if (document.getElementById('slideProj').disabled) return;" +
599 "go("+dest+" - snum); " +
600 "if (e.preventDefault) e.preventDefault();"), true);
601 } else if (aelements[i].attachEvent) {
602 aelements[i].attachEvent("onclick", new Function("",
603 "if (document.getElementById('slideProj').disabled) return;" +
604 "go("+dest+" - snum); " +
605 "event.returnValue = false;"));
612 function externalLinks() {
613 if (!document.getElementsByTagName) return;
614 var anchors = document.getElementsByTagName('a');
615 for (var i=0; i<anchors.length; i++) {
616 var anchor = anchors[i];
617 if (anchor.getAttribute('href') && hasValue(anchor.rel, 'external')) {
618 anchor.target = '_blank';
619 addClass(anchor,'external');
624 function permaLink() {
625 document.getElementById('plink').href = window.location.pathname + '#slide' + snum;
628 function createControls() {
629 var controlsDiv = document.getElementById("controls");
630 if (!controlsDiv) return;
631 var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';
632 var hideDiv, hideList = '';
633 if (controlVis == 'hidden') {
641 var str = '<a accesskey="t" id="sheet" title="toggle CSS" href="javascript:toggle();">±<\/a>';
644 var tmp = "move around&xA0;until the color&xA0;change to red!";
646 var tmp = "move around\r\nuntil the color\r\nchange to red!";
648 var tmp = "move around until color change to red!";
651 controlsDiv.innerHTML = str + '<form action="#" id="controlForm"' + hideDiv + '>' +
652 '<div id="navLinks" title="press [backspace] for keyboard help!" style="background-image: none;">' +
653 '<a accesskey="n" id="show-notes" title="show Notes" href="javascript:createNotesWindow();">i<\/a>' +
654 '<a accesskey="t" id="toggle" title="toggle CSS" href="javascript:toggle();">±<\/a>' +
655 '<a accesskey="h" id="zero" title="goto Start Slide" href="javascript:goTo(0);">|<<\/a>' +
656 '<a accesskey="y" id="prev" title="previous Slide" href="javascript:go(-1);"><<\/a>' +
657 '<a accesskey="x" id="next" title="next Slide" href="javascript:go(1);">><\/a>' +
658 '<a accesskey="e" id="last" title="goto Last Slide" href="javascript:goTo(smax-1);">>|<\/a>' +
659 '<br \/><div class="subLinks" id="autoLinks" style="margin-left:0.25em;">' +
660 '<a accesskey="a" id="auto" title="Auto Play" href="javascript:togglePlay();">><\/a> ' +
661 '<a style="font-weight: bold;" accesskey="p" id="pause" title="Pausing" href="javascript:pausePlay();">||<\/a> ' +
662 '<a style="font-weight: bold;" accesskey="l" id="loop" title="Looping" href="javascript:switchLoop();">∞<\/a> ' +
663 '<a title="5 Sec. Delay" href="javascript:setDelay(5);">5<\/a>·' +
664 '<a title="10 Sec. Delay" href="javascript:setDelay(10);">10<\/a>·' +
665 '<a title="15 Sec. Delay" href="javascript:setDelay(15);">15<\/a>·' +
666 '<a title="30 Sec. Delay" href="javascript:setDelay(30);">30<\/a>·' +
667 '<a title="60 Sec. Delay" href="javascript:setDelay(60);">60<\/a>' +
668 '<\/div><select id="jumplist" style="position: absolute; left: -9999px;"><\/select><\/div><\/form>';
670 controlsDiv.innerHTML = str +
671 '<form action="#" id="controlForm"' + hideDiv + '>' +
672 '<div id="navLinks" title="press [backspace] or double click this area for keyboard help!" ondblclick="createHelpReq();">' +
673 '<a accesskey="q" id="exit" title="exit Show" href="javascript:byby();">×<\/a>' +
674 '<a accesskey="n" id="show-notes" title="show Notes" href="javascript:createNotesWindow();">❏<\/a>' +
675 '<a accesskey="t" id="toggle" title="toggle CSS" href="javascript:toggle();">±<\/a>' +
676 '<a accesskey="h" id="zero" title="goto Start Slide" href="javascript:goTo(0);">|<<\/a>' +
677 '<a accesskey="y" id="prev" title="previous Slide" href="javascript:go(-1);"><<\/a>' +
678 '<a accesskey="x" id="next" title="next Slide" href="javascript:go(1);">><\/a>' +
679 '<a accesskey="e" id="last" title="goto Last Slide" href="javascript:goTo(smax-1);">>|<\/a>' +
680 '<a id="list" style="cursor:wait;" title="' + tmp + '">Ξ<\/a>' +
681 '<select id="jumplist" title="select named Slide" onchange="go(\'j\');"><\/select>' +
682 '<br \/><div class="subLinks" id="fadeLinks">' +
683 '<a style="font-weight: bold;" accesskey="f" id="fade" title="Transions" href="javascript:switchFade();">▨<\/a> ' +
684 '<\/div><div class="subLinks" id="audioLinks" style="margin-left:0.25em;">' +
685 '<a accesskey="s" id="audio" title="Sound" href="javascript:toggleSounds();">♫<\/a> ' +
686 '<a id="volume" style="cursor:wait;" title="' + tmp + '">◢<\/a>' +
687 '<select id="volumelist" title="select Volume" onchange="setVolume();"><option value="100">100</option>' +
688 '<option value="90">90</option><option value="80">80</option>' +
689 '<option value="70">70</option><option value="60">60</option>' +
690 '<option value="50">50</option><option value="40">40</option>' +
691 '<option value="30">30</option><option value="20">20</option>' +
692 '<option value="10">10</option><option value="0">0</option>' +
694 '<\/div><div class="subLinks" id="autoLinks" style="margin-left:0.25em;">' +
695 '<a accesskey="a" id="auto" title="Auto Play" href="javascript:togglePlay();">▶<\/a> ' +
696 '<a style="font-weight: bold;" accesskey="p" id="pause" title="Pausing" href="javascript:pausePlay();">||<\/a> ' +
697 '<a style="font-weight: bold;" accesskey="l" id="loop" title="Looping" href="javascript:switchLoop();">∞<\/a> ' +
698 '<a title="5 Sec. Delay" href="javascript:setDelay(5);">5<\/a>·' +
699 '<a title="10 Sec. Delay" href="javascript:setDelay(10);">10<\/a>·' +
700 '<a title="15 Sec. Delay" href="javascript:setDelay(15);">15<\/a>·' +
701 '<a title="30 Sec. Delay" href="javascript:setDelay(30);">30<\/a>·' +
702 '<a title="60 Sec. Delay" href="javascript:setDelay(60);">60<\/a>' +
703 '<\/div><\/div><\/form>';
705 if (controlVis == 'hidden') {
706 var hidden = document.getElementById('navLinks');
708 var hidden = document.getElementById('jumplist');
710 addClass(hidden,'hideme');
713 function fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers
714 if (!s5mode && !isOp) return false;
715 var hScreen = screen.width; var vScreen = screen.height;
716 var vWindow = window.outerHeight; var hWindow = window.outerWidth;
717 if (isOp && s5mode && defaultView=='slideshow' && ((hScreen != hWindow) || (vScreen != vWindow))) {
721 if (isOp && !s5mode && ((hScreen != hWindow) || (vScreen != vWindow))) return false;
722 if (isOp && !s5mode && (hScreen == hWindow) && (vScreen == vWindow)) toggle();
723 var vScale = 48; // both yield 16 (the usual browser default) at 1024x768
724 var hScale = 64; // perhaps should auto-calculate based on theme's declared value?
725 if (window.innerHeight) {
726 var vSize = window.innerHeight;
727 var hSize = window.innerWidth;
728 } else if (document.documentElement.clientHeight) {
729 var vSize = document.documentElement.clientHeight;
730 var hSize = document.documentElement.clientWidth;
731 } else if (document.body.clientHeight) {
732 var vSize = document.body.clientHeight;
733 var hSize = document.body.clientWidth;
735 var vSize = 700; // assuming 1024x768, minus chrome and such equals 8:5
736 var hSize = 1024; // these do not account for kiosk mode or Opera Show
738 var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));
739 extendImgSizes(newSize); // scalable images extension
740 extendCanSizes(newSize); // scalable canvas extension
741 extendObjSizes(newSize); // scalable object extension
742 fontSize(newSize,"px");
743 if(!isS2 || firstTime==0) {
744 generateCanvas(); // dynamic canvas extension
746 if (isGe) { // hack to counter incremental reflow bugs
747 var obj = document.getElementsByTagName('body')[0];
748 obj.style.visibility = 'hidden';
749 obj.style.display = 'none';
750 obj.style.display = 'block';
751 obj.style.visibility = 'visible';
752 changeOpac(100,'slide' + snum);
753 shiftOpacity('slide' + snum,10);
754 window.setTimeout("fixReflow()",10);
756 setListPos(); // invisible select extension
760 function fixReflow() {
761 shiftOpacity('slide' + snum,10);
762 window.setTimeout("finishReflow()",10);
764 function finishReflow() {
765 setListPos(); // invisible select extension
768 function fontSize(val,fmt) {
769 var value = val + fmt;
770 if (!(s5ss = document.getElementById('s5ss'))) {
771 if (!document.createStyleSheet) {
772 document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));
773 s5ss.setAttribute('media','screen, projection');
774 s5ss.setAttribute('id','s5ss');
776 document.createStyleSheet();
777 document.s5ss = document.styleSheets[document.styleSheets.length - 1];
780 if (!(document.s5ss && document.s5ss.addRule)) {
781 while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);
782 s5ss.appendChild(document.createTextNode('html {font-size: ' + value + ' !important;}'));
784 document.s5ss.addRule('html','font-size: ' + value + ' !important;');
788 function windowChange() {
792 function notOperaFix() {
793 slideCSS = document.getElementById('slideProj').href;
794 var slides = document.getElementById('slideProj');
795 var outline = document.getElementById('outlineStyle');
796 slides.setAttribute('media','screen');
797 outline.disabled = true;
799 slides.setAttribute('href','null'); // Gecko fix
800 slides.setAttribute('href',slideCSS); // Gecko fix
802 if ((isIE && notIE7) && document.styleSheets && document.styleSheets[0]) {
803 document.styleSheets[0].addRule('img', 'behavior: url(ui/graphic_support/iepngfix.htc)');
804 document.styleSheets[0].addRule('div', 'behavior: url(ui/graphic_support/iepngfix.htc)');
805 document.styleSheets[0].addRule('.slide', 'behavior: url(ui/graphic_support/iepngfix.htc)');
809 function getIncrementals(obj) {
810 var incrementals = new Array();
813 var children = obj.childNodes;
814 for (var i = 0; i < children.length; i++) {
815 var child = children[i];
816 if (hasClass(child, 'incremental')) {
817 if (child.nodeName == 'OL' || child.nodeName == 'UL') {
818 removeClass(child, 'incremental');
819 for (var j = 0; j < child.childNodes.length; j++) {
820 if (child.childNodes[j].nodeType == 1) {
821 addClass(child.childNodes[j], 'incremental');
825 incrementals[incrementals.length] = child;
826 removeClass(child,'incremental');
829 if (hasClass(child, 'show-first')) {
830 if (child.nodeName == 'OL' || child.nodeName == 'UL') {
831 removeClass(child, 'show-first');
832 if (child.childNodes[isGe].nodeType == 1) {
833 removeClass(child.childNodes[isGe], 'incremental');
836 incrementals[incrementals.length] = child;
839 incrementals = incrementals.concat(getIncrementals(child));
844 function createIncrementals() {
845 var incrementals = new Array();
846 for (var i = 0; i < smax; i++) {
847 incrementals[i] = getIncrementals(document.getElementById('slide'+i));
858 modifierKey = e.ctrlKey || e.altKey || e.metaKey;
863 return modifierKey || e.which == 0;
867 function noteLabel() { // Gives notes id's to match parent slides
868 var notes = GetElementsWithClassName('div','notes');
869 for (var i = 0; i < notes.length; i++) {
871 var id = 'note' + note.parentNode.id.substring(5);
872 note.setAttribute('id',id);
875 resetRemainingTime();
876 window.setInterval('updateElaspedTime()', 1000);
879 function createNotesWindow() { // creates a window for our notes
880 if (!s5NotesWindow || s5NotesWindow.closed) { // Create the window if it doesn't exist
881 s5NotesWindowLoaded = false;
882 // Note: Safari has a tendency to ignore window options preferring to default to the settings of the parent window, grr.
883 s5NotesWindow = window.open('ui/s5-notes.html', 's5NotesWindow', 'top=0,left=0');
885 if (s5NotesWindowLoaded) { // Load the current note if the Note HTML has loaded
887 } else { // Keep trying...
888 window.setTimeout('createNotesWindow()', 50);
892 function loadNote() {
893 // Loads a note into the note window
894 var notes = nextNotes = '<em class="disclaimer">There are no notes for this slide.</em>';
895 if (document.getElementById('note' + snum)) {
896 notes = document.getElementById('note' + snum).innerHTML;
898 if (document.getElementById('note' + (snum + 1))) {
899 nextNotes = document.getElementById('note' + (snum + 1)).innerHTML;
902 var jl = document.getElementById('jumplist');
903 var slideTitle = jl.options[jl.selectedIndex].text.replace(/^\d+\s+:\s+/, '') + ((jl.selectedIndex) ? ' (' + jl.selectedIndex + '/' + (smax - 1) + ')' : '');
904 if (incrementals[snum].length > 0) {
905 slideTitle += ' <small>[' + incpos + '/' + incrementals[snum].length + ']</small>';
907 if (jl.selectedIndex < smax - 1) {
908 var nextTitle = jl.options[jl.selectedIndex + 1].text.replace(/^\d+\s+:\s+/, '') + ((jl.selectedIndex + 1) ? ' (' + (jl.selectedIndex + 1) + '/' + (smax - 1) + ')' : '');
910 var nextTitle = '[end of slide show]';
913 if (s5NotesWindow && !s5NotesWindow.closed && s5NotesWindow.document) {
914 s5NotesWindow.document.getElementById('slide').innerHTML = slideTitle;
915 s5NotesWindow.document.getElementById('notes').innerHTML = notes;
916 s5NotesWindow.document.getElementById('next').innerHTML = nextTitle;
917 s5NotesWindow.document.getElementById('nextnotes').innerHTML = nextNotes;
922 function minimizeTimer(id) {
923 var obj = s5NotesWindow.document.getElementById(id);
924 if (hasClass(obj,'collapsed')) {
925 removeClass(obj,'collapsed');
927 addClass(obj,'collapsed');
931 function resetElapsedTime() {
932 presentationStart = new Date();
933 slideStart = new Date();
937 function resetElapsedSlide() {
938 if (snum != previousSlide) {
939 slideStart = new Date();
940 previousSlide = snum;
945 function updateElaspedTime() {
946 if (!s5NotesWindowLoaded || !s5NotesWindow || s5NotesWindow.closed) return;
947 var now = new Date();
948 var ep = s5NotesWindow.document.getElementById('elapsed-presentation');
949 var es = s5NotesWindow.document.getElementById('elapsed-slide');
950 ep.innerHTML = formatTime(now.valueOf() - presentationStart.valueOf());
951 es.innerHTML = formatTime(now.valueOf() - slideStart.valueOf());
954 function resetRemainingTime() {
955 if (!s5NotesWindowLoaded || !s5NotesWindow || s5NotesWindow.closed) return;
956 var startField = s5NotesWindow.document.getElementById('startFrom');
957 startFrom = readTime(startField.value);
958 countdown.remaining = startFrom * 60000; // convert to msecs
959 countdown.start = new Date().valueOf();
960 countdown.end = countdown.start + countdown.remaining;
961 var tl = s5NotesWindow.document.getElementById('timeLeft');
962 var timeLeft = formatTime(countdown.remaining);
963 tl.innerHTML = timeLeft;
966 function updateRemainingTime() {
967 if (!s5NotesWindowLoaded || !s5NotesWindow || s5NotesWindow.closed) return;
968 var tl = s5NotesWindow.document.getElementById('timeLeft');
969 var now = new Date();
970 if (countdown.state == 'run') {
971 countdown.remaining = countdown.end - now;
974 tl.style.backgroundColor = '';
975 if (countdown.remaining >= 0) {
976 var timeLeft = formatTime(countdown.remaining);
977 removeClass(tl,'overtime');
978 if (countdown.remaining < 300000) {
979 tl.style.color = 'rgb(' + (255-Math.round(countdown.remaining/2000)) + ',0,0)';
980 tl.style.backgroundColor = 'rgb(255,255,' + (Math.round(countdown.remaining/2000)) + ')';
983 var timeLeft = '-' + formatTime(-countdown.remaining);
984 addClass(tl,'overtime');
986 tl.innerHTML = timeLeft;
989 function toggleRemainingTime() {
990 if (countdown.state == 'pause') countdown.state = 'run'; else countdown.state = 'pause';
991 if (countdown.state == 'pause') {
992 window.clearInterval(countdown.timer);
994 if (countdown.state == 'run') {
995 countdown.start = new Date().valueOf();
996 countdown.end = countdown.start + countdown.remaining;
997 countdown.timer = window.setInterval('updateRemainingTime()', 1000);
1001 function alterRemainingTime(amt) {
1002 var change = amt * 60000; // convert to msecs
1003 countdown.end += change;
1004 countdown.remaining += change;
1005 updateRemainingTime();
1008 function formatTime(msecs) {
1009 var time = new Date(msecs);
1011 var hrs = time.getUTCHours() + ((time.getUTCDate() -1) * 24); // I doubt anyone will spend more than 24 hours on a presentation or single slide but just in case...
1012 hrs = (hrs < 10) ? '0'+hrs : hrs;
1013 if (hrs == 'NaN' || isNaN(hrs)) hrs = '--';
1015 var min = time.getUTCMinutes();
1016 min = (min < 10) ? '0'+min : min;
1017 if (min == 'NaN' || isNaN(min)) min = '--';
1019 var sec = time.getUTCSeconds();
1020 sec = (sec < 10) ? '0'+sec : sec;
1021 if (sec == 'NaN' || isNaN(sec)) sec = '--';
1023 return hrs + ':' + min + ':' + sec;
1026 function readTime(val) {
1028 var matches = sregex.exec(val);
1029 if (matches == null) {
1032 var times = val.split(':');
1033 var hours = parseInt(times[0]);
1034 var mins = parseInt(times[1]);
1035 var total = (hours * 60) + mins;
1042 function createSlideShow() {
1044 if(!isIE) createDetector(); // (degrade IE) scalable images extension
1045 if(opac!=0 || isIE) { // &&!isIE (degrade IE)
1046 tranSitions = false;
1049 if(tranSitions && document.getElementById && document.createElement){
1051 var nop=document.getElementById('StartupControl');
1052 nop.onload = dumpProgress;
1056 setListPos(true); // invisible select extension
1058 audioSetup(); // audio extension
1059 if(isS2 && firstTime>=1) {
1060 generateCanvas(); // dynamic canvas extension
1065 function defaultCheck() {
1066 var allMetas = document.getElementsByTagName('meta');
1067 for (var i = 0; i< allMetas.length; i++) {
1068 if (allMetas[i].name == 'defaultView') {
1069 defaultView = allMetas[i].content;
1071 if (allMetas[i].name == 'controlVis') {
1072 controlVis = allMetas[i].content;
1074 if (allMetas[i].name == 'tranSitions') {
1075 tranSitions = (allMetas[i].content == "true") ? true : false;
1076 fadeModus = (tranSitions == true) ? true : false;
1078 if (allMetas[i].name == 'fadeDuration') {
1079 var tmp = parseInt(allMetas[i].content);
1080 fadeDuration = Math.max(200,Math.min(tmp,2000));
1082 if (allMetas[i].name == 'incrDuration') {
1083 var tmp = parseInt(allMetas[i].content);
1084 incrDuration = Math.max(50,Math.min(tmp,500));
1086 if (allMetas[i].name == 'autoMatic') {
1087 autoMatic = (allMetas[i].content == "true") ? true : false;
1089 if (allMetas[i].name == 'playLoop') {
1090 playLoop = (allMetas[i].content == "true") ? true : false;
1092 if (allMetas[i].name == 'playDelay') {
1093 var tmp = parseInt(allMetas[i].content);
1094 playDelay = Math.max(5,Math.min(tmp,90))*1000;
1095 playDelay = (fadeModus == true) ? (playDelay+(2*fadeDuration)) : playDelay;
1097 if (allMetas[i].name == 'audioSupport') {
1098 audioSupport = (allMetas[i].content == "true") ? true : false;
1100 if (allMetas[i].name == 'audioVolume') {
1101 var tmp = parseInt(allMetas[i].content);
1102 audioVolume = Math.max(0,Math.min(tmp,100));
1104 if (allMetas[i].name == 'audioError') {
1105 audioError = (allMetas[i].content == "true") ? true : false;
1110 function createProgress() {
1111 var obj = document.getElementsByTagName("body")[0].firstChild;
1112 var pg = document.createElement('div');
1113 pg.id = "StartupProgress";
1114 pg.style.position = 'absolute';
1115 pg.style.left = 0 + 'px';
1116 pg.style.top = 0 + 'px';
1117 pg.style.width = 100 + '%';
\r
1118 pg.style.height = 100 + '%';
1119 pg.style.margin = 0 + 'px';
1120 pg.style.padding = 0 + 'px';
1122 pg.style.filter = "alpha(opacity=100)";
1124 pg.style.opacity = 1.0;
1125 }
\r pg.style.zIndex = 9999;
1126 pg.style.backgroundColor="rgb(255, 255, 255)";
1127 pg.style.textAlign = "center";
\r pg.style.verticalAlign = "middle";
1128 pg.style.backgroundPosition="center center";
1129 pg.style.backgroundRepeat="no-repeat";
1130 pg.style.backgroundImage="url(ui/graphic_support/progress.gif)";
1131 document.getElementsByTagName("body")[0].insertBefore(pg,obj);
1133 var im = document.createElement('img');
1134 im.id = "StartupControl";
1135 im.src = "ui/graphic_support/blank.gif?" + new Date().valueOf();
1136 document.getElementsByTagName("body")[0].appendChild(im);
1139 function startup() {
1140 createControls(); // hallvord
1142 incrementals = createIncrementals();
1143 noteLabel(); // [SI:060104] must follow slideLabel()
1151 document.getElementById('exit').style.visibility = 'hidden';
1152 document.getElementById('toggle').style.visibility = 'hidden';
1153 document.getElementById('list').style.visibility = 'hidden';
1154 document.getElementById('jumplist').style.visibility = 'hidden';
1155 document.getElementById('audioLinks').style.display = 'none';
1158 if (defaultView == 'outline') toggle();
1159 document.onkeyup = keys;
1160 document.onkeypress = trap;
1161 document.onclick = clicker;
1164 function preloadImgages() {
1166 var objects = document.getElementsByTagName('img');
1167 for (var i=0; i < objects.length; i++) {
1168 if(objects[i].src != '') {
\r
1170 temp.src = objects[i].src;
\r
1175 function showAll() {
1176 var obj1 = GetElementsWithClassName('div','presentation')[0];
1177 if(!obj1) var obj1 = GetElementsWithClassName('ol','presentation')[0];
1178 var obj2 = GetElementsWithClassName('div','layout')[0];
1179 if(!obj1){}else {obj1.style.display = 'block'};
1180 if(!obj2){}else {obj2.style.display = 'block'};
1183 function dumpProgress() {
1184 document.body.removeChild(document.getElementById('StartupControl'));
1188 createSoundManagerScript();
1189 shiftOpacity('StartupProgress',1000);
1190 window.setTimeout("removeProgress()",1000);
\r}
1192 function removeProgress() {
1193 document.body.removeChild(document.getElementById('StartupProgress'));
1194 setListPos(true); // invisible select extension
1196 audioSetup(); // audio extension
1197 if(isS2 && firstTime>=1) {
1198 generateCanvas(); // dynamic canvas extension
1201 function panelSetup() {
1202 if(playPause) document.getElementById('pause').style.color=highLight;
1203 if(playLoop) document.getElementById('loop').style.color=highLight;
1204 if(audioSupport && !isIE && !isOp) document.getElementById('audio').style.color=highLight;
1205 if(fadeModus && !isIE) document.getElementById('fade').style.color=highLight;
1207 document.getElementById('auto').style.color=highLight;
1210 if(audioVolume && !isIE && !isOp) {
1212 if(audioVolume >= 95 && audioVolume <= 100) {idx = 0;}
1213 else if(audioVolume >= 85 && audioVolume < 95) {idx = 1;}
1214 else if(audioVolume >= 75 && audioVolume < 85) {idx = 2;}
1215 else if(audioVolume >= 65 && audioVolume < 75) {idx = 3;}
1216 else if(audioVolume >= 55 && audioVolume < 65) {idx = 4;}
1217 else if(audioVolume >= 45 && audioVolume < 55) {idx = 5;}
1218 else if(audioVolume >= 35 && audioVolume < 45) {idx = 6;}
1219 else if(audioVolume >= 25 && audioVolume < 35) {idx = 7;}
1220 else if(audioVolume >= 15 && audioVolume < 25) {idx = 8;}
1221 else if(audioVolume >= 5 && audioVolume < 15) {idx = 9;}
1223 document.getElementById('volumelist').selectedIndex = idx;
1231 if(tranSitions && fadeModus && s5mode && !isOp) {
1232 fadeoutSound(curSoundID,true); // audio support
1233 var pg = document.createElement('div');
1235 pg.style.position = 'absolute';
1236 pg.style.left = 0 + 'px';
1237 pg.style.top = 0 + 'px';
1238 pg.style.width = 100 + '%';
\r
1239 pg.style.height = 100 + '%';
1240 pg.style.margin = 0 + 'px';
1241 pg.style.padding = 0 + 'px';
1243 pg.style.filter = "alpha(opacity=0)";
1245 pg.style.opacity = 0.0;
1246 }
\r pg.style.zIndex = 9999;
1247 pg.style.backgroundColor="rgb(255, 255, 255)";
1248 pg.style.textAlign = "center";
\r pg.style.verticalAlign = "middle";
1249 pg.style.backgroundPosition="center center";
1250 pg.style.backgroundRepeat="no-repeat";
1251 pg.style.backgroundImage="url(ui/graphic_support/finish.gif)";
1252 document.getElementsByTagName("body")[0].appendChild(pg);
1253 shiftOpacity('GoodBy',1000);
1254 window.setTimeout("history.back()",1000);
\r }else {
1255 stopSound(curSoundID);
1261 // scalable images extension
1262 function createDetector() {
1263 var em = document.createElement('div');
\r
1264 em.id='EMSizeControl'; em.style.position="absolute"; em.style.left="-999px";
1265 em.style.width="1em"; em.style.height="1em"; em.style.opacity=0.0;
\r
1266 document.getElementsByTagName("body")[0].appendChild(em);
1267 var nop=document.getElementById('EMSizeControl');
\r
1268 if(!nop||findPosX(nop)!=-999) {}else {
1269 opac=document.getElementById('EMSizeControl').style.opacity;
1270 empx=document.getElementById('EMSizeControl').offsetHeight;
1271 document.body.removeChild(document.getElementById('EMSizeControl'));
1272 var objects = document.getElementsByTagName('img');
1273 var j = 0; var i = 0; var k = 0; var d; var obj;
1274 for (i=0; i < objects.length; i++) {
1275 if(objects[i].className.match(/^scale/i)) {
\r
1276 images[j] = objects[i];
\r
1280 var objects = document.getElementsByTagName('canvas'); j = 0;
1281 for (i=0; i < objects.length; i++) {
1282 if(objects[i].className.match(/^scale/i)) {
\r
1283 canvas[objects[i].id] = objects[i];
1285 if(objects[i].getContext) {
1286 canvasSupport = true;
1292 if(canvasSupport!=true) {
1294 canvas[d].setAttribute("width",1);
1295 canvas[d].setAttribute("height",1);
1298 var objects = document.getElementsByTagName('table');
1299 j = 0; k = 0; l = 0; var w; var h; var tmp; var cnt;
1300 for (i=0; i < objects.length; i++) {
1301 if(objects[i].className.match(/^piechart/i)) {
1302 tmp = objects[i].id;
1303 cnt = tmp.split("_");
1304 obj = cnt[0] + "_canvas";
1306 w = canvas[obj].getAttribute("width");
1307 h = canvas[obj].getAttribute("height");
1309 piecharts[j] = objects[i];
1310 em = piecharts[j].getAttribute("summary");
1311 if(em != "") em = "," + em;
1312 piecharts[j].setAttribute("summary", w + "," + h + em);
1317 if(objects[i].className.match(/^barchart/i)) {
1318 tmp = objects[i].id;
1319 cnt = tmp.split("_");
1320 obj = cnt[0] + "_canvas";
1322 w = canvas[obj].getAttribute("width");
1323 h = canvas[obj].getAttribute("height");
1325 barcharts[k] = objects[i];
1326 em = barcharts[k].getAttribute("summary");
1327 if(em != "") em = "," + em;
1328 barcharts[k].setAttribute("summary", w + "," + h + em);
1333 if(objects[i].className.match(/^linechart/i)) {
1334 tmp = objects[i].id;
1335 cnt = tmp.split("_");
1336 obj = cnt[0] + "_canvas";
1338 w = canvas[obj].getAttribute("width");
1339 h = canvas[obj].getAttribute("height");
1341 linecharts[l] = objects[i];
1342 em = linecharts[l].getAttribute("summary");
1343 if(em != "") em = "," + em;
1344 linecharts[l].setAttribute("summary", w + "," + h + em);
1350 objects = document.getElementsByTagName('object'); j = 0; i = 0;
1351 for (i=0; i < objects.length; i++) {
1352 if(objects[i].className.match(/^scale/i)) {
\r
1353 medias[j] = objects[i]; ++j;
1355 if(objects[i].getAttributeNode("classid")) objects[i].removeAttributeNode(objects[i].getAttributeNode("classid"));
1356 if(objects[i].getAttributeNode("codebase")) objects[i].removeAttributeNode(objects[i].getAttributeNode("codebase"));
1362 function extendImgSizes(f) {
1364 var q = (f/empx); var w = 0; var h = 0;
1365 for(var i=0; i < images.length; i++) {
\r
1366 w=images[i].getAttribute("width",0);
1367 h=images[i].getAttribute("height",0);
1369 images[i].style.width=Math.floor(w*q)+"px";
\r images[i].style.height=Math.floor(h*q)+"px";
1375 function extendCanSizes(f) {
1376 if(empx>0 && canvasSupport) {
1377 var q = (f/empx); var w = 0; var h = 0; var tmp = ""; var cnt; var obj;
1378 for(var i=0; i < piecharts.length; i++) {
1379 if(piecharts[i].getAttribute("summary")) {
1380 tmp = piecharts[i].getAttribute("summary");
1381 cnt = tmp.split(",");
1382 if(cnt[0].match(/^[1-9][0-9]+/)) w = parseInt(cnt[0]);
1383 if(cnt[1].match(/^[1-9][0-9]+/)) h = parseInt(cnt[1]);
1385 tmp = piecharts[i].id;
1386 cnt = tmp.split("_");
1387 obj = cnt[0] + "_canvas";
1388 canvas[obj].setAttribute("width",Math.floor(w*q));
1389 canvas[obj].setAttribute("height",Math.floor(h*q));
1390 canvas[obj].style.width=Math.floor(w*q)+"px";
\r canvas[obj].style.height=Math.floor(h*q)+"px";
1394 for(var i=0; i < barcharts.length; i++) {
1395 if(barcharts[i].getAttribute("summary")) {
1396 tmp = barcharts[i].getAttribute("summary");
1397 cnt = tmp.split(",");
1398 if(cnt[0].match(/^[1-9][0-9]+/)) w = parseInt(cnt[0]);
1399 if(cnt[1].match(/^[1-9][0-9]+/)) h = parseInt(cnt[1]);
1401 tmp = barcharts[i].id;
1402 cnt = tmp.split("_");
1403 obj = cnt[0] + "_canvas";
1404 canvas[obj].setAttribute("width",Math.floor(w*q));
1405 canvas[obj].setAttribute("height",Math.floor(h*q));
1406 canvas[obj].style.width=Math.floor(w*q)+"px";
\r canvas[obj].style.height=Math.floor(h*q)+"px";
1410 for(var i=0; i < linecharts.length; i++) {
1411 if(linecharts[i].getAttribute("summary")) {
1412 tmp = linecharts[i].getAttribute("summary");
1413 cnt = tmp.split(",");
1414 if(cnt[0].match(/^[1-9][0-9]+/)) w = parseInt(cnt[0]);
1415 if(cnt[1].match(/^[1-9][0-9]+/)) h = parseInt(cnt[1]);
1417 tmp = linecharts[i].id;
1418 cnt = tmp.split("_");
1419 obj = cnt[0] + "_canvas";
1420 canvas[obj].setAttribute("width",Math.floor(w*q));
1421 canvas[obj].setAttribute("height",Math.floor(h*q));
1422 canvas[obj].style.width=Math.floor(w*q)+"px";
\r canvas[obj].style.height=Math.floor(h*q)+"px";
1428 function extendObjSizes(f) {
1430 var q = (f/empx); var w = 0; var h = 0;
1431 for(var i=0; i < medias.length; i++) {
\r
1432 w=medias[i].getAttribute("width",0);
1433 h=medias[i].getAttribute("height",0);
1435 medias[i].style.width=Math.floor(w*q)+"px";
\r medias[i].style.height=Math.floor(h*q)+"px";
1440 function findPosX(obj) {
\r
1442 while (obj.offsetParent) {
\r
1443 posLeft += obj.offsetLeft;
\r
1444 obj = obj.offsetParent;
\r
1448 function findPosY(obj) {
\r
1450 while (obj.offsetParent) {
\r
1451 posTop += obj.offsetTop;
\r
1452 obj = obj.offsetParent;
\r
1456 // scalable images extension
1458 // canvas chart extension
1459 function deg2rad(degrees) {
1460 return Math.PI *degrees/180;
1462 function rad2deg(radians) {
1463 return 180.0 *radians/Math.PI;
1465 function circle_point_x(radians, diameter) {
1466 var x = Math.cos(radians)*(diameter/2);
1469 function circle_point_y(radians, diameter) {
1470 var y = Math.sin(radians)*(diameter/2);
1473 function roundTo(val,dig) {
1475 if (val > 8191 && val < 10485) {
1477 num = Math.round(val*Math.pow(10,dig))/Math.pow(10,dig);
1480 num = Math.round(val*Math.pow(10,dig))/Math.pow(10,dig);
1484 function searchColor(value) {
1485 for (var dat in colorNames) {
1486 if(dat==value) return colorNames[dat];
1490 function scanColor(value) {
1491 if(value.match(/^#[0-9a-f][0-9a-f][0-9a-f]$/i)) {
1492 var val1 = value.substr(1,1).toLowerCase();
1493 var val2 = value.substr(2,1).toLowerCase();
1494 var val3 = value.substr(3,1).toLowerCase();
1495 value = '#' + val1 + val1 + val2 + val2 + val3 + val3;
1497 if(!value.match(/^#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]$/i)) {
1498 var tmp = searchColor(value.toLowerCase());
1499 if(!tmp) {}else{value = tmp;}
1501 if(!value.match(/^#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]$/i)) {
1504 return value.toLowerCase();
1506 function hex2rgb(val,trans) {
1508 var tp1 = Math.max(0,Math.min(parseInt(val.substr(1,2),16),255));
1509 var tp2 = Math.max(0,Math.min(parseInt(val.substr(3,2),16),255));
1510 var tp3 = Math.max(0,Math.min(parseInt(val.substr(5,2),16),255));
1511 return 'rgba(' + tp1 + ',' + tp2 + ',' + tp3 + ',' + trans + ')';
1514 function trim(str) {
1515 return (str.replace(/\s+$/,"").replace(/^\s+/,""));
1517 function roundedRect(ctx,x,y,width,height,radius){
1519 ctx.moveTo(x,y+radius);
1520 ctx.lineTo(x,y+height-radius);
1521 ctx.quadraticCurveTo(x,y+height,x+radius,y+height);
1522 ctx.lineTo(x+width-radius,y+height);
1523 ctx.quadraticCurveTo(x+width,y+height,x+width,y+height-radius);
1524 ctx.lineTo(x+width,y+radius);
1525 ctx.quadraticCurveTo(x+width,y,x+width-radius,y);
1526 ctx.lineTo(x+radius,y);
1527 ctx.quadraticCurveTo(x,y,x,y+radius);
1530 function drawString(ctx, text, fc, tx, ty) {
1531 var xp = 0; var c = "";
1533 for (var i = 0; i < text.length; i++) {
1535 ctx.drawImage(font, signs[c].sx, signs[c].sy, signs[c].sw, signs[c].sh, tx+xp, ty, signs[c].sw*fc, signs[c].sh*fc);
1536 xp += (signs[c].sw*fc);
1540 function strokeString(ctx, txt, col, fh, tx, ty) {
1541 var fw = fh*0.666666; var lw = fh*0.125;
1542 var ls = lw/2; var cr = lw; var xp = 0;
1543 ctx.lineCap = "round"; ctx.lineJoin = "round"
1544 ctx.lineWidth = lw; ctx.strokeStyle = col;
1545 for (var i = 0; i < txt.length; i++) {
1546 strokeSymbol(ctx, txt[i], ls, tx+xp, ty, fw, fh);
1547 xp += (txt[i]!="."?fw+cr:(fw/2)+cr);
1550 function strokeSymbol(ctx, symbol, fc, cx, cy, cw, ch) {
1554 ctx.moveTo(cx+fc,cy+(ch*0.333333));
1555 ctx.arc(cx+(cw/2),cy+(cw/2),(cw/2)-fc,deg2rad(180),0, false);
1556 ctx.arc(cx+(cw/2),(cy+ch)-(cw/2),(cw/2)-fc,0,deg2rad(180), false);
1560 ctx.moveTo(cx+(cw*0.1)+fc,cy+ch-fc);
1561 ctx.lineTo(cx+cw-fc,cy+ch-fc);
1562 ctx.moveTo(cx+(cw*0.666666),cy+ch-fc);
1563 ctx.lineTo(cx+(cw*0.666666),cy+fc);
1564 ctx.lineTo(cx+(cw*0.25),cy+(ch*0.25));
1567 ctx.moveTo(cx+cw-fc,cy+(ch*0.8));
1568 ctx.lineTo(cx+cw-fc,cy+ch-fc);
1569 ctx.lineTo(cx+fc,cy+ch-fc);
1570 ctx.arc(cx+(cw/2),cy+(cw*0.425),(cw*0.425)-fc,deg2rad(45),deg2rad(-180), true);
1573 ctx.moveTo(cx+(cw*0.1)+fc,cy+fc);
1574 ctx.lineTo(cx+(cw*0.9)-fc,cy+fc);
1575 ctx.arc(cx+(cw/2),cy+ch-(cw*0.5),(cw*0.5)-fc,deg2rad(-90),deg2rad(180), false);
1578 ctx.moveTo(cx+(cw*0.75),cy+ch-fc);
1579 ctx.lineTo(cx+(cw*0.75),cy+fc);
1580 ctx.moveTo(cx+cw-fc,cy+(ch*0.666666));
1581 ctx.lineTo(cx+fc,cy+(ch*0.666666));
1582 ctx.lineTo(cx+(cw*0.75),cy+fc);
1583 ctx.moveTo(cx+cw-fc,cy+ch-fc);
1584 ctx.lineTo(cx+(cw*0.5),cy+ch-fc);
1587 ctx.moveTo(cx+(cw*0.9)-fc,cy+fc);
1588 ctx.lineTo(cx+(cw*0.1)+fc,cy+fc);
1589 ctx.lineTo(cx+(cw*0.1)+fc,cy+(ch*0.333333));
1590 ctx.arc(cx+(cw/2),cy+ch-(cw*0.5),(cw*0.5)-fc,deg2rad(-80),deg2rad(180), false);
1593 ctx.moveTo(cx+fc,cy+ch-(cw*0.5)-fc);
1594 ctx.arc(cx+(cw/2),cy+ch-(cw*0.5),(cw*0.5)-fc,deg2rad(-180),deg2rad(180), false);
1595 ctx.bezierCurveTo(cx+fc,cy+fc,cx+fc,cy+fc,cx+(cw*0.9)-fc,cy+fc);
1596 ctx.moveTo(cx+(cw*0.9)-fc,cy+fc);
1599 ctx.moveTo(cx+(cw*0.5),cy+ch-fc);
1600 ctx.lineTo(cx+cw-fc,cy+fc);
1601 ctx.lineTo(cx+(cw*0.1)+fc,cy+fc);
1602 ctx.lineTo(cx+(cw*0.1)+fc,cy+(ch*0.25)-fc);
1605 ctx.moveTo(cx+(cw*0.92)-fc,cy+(cw*0.59));
1606 ctx.arc(cx+(cw/2),cy+(cw*0.45),(cw*0.45)-fc,deg2rad(25),deg2rad(-205), true);
1607 ctx.arc(cx+(cw/2),cy+ch-(cw*0.5),(cw*0.5)-fc,deg2rad(-135),deg2rad(-45), true);
1609 ctx.moveTo(cx+(cw*0.79),cy+(ch*0.47));
1610 ctx.lineTo(cx+(cw*0.21),cy+(ch*0.47));
1613 ctx.moveTo(cx+cw-fc,cy+(cw*0.5));
1614 ctx.arc(cx+(cw/2),cy+(cw*0.5),(cw*0.5)-fc,deg2rad(0),deg2rad(360), false);
1615 ctx.bezierCurveTo(cx+cw-fc,cy+ch-fc,cx+cw-fc,cy+ch-fc,cx+(cw*0.1)+fc,cy+ch-fc);
1618 ctx.moveTo(cx+fc,cy+(ch*0.75));
1619 ctx.lineTo(cx+cw-fc,cy+(ch*0.25));
1620 ctx.moveTo(cx+(cw*0.505),cy+(cw*0.3));
1621 ctx.arc(cx+(cw*0.3),cy+(cw*0.3),(cw*0.3)-fc,deg2rad(0),deg2rad(360), false);
1622 ctx.moveTo(cx+(cw*0.905),cy+ch-(cw*0.3));
1623 ctx.arc(cx+(cw*0.7),cy+ch-(cw*0.3),(cw*0.3)-fc,deg2rad(0),deg2rad(360), false);
1626 ctx.moveTo(cx+(cw*0.25),cy+ch-fc-fc);
1627 ctx.arc(cx+(cw*0.25),cy+ch-fc-fc,fc,deg2rad(0),deg2rad(360), false);
1635 function drawBar(ctx,x,y,width,height,color,value,textdiv){
1636 var rw = width/2; var rh = rw/2;
1637 height = Math.max(height,rw);
1638 var dh = Math.max(height-(2*rh),0.1); var S2L;
1639 var xx = rw/8; var yy = rh/4;
1640 var yo = rh/2; y = y - yy;
1641 if(canvas_noshadow <= 0 && canvas_noshade <= 0) {
1643 S2L = ctx.createRadialGradient(x+rw+rh,y+height-rw+yy+rh,0,x+rw,y+height-rw+yy,rw);
1644 S2L.addColorStop(0, 'rgba(0,0,0,0.5)');
1645 S2L.addColorStop(0.7, 'rgba(0,0,0,0.25)');
1646 S2L.addColorStop(0.9, 'rgba(0,0,0,0.1)');
1647 S2L.addColorStop(1, 'rgba(0,0,0,0)');
1648 ctx.fillStyle = S2L;
1650 ctx.translate(xx,y+height+yy);
1652 ctx.fillRect(x,y+yy+height-width,width,width);
1654 ctx.arc(x+rw,y+yy+height-width,width,0,deg2rad(360), false);
1658 }else if(canvas_noshadow <= 0 && canvas_noshade >= 1) {
1659 ctx.fillStyle = 'rgba(0,0,0,0.2)';
1660 ctx.fillRect(x+yo,y+rh+yo+yo,width,dh);
1663 if(canvas_noshade <= 0) {
1666 ctx.lineTo(x,y+rh+dh);
1667 ctx.bezierCurveTo(x,y+height,x+width,y+height,x+width,y+rh+dh)
1668 ctx.lineTo(x+width,y+rh);
1669 ctx.bezierCurveTo(x+width,y,x,y,x,y+rh)
1671 ctx.fillStyle = color;
1673 S2L = ctx.createLinearGradient(x,y+(height/2),x+width,y+(height/2));
1674 S2L.addColorStop(0, 'rgba(255,255,255,0.75)');
1675 S2L.addColorStop(0.2, 'rgba(255,255,255,0)');
1676 S2L.addColorStop(0.3, 'rgba(0,0,0,0)');
1677 S2L.addColorStop(0.5, 'rgba(0,0,0,0.1)');
1678 S2L.addColorStop(0.9, 'rgba(0,0,0,0.35)');
1679 S2L.addColorStop(1, 'rgba(0,0,0,0.3)');
1682 ctx.lineTo(x,y+rh+dh);
1683 ctx.bezierCurveTo(x,y+height,x+width,y+height,x+width,y+rh+dh)
1684 ctx.lineTo(x+width,y+rh);
1685 ctx.bezierCurveTo(x+width,y,x,y,x,y+rh)
1687 ctx.fillStyle = S2L;
1690 ctx.moveTo(x+width,y+rh);
1691 ctx.bezierCurveTo(x+width,y,x,y,x,y+rh)
1692 ctx.bezierCurveTo(x,y+(rh*2),x+width,y+(rh*2),x+width,y+rh)
1694 ctx.fillStyle = color;
1696 S2L = ctx.createLinearGradient(x+rw-(width*0.15),y-2,x+rw+(width*0.15),y+(2.1*rh));
1697 S2L.addColorStop(0, 'rgba(255,255,255,0.9)');
1698 S2L.addColorStop(0.5, 'rgba(255,255,255,0)');
1699 S2L.addColorStop(0.6, 'rgba(0,0,0,0)');
1700 S2L.addColorStop(1, 'rgba(0,0,0,0.3)');
1702 ctx.moveTo(x+width,y+rh);
1703 ctx.bezierCurveTo(x+width,y,x,y,x,y+rh)
1704 ctx.bezierCurveTo(x,y+(rh*2),x+width,y+(rh*2),x+width,y+rh)
1706 ctx.fillStyle = S2L;
1708 S2L = ctx.createLinearGradient(x+rw-(width*0.15),y-2,x+rw+(width*0.15),y+(2.1*rh));
1709 S2L.addColorStop(0, 'rgba(255,255,255,0.9)');
1710 S2L.addColorStop(0.5, 'rgba(255,255,255,0)');
1711 S2L.addColorStop(0.6, 'rgba(0,0,0,0)');
1712 S2L.addColorStop(1, 'rgba(0,0,0,0.1)');
1714 ctx.moveTo(x+width,y+rh);
1715 ctx.bezierCurveTo(x+width,y,x,y,x,y+rh)
1716 ctx.bezierCurveTo(x,y+(rh*2),x+width,y+(rh*2),x+width,y+rh)
1718 ctx.strokeStyle = S2L;
1721 ctx.fillStyle = color;
1722 ctx.fillRect(x,y+rh+yo,width,dh);
1724 ctx.lineCap = "butt";
1726 ctx.fillStyle = 'rgba(255,255,255,0.5)';
1727 var bw = width; var bh = bw/4;
1728 var th = roundTo(bh*0.75,0); var tf = bh/80;
1730 if(canvas_notext <= 0) {
1731 if(canvas_htmltext <= 0) {
1732 w = '"' + per + '"';
1733 if(w.indexOf(".")!=-1) {
1735 w = parseFloat(c-2)*parseFloat(48*tf);
1736 bw = parseFloat(c-1)*parseFloat(48*tf);
1739 w = parseFloat(c-1)*parseFloat(48*tf);
1740 bw = parseFloat(c)*parseFloat(48*tf);
1742 roundedRect(ctx,x+(width/2)-(bw/2),y,bw,bh,bh/4);
1744 if(canvas_imgtext <= 0) {
1745 strokeString(ctx, value + "%","rgba(48,48,48,1)", th, x+(width/2)-(w/2), y+((bh-th)/2));
1747 drawString(ctx, value + "%", tf, x+(width/2)-(w/2), y+((bh-th)/2.2));
1750 var bh = bw/3; var th = roundTo(bh*0.75,0);
1751 roundedRect(ctx,x,y,bw,bh,bh/4);
1753 var obj = document.createElement('div');
1754 obj.style.position = "absolute";
1755 obj.style.overflow = "hidden";
1756 obj.style.textAlign = "center";
1757 obj.style.width = bw + "px";
1758 obj.style.left = x + "px";
1759 obj.style.top = y+((bh-th)/2.2) + "px";
1760 obj.appendChild(document.createTextNode(per + "%"));
1761 textdiv.appendChild(obj);
1766 function drawLine(ctx,x,y,width,height,dist,array,factor,color,fill){
1768 var style = hex2rgb(color,0.5);
1769 ctx.lineJoin = "miter";
1771 ctx.moveTo(x,y+height);
1772 for (var i = 0; i < array.length; i++) {
1773 ctx.lineTo(x+(i*dist),y+height-(array[i]*factor));
1775 ctx.lineTo(x+width,y+height);
1776 ctx.lineTo(x,y+height);
1778 ctx.fillStyle = style;
1781 ctx.lineJoin = "round";
1783 ctx.moveTo(x,y+height-(array[0]*factor));
1784 for (var i = 0; i < array.length; i++) {
1785 ctx.lineTo(x+(i*dist),y+height-(array[i]*factor));
1787 ctx.strokeStyle = color;
1790 function setDataURL(cid) {
1792 var obj = document.getElementById(cid.id + "_link");
1794 obj.setAttribute("title", "To Data URL");
1795 obj.setAttribute("target", "_blank");
1796 obj.setAttribute("href", cid.toDataURL());
1800 function get_input(dataobj,canvasobj,linechart) {
1801 var table = document.getElementById(dataobj);
1802 var canvas = document.getElementById(canvasobj);
1803 var row; var clm; var cnt = 0; var val = 0; var nme = ""; var col = "";
1804 if(canvas.getContext) {
1805 canvas_width = parseInt(canvas.style.width);
1806 canvas_height = parseInt(canvas.style.height);
1807 if(canvas_width >= 16 && canvas_height >= 16) {
1808 var tmp = table.getAttribute("summary");
1809 canvas_noshade = 0; canvas_noshadow = 0;
1810 canvas_notext = 0; canvas_imgtext = 0;
1811 canvas_htmltext = 0; canvas_nofill = 0;
1812 if(tmp.search(/noshadow/) != -1) canvas_noshadow = 1;
1813 if(tmp.search(/noshade/) != -1) canvas_noshade = 1;
1814 if(tmp.search(/nofill/) != -1) canvas_nofill = 1;
1815 if(tmp.search(/notext/) != -1) canvas_notext = 1;
1816 if(tmp.search(/htmltext/) != -1) canvas_htmltext = 1;
1817 if(tmp.search(/imgtext/) != -1) canvas_imgtext = 1;
1818 if(table.getAttribute("bgcolor")) {
1819 canvas_bgcolor = scanColor(table.getAttribute("bgcolor"));
1821 ChartData = new Array(); colorSlice = new Array();
1822 if(table.getElementsByTagName("tr")[0].getElementsByTagName("th")[0]) cnt = 1;
1823 for(var r = cnt; r < table.getElementsByTagName("tr").length; r++) {
1824 row = table.getElementsByTagName("tr")[r];
1825 clm = row.getElementsByTagName("td").length;
1826 if(row.getElementsByTagName("td")[0].getAttribute("bgcolor")) {
1827 col = scanColor(row.getElementsByTagName("td")[0].getAttribute("bgcolor")); val = 0;
1828 nme = trim(row.getElementsByTagName("td")[1].innerHTML.replace(/<[^>]+>/g,""));
1831 for(var z = 2; z < clm; z++) {
1832 val += parseFloat(row.getElementsByTagName("td")[z].innerHTML.replace(/<[^>]+>/g,""));
1835 val = parseFloat(row.getElementsByTagName("td")[2].innerHTML.replace(/<[^>]+>/g,""));
1837 if(!isNaN(val) && val > 0 && nme != '') {
1838 colorSlice[r-cnt] = col; ChartData[nme] = Math.abs(val);
1844 if(clm > 3 && nme != '') {
1845 ChartData[r-cnt] = new Array();
1846 colorSlice[r-cnt] = col;
1847 for(var z = 2; z < clm; z++) {
1848 val = Math.abs(parseFloat(row.getElementsByTagName("td")[z].innerHTML.replace(/<[^>]+>/g,"")));
1849 if(!isNaN(val) && val >= 0) {
1850 ChartData[r-cnt][i] = val; i++;
1852 ChartData[r-cnt][i] = 0; i++;
1866 function setPieChart(canvasobj,textobj) {
1867 var cd = (Math.min(canvas_width,canvas_height)/110)*100;
1868 var cp = cd*0.1; var cr = cd/2;
1869 var sr = cr*0.93; var cw = cd+cp; var ch = cw;
1870 var cx = (cd/2)+(cp/2); var cy = cx; var ct = 0;
1871 for (var data in ChartData) {
1872 ct += ChartData[data];
1875 var canvas = document.getElementById(canvasobj);
1876 if(canvas_htmltext >= 1) {
1877 if(document.getElementById(textobj)) {
1878 canvas.parentNode.removeChild(canvas.parentNode.lastChild);
1881 if(canvas.getContext) {
1882 var ctx = canvas.getContext('2d');
1883 if(canvas_bgcolor != "") {
1884 ctx.fillStyle = canvas_bgcolor;
1885 ctx.fillRect(0,0,cw,ch);
1887 ctx.clearRect(0,0,cw,ch);
1889 if(canvas_noshadow <= 0) {
1892 var B2B = ctx.createRadialGradient(cx+(cr*0.1),cy+(cr*0.1),cr,cx+(cr*0.1),cy+(cr*0.1),sr*0.9);
1893 B2B.addColorStop(0, 'rgba(0,0,0,0)');
1894 B2B.addColorStop(1, 'rgba(0,0,0,0.5)');
1895 ctx.arc(cx+(cr*0.1),cy+(cr*0.1),cr,0,deg2rad(360), false);
1897 ctx.fillStyle = B2B;
1900 var B2B = ctx.createRadialGradient(cx+(cr*0.1),cy+(cr*0.1),0,cx+(cr*0.1),cy+(cr*0.1),cr);
\r
1901 B2B.addColorStop(0, 'rgba(0,0,0,0.5)');
\r
1902 B2B.addColorStop(0.87, 'rgba(0,0,0,0.5)');
\r
1903 B2B.addColorStop(1, 'rgba(0,0,0,0)');
\r
1904 ctx.fillStyle = B2B;
\r
1905 ctx.fillRect(0,0,cw,ch);
\r
1908 var val = 0; var deg = 0; var idx = 0; var data;
1909 for (data in ChartData) {
1910 val = ChartData[data]; sdeg = deg;
1911 deg += (val/ct)*deg2rad(360); edeg = deg;
1914 ctx.arc(cx,cy,cr,sdeg,edeg, false);
1917 ctx.fillStyle = colorSlice[(idx++)];
1920 if(canvas_noshade <= 0) {
1922 var W2T = ctx.createLinearGradient(cp*2,cp*2,cx,cy);
1923 W2T.addColorStop(0, 'rgba(255,255,255,0.8)');
1924 W2T.addColorStop(1, 'rgba(255,255,255,0)');
1926 ctx.arc(cx,cy,sr,deg2rad(135),deg2rad(315), false);
1928 ctx.fillStyle = W2T;
1931 var T2B = ctx.createLinearGradient(cx,cy,cw-(cp*2),ch-(cp*2));
1932 T2B.addColorStop(0, 'rgba(0,0,0,0)');
1933 T2B.addColorStop(1, 'rgba(0,0,0,0.5)');
1935 ctx.arc(cx,cy,sr,deg2rad(-45),deg2rad(135), false);
1937 ctx.fillStyle = T2B;
1940 var B2T = ctx.createLinearGradient(cx,cy,cw-(cp*1.9),ch-(cp*1.9));
1941 B2T.addColorStop(0, 'rgba(0,0,0,0)');
1942 B2T.addColorStop(1, 'rgba(0,0,0,0.6)');
1943 ctx.lineWidth = cr*0.07;
1944 ctx.lineCap = "round";
1946 ctx.arc(cx,cy,cr*0.965,deg2rad(-45),deg2rad(135), false);
1948 ctx.strokeStyle = B2T;
1951 var T2W = ctx.createLinearGradient(cx,cy,(cp*1.9),(cp*1.9));
1952 T2W.addColorStop(0, 'rgba(255,255,255,0)');
1953 T2W.addColorStop(1, 'rgba(255,255,255,0.6)');
1954 ctx.lineWidth = cr*0.07;
1955 ctx.lineCap = "round";
1957 ctx.arc(cx,cy,cr*0.965,deg2rad(135),deg2rad(315), false);
1959 ctx.strokeStyle = T2W;
1962 ctx.lineCap = "butt";
1964 ctx.fillStyle = 'rgba(255,255,255,0.5)';
1965 var mpos = 0; var per = 0; var gx = 0;
1966 var gy = 0; var tx = 0; var ty = 0;
1967 var obj = ""; var w = 0; var c = 0;
1968 var bw = cr*0.45; var bh = cr*0.125;
1969 var th = roundTo(bh*0.75,0); var tf = bh/80;
1970 if(canvas_notext <= 0) {
1971 if(canvas_htmltext >= 1) {
1973 canvas.parentNode.style.position = "relative";
1974 if(!document.getElementById(textobj)) {
1975 obj = document.createElement('div');
1977 obj.style.color = "rgb(0,0,0)";
1978 obj.style.fontFamily = "Arial,sans-serif";
1979 obj.style.fontSize = th + "px";
1980 obj.style.zIndex = 11;
1981 canvas.parentNode.appendChild(obj);
1983 var textdiv = document.getElementById(obj.id);
1985 for (data in ChartData) {
1986 val = ChartData[data];
1987 sdeg = deg; mpos = deg+(((val/2)/ct)*deg2rad(360));
1988 deg += (val/ct)*deg2rad(360); edeg = deg;
1989 per = roundTo(val/poc,2);
1990 gx = circle_point_x(mpos, cd);
1991 gy = circle_point_y(mpos, cd);
1992 tx = parseFloat((cx+(2*Math.floor(cx + gx)))/3);
1993 ty = (cy+(2*Math.floor(cy + gy)))/3;
1994 if(canvas_htmltext <= 0) {
1995 w = '"' + per + '"';
1996 if(w.indexOf(".")!=-1) {
1998 w = parseFloat(c-2)*parseFloat(48*tf);
1999 bw = parseFloat(c-1)*parseFloat(48*tf);
2002 w = parseFloat(c-1)*parseFloat(48*tf);
2003 bw = parseFloat(c)*parseFloat(48*tf);
2005 roundedRect(ctx,(tx-(bw/2)),ty-(bh/2),bw,bh,bh/4);
2007 if(canvas_imgtext >= 1) {
2008 drawString(ctx, per + "%", tf, tx-(w/2), ty-(th/1.8));
2010 strokeString(ctx, per + "%","rgba(48,48,48,1)", th, tx-(w/2), ty-(th/2));
2013 roundedRect(ctx,(tx-(bw/2)),ty-(bh/2),bw,bh,bh/4);
2015 obj = document.createElement('div');
2016 obj.style.position = "absolute";
2017 obj.style.overflow = "hidden";
2018 obj.style.textAlign = "center";
2019 obj.style.width = bw + "px";
2020 obj.style.left = (tx-(bw/2)) + "px";
2021 obj.style.top = ty-(th/1.8) + "px";
2022 obj.appendChild(document.createTextNode(per + "%"));
2023 textdiv.appendChild(obj);
2029 function setBarChart(canvasobj,textobj) {
2030 var iw = canvas_width*0.9; var ih = canvas_height*0.9;
2031 var pw = canvas_width*0.05; var ph = canvas_height*0.05;
2032 var cm = 0; var ct = 0;
2033 for (var data in ChartData) {
2034 cm = Math.max(cm,ChartData[data]);
2035 ct += ChartData[data];
2037 var hf = ih/cm; var bs = colorSlice.length;
2038 var bw = iw/(bs*1.1); var poc = ct/100;
2039 var th = roundTo((bw/3)*0.75,0);
2040 var canvas = document.getElementById(canvasobj);
2041 if(canvas.getContext) {
2042 var ctx = canvas.getContext('2d');
2043 if(canvas_bgcolor != "") {
2044 ctx.fillStyle = canvas_bgcolor;
2045 ctx.fillRect(0,0,canvas_width,canvas_height);
2047 ctx.clearRect(0,0,canvas_width,canvas_height);
2049 if(canvas_htmltext >= 1) {
2050 if(document.getElementById(textobj)) {
2051 canvas.parentNode.removeChild(canvas.parentNode.lastChild);
2053 canvas.parentNode.style.position = "relative";
2054 if(!document.getElementById(textobj)) {
2055 var obj = document.createElement('div');
2057 obj.style.color = "rgb(0,0,0)";
2058 obj.style.fontFamily = "Arial,sans-serif";
2059 obj.style.fontSize = th + "px";
2060 obj.style.zIndex = 11;
2061 canvas.parentNode.appendChild(obj);
2063 var textdiv = document.getElementById(obj.id);
2065 var cc = ""; var bh = 0; var idx = 0; var t = 0; per = 0;
2066 for (var data in ChartData) {
2067 per = roundTo(ChartData[data]/poc,2);
2068 bh = ChartData[data]*hf;
2069 drawBar(ctx,pw+(t*(bw*1.1)),ph+ih-bh,bw,bh,colorSlice[(idx++)],per,textdiv);
2074 function setLineChart(canvasobj,textobj) {
2075 var iw = canvas_width*0.9;
2076 var ih = canvas_height*0.9;
2077 var pw = canvas_width*0.05;
2078 var ph = canvas_height*0.05;
2080 for (var i = 0; i < ChartData.length; i++) {
2081 for (var j = 0; j < ChartData[i].length; j++) {
2082 cm = Math.max(cm,ChartData[i][j]);
2085 var hf = (ih*0.95)/cm; var bw = iw;
2086 var dw = iw/(ChartData[0].length-1)
2087 var dh = ih/(ChartData[0].length-1)
2088 var ps = Math.min(pw,ph); lw = ps/4;
2090 var canvas = document.getElementById(canvasobj);
2091 if(canvas.getContext) {
2092 var ctx = canvas.getContext('2d');
2093 if(canvas_bgcolor != "") {
2094 ctx.fillStyle = canvas_bgcolor;
2095 ctx.fillRect(0,0,canvas_width,canvas_height);
2097 ctx.clearRect(0,0,canvas_width,canvas_height);
2099 if(canvas_noshadow <= 0) {
2100 B2T = ctx.createLinearGradient(pw+ps,ph+ih+1,pw+ps+ps,ph+ih+1);
2101 B2T.addColorStop(0, 'rgba(0,0,0,0.0)');
2102 B2T.addColorStop(1, 'rgba(0,0,0,0.5)');
2103 ctx.fillStyle = B2T;
2105 ctx.moveTo(pw+ps,ph+ih);
2106 ctx.lineTo(pw+ps,ph+ih+ps);
2107 ctx.lineTo(pw+ps+ps,ph+ih);
2110 B2T = ctx.createLinearGradient(pw+ps+ps,ph+ih,pw+ps+ps,ph+ih+ps);
2111 B2T.addColorStop(0, 'rgba(0,0,0,0.5)');
2112 B2T.addColorStop(1, 'rgba(0,0,0,0.0)');
2113 ctx.fillStyle = B2T;
2115 ctx.moveTo(pw+ps+ps,ph+ih);
2116 ctx.lineTo(pw+iw,ph+ih);
2117 ctx.lineTo(pw+ps+iw,ph+ih+ps);
2118 ctx.lineTo(pw+ps,ph+ih+ps);
2121 var B2T = ctx.createLinearGradient(pw+iw+1,ph+ps,pw+iw+1,ph+ps+ps);
2122 B2T.addColorStop(0, 'rgba(0,0,0,0.0)');
2123 B2T.addColorStop(1, 'rgba(0,0,0,0.35)');
2124 ctx.fillStyle = B2T;
2126 ctx.moveTo(pw+iw,ph+ps);
2127 ctx.lineTo(pw+iw,ph+ps+ps);
2128 ctx.lineTo(pw+iw+ps,ph+ps);
2131 B2T = ctx.createLinearGradient(pw+iw,ph+ps+ps,pw+iw+ps,ph+ps+ps);
2132 B2T.addColorStop(0, 'rgba(0,0,0,0.35)');
2133 B2T.addColorStop(1, 'rgba(0,0,0,0.0)');
2134 ctx.fillStyle = B2T;
2136 ctx.moveTo(pw+iw,ph+ps+ps);
2137 ctx.lineTo(pw+iw,ph+ih);
2138 ctx.lineTo(pw+iw+ps,ph+ih+ps);
2139 ctx.lineTo(pw+iw+ps,ph+ps);
2143 ctx.lineCap = "butt";
2144 ctx.lineWidth = lw/2;
2145 ctx.strokeStyle = "rgba(255,255,255,0.25)";
2146 if(canvas_nofill <= 0) {
2147 ctx.fillStyle = "rgba(240,240,240,0.8)";
2148 ctx.strokeStyle = "rgba(255,255,255,1)";
2149 ctx.fillRect(pw,ph,iw,ih);
2151 for (var i = 0; i < ChartData[0].length-1; i++) {
2153 ctx.moveTo(pw+(i*dw),ph);
2154 ctx.lineTo(pw+(i*dw),ph+ih);
2157 for (var i = 1; i < ChartData[0].length; i++) {
2159 ctx.moveTo(pw,ph+(i*dh));
2160 ctx.lineTo(pw+iw,ph+(i*dh));
2164 var cc = ""; var bh = 0; var idx = 0; var t = 0;
2165 for (var i = 0; i < ChartData.length; i++) {
2166 for (var j = 0; j < ChartData[i].length; j++) {
2167 t = Math.max(t,ChartData[i][j]);
2169 bh = t*hf; cc = colorSlice[(idx++)];
2170 drawLine(ctx,pw,ph+ih-bh,bw,bh,dw,ChartData[i],hf,cc,canvas_nofill);
2174 ctx.lineTo(pw,ph+ih);
2175 ctx.lineTo(pw+iw+(lw/2),ph+ih);
2176 ctx.strokeStyle = "rgba(48,48,48,1)";
2178 ctx.lineWidth = lw/2;
2179 B2T = ctx.createLinearGradient(pw,ph+ih,pw,ph+ih+ps);
2180 B2T.addColorStop(0, 'rgba(0,0,0,1)');
2181 B2T.addColorStop(0.5, 'rgba(0,0,0,1)');
2182 B2T.addColorStop(1, 'rgba(0,0,0,0)');
2183 ctx.strokeStyle = B2T;
2184 for (var i = 0; i < ChartData[0].length; i++) {
2186 ctx.moveTo(pw+(i*dw),ph+ih);
2187 ctx.lineTo(pw+(i*dw),ph+ih+ps);
2190 B2T = ctx.createLinearGradient(pw-ps,ph,pw,ph);
2191 B2T.addColorStop(0, 'rgba(0,0,0,0)');
2192 B2T.addColorStop(0.5, 'rgba(0,0,0,1)');
2193 B2T.addColorStop(1, 'rgba(0,0,0,1)');
2194 ctx.strokeStyle = B2T;
2195 for (var i = 1; i < ChartData[0].length; i++) {
2197 ctx.moveTo(pw-ps,ph+(i*dh));
2198 ctx.lineTo(pw,ph+(i*dh));
2203 function generateCanvas() {
2205 var canvasID; var tdataID; var textID;
2206 var tmp; var dat; var i; var j;
2207 for(i=0; i < piecharts.length; i++) {
2208 tmp = piecharts[i].id.split("_");
2209 tdataID = piecharts[i].id;
2210 canvasID = tmp[0] + "_canvas";
2211 textID = tmp[0] + "_text";
2212 if(document.getElementById(tdataID)) {
2213 get_input(tdataID,canvasID);
2214 if(colorSlice.length > 0) {
2215 j = 0; dat = ""; for(dat in ChartData) {j++; }
2216 if(j > 0 && j == colorSlice.length) {
2217 setPieChart(canvasID,textID);
2222 for(i=0; i < barcharts.length; i++) {
2223 tmp = barcharts[i].id.split("_");
2224 tdataID = barcharts[i].id;
2225 canvasID = tmp[0] + "_canvas";
2226 textID = tmp[0] + "_text";
2227 if(document.getElementById(tdataID)) {
2228 get_input(tdataID,canvasID);
2229 if(colorSlice.length > 0) {
2230 j = 0; dat = ""; for(dat in ChartData) {j++; }
2231 if(j > 0 && j == colorSlice.length) {
2232 setBarChart(canvasID,textID);
2237 for(i=0; i < linecharts.length; i++) {
2238 tmp = linecharts[i].id.split("_");
2239 tdataID = linecharts[i].id;
2240 canvasID = tmp[0] + "_canvas";
2241 textID = tmp[0] + "_text";
2242 if(document.getElementById(tdataID)) {
2243 get_input(tdataID,canvasID,true);
2244 if(colorSlice.length > 0) {
2245 if(ChartData.length == colorSlice.length) {
2246 setLineChart(canvasID,textID);
2253 // canvas chart extension
2255 // invisible select extension
2256 function setListPos(opt) {
2257 if(!isIE) { //(degrade IE)
2258 var ref = document.getElementById('list');
2259 var x = findPosX(ref); var y = findPosY(ref);
2260 var obj = document.getElementById('jumplist');
2261 obj.style.position = 'fixed'; obj.style.left = x + 'px'; obj.style.top = y + 'px';
2262 var vol = document.getElementById('volumelist');
2263 ref = document.getElementById('volume');
2264 x = findPosX(ref); y = findPosY(ref);
2265 vol.style.position = 'fixed'; vol.style.left = x + 'px'; vol.style.top = y + 'px';
2266 var pnl = document.getElementById('navLinks');
2271 //obj.style.filter = "alpha(opacity=0)";
2272 //vol.style.filter = "alpha(opacity=0)";
2273 //pnl.style.filter = "alpha(opacity=90)";
2275 obj.style.opacity = 0.0;
2276 vol.style.opacity = 0.0;
2277 pnl.style.opacity = 0.9;
2279 if(!isOp && !isIE) {
2280 vol.onmouseover = function () { document.getElementById('volume').style.color="rgb(255, 0, 0)"; return false; }
2281 vol.onmouseout = function () { document.getElementById('volume').style.color=""; return false; }
2282 obj.onmouseover = function () { document.getElementById('list').style.color="rgb(255, 0, 0)"; return false; }
2283 obj.onmouseout = function () { document.getElementById('list').style.color=""; return false; }
2287 // invisible select extension
2289 // transition extension
2290 function switchFade() {
2291 if(tranSitions && s5mode && fadeModus) {
2293 playDelay = playDelay-(2*fadeDuration);
2294 document.getElementById('fade').style.color="";
2295 }else if(tranSitions && s5mode && !fadeModus) {
2297 playDelay = playDelay+(2*fadeDuration);
2298 document.getElementById('fade').style.color=highLight;
2302 function opacity(ids, opacStart, opacEnd, millisec) {
\r var speed = Math.round(millisec / 100);
\r var timer = 0;
\r if(opacStart > opacEnd) {
\r for(var i = opacStart; i >= opacEnd; i--) {
\r window.setTimeout("changeOpac(" + i + ",'" + ids + "')",(timer * speed));
\r timer++;
\r }
\r } else if(opacStart < opacEnd) {
\r for(var i = opacStart; i <= opacEnd; i++) {
\r window.setTimeout("changeOpac(" + i + ",'" + ids + "')",(timer * speed));
\r timer++;
\r }
\r }
2303 }
\rfunction changeOpac(opacity, ids) {
\r var obj = document.getElementById(ids);
2305 obj.style.filter = "alpha(opacity=" + opacity + ")";
\r } else {
\r obj.style.opacity = (opacity / 100);
\r }
\r}
\rfunction shiftOpacity(ids, millisec) {
\r if(document.getElementById(ids).style.opacity != '') {
\r var currentOpac = document.getElementById(ids).style.opacity * 100;
2307 var currentOpac = 0;
2309 if(currentOpac == 0) {
2310 opacity(ids, currentOpac, 100, millisec);
\r } else if(currentOpac > 0) {
2311 opacity(ids, currentOpac, 0, millisec);
\r }
\r}
2312 // transition extension
2314 // autoplay extension
2315 function autoPlay() {
2316 if (s5mode && autoMatic && !playPause) {
\r
2317 if ((snum >= (smax-1)) && playLoop) {
2319 autoRun = setTimeout('autoPlay();',playDelay);
\r
2320 }else if ((snum >= (smax-1)) && !playLoop) {
2323 if (!incrementals[snum] || incpos >= incrementals[snum].length) {
2325 if (incrementals[snum].length >0) {
2326 clearTimeout(autoRun); autoRun = null;
2327 incrDelay = parseInt(playDelay/(incrementals[snum].length+1));
2328 remainDer = parseInt(playDelay-(incrDelay*incrementals[snum].length));
2329 autoRun = setTimeout('autoPlayIncr()',incrDelay);
2332 clearTimeout(autoRun); autoRun = null;
2333 incrDelay = incrDuration;
2334 remainDer = parseInt(playDelay-(incrementals[snum].length*incrDuration));
2335 autoRun = setTimeout('autoPlayIncr()',incrDelay);
2337 autoRun = setTimeout('autoPlay();',playDelay);
2341 function autoPlayIncr() {
2342 if (incpos < incrementals[snum].length) {
2344 autoRun = setTimeout('autoPlayIncr();',incrDelay);
2346 autoRun = setTimeout('nop();',remainDer);
2350 // no operation dummy
2352 function togglePlay() {
\r
2353 if (autoRun && s5mode) {
2355 }else if (!autoRun && s5mode) {
2359 function stopPlay() {
\r
2360 if (autoRun && s5mode) {
2361 clearTimeout(autoRun); autoRun = null;
2362 autoMatic = false; playPause = false;
2363 document.getElementById('auto').style.color="";
2364 document.getElementById('pause').style.color="";
2368 function startPlay() {
2369 if (!autoRun && s5mode) {
2370 playPause = false; autoMatic = true;
2371 document.getElementById('pause').style.color="";
2372 document.getElementById('auto').style.color=highLight;
2373 autoRun = setTimeout('autoPlay();',playDelay);
2377 function pausePlay() {
2378 if (s5mode && autoMatic) {
2380 playPause = false; autoRun = setTimeout('autoPlay();',playDelay);
2381 document.getElementById('pause').style.color="";
2384 clearTimeout(autoRun); autoRun = null; playPause = true;
2385 document.getElementById('pause').style.color=highLight;
2391 function switchLoop() {
2394 playLoop = false; document.getElementById('loop').style.color="";
2396 playLoop = true; document.getElementById('loop').style.color=highLight;
2401 function setDelay(val) {
2403 var delay = Math.max(5,Math.min(val,300));
2404 playDelay = (fadeModus == true) ? ((delay*1000)+(2*fadeDuration)) : (delay*1000);
2407 // autoplay extension
2410 function createSoundManagerScript() {
2411 if(typeof soundManager=="undefined") {
2414 var script=document.createElement('SCRIPT');
2415 var tx=document.createTextNode("soundManager.createMovie();");
2416 script.appendChild(tx);
2417 document.getElementsByTagName("body")[0].appendChild(script);
2420 //soundManager.onload = function() {
2421 function onloadSM2() {
2422 if(!isIE) { //(degrade IE)
2423 swfUnloaded = false;
\r
2427 //soundManager.onerror = function() {
2428 function onerrorSM2() {
2429 if(typeof soundManager!="undefined") {
2430 soundManager.destruct;
2431 delete soundManager;
2433 audioSupport = false; swfUnloaded = true;
2434 if(audioError && !isIE && !isOp) {
2435 var dv = document.createElement('div'); dv.id = "guru";
2436 var d2=document.createElement('div'); dv.appendChild(d2);
\r var tx=document.createTextNode('Guru Meditation - SoundManager failed to load/initialize!');
2437 d2.appendChild(tx); document.getElementById('slide0').appendChild(dv);
2440 function audioSetup() {
2443 }else if(sound[bgSoundItem] && !sound[0]) {
2444 playSound(bgSoundItem);
2447 function fadeoutSound(ids, option) {
2448 if(curSoundID >= 0 && !swfUnloaded) {
2450 if(ids == "bgSound") {
2451 var cnum = parseInt(bgSoundItem);
2453 for (var i = 0; i < (sound.length-1); i++) {
2454 if(sound[i] && ids == sound[i]["id"]) {
2462 ids = sound[cnum]["id"];
2464 var vol = getMaxVolume(sound[cnum]["volume"]);
2465 var millisec = fadeDuration;
2466 var speed = Math.round(millisec / vol);
\r var timer = 0;
\r for(var i = vol; i > 0; i--) {
\r setTimeout("fadeout(" + i + ",'" + ids + "')",(timer * speed));
\r timer++;
\r }
2467 if(option) setTimeout("stopSound('"+ids+"')",millisec);
2470 function fadeout(volume, id) {
\r soundManager.setVolume(id,volume);
\r}
2471 function stopSound(ids) {
2475 }else if(sound[ids]) {
2476 sid = sound[ids]["id"];
2478 if(sid!='' && curSoundID >= 0) {
2479 soundManager.stop(sid);
2483 function toggleSounds() {
2484 if(audioSupport && !swfUnloaded) {
2486 }else if (!audioSupport && !swfUnloaded) {
2490 function allowSounds() {
2492 audioSupport = true;
2493 document.getElementById('audio').style.color=highLight;
2497 function stopAllSounds() {
2498 if(curSoundID >= 0) {
2499 stopSound(curSoundID);
2501 soundManager.stopAll();
2504 audioSupport = false;
2505 document.getElementById('audio').style.color="";
2508 function playSound(id) {
2509 if(audioSupport && !swfUnloaded) {
2510 var url, sid, vol, lps, cnum;
2513 if(sid == "bgSound") {
2514 cnum = parseInt(bgSoundItem);
2516 cnum = getSoundID(id);
2519 cnum = parseInt(id);
2520 if(sound[cnum]) sid = sound[cnum]["id"];
2522 if(sound[cnum] && sound[cnum]["url"]!='' && sid!=''){
2523 url = sound[cnum]["url"];
2524 vol = (sound[cnum]["volume"]!='')?getMaxVolume(sound[cnum]["volume"]):getMaxVolume(100);
2525 lps = (sound[cnum]["loops"])?true:false;
2527 soundManager.play(sid,{volume:vol,onplay:function(){curSoundID=cnum;},onfinish:function(){soundManager.play(sid,{volume:getMaxVolume(sound[cnum]["volume"])});}});
2529 soundManager.play(sid,{volume:vol,onplay:function(){curSoundID=cnum;},onfinish:function(){curSoundID=-1;}});
2534 function getSoundID(str) {
2535 for (var i = 0; i < (sound.length-1); i++) {
2536 if(sound[i] && str == sound[i]["id"]) {
2543 function setVolume() {
2544 var vol = document.getElementById('volumelist');
2545 if(audioSupport && !swfUnloaded) {
2546 audioVolume = parseInt(vol.value);
2547 if(curSoundID >= 0) {
2548 if(sound[curSoundID]) {
2549 var sid = sound[curSoundID]["id"];
2550 var vid = getMaxVolume(sound[curSoundID]["volume"]);
2551 soundManager.setVolume(sid,vid);
2555 function getMaxVolume(value) {
2556 if(audioVolume>0) {var factor = audioVolume/100;}else {var factor = 0;}
2557 return Math.max(0,Math.min(parseInt(value*factor),audioVolume));
2559 function preloadSounds() {
2560 var temp = ''; var parm = ''; var t = ''; var cl = '';
2561 var objects = document.getElementsByTagName('object');
2562 for (var i=0; i < objects.length; i++) {
2563 if(objects[i].type.toLowerCase() == 'audio/mp3' && objects[i].data != '') {
2564 objects[i].width = 0; objects[i].height = 0;
2565 if(objects[i].parentNode.tagName == 'DIV') {
2566 cl = objects[i].parentNode.className.toLowerCase();
2567 if(cl == 'presentation' || cl == 'slide') {
2568 if(cl == 'presentation') {
2569 t = parseInt(bgSoundItem);
2571 t = parseInt(objects[i].parentNode.id.slice(5, objects[i].parentNode.id.length));
2573 sound[t] = new Object();
2574 if(t < bgSoundItem) {
2575 sound[t]["id"] = objects[i].parentNode.id;
2577 sound[t]["id"] = "bgSound";
2579 sound[t]["url"] = objects[i].data;
2580 sound[t]["volume"] = 100; sound[t]["loops"] = false;
2581 if(objects[i].archive != '') {
2582 parm = objects[i].archive.toLowerCase().split(',');
2583 for (var j=0; j < parm.length; j++) {
2584 if(parm[j] == 'loop') sound[t]["loops"] = true;
2585 if(parm[j].search(/^volume/) != -1) {
2586 var tmp = parm[j].split(':');
2587 sound[t]["volume"] = parseInt(tmp[1]);
2591 soundManager.createSound(sound[t]["id"],sound[t]["url"]);
2600 function createHelpReq() {
2601 if(!document.getElementById("HelpReq")) {
2602 var obj = document.getElementsByTagName("body")[0].firstChild;
2603 var pg = document.createElement('div');
2605 if (pg.addEventListener) {
2606 pg.addEventListener("onclick",dumpHelpReq,false);
2607 } else if (pg.attachEvent) {
2608 pg.attachEvent("onclick",dumpHelpReq);
2610 pg.style.position = 'absolute';
2611 pg.style.left = 0 + 'px';
2612 pg.style.top = 0 + 'px';
2613 pg.style.width = 100 + '%';
\r
2614 pg.style.height = 100 + '%';
2615 pg.style.margin = 0 + 'px';
2616 pg.style.padding = 0 + 'px';
2618 pg.style.filter = "alpha(opacity=90)";
2620 pg.style.opacity = 0.9;
2621 }
\r pg.style.zIndex = 9999;
2622 pg.style.backgroundColor="rgb(64,64,64)";
2623 pg.style.textAlign = "center";
\r pg.style.verticalAlign = "middle";
2624 pg.style.backgroundPosition="center center";
2625 pg.style.backgroundRepeat="no-repeat";
2626 pg.style.backgroundImage="url(ui/graphic_support/help.jpg)";
2627 document.getElementsByTagName("body")[0].insertBefore(pg,obj);
2628 if(document.getElementById("HelpReq")) {
2633 function dumpHelpReq() {
2634 if(document.getElementById("HelpReq")) {
2635 document.body.removeChild(document.getElementById('HelpReq'));
2642 function ConsoleLog(value) {
2643 if(window.console) {
2644 window.console.log(value);
\r
2649 document.write('<style type="text/css" media="screen" id="blockStyle">.presentation, .layout {display: none; }</style>');
2651 if(!isIE && !isOp) {
2652 document.write('<script type="text/javascript" src="ui/audio_support/soundmanager2.js"></script>');
2653 if(typeof soundManager!="undefined") {
2654 var allMetas = document.getElementsByTagName('meta');
2655 for (var i = 0; i< allMetas.length; i++) {
2656 if (allMetas[i].name == 'audioDebug') {
2657 var audioDebug = (allMetas[i].content == "true") ? true : false;
2658 soundManager.defaultOptions.debugMode = audioDebug;
2664 window.onload = createSlideShow;
2665 window.onresize = function(){setTimeout('windowChange()',5);}