PageSourceSearch

https://rypina.pl/plugins/content/jw_allvideos/includes/js/jwp.js.php?v=4.6.1

js rypina.pl collected 2026-10-08 08:18:03 UTC 52,065 bytes, 1,425 lines download raw bytes

1/* behaviour.js */
2/**
3 * @version		4.6.1
4 * @package		AllVideos (plugin)
5 * @author    	JoomlaWorks - http://www.joomlaworks.net
6 * @copyright	Copyright (c) 2006 - 2014 JoomlaWorks Ltd. All rights reserved.
7 * @license		GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
8 */
9
10var allvideos = {
11	ready: function(cb) {
12		/in/.test(document.readyState) ? setTimeout('allvideos.ready('+cb+')', 9) : cb();
13	},
14
15	getRemoteJson: function(url) {
16		var remoteJsonScript = document.createElement('script');
17		remoteJsonScript.setAttribute('charset', 'utf-8');
18		remoteJsonScript.setAttribute('type', 'text/javascript');
19		remoteJsonScript.setAttribute('async', 'true');
20		remoteJsonScript.setAttribute('src', url);
21		return remoteJsonScript;
22	},
23
24	embed: function(el){
25		var jsonpCallback = el.callback;
26		var tempId = Math.floor(Math.random()*1000)+1;
27		var responseContainer = [];
28		window[jsonpCallback] = function(response){
29			responseContainer.tempId = [response];
30		};
31		var head = document.getElementsByTagName('head')[0];
32		var jsonp = this.getRemoteJson(el.url);
33		jsonp.onloadDone = false;
34		jsonp.onload = function(){
35			if (!jsonp.onloadDone){
36				jsonp.onloadDone = true;
37				document.getElementById(el.playerID).innerHTML = responseContainer.tempId[0].html;
38			}
39		};
40		jsonp.onreadystatechange = function(){
41			if (("loaded" === jsonp.readyState || "complete" === jsonp.readyState) && !jsonp.onloadDone) {
42				jsonp.onloadDone = true;
43				document.getElementById(el.playerID).innerHTML = responseContainer.tempId[0].html;
44			}
45		}
46		head.appendChild(jsonp);
47	}
48}
49/* silverlight.js */
50///////////////////////////////////////////////////////////////////////////////
51//
52//  Silverlight.js   			version 2.0.30523.6
53//
54//  This file is provided by Microsoft as a helper file for websites that
55//  incorporate Silverlight Objects. This file is provided under the Microsoft
56//  Public License available at 
57//  http://code.msdn.microsoft.com/silverlightjs/Project/License.aspx.  
58//  You may not use or distribute this file or the code in this file except as 
59//  expressly permitted under that license.
60// 
61//  Copyright (c) Microsoft Corporation. All rights reserved.
62//
63///////////////////////////////////////////////////////////////////////////////
64
65if (!window.Silverlight)
66{
67    window.Silverlight = { };
68}
69
70//////////////////////////////////////////////////////////////////
71//
72// _silverlightCount:
73//
74// Counter of globalized event handlers
75//
76//////////////////////////////////////////////////////////////////
77Silverlight._silverlightCount = 0;
78
79//////////////////////////////////////////////////////////////////
80//
81// fwlinkRoot:
82//
83// Prefix for fwlink URL's
84//
85//////////////////////////////////////////////////////////////////
86Silverlight.fwlinkRoot='http://go2.microsoft.com/fwlink/?LinkID=';
87
88//////////////////////////////////////////////////////////////////
89//  
90// onGetSilverlight:
91//
92// Called by Silverlight.GetSilverlight to notify the page that a user
93// has requested the Silverlight installer
94//
95//////////////////////////////////////////////////////////////////
96Silverlight.onGetSilverlight = null;
97
98//////////////////////////////////////////////////////////////////
99//
100// onSilverlightInstalled:
101//
102// Called by Silverlight.WaitForInstallCompletion when the page detects
103// that Silverlight has been installed. The event handler is not called
104// in upgrade scenarios.
105//
106//////////////////////////////////////////////////////////////////
107Silverlight.onSilverlightInstalled = function () {window.location.reload(false);};
108
109//////////////////////////////////////////////////////////////////
110//
111// isInstalled:
112//
113// Checks to see if the correct version is installed
114//
115//////////////////////////////////////////////////////////////////
116Silverlight.isInstalled = function(version)
117{
118    var isVersionSupported=false;
119    var container = null;
120    
121    try 
122    {
123        var control = null;
124        
125        try
126        {
127            control = new ActiveXObject('AgControl.AgControl');
128            if ( version == null )
129            {
130                isVersionSupported = true;
131            }
132            else if ( control.IsVersionSupported(version) )
133            {
134                isVersionSupported = true;
135            }
136            control = null;
137        }
138        catch (e)
139        {
140            var plugin = navigator.plugins["Silverlight Plug-In"] ;
141            if ( plugin )
142            {
143                if ( version === null )
144                {
145                    isVersionSupported = true;
146                }
147                else
148                {
149                    var actualVer = plugin.description;
150                    if ( actualVer === "1.0.30226.2")
151                        actualVer = "2.0.30226.2";
152                    var actualVerArray =actualVer.split(".");
153                    while ( actualVerArray.length > 3)
154                    {
155                        actualVerArray.pop();
156                    }
157                    while ( actualVerArray.length < 4)
158                    {
159                        actualVerArray.push(0);
160                    }
161                    var reqVerArray = version.split(".");
162                    while ( reqVerArray.length > 4)
163                    {
164                        reqVerArray.pop();
165                    }
166                    
167                    var requiredVersionPart ;
168                    var actualVersionPart
169                    var index = 0;
170                    
171                    
172                    do
173                    {
174                        requiredVersionPart = parseInt(reqVerArray[index]);
175                        actualVersionPart = parseInt(actualVerArray[index]);
176                        index++;
177                    }
178                    while (index < reqVerArray.length && requiredVersionPart === actualVersionPart);
179                    
180                    if ( requiredVersionPart <= actualVersionPart && !isNaN(requiredVersionPart) )
181                    {
182                        isVersionSupported = true;
183                    }
184                }
185            }
186        }
187    }
188    catch (e) 
189    {
190        isVersionSupported = false;
191    }
192    if (container) 
193    {
194        document.body.removeChild(container);
195    }
196    
197    return isVersionSupported;
198}
199//////////////////////////////////////////////////////////////////
200//
201// WaitForInstallCompletion:
202//
203// Occasionally checks for Silverlight installation status. If it
204// detects that Silverlight has been installed then it calls
205// Silverlight.onSilverlightInstalled();. This is only supported
206// if Silverlight was not previously installed on this computer.
207//
208//////////////////////////////////////////////////////////////////
209Silverlight.WaitForInstallCompletion = function()
210{
211    if ( ! Silverlight.isBrowserRestartRequired && Silverlight.onSilverlightInstalled )
212    {
213        try
214        {
215            navigator.plugins.refresh();
216        }
217        catch(e)
218        {
219        }
220        if ( Silverlight.isInstalled(null) )
221        {
222            Silverlight.onSilverlightInstalled();
223        }
224        else
225        {
226              setTimeout(Silverlight.WaitForInstallCompletion, 3000);
227        }    
228    }
229}
230//////////////////////////////////////////////////////////////////
231//
232// __startup:
233//
234// Performs startup tasks
235//////////////////////////////////////////////////////////////////
236Silverlight.__startup = function()
237{
238    Silverlight.isBrowserRestartRequired = Silverlight.isInstalled(null);
239    if ( !Silverlight.isBrowserRestartRequired)
240    {
241        Silverlight.WaitForInstallCompletion();
242    }
243    if (window.removeEventListener) { 
244       window.removeEventListener('load', Silverlight.__startup , false);
245    }
246    else { 
247        window.detachEvent('onload', Silverlight.__startup );
248    }
249}
250
251if (window.addEventListener) 
252{
253    window.addEventListener('load', Silverlight.__startup , false);
254}
255else 
256{
257    window.attachEvent('onload', Silverlight.__startup );
258}
259
260///////////////////////////////////////////////////////////////////////////////
261// createObject:
262//
263// Inserts a Silverlight <object> tag or installation experience into the HTML
264// DOM based on the current installed state of Silverlight. 
265//
266/////////////////////////////////////////////////////////////////////////////////
267
268Silverlight.createObject = function(source, parentElement, id, properties, events, initParams, userContext)
269{
270    var slPluginHelper = new Object();
271    var slProperties = properties;
272    var slEvents = events;
273    
274    slPluginHelper.version = slProperties.version;
275    slProperties.source = source;    
276    slPluginHelper.alt = slProperties.alt;
277    
278    //rename properties to their tag property names. For bacwards compatibility
279    //with Silverlight.js version 1.0
280    if ( initParams )
281        slProperties.initParams = initParams;
282    if ( slProperties.isWindowless && !slProperties.windowless)
283        slProperties.windowless = slProperties.isWindowless;
284    if ( slProperties.framerate && !slProperties.maxFramerate)
285        slProperties.maxFramerate = slProperties.framerate;
286    if ( id && !slProperties.id)
287        slProperties.id = id;
288    
289    // remove elements which are not to be added to the instantiation tag
290    delete slProperties.ignoreBrowserVer;
291    delete slProperties.inplaceInstallPrompt;
292    delete slProperties.version;
293    delete slProperties.isWindowless;
294    delete slProperties.framerate;
295    delete slProperties.data;
296    delete slProperties.src;
297    delete slProperties.alt;
298
299
300    // detect that the correct version of Silverlight is installed, else display install
301
302    if (Silverlight.isInstalled(slPluginHelper.version))
303    {
304        //move unknown events to the slProperties array
305        for (var name in slEvents)
306        {
307            if ( slEvents[name])
308            {
309                if ( name == "onLoad" && typeof slEvents[name] == "function" && slEvents[name].length != 1 )
310                {
311                    var onLoadHandler = slEvents[name];
312                    slEvents[name]=function (sender){ return onLoadHandler(document.getElementById(id), userContext, sender)};
313                }
314                var handlerName = Silverlight.__getHandlerName(slEvents[name]);
315                if ( handlerName != null )
316                {
317                    slProperties[name] = handlerName;
318                    slEvents[name] = null;
319                }
320                else
321                {
322                    throw "typeof events."+name+" must be 'function' or 'string'";
323                }
324            }
325        }
326        slPluginHTML = Silverlight.buildHTML(slProperties);
327    }
328    //The control could not be instantiated. Show the installation prompt
329    else 
330    {
331        slPluginHTML = Silverlight.buildPromptHTML(slPluginHelper);
332    }
333
334    // insert or return the HTML
335    if(parentElement)
336    {
337        parentElement.innerHTML = slPluginHTML;
338    }
339    else
340    {
341        return slPluginHTML;
342    }
343
344}
345
346///////////////////////////////////////////////////////////////////////////////
347//
348//  buildHTML:
349//
350//  create HTML that instantiates the control
351//
352///////////////////////////////////////////////////////////////////////////////
353Silverlight.buildHTML = function( slProperties)
354{
355    var htmlBuilder = [];
356
357    htmlBuilder.push('<object type=\"application/x-silverlight\" data="data:application/x-silverlight,"');
358    if ( slProperties.id != null )
359    {
360        htmlBuilder.push(' id="' + slProperties.id + '"');
361    }
362    if ( slProperties.width != null )
363    {
364        htmlBuilder.push(' width="' + slProperties.width+ '"');
365    }
366    if ( slProperties.height != null )
367    {
368        htmlBuilder.push(' height="' + slProperties.height + '"');
369    }
370    htmlBuilder.push(' >');
371    
372    delete slProperties.id;
373    delete slProperties.width;
374    delete slProperties.height;
375    
376    for (var name in slProperties)
377    {
378        if (slProperties[name])
379        {
380            htmlBuilder.push('<param name="'+Silverlight.HtmlAttributeEncode(name)+'" value="'+Silverlight.HtmlAttributeEncode(slProperties[name])+'" />');
381        }
382    }
383    htmlBuilder.push('<\/object>');
384    return htmlBuilder.join('');
385}
386
387
388
389//////////////////////////////////////////////////////////////////
390//
391// createObjectEx:
392//
393// takes a single parameter of all createObject 
394// parameters enclosed in {}
395//
396//////////////////////////////////////////////////////////////////
397
398Silverlight.createObjectEx = function(params)
399{
400    var parameters = params;
401    var html = Silverlight.createObject(parameters.source, parameters.parentElement, parameters.id, parameters.properties, parameters.events, parameters.initParams, parameters.context);
402    if (parameters.parentElement == null)
403    {
404        return html;
405    }
406}
407
408///////////////////////////////////////////////////////////////////////////////////////////////
409//
410// buildPromptHTML
411//
412// Builds the HTML to prompt the user to download and install Silverlight
413//
414///////////////////////////////////////////////////////////////////////////////////////////////
415Silverlight.buildPromptHTML = function(slPluginHelper)
416{
417    var slPluginHTML = "";
418    var urlRoot = Silverlight.fwlinkRoot;
419    var shortVer = slPluginHelper.version ;
420    if ( slPluginHelper.alt )
421    {
422        slPluginHTML = slPluginHelper.alt;
423    }
424    else
425    {
426        if (! shortVer )
427        {
428            shortVer="";
429        }
430        slPluginHTML = "<a href='javascript:Silverlight.getSilverlight(\"{1}\");' style='text-decoration: none;'><img src='{2}' alt='Get Microsoft Silverlight' style='border-style: none'/></a>";
431        slPluginHTML = slPluginHTML.replace('{1}', shortVer );
432        slPluginHTML = slPluginHTML.replace('{2}', urlRoot + '108181');
433    }
434    
435    return slPluginHTML;
436}
437
438///////////////////////////////////////////////////////////////////////////////////////////////
439//
440// getSilverlight:
441//
442// Navigates the browser to the appropriate Silverlight installer
443//
444///////////////////////////////////////////////////////////////////////////////////////////////
445Silverlight.getSilverlight = function(version)
446{
447    if (Silverlight.onGetSilverlight )
448    {
449        Silverlight.onGetSilverlight();
450    }
451    
452    var shortVer = "";
453    var reqVerArray = String(version).split(".");
454    if (reqVerArray.length > 1)
455    {
456        var majorNum = parseInt(reqVerArray[0] );
457        if ( isNaN(majorNum) || majorNum < 2 )
458        {
459            shortVer = "1.0";
460        }
461        else
462        {
463            shortVer = reqVerArray[0]+'.'+reqVerArray[1];
464        }
465    }
466    
467    var verArg = "";
468    
469    if (shortVer.match(/^\d+\056\d+$/) )
470    {
471        verArg = "&v="+shortVer;
472    }
473    
474    Silverlight.followFWLink("114576" + verArg);
475}
476
477
478///////////////////////////////////////////////////////////////////////////////////////////////
479//
480// followFWLink:
481//
482// Navigates to a url based on fwlinkid
483//
484///////////////////////////////////////////////////////////////////////////////////////////////
485Silverlight.followFWLink = function(linkid)
486{
487    top.location=Silverlight.fwlinkRoot+String(linkid);
488}
489
490///////////////////////////////////////////////////////////////////////////////////////////////
491//
492// HtmlAttributeEncode:
493//
494// Encodes special characters in input strings as charcodes
495//
496///////////////////////////////////////////////////////////////////////////////////////////////
497Silverlight.HtmlAttributeEncode = function( strInput )
498{
499      var c;
500      var retVal = '';
501
502    if(strInput == null)
503      {
504          return null;
505    }
506      
507      for(var cnt = 0; cnt < strInput.length; cnt++)
508      {
509            c = strInput.charCodeAt(cnt);
510
511            if (( ( c > 96 ) && ( c < 123 ) ) ||
512                  ( ( c > 64 ) && ( c < 91 ) ) ||
513                  ( ( c > 43 ) && ( c < 58 ) && (c!=47)) ||
514                  ( c == 95 ))
515            {
516                  retVal = retVal + String.fromCharCode(c);
517            }
518            else
519            {
520                  retVal = retVal + '&#' + c + ';';
521            }
522      }
523      
524      return retVal;
525}
526///////////////////////////////////////////////////////////////////////////////
527//
528//  default_error_handler:
529//
530//  Default error handling function 
531//
532///////////////////////////////////////////////////////////////////////////////
533
534Silverlight.default_error_handler = function (sender, args)
535{
536    var iErrorCode;
537    var errorType = args.ErrorType;
538
539    iErrorCode = args.ErrorCode;
540
541    var errMsg = "\nSilverlight error message     \n" ;
542
543    errMsg += "ErrorCode: "+ iErrorCode + "\n";
544
545
546    errMsg += "ErrorType: " + errorType + "       \n";
547    errMsg += "Message: " + args.ErrorMessage + "     \n";
548
549    if (errorType == "ParserError")
550    {
551        errMsg += "XamlFile: " + args.xamlFile + "     \n";
552        errMsg += "Line: " + args.lineNumber + "     \n";
553        errMsg += "Position: " + args.charPosition + "     \n";
554    }
555    else if (errorType == "RuntimeError")
556    {
557        if (args.lineNumber != 0)
558        {
559            errMsg += "Line: " + args.lineNumber + "     \n";
560            errMsg += "Position: " +  args.charPosition + "     \n";
561        }
562        errMsg += "MethodName: " + args.methodName + "     \n";
563    }
564    alert (errMsg);
565}
566
567///////////////////////////////////////////////////////////////////////////////////////////////
568//
569// __cleanup:
570//
571// Releases event handler resources when the page is unloaded
572//
573///////////////////////////////////////////////////////////////////////////////////////////////
574Silverlight.__cleanup = function ()
575{
576    for (var i = Silverlight._silverlightCount - 1; i >= 0; i--) {
577        window['__slEvent' + i] = null;
578    }
579    Silverlight._silverlightCount = 0;
580    if (window.removeEventListener) { 
581       window.removeEventListener('unload', Silverlight.__cleanup , false);
582    }
583    else { 
584        window.detachEvent('onunload', Silverlight.__cleanup );
585    }
586}
587
588///////////////////////////////////////////////////////////////////////////////////////////////
589//
590// __getHandlerName:
591//
592// Generates named event handlers for delegates.
593//
594///////////////////////////////////////////////////////////////////////////////////////////////
595Silverlight.__getHandlerName = function (handler)
596{
597    var handlerName = "";
598    if ( typeof handler == "string")
599    {
600        handlerName = handler;
601    }
602    else if ( typeof handler == "function" )
603    {
604        if (Silverlight._silverlightCount == 0)
605        {
606            if (window.addEventListener) 
607            {
608                window.addEventListener('onunload', Silverlight.__cleanup , false);
609            }
610            else 
611            {
612                window.attachEvent('onunload', Silverlight.__cleanup );
613            }
614        }
615        var count = Silverlight._silverlightCount++;
616        handlerName = "__slEvent"+count;
617        
618        window[handlerName]=handler;
619    }
620    else
621    {
622        handlerName = null;
623    }
624    return handlerName;
625}
626
627/* wmvplayer.js */
628/****************************************************************************
629* JW WMV Player version 1.1, created with M$ Silverlight 1.0
630*
631* This file contains all logic for the JW WMV Player. For a functional setup,
632* the following two files are also needed:
633* - silverlight.js (for instantiating the silverlight plugin)
634* - wmvplayer.xaml (or another XAML skin describing the player graphics)
635*
636* More info: http://www.jeroenwijering.com/?item=JW_WMV_Player
637****************************************************************************/
638if(typeof jeroenwijering == "undefined") {
639	var jeroenwijering = new Object();
640	jeroenwijering.utils = new Object();
641}
642
643
644
645
646
647
648
649
650
651
652/****************************************************************************
653* The player wrapper; loads config variables and starts MVC cycle.
654****************************************************************************/
655jeroenwijering.Player = function(cnt,src,cfg) {
656	this.controller;
657	this.model;
658	this.view;
659	this.configuration = {
660		backgroundcolor:'FFFFFF',
661		windowless:'false',
662		file:'',
663		height:'260',
664		image:'',
665		backcolor:'FFFFFF',
666		frontcolor:'000000',
667		lightcolor:'000000',
668		screencolor:'000000',
669		width:'320',
670		logo:'',
671		overstretch:'false',
672		shownavigation:'true',
673		showstop:'false',
674		showdigits:'true',
675		usefullscreen:'true',
676		usemute:'false',
677		autostart:'false',
678		bufferlength:'3',
679		duration:'0',
680		repeat:'false',
681		sender:'',
682		start:'0',
683		volume:'90',
684		link:'',
685		linkfromdisplay:'false',
686		linktarget:'_self'
687	};
688	for(itm in this.configuration) {
689		if(cfg[itm] != undefined) {
690			if (itm.indexOf('color') > 0) { 
691				this.configuration[itm] = cfg[itm].substr(cfg[itm].length-6);
692			} else {
693				this.configuration[itm] = cfg[itm];
694			}
695		}
696	}
697	Silverlight.createObjectEx({
698		source:src,
699		parentElement:cnt,
700		properties:{
701			width:this.configuration['width'],
702			height:this.configuration['height'],
703			version:'1.0',
704			inplaceInstallPrompt:true,
705			isWindowless:this.configuration['windowless'],
706			background:'#'+this.configuration['backgroundcolor']
707		},
708		events:{
709			onLoad:this.onLoadHandler,
710			onError:null
711		},
712		context:this
713	});
714}
715
716jeroenwijering.Player.prototype = {
717	addListener: function(typ,fcn) {
718		this.view.listeners.push({type:typ,func:fcn});
719	},
720
721	getConfig: function() { 
722		return this.configuration;
723	},
724
725	onLoadHandler: function(pid,tgt,sdr) {
726		tgt.configuration['sender'] = sdr;
727		tgt.controller = new jeroenwijering.Controller(tgt.configuration);
728		tgt.view = new jeroenwijering.View(tgt.configuration,tgt.controller);
729		tgt.model = new jeroenwijering.Model(tgt.configuration,tgt.controller,tgt.view
729);
730		tgt.controller.startMVC(tgt.view,tgt.model);
731	},
732
733	sendEvent: function(typ,prm) {
734		switch(typ.toUpperCase()) {
735			case 'LINK':
736				this.controller.setLink();
737				break;
738			case 'LOAD':
739				this.controller.setLoad(prm);
740				break;
741			case 'MUTE':
742				this.controller.setMute();
743				break;
744			case 'PLAY':
745				this.controller.setPlay();
746				break;
747			case 'SCRUB':
748				this.controller.setScrub(prm);
749				break;
750			case 'STOP':
751				this.controller.setStop();
752				break;
753			case 'VOLUME':
754				this.controller.setVolume(prm);
755				break;
756		}
757	}
758}
759
760
761
762
763
764
765
766
767
768
769/****************************************************************************
770* The controller of the player MVC triad, which processes all user input.
771****************************************************************************/
772jeroenwijering.Controller = function(cfg) {
773	this.configuration = cfg;
774}
775
776jeroenwijering.Controller.prototype = {
777	startMVC: function(vie,mdl) {
778		this.view = vie;
779		this.model = mdl;
780		if(this.configuration['usemute'] == 'true') {
781			this.view.onVolume(0);
782			this.view.onMute(true);
783			this.model.goVolume(0);
784		} else {
785			this.view.onVolume(this.configuration['volume']);
786			this.model.goVolume(this.configuration['volume']);
787		}
788		if(this.configuration['autostart'] == 'true') {
789			this.model.goStart();
790		} else { 
791			this.model.goPause();
792		}
793	},
794
795	setState: function(old,stt) {
796		this.state = stt;
797		var pos = this.configuration['start'];
798		if(old == 'Closed' && pos > 0) {
799			setTimeout(jeroenwijering.utils.delegate(this,this.setScrub),200,pos);
800		} 
801	},
802
803	setLink: function() {
804		if (this.configuration['linktarget'].indexOf('javascript:') == 0) {
805			return Function(this.configuration['linktarget']).apply();
806		} else if (this.configuration['linktarget'] == '_blank') {
807			window.open(this.configuration['link']);
808		} else if (this.configuration['linktarget'] != '') {
809			window.location = this.configuration['link'];
810		}
811	},
812
813	setLoad: function(fil) {
814		if(this.model.state != "Closed") {
815			this.model.goStop(); 
816		}
817		this.configuration['file'] = fil;
818		if(this.configuration['autostart'] == 'true') {
819			setTimeout(jeroenwijering.utils.delegate(this.model,this.model.goStart),100);
820		}
821	},
822
823	setMute: function() {
824		if(this.configuration['usemute'] == 'true') {
825			this.configuration['usemute'] = 'false';
826			this.model.goVolume(this.configuration['volume']);
827			this.view.onMute(false);
828		} else {
829			this.configuration['usemute'] = 'true';
830			this.model.goVolume(0);
831			this.view.onMute(true);
832		}
833	},
834
835	setPlay: function() {
836		if(this.state == 'Buffering' || this.state == 'Playing') {
837			if(this.configuration['duration'] == 0) { 
838				this.model.goStop();
839			} else { 
840				this.model.goPause();
841			}
842		} else {
843			this.model.goStart();
844		}
845	},
846
847	setScrub: function(sec) {
848		if(sec < 2) {
849			sec = 0;
850		} else if (sec > this.configuration['duration']-4) {
851			sec = this.configuration['duration']-4;
852		}
853		if(this.state == 'Buffering' || this.state == 'Playing') {
854			this.model.goStart(sec);
855		} else {
856			this.model.goPause(sec);
857		}
858	},
859
860	setStop: function() {
861		this.model.goStop();
862	},
863
864	setVolume: function(pct) {
865		if(pct < 0) { pct = 0; } else if(pct > 100) { pct = 100; }
866		this.configuration['volume'] = Math.round(pct);
867		this.model.goVolume(pct);
868		this.view.onVolume(pct);
869		if(this.configuration['usemute'] == 'true') {
870			this.configuration['usemute'] = 'false';
871			this.view.onMute(false);
872		} 
873	},
874
875	setFullscreen: function() {
876		var fss = !this.configuration['sender'].getHost().content.FullScreen;
877		this.configuration['sender'].getHost().content.FullScreen = fss;
878		jeroenwijering.utils.delegate(this.view,this.view.onFullscreen);
879	}
880}
881
882
883
884
885
886
887
888
889
890
891/****************************************************************************
892* The view of the player MVC triad, which manages the graphics.
893****************************************************************************/
894jeroenwijering.View = function(cfg,ctr) {
895	this.configuration = cfg;
896	this.listeners = Array();
897	this.controller = ctr;
898	this.fstimeout;
899	this.fslistener;
900	this.display = this.configuration['sender'].findName("PlayerDisplay");
901	this.controlbar = this.configuration['sender'].findName("PlayerControls");
902	this.configuration['sender'].getHost().content.onResize = 
903		jeroenwijering.utils.delegate(this,this.resizePlayer);
904	this.configuration['sender'].getHost().content.onFullScreenChange = 
905		jeroenwijering.utils.delegate(this,this.onFullscreen);
906	this.assignColorsClicks();
907	this.resizePlayer();
908}
909
910jeroenwijering.View.prototype = {
911	onBuffer: function(pct) {
912		var snd = this.configuration['sender'];
913		if(pct == 0) { 
914			snd.findName("BufferText").Text = null;
915		} else { 
916			pct < 10 ? pct = "0"+pct: pct = ""+pct;
917			snd.findName("BufferText").Text = pct;
918		}
919		this.delegate('BUFFER',[pct]);
920	},
921
922	onFullscreen: function(fss) {
923		var snd = this.configuration['sender'];
924		var fst = snd.getHost().content.FullScreen;
925		if(fst) { 
926			this.fstimeout = setTimeout(jeroenwijering.utils.delegate(this,
927				this.hideFSControls),2000);
928			this.fslistener = this.display.addEventListener('MouseMove',
929				jeroenwijering.utils.delegate(this,this.showFSControls));
930			snd.findName("FullscreenSymbol").Visibility = "Collapsed";
931			snd.findName("FullscreenOffSymbol").Visibility = "Visible";
932		} else {
933			clearTimeout(this.fstimeout);
934			this.display.removeEventListener("MouseMove",this.fslistener);
935			this.controlbar.Visibility = "Visible";
936			this.display.Cursor = "Hand";
937			snd.findName("FullscreenSymbol").Visibility = "Visible";
938			snd.findName("FullscreenOffSymbol").Visibility = "Collapsed";
939		}
940		this.resizePlayer();
941		this.delegate('FULLSCREEN');
942	},
943
944	showFSControls: function(sdr,arg) {
945		var vbt = sdr.findName('PlayerControls');
946		var yps = arg.GetPosition(vbt).Y;
947		clearTimeout(this.fstimeout);
948		this.controlbar.Visibility = "Visible";
949		this.display.Cursor = "Hand";
950		if(yps < 0) { 
951			this.fstimeout = setTimeout(jeroenwijering.utils.delegate(this,
952				this.hideFSControls),2000);
953		}
954	},
955
956	hideFSControls: function() {
957		this.controlbar.Visibility = "Collapsed";
958		this.display.Cursor = "None";
959	},
960
961	onLoad: function(pct) {
962		var snd = this.configuration['sender'];
963		var max = snd.findName("TimeSlider").Width;
964		snd.findName("DownloadProgress").Width = Math.round(max*pct/100);
965		this.delegate('LOAD',[pct]);
966	},
967
968	onMute: function(mut) {
969		var snd = this.configuration['sender'];
970		this.configuration['usemute'] = ''+mut;
971		if(mut) {
972			snd.findName("VolumeHighlight").Visibility = "Collapsed";
973			snd.findName("MuteSymbol").Visibility = "Visible";
974			snd.findName("MuteOffSymbol").Visibility = "Collapsed";
975			if(this.state == 'Playing') {
976				snd.findName("MuteIcon").Visibility = "Visible";
977			}
978		} else {
979			snd.findName("VolumeHighlight").Visibility = "Visible";
980			snd.findName("MuteSymbol").Visibility = "Collapsed";
981			snd.findName("MuteOffSymbol").Visibility = "Visible";
982			snd.findName("MuteIcon").Visibility = "Collapsed";
983		}
984		this.delegate('MUTE');
985	},
986
987	onState: function(old,stt) {
988		var snd = this.configuration['sender'];
989		this.state = stt;
990		if(stt == 'Buffering' || stt == 'Playing' || stt == 'Opening') {
991			snd.findName("PlayIcon").Visibility = "Collapsed";
992			snd.findName("PlaySymbol").Visibility = "Collapsed";
993			snd.findName("PlayOffSymbol").Visibility = "Visible";
994			if (stt=='Playing') {
995				snd.findName("BufferIcon").Visibility = "Collapsed";
996				snd.findName("BufferText").Visibility = "Collapsed";
997				if(this.configuration['usemute'] == 'true') {
998					snd.findName("MuteIcon").Visibility = "Visible";
999				}
1000			} else{
1001				snd.findName("BufferIcon").Visibility = "Visible";
1002				snd.findName("BufferText").Visibility = "Visible";
1003			}
1004		} else { 
1005			snd.findName("MuteIcon").Visibility = "Collapsed";
1006			snd.findName("BufferIcon").Visibility = "Collapsed";
1007			snd.findName("BufferText").Visibility = "Collapsed";
1008			snd.findName("PlayOffSymbol").Visibility = "Collapsed";
1009			snd.findName("PlaySymbol").Visibility = "Visible";
1010			if(this.configuration['linkfromdisplay'] == 'true') {
1011				snd.findName("PlayIcon").Visibility = "Collapsed";
1012			} else { 
1013				snd.findName("PlayIcon").Visibility = "Visible";
1014			}
1015		}
1016		try {
1017			if(!(old == 'Completed' && stt == 'Buffering') &&
1018				!(old == 'Buffering' && stt == 'Paused')) {
1019				playerStatusChange(old.toUpperCase(),stt.toUpperCase());
1020			}
1021		} catch (err) {}
1022		this.delegate('STATE',[old,stt]);
1023	},
1024
1025	onTime: function(elp,dur) {
1026		var snd = this.configuration['sender'];
1027		var snd = this.configuration['sender'];
1028		var max = snd.findName("TimeSlider").Width;
1029		if(dur > 0) {
1030			var pos = Math.round(max*elp/dur);
1031			this.configuration['duration'] = dur;
1032			snd.findName("ElapsedText").Text = jeroenwijering.utils.timestring(elp);
1033			snd.findName("RemainingText").Text = jeroenwijering.utils.timestring(dur-elp);
1034			snd.findName("TimeSymbol").Visibility = "Visible";
1035			snd.findName("TimeSymbol")['Canvas.Left'] = pos+4;
1036			snd.findName("TimeHighlight").Width = pos-2;
1037		} else  { 
1038			snd.findName("TimeSymbol").Visibility = "Collapsed";
1039		}
1040		this.delegate('TIME',[elp,dur]);
1041	},
1042
1043	onVolume: function(pct) {
1044		var snd = this.configuration['sender'];
1045		snd.findName("VolumeHighlight").Width = Math.round(pct/5);
1046		this.delegate('VOLUME',[pct]);
1047	},
1048
1049	assignColorsClicks: function() {
1050		this.display.Cursor = "Hand";
1051		this.display.Background = "#FF"+this.configuration['screencolor'];
1052		if(this.configuration['linkfromdisplay'] == 'false') { 
1053			this.display.addEventListener('MouseLeftButtonUp',
1054				jeroenwijering.utils.delegate(this.controller,
1055				this.controller.setPlay));
1056		} else { 
1057			this.display.addEventListener('MouseLeftButtonUp',
1058				jeroenwijering.utils.delegate(this.controller,
1059				this.controller.setLink));
1060			this.display.findName("PlayIcon").Visibility = "Collapsed";
1061		}
1062		if(this.configuration['logo'] != '') {
1063			this.display.findName('OverlayCanvas').Visibility = "Visible";
1064			this.display.findName('OverlayLogo').ImageSource = 
1065				this.configuration['logo'];
1066		}
1067		this.controlbar.findName("ControlbarBack").Fill = 
1068			"#FF"+this.configuration['backcolor'];
1069		this.assignButton('Play',this.controller.setPlay);
1070		this.assignButton('Stop',this.controller.setStop);
1071		this.configuration['sender'].findName('ElapsedText').Foreground = 
1072			"#FF"+this.configuration['frontcolor'];
1073		this.assignSlider('Time',this.changeTime);
1074		this.configuration['sender'].findName('DownloadProgress').Fill = 
1075			"#FF"+this.configuration['frontcolor'];
1076		this.configuration['sender'].findName('RemainingText').Foreground = 
1077			"#FF"+this.configuration['frontcolor'];
1078		this.assignButton('Link',this.controller.setLink);
1079		this.assignButton('Fullscreen',this.controller.setFullscreen);
1080		this.assignButton('Mute',this.controller.setMute);
1081		this.assignSlider('Volume',this.changeVolume);
1082	},
1083
1084	assignButton: function(btn,act) {
1085		var el1 = this.configuration['sender'].findName(btn+'Button');
1086		el1.Cursor = "Hand";
1087		el1.addEventListener('MouseLeftButtonUp',
1088			jeroenwijering.utils.delegate(this.controller,act));
1089		el1.addEventListener('MouseEnter',
1090			jeroenwijering.utils.delegate(this,this.rollOver));
1091		el1.addEventListener('MouseLeave',
1092			jeroenwijering.utils.delegate(this,this.rollOut));
1093		this.configuration['sender'].findName(btn+'Symbol').Fill = 
1094			"#FF"+this.configuration['frontcolor'];
1095		try {
1096			this.configuration['sender'].findName(btn+'OffSymbol').Fill = 
1097				"#FF"+this.configuration['frontcolor'];
1098		} catch(e) {}
1099	},
1100
1101	assignSlider: function(sld,act) {
1102		var el1 = this.configuration['sender'].findName(sld+'Button');
1103		el1.Cursor = "Hand";
1104		el1.addEventListener('MouseLeftButtonUp',
1105			jeroenwijering.utils.delegate(this,act));
1106		el1.addEventListener('MouseEnter',
1107			jeroenwijering.utils.delegate(this,this.rollOver));
1108		el1.addEventListener('MouseLeave',
1109			jeroenwijering.utils.delegate(this,this.rollOut));
1110		this.configuration['sender'].findName(sld+'Slider').Fill = 
1111			"#FF"+this.configuration['frontcolor'];
1112		this.configuration['sender'].findName(sld+'Highlight').Fill = 
1113			"#FF"+this.configuration['frontcolor'];
1114		this.configuration['sender'].findName(sld+'Symbol').Fill = 
1115			"#FF"+this.configuration['frontcolor'];
1116	},
1117
1118	delegate: function(typ,arg) {
1119		for(var i=0; i<this.listeners.length; i++) {
1120			if(this.listeners[i]['type'].toUpperCase() == typ) {
1121				this.listeners[i]['func'].apply(null,arg);
1122			}
1123		}
1124	},
1125
1126	rollOver: function(sdr) {
1127		var str = sdr.Name.substr(0,sdr.Name.length-6);
1128		this.configuration['sender'].findName(str+'Symbol').Fill = 
1129			"#FF"+this.configuration['lightcolor'];
1130		try {
1131			this.configuration['sender'].findName(str+'OffSymbol').Fill = 
1132				"#FF"+this.configuration['lightcolor'];
1133		} catch(e) {}
1134	},
1135
1136	rollOut: function(sdr) {
1137		var str = sdr.Name.substr(0,sdr.Name.length-6);
1138		this.configuration['sender'].findName(str+'Symbol').Fill = 
1139			"#FF"+this.configuration['frontcolor'];
1140		try {
1141			this.configuration['sender'].findName(str+'OffSymbol').Fill = 
1142				"#FF"+this.configuration['frontcolor'];
1143		} catch(e) {}
1144	},
1145
1146	changeTime: function(sdr,arg) {
1147		var tbt = sdr.findName('TimeSlider');
1148		var xps = arg.GetPosition(tbt).X;
1149		var sec = Math.floor(xps/tbt.Width*this.configuration['duration']);
1150		this.controller.setScrub(sec);
1151	},
1152
1153	changeVolume: function(sdr,arg) {
1154		var vbt = sdr.findName('VolumeButton');
1155		var xps = arg.GetPosition(vbt).X;
1156		this.controller.setVolume(xps*5);
1157	},
1158
1159	resizePlayer: function() {
1160		var wid = this.configuration['sender'].getHost().content.actualWidth;
1161		var hei = this.configuration['sender'].getHost().content.actualHeight;
1162		var fss = this.configuration['sender'].getHost().content.FullScreen;
1163		if(this.configuration['shownavigation'] == 'true') {
1164			if(fss == true) {
1165				this.resizeDisplay(wid,hei);
1166				this.controlbar['Canvas.Left'] = Math.round(wid/2-250);
1167				this.resizeControlbar(500,hei-this.controlbar.Height-16);
1168				this.controlbar.findName('ControlbarBack')['Opacity'] = 0.5;
1169			} else { 
1170				this.resizeDisplay(wid,hei-20);
1171				this.controlbar['Canvas.Left'] = 0;
1172				this.resizeControlbar(wid,hei-this.controlbar.Height);
1173				this.controlbar.findName('ControlbarBack')['Opacity'] = 1;
1174			}
1175		} else {
1176			this.resizeDisplay(wid,hei);
1177		}
1178	},
1179
1180	resizeDisplay: function(wid,hei) {
1181		this.stretchElement('PlayerDisplay',wid,hei);
1182		this.stretchElement('VideoWindow',wid,hei);
1183		this.stretchElement('PlaceholderImage',wid,hei);
1184		this.centerElement('PlayIcon',wid,hei);
1185		this.centerElement('MuteIcon',wid,hei);
1186		this.centerElement('BufferIcon',wid,hei);
1187		this.centerElement('BufferText',wid,hei);
1188		this.display.findName('OverlayCanvas')['Canvas.Left'] = wid -
1189			this.display.findName('OverlayCanvas').Width - 10;
1190		this.display.Visibility = "Visible";
1191	},
1192
1193	resizeControlbar: function(wid,yps,alp) {
1194		this.controlbar['Canvas.Top'] = yps;
1195		this.stretchElement('PlayerControls',wid);
1196		this.stretchElement('ControlbarBack',wid);
1197		this.placeElement('PlayButton',0);
1198		var lft = 17;
1199		this.placeElement('VolumeButton',wid-24);
1200		this.placeElement('MuteButton',wid-37);
1201		var rgt = 37;
1202		if(this.configuration['showstop'] == 'true') {
1203			this.placeElement('StopButton',lft);
1204			lft += 17;
1205		} else {
1206			this.controlbar.findName('StopButton').Visibility="Collapsed";
1207		}
1208		if(this.configuration['usefullscreen'] == 'true') {
1209			rgt += 18;
1210			this.placeElement('FullscreenButton',wid-rgt);
1211		} else {
1212			this.controlbar.findName('FullscreenButton').Visibility = 
1213				"Collapsed";
1214		}
1215		if(this.configuration['link'] != '') {
1216			rgt += 18;
1217			this.placeElement('LinkButton',wid-rgt);
1218		} else {
1219			this.controlbar.findName('LinkButton').Visibility="Collapsed";
1220		}
1221		if(this.configuration['showdigits'] == 'true' && wid-rgt-lft> 160) {
1222			rgt += 35;
1223			this.controlbar.findName('RemainingButton').Visibility="Visible";
1224			this.controlbar.findName('ElapsedButton').Visibility="Visible";
1225			this.placeElement('RemainingButton',wid-rgt);
1226			this.placeElement('ElapsedButton',lft);
1227			lft +=35;
1228		} else {
1229			this.controlbar.findName('RemainingButton').Visibility = 
1230				"Collapsed";
1231			this.controlbar.findName('ElapsedButton').Visibility="Collapsed";
1232		}
1233		this.placeElement('TimeButton',lft);
1234		this.stretchElement('TimeButton',wid-lft-rgt);
1235		this.stretchElement('TimeShadow',wid-lft-rgt);
1236		this.stretchElement('TimeStroke',wid-lft-rgt);
1237		this.stretchElement('TimeFill',wid-lft-rgt);
1238		this.stretchElement('TimeSlider',wid-lft-rgt-10);
1239		this.stretchElement('DownloadProgress',wid-lft-rgt-10);
1240		var tsb = this.configuration['sender'].findName('TimeSymbol');
1241		this.stretchElement('TimeHighlight',tsb['Canvas.Left']-5);
1242		this.controlbar.Visibility = "Visible";
1243	},
1244
1245	centerElement: function(nam,wid,hei) {
1246		var elm = this.configuration['sender'].findName(nam);
1247		elm['Canvas.Left'] = Math.round(wid/2 - elm.Width/2);
1248		elm['Canvas.Top'] = Math.round(hei/2 - elm.Height/2);
1249	},
1250
1251	stretchElement: function(nam,wid,hei) {
1252		var elm = this.configuration['sender'].findName(nam);
1253		elm.Width = wid;
1254		if (hei != undefined) { elm.Height = hei; }
1255	},
1256
1257	placeElement: function(nam,xps,yps) {
1258		var elm = this.configuration['sender'].findName(nam);
1259		elm['Canvas.Left'] = xps;
1260		if(yps) { elm['Canvas.Top'] = yps; }
1261	}
1262}
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273/****************************************************************************
1274* The model of the player MVC triad, which stores all playback logic.
1275****************************************************************************/
1276jeroenwijering.Model = function(cfg,ctr,vie) {
1277	this.configuration = cfg;
1278	this.controller = ctr;
1279	this.view = vie;
1280	this.video = this.configuration['sender'].findName("VideoWindow");
1281	this.preview = this.configuration['sender'].findName("PlaceholderImage");
1282	var str = {
1283		'true':'UniformToFill',
1284		'false':'Uniform',
1285		'fit':'Fill',
1286		'none':'None'
1287	}
1288	this.state = this.video.CurrentState;
1289	this.timeint;
1290	this.video.Stretch = str[this.configuration['overstretch']];
1291	this.preview.Stretch = str[this.configuration['overstretch']];
1292	this.video.BufferingTime = 
1293		jeroenwijering.utils.spanstring(this.configuration['bufferlength']);
1294	this.video.AutoPlay = true;
1295	this.video.AddEventListener("CurrentStateChanged",
1296		jeroenwijering.utils.delegate(this,this.stateChanged));
1297	this.video.AddEventListener("MediaEnded",
1298		jeroenwijering.utils.delegate(this,this.mediaEnded));
1299	this.video.AddEventListener("BufferingProgressChanged",
1300		jeroenwijering.utils.delegate(this,this.bufferChanged));
1301	this.video.AddEventListener("DownloadProgressChanged",
1302		jeroenwijering.utils.delegate(this,this.downloadChanged));
1303	if(this.configuration['image'] != '') {
1304		this.preview.Source = this.configuration['image'];
1305	}
1306}
1307
1308jeroenwijering.Model.prototype = {
1309	goPause: function(sec) {
1310		this.video.pause();
1311		if(!isNaN(sec)) {
1312			this.video.Position = jeroenwijering.utils.spanstring(sec);
1313		}
1314		this.timeChanged();
1315	},
1316
1317	goStart: function(sec) {
1318		this.video.Visibility = 'Visible';
1319		this.preview.Visibility = 'Collapsed';
1320		if(this.state == "Closed") {
1321			this.video.Source = this.configuration['file'];
1322		} else {
1323			this.video.play();
1324		}
1325		if(!isNaN(sec)) {
1326			this.video.Position = jeroenwijering.utils.spanstring(sec);
1327		}
1328	},
1329
1330	goStop: function() {
1331		this.video.Visibility = 'Collapsed';
1332		this.preview.Visibility = 'Visible';
1333		this.goPause(0);
1334		this.video.Source = 'null';
1335		this.view.onBuffer(0);
1336		clearInterval(this.timeint);
1337	},
1338
1339	goVolume: function(pct) {
1340		this.video.Volume = pct/100;
1341	},
1342
1343	stateChanged: function() {
1344		var stt = this.video.CurrentState;
1345		if(stt != this.state) {
1346			this.controller.setState(this.state,stt);
1347			this.view.onState(this.state,stt);
1348			this.state = stt;
1349			this.configuration['duration'] = 
1350				Math.round(this.video.NaturalDuration.Seconds*10)/10;
1351			if(stt != "Playing" && stt != "Buffering" && stt != "Opening") {
1352				clearInterval(this.timeint);
1353			} else {
1354				this.timeint = setInterval(jeroenwijering.utils.delegate(
1355					this,this.timeChanged),100);
1356			}
1357		}
1358	},
1359
1360	mediaEnded: function() {
1361		if(this.configuration['repeat'] == 'true') {
1362			this.goStart(0);
1363		} else {
1364			this.state = 'Completed';
1365			this.view.onState(this.state,'Completed');
1366			this.video.Visibility = 'Collapsed';
1367			this.preview.Visibility = 'Visible';
1368			this.goPause(0);
1369		}
1370	},
1371
1372	bufferChanged: function() {
1373		var bfr = Math.round(this.video.BufferingProgress*100);
1374		this.view.onBuffer(bfr);
1375	},
1376
1377	downloadChanged: function() {
1378		var dld = Math.round(this.video.DownloadProgress*100);
1379		this.view.onLoad(dld);
1380	},
1381
1382	timeChanged: function() {
1383		var pos = Math.round(this.video.Position.Seconds*10)/10;
1384		this.view.onTime(pos,this.configuration['duration']);
1385	}
1386}
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397/****************************************************************************
1398* Some utility functions.
1399****************************************************************************/
1400jeroenwijering.utils.delegate = function(obj,fcn) {
1401	return function() {
1402		return fcn.apply(obj,arguments);
1403	}
1404}
1405jeroenwijering.utils.timestring = function(stp) {
1406	var hrs = Math.floor(stp/3600);
1407	var min = Math.floor(stp%3600/60);
1408	var sec = Math.round(stp%60);
1409	var str = "";
1410	sec > 9 ? str += sec: str +='0'+sec;
1411	min > 9 ? str = min+":"+str: str='0'+min+":"+str;
1412	hrs > 0 ? str = hrs+":"+str: null;
1413	return str;
1414}
1415jeroenwijering.utils.spanstring = function(stp) {
1416	var hrs = Math.floor(stp/3600);
1417	var min = Math.floor(stp%3600/60);
1418	var sec = Math.round(stp%60*10)/10;
1419	var str = hrs+':'+min+':'+sec;
1420	return str;
1421}
1422
1423/* AC_QuickTime.js */
1424/*��File: AC_QuickTime.js��Abstract: This file contains functions to generate OBJECT and EMBED tags for QuickTime content.��Version: <1.1>��Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple�Computer, Inc. ("Apple") in consideration of your agreement to the�following terms, and your use, installation, modification or�redistribution of this Apple software constitutes acceptance of these�terms.  If you do not agree with these terms, please do not use,�install, modify or redistribute this Apple software.��In consideration of your agreement to abide by the following terms, and�subject to these terms, Apple grants you a personal, non-exclusive�license, under Apple's copyrights in this original Apple software (the�"Apple Software"), to use, reproduce, modify and redistribute the Apple�Software, with or without modifications, in source and/or binary forms;�provided that if you redistribute the Apple Software in its entirety and�without modifications, you must retain this notice and the following�text and disclaimers in all such redistributions of the Apple Software.�Neither the name, trademarks, service marks or logos of Apple Computer,�Inc. may be used to endorse or promote products derived from the Apple�Software without specific prior written permission from Apple.  Except�as expressly stated in this notice, no other rights or licenses, express�or implied, are granted by Apple herein, including but not limited to�any patent rights that may be infringed by your derivative works or by�other works in which the Apple Software may be incorporated.��The Apple Software is provided by Apple on an "AS IS" basis.  APPLE�MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION�THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS�FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND�OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.��IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL�OR CONSEQUENTIAL DAMAGES (
1424INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF�SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS�INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,�MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED�AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),�STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE�POSSIBILITY OF SUCH DAMAGE.��Copyright © 2006 Apple Computer, Inc., All Rights Reserved��*/��/*� * This file contains functions to generate OBJECT and EMBED tags for QuickTime content.� */��/************** LOCALIZABLE GLOBAL VARIABLES ****************/��var gArgCountErr =	'The "%%" function requires an even number of arguments.'�				+	'\nArguments should be in the form "atttributeName", "attributeValue", ...';��/******************** END LOCALIZABLE **********************/��var gTagAttrs				= null;�var gQTGeneratorVersion		= 1.0;��function AC_QuickTimeVersion()	{ return gQTGeneratorVersion; }��function _QTComplain(callingFcnName, errMsg)�{�    errMsg = errMsg.replace("%%", callingFcnName);�	alert(errMsg);�}��function _QTAddAttribute(prefix, slotName, tagName)�{�	var		value;��	value = gTagAttrs[prefix + slotName];�	if ( null == value )�		value = gTagAttrs[slotName];��	if ( null != value )�	{�		if ( 0 == slotName.indexOf(prefix) && (null == tagName) )�			tagName = slotName.substring(prefix.length);�		if ( null == tagName )�			tagName = slotName;�		return '' + tagName + '="' + value + '"';�	}�	else�		return "";�}��function _QTAddObjectAttr(slotName, tagName)�{�	// don't bother if it is only for the embed tag�	if ( 0 == slotName.indexOf("emb#") )�		return "";��	if ( 0 == slotName.indexOf("obj#") && (null == tagName) )�		tagName = slotName.substring(4);��	return _QTAddAttribute("obj#", slotName, tagName);�}��function _QTAddEmbedAttr(slotName, tagName)�{�	// don't bother if it is only for the object tag�	if ( 0 == slotName.indexOf("obj#") )�		return "";��	if ( 0 == slotName.indexOf("emb#") && (null == tagName) )�		tagName = slotName.substring(4);��	return _QTAddAttribute("emb#", slotName, tagName);�}���function _QTAddObjectParam(slotName, generateXHTML)�{�	var		paramValue;�	var		paramStr = "";�	var		endTagChar = (generateXHTML) ? ' />' : '>';��	if ( -1 == slotName.indexOf("emb#") )�	{�		// look for the OBJECT-only param first. if there is none, look for a generic one�		paramValue = gTagAttrs["obj#" + slotName];�		if ( null == paramValue )�			paramValue = gTagAttrs[slotName];��		if ( 0 == slotName.indexOf("obj#") )�			slotName = slotName.substring(4);��		if ( null != paramValue )�			paramStr = '<param name="' + slotName + '" value="' + paramValue + '"' + endTagChar;�	}��	return paramStr;�}��function _QTDeleteTagAttrs()�{�	for ( var ndx = 0; ndx < arguments.length; ndx++ )�	{�		var attrName = arguments[ndx];�		delete gTagAttrs[attrName];�		delete gTagAttrs["emb#" + attrName];�		delete gTagAttrs["obj#" + attrName];�	}�}����// generate an embed and object tag, return as a string�function _QTGenerate(callingFcnName, generateXHTML, args)�{�	// is the number of optional arguments even?�	if ( args.length < 4 || (0 != (args.length % 2)) )�	{�		_QTComplain(callingFcnName, gArgCountErr);�		return "";�	}��	// allocate an array, fill in the required attributes with fixed place params and defaults�	gTagAttrs = new Object();�	gTagAttrs["src"] = args[0];�	gTagAttrs["width"] = args[1];�	gTagAttrs["height"] = args[2];�	gTagAttrs["classid"] = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";�		//Impportant note: It is recommended that you use this exact classid in order to ensure a seamless experience for all viewers�	gTagAttrs["pluginspage"] = "http://www.apple.com/quicktime/download/";��	// set up codebase attribute with specified or default version before parsing args so�	//  anything passed in will override�	var activexVers = args[3]�	if ( (null == activexVers) || ("" == activexVers) )�		activexVers = "6,0,2,0";�	gTagAttrs["codebase"] = "http://www.apple.com/qtactivex/qtplugin.cab#version=" + activexVers;��	var	attrName,�		attrValue;��	// add all of the optional attributes to the array�	for ( var ndx = 4; ndx < args.length; ndx += 2)�	{�		attrName = args[ndx].toLowerCase();�		attrValue = args[ndx + 1];��		// "name" and "id" should have the same value, the former goes in the embed and the later goes in�		//  the object. use one array slot�		if ( "name" == attrName || "id" == attrName )�			gTagAttrs["name"] = attrValue;��		else�			gTagAttrs[attrName] = attrValue;�	}��	// init both tags with the required and "special" attributes�	var objTag =  '<object '�					+ _QTAddObjectAttr("classid")�					+ _QTAddObjectAttr("width")�					+ _QTAddObjectAttr("height")�					+ _QTAddObjectAttr("codebase")�					+ _QTAddObjectAttr("name", "id")�					+ _QTAddObjectAttr("tabindex")�					+ _QTAddObjectAttr("hspace")�					+ _QTAddObjectAttr("vspace")�					+ _QTAddObjectAttr("border")�					+ _QTAddObjectAttr("align")�					+ _QTAddObjectAttr("class")�					+ _QTAddObjectAttr("title")�					+ _QTAddObjectAttr("accesskey")�					+ _QTAddObjectAttr("noexternaldata")�					+ '>'�					+ _QTAddObjectParam("src", generateXHTML);�	var embedTag = '<embed '�					+ _QTAddEmbedAttr("src")�					+ _QTAddEmbedAttr("width")�					+ _QTAddEmbedAttr("height")�					+ _QTAddEmbedAttr("pluginspage")�					+ _QTAddEmbedAttr("name")�					+ _QTAddEmbedAttr("align")�					+ _QTAddEmbedAttr("tabindex");��	// delete the attributes/params we have already added�	_QTDeleteTagAttrs("src","width","height","pluginspage","classid","codebase","name","tabindex",�					"hspace","vspace","border","align","noexternaldata","class","title","accesskey");��	// and finally, add all of the remaining attributes to the embed and object�	for ( var attrName in gTagAttrs )�	{�		attrValue = gTagAttrs[attrName];�		if ( null != attrValue )�		{�			embedTag += _QTAddEmbedAttr(attrName);�			objTag += _QTAddObjectParam(attrName, generateXHTML);�		}�	}��	// end both tags, we're done�	return objTag + embedTag + '></em' + 'bed></ob' + 'ject' + '>';�}��// return the object/embed as a string�function QT_GenerateOBJECTText()�{�	return _QTGenerate("QT_GenerateOBJECTText", false, arguments);�}��function QT_GenerateOBJECTText_XHTML()�{�	return _QTGenerate("QT_GenerateOBJECTText_XHTML", true, arguments);�}��function QT_WriteOBJECT()�{�	document.writeln(_QTGenerate("QT_WriteOBJECT", false, arguments));�}��function QT_WriteOBJECT_XHTML()�{�	document.writeln(_QTGenerate("QT_WriteOBJECT_XHTML", true, arguments));�}��
1425

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.