
bbcjs.trace("<b><font color=green>jst_plugins.js</font> was included.</b>",2);
bbcjs.plugins = new Object();
bbcjs.plugins.prototype = new bbcjs.Module("plugins", 1, "$Revision: 1.63 $", "$Date: 2006/10/05 16:05:49 $");
bbcjs.plugins.flash = false;
bbcjs.plugins.flashVersion = -1;
bbcjs.plugins.numFlashMovies = 0;
bbcjs.plugins.real = false;
bbcjs.plugins.realVersion = -1;
bbcjs.plugins.numRealmediaMovies = 0;
bbcjs.plugins.quicktime = false;
bbcjs.plugins.quicktimeVersion = -1;
bbcjs.plugins.numQuicktimeMovies = 0;
bbcjs.plugins.shockwave = false;
bbcjs.plugins.shockwaveVersion = -1;
bbcjs.plugins.numShockwaveMovies = 0;
bbcjs.plugins.numWindowsMedia = 0;
bbcjs.plugins.noPluginMsg =
bbcjs.plugins.noflashStr = bbcjs.plugins.noquicktimeStr = bbcjs.plugins.norealStr = bbcjs.plugins.noshockwaveStr = bbcjs.plugins.noWMPString =
"<p>You are trying to view {name} content, but you have no {name} plugin installed.</p>" +
"<p>To find out how to install a {name} plugin, go to the {wwguide}.</p>";
bbcjs.plugins.lowversionStr = "<p>The {name} content you are trying to view requires {name} plugin version {version}, whilst this computer seems to " +
"only have version {detected}. In order to view this content you must upgrade your {name} " +
"plugin.</p><p>For help upgrading your plugin, please visit the {wwguide}.</p>";
bbcjs.plugins.wwguides = {
flash : '<a href="/webwise/askbruce/articles/download/howdoidownloadflashplayer_1.shtml" onclick="return wwguide(\'flash\');">WebWise Flash install guide</a>',
quicktime : '<a href="/webwise/askbruce/articles/download/whatpluginsdoineed_1.shtml" onclick="return wwguide(\'quicktime\');">WebWise Quicktime install guide</a>',
real : '<a href="/webwise/askbruce/articles/download/howdoidownloadrealplayer_1.shtml" onclick="return wwguide(\'real\');">WebWise RealPlayer install guide</a>',
shockwave : '<a href="/webwise/askbruce/articles/download/whatpluginsdoineed_1.shtml" onclick="return wwguide(\'shockwave\');">WebWise Shockwave install guide</a>',
wmp : '<a href="/webwise/categories/plug/winmedia/winmedia.shtml?intro" onclick="return wwguide(\'winmedia\');">WebWise Windows Media Player install guide</a>'
};
bbcjs.plugins.checkActivexVersions = function (progid, versionCeiling)
{
var highestVersion = -1;
var objectString;
for (var i=0; i<=versionCeiling; i++)
{
objectString = (versionCeiling > 0)? progid + i : progid;
if (this.checkActivexObject(objectString)) highestVersion = i;
}
return highestVersion;
};
bbcjs.plugins.checkActivexObject = function (progid)
{
objectSuccess = false; 
objectString = progid; 
if (execScript) execScript('On Error Resume Next: objectSuccess = IsObject(CreateObject(objectString))','VBScript');
if (objectSuccess) bbcjs.trace("<code>"+objectString+"</code> detected",5);
return objectSuccess;
};
bbcjs.plugins.checkNavigatorPluginVersions = function (name, field, versionRegexp)
{
var highestVersion = -1;
var currentField;
var currentVersion;
var versionMatch;
for (var i=0; i<navigator.plugins.length; i++)
{
currentField = navigator.plugins[i][field];
if (this.checkNavigatorPlugin(name, currentField))
{
versionMatch = currentField.match(versionRegexp);
currentVersion = (versionMatch)? versionMatch[1] : 0;
if (currentVersion > highestVersion) highestVersion = currentVersion;
}
}
return highestVersion;
};
bbcjs.plugins.checkNavigatorPlugin = function (name, field)
{
var pluginSuccess = (field.indexOf(name) > -1)? true : false;
if (pluginSuccess) bbcjs.trace('<code>'+field+'</code> detected',5);
return pluginSuccess;
};
bbcjs.plugins.checkPluginVersions = function (name, field, versionRegexp, progid, versionMax)
{
if (navigator.plugins && navigator.plugins.length)
{
return this.checkNavigatorPluginVersions(name, field, versionRegexp);
}
else
{
return this.checkActivexVersions(progid, versionMax);
}
};
bbcjs.plugins.getFlashVersion = function ()
{
var versionRegexp = /\w+ \w+ (\d)\./; 
this.flashVersion = this.checkPluginVersions("Flash", "description", versionRegexp, "ShockwaveFlash.ShockwaveFlash.", 20);
this.flash = this.flashVersion > -1;
bbcjs.trace((this.flash)? "<b>Flash "+this.flashVersion+"</b> detected" : "No Flash detected", 3);
return this.flashVersion;
};
bbcjs.plugins.getQuicktimeVersion = function ()
{
var versionRegexp = /\w+ [a-zA-z\-]+ (\d)\./; 
this.quicktimeVersion = this.checkPluginVersions("QuickTime", "name", versionRegexp, "QuickTime.QuickTime.", 6);
this.quicktime = this.quicktimeVersion > -1;
bbcjs.trace((this.quicktime)? "<b>Quicktime "+this.quicktimeVersion+"</b> detected" : "No Quicktime detected" ,3);
return this.quicktimeVersion;
};
bbcjs.plugins.getRealVersion = function ()
{
var versionRegexp = null; 
this.realVersion = this.checkPluginVersions("Real", "description", versionRegexp, "rmocx.RealPlayer G2 Control", 0);
this.real = this.realVersion > -1;
bbcjs.trace((this.real)? "<b>Realplayer G2</b> detected" : "No Realplayer detected" , 3);
return this.realVersion;
};
bbcjs.plugins.getShockwaveVersion = function ()
{
var versionRegexp = /\w (\d+)\./; 
this.shockwaveVersion = this.checkPluginVersions("Macromedia Shockwave", "description", versionRegexp, "SWCtl.SWCtl.", 10);
this.shockwave = this.shockwaveVersion > -1;
bbcjs.trace((this.shockwave)? "<b>Shockwave "+this.shockwaveVersion+"</b> detected" : "No Shockwave detected" ,3);
return this.shockwaveVersion;
};
bbcjs.plugins.getWindowsMediaVersion = function ()
{
var versionRegexp = /(\d)/;
this.wmpVersion = this.checkPluginVersions("Windows Media", "name", versionRegexp, "WMPlayer.OCX.", 10);
this.wmp = this.wmpVersion > -1;
return this.wmpVersion;
};
var GLOB = Object.extend( {PLUGINS_AUTO_DETECT : true}, GLOB);
if (GLOB.PLUGINS_AUTO_DETECT)
{
bbcjs.plugins.getFlashVersion();
bbcjs.plugins.getQuicktimeVersion();
bbcjs.plugins.getRealVersion();
bbcjs.plugins.getShockwaveVersion();
bbcjs.plugins.getWindowsMediaVersion();
}
bbcjs.plugins.generateObjectTag = function (data)
{
var s = '';
var o = data.object;
if (o)
{
s += '<object';
for (var a in o)
{
if (typeof(o[a]) != 'object' && (o[a] !== '')) s += (' ' + a + '="' + o[a] + '"');
}
s += '>\n';
for (var p in o.params)
{
if (o.params[p].toString() !== '') s += ('\t<param name="' + p + '" value="' + o.params[p].toString() + '" />\n');
}
s += this.generateEmbedTag(data);
s += '</object>\n';
bbcjs.trace('<xmp>'+s+'</xmp>', 3);
}
return s;
};
bbcjs.plugins.generateEmbedTag = function (data)
{
var s = '';
var e = data.embed;
if (e)
{
s += '\t<embed';
for (var a in e)
{
if (e[a].toString() !== '') s += (' ' + a + '="' + e[a].toString() + '"');
}
s += '></embed>\n';
bbcjs.trace('<xmp>'+s+'</xmp>', 3);
}
return s;
};
bbcjs.plugins.generateErrorString = function (o)
{
bbcjs.trace("No plugin player found! Showing error message:", 2);
var ptn = /\<\<([\w\._]*)\>\>/g;
var err = (o.detected > -1 && o.lowversion) ? o.lowversion : o.noPluginMsg;
if (err.match(ptn))
{
return err.replace(ptn, function() {
return eval(arguments[1].replace(/this/g, "o"));
});
}
return err.supplant(o);
};
bbcjs.plugins.FlashMovie = function (src, version, width, height)
{
this.type = 'flash';
this.name = 'Flash';
this.version = (version)? version : 5;
this.detected = bbcjs.plugins.getFlashVersion();
this.wwguide = bbcjs.plugins.wwguides.flash;
this.lowversion = bbcjs.plugins.lowversionStr;
this.noPluginMsg = bbcjs.plugins.noflashStr;
this.src = src;
this.width = (width)? width : "100%";
this.height = (height)? height : "100%";
this.quality = "autohigh";
this.loop = false;
this.play = true;
this.menu = true;
this.wmode = "";
this.allowScriptAccess = "sameDomain";
this.swLiveConnect = true;
this.allowFullScreen = false;
this.htmlString = "";
this.align = "";
this.flashvars = "";
this.bgcolor = "";
bbcjs.plugins.numFlashMovies++;
this.id = "flashmovie_"+bbcjs.plugins.numFlashMovies;
};
bbcjs.plugins.FlashMovie.prototype.tagData = function ()
{
return {
object : {
classid : 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',
codebase : 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab',
width : this.width,
height : this.height,
id : this.id,
params : {
src : this.src,
loop : this.loop,
quality : this.quality,
play : this.play,
menu : this.menu,
align : this.align,
bgcolor : this.bgcolor,
flashvars : this.flashvars,
wmode : this.wmode,
allowScriptAccess : this.allowScriptAccess,
allowFullScreen : this.allowFullScreen
}
},
embed : {
pluginspage : 'http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash',
type : 'application/x-shockwave-flash',
name : this.id,
width : this.width,
height : this.height,
src : this.src,
loop : this.loop,
quality : this.quality,
play : this.play,
menu : this.menu,
align : this.align,
bgcolor : this.bgcolor,
flashvars : this.flashvars,
wmode : this.wmode,
allowScriptAccess : this.allowScriptAccess,
swLiveConnect : this.swLiveConnect,
allowFullScreen : this.allowFullScreen
}};
};
bbcjs.plugins.FlashMovie.prototype.embed = function ()
{
if (this.version <= this.detected)
{
var code = bbcjs.plugins.generateObjectTag(this.tagData());
this.htmlString = code;
document.write(code);
}
else document.write(bbcjs.plugins.generateErrorString(this));
return this;
};
bbcjs.plugins.FlashMovie.prototype.insert = function (element)
{
if (this.version <= this.detected)
{
var code = bbcjs.plugins.generateObjectTag(this.tagData());
this.htmlString = code;
$(element).innerHTML = code;
}
else $(element).innerHTML =  bbcjs.plugins.generateErrorString(this);
return this;
};
bbcjs.plugins.embedFlashMovie = function(mov, version, width, height)
{
bbcjs.trace("<b>bbcjs.plugins.embedFlashMovie</b> called...",3);
if (typeof(mov)=="string") mov = new bbcjs.plugins.FlashMovie(mov, version, width, height);
return mov.embed();
};
bbcjs.plugins.QuicktimeMovie = function (src, version, width, height)
{
this.type = 'quicktime';
this.name = 'Quicktime';
this.detected = bbcjs.plugins.getQuicktimeVersion();
this.noPluginMsg = bbcjs.plugins.noquicktimeStr;
this.lowversion = bbcjs.plugins.lowversionStr;
this.wwguide = bbcjs.plugins.wwguides.quicktime;
this.src = src;
this.version = (version)? version : 6;
this.width = (width)? width : "100%";
this.height = (height)? height : "100%";
this.loop = false;
this.autoplay = true;
this.controller = true;
this.scale = 1;
this.hotspots = [];
bbcjs.plugins.numQuicktimeMovies++;
this.id = "quicktimemovie_"+bbcjs.plugins.numQuicktimeMovies;
};
bbcjs.plugins.QuicktimeMovie.prototype.tagData = function ()
{
var data = {
object: {
classid : 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
codebase : 'http://www.apple.com/qtactivex/qtplugin.cab',
id : this.id,
width : this.width,
height : this.height,
params : {
src : this.src,
loop : this.loop,
autoplay : this.autoplay,
controller : this.controller,
scale : this.scale
}
},
embed : {
type : 'video/quicktime',
name : this.id,
width : this.width,
height : this.height,
src : this.src,
loop : this.loop,
autoplay : this.autoplay,
controller : this.controller,
scale : this.scale
}
};
var i = this.hotspots.length;
do
{
var curr = this.hotspots[i];
var spot = 'hotspot' + i;
if (curr) data.embed[spot] = data.object.params[spot] = curr;
}
while (i--);
return data;
};
bbcjs.plugins.QuicktimeMovie.prototype.embed = function ()
{
if (this.detected > -1)
{
var code = bbcjs.plugins.generateObjectTag(this.tagData());
this.htmlString = code;
document.write(code);
}
else document.write(bbcjs.plugins.generateErrorString(this));
return this;
};
bbcjs.plugins.QuicktimeMovie.prototype.insert = function (element)
{
if (this.detected > -1)
{
var code = bbcjs.plugins.generateObjectTag(this.tagData());
this.htmlString = code;
$(element).innerHTML = code;
}
else $(element).innerHTML =  bbcjs.plugins.generateErrorString(this);
return this;
};
bbcjs.plugins.embedQuicktimeMovie = function(mov, version, width, height)
{
bbcjs.trace("<b>bbcjs.plugins.embedQuicktimeMovie</b> called...", 3);
if (typeof(mov)=="string") mov = new bbcjs.plugins.QuicktimeMovie(mov, version, width, height);
return mov.embed();
};
bbcjs.plugins.RealmediaMovie = function (src, version, width, height)
{
this.type = 'real';
this.name = 'RealPlayer';
this.detected = bbcjs.plugins.getRealVersion();
this.noPluginMsg = bbcjs.plugins.norealStr;
this.lowversion = bbcjs.plugins.lowversionStr;
this.wwguide = bbcjs.plugins.wwguides.real;
this.src = src;
this.version = (version)? version : 0;
this.width = (width)? width : "100%";
this.height = (height)? height : "100%";
this.play = true;
this.loop = true;
this.showControls = "ControlPanel";
this.showStatus = "StatusBar";
this.border = 0;
this.mayscript = true;
this.nojava = false;
this.nolabels = 0;
this.controlwidth = this.width;
this.controlheight = "39";
this.statuswidth = this.width;
this.statusheight = "30";
this.scriptcallbacks = '';
bbcjs.plugins.numRealmediaMovies++;
this.id = "realmediamovie_"+bbcjs.plugins.numRealmediaMovies;
};
bbcjs.plugins.RealmediaMovie.prototype.tagData = function ()
{
return {
object : {
classid : 'CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA',
id : this.id,
width : this.width,
height : this.height,
border : this.border,
mayscript : this.mayscript,
params : {
src : this.src,
autostart : this.play,
nolabels : this.nolabels,
controls : 'imagewindow',
console: this.id
}
},
embed : {
type : 'audio/x-pn-realaudio-plugin',
name : this.id,
width : this.width,
height : this.height,
src : this.src,
loop : this.loop,
autostart : this.play,
console : this.id,
controls : 'imagewindow',
nojava : this.nojava,
scriptcallbacks : this.scriptcallbacks,
border : this.border
}
};
};
bbcjs.plugins.RealmediaMovie.prototype.controlsData = function ()
{
return {
object : {
classid : 'CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA',
width : this.controlwidth,
height : this.controlheight,
border : this.border,
mayscript : this.mayscript,
params : {
src : this.src,
controls : 'ControlPanel',
console: this.id
}
},
embed : {
type : 'audio/x-pn-realaudio-plugin',
width : this.controlwidth,
height : this.controlheight,
src : this.src,
console : this.id,
controls : 'ControlPanel',
nojava : this.nojava
}
};
};
bbcjs.plugins.RealmediaMovie.prototype.statusData = function ()
{
return {
object : {
classid : 'CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA',
width : this.statuswidth,
height : this.statusheight,
border : this.border,
mayscript : this.mayscript,
params : {
src : this.src,
controls : 'StatusBar',
console: this.id
}
},
embed : {
type : 'audio/x-pn-realaudio-plugin',
width : this.statuswidth,
height : this.statusheight,
src : this.src,
console : this.id,
controls : 'StatusBar',
nojava : this.nojava
}
};
};
bbcjs.plugins.RealmediaMovie.prototype.embed = function ()
{
if (this.detected > -1)
{
var code = bbcjs.plugins.generateObjectTag(this.tagData());
if (this.showStatus) code += '<br />' + bbcjs.plugins.generateObjectTag(this.statusData());
if (this.showControls) code += '<br />' + bbcjs.plugins.generateObjectTag(this.controlsData());
this.htmlString = code;
document.write(code);
}
else document.write(bbcjs.plugins.generateErrorString(this));
return this;
};
bbcjs.plugins.RealmediaMovie.prototype.insert = function (element)
{
if (this.detected > -1)
{
var code = bbcjs.plugins.generateObjectTag(this.tagData());
if (this.showStatus) code += '<br />' + bbcjs.plugins.generateObjectTag(this.statusData());
if (this.showControls) code += '<br />' + bbcjs.plugins.generateObjectTag(this.controlsData());
this.htmlString = code;
$(element).innerHTML = code;
}
else $(element).innerHTML =  bbcjs.plugins.generateErrorString(this);
return this;
};
bbcjs.plugins.embedRealmediaMovie = function(mov, version, width, height)
{
bbcjs.trace("<b>bbcjs.plugins.embedRealmediaMovie</b> called...",3);
if (typeof(mov)=="string") mov = new bbcjs.plugins.RealmediaMovie(mov, version, width, height);
return mov.embed();
};
bbcjs.plugins.ShockwaveMovie = function (src, version, width, height)
{
this.type = 'shockwave';
this.name = 'Shockwave';
this.detected = bbcjs.plugins.getShockwaveVersion();
this.noPluginMsg = bbcjs.plugins.noshockwaveStr;
this.lowversion = bbcjs.plugins.lowversionStr;
this.wwguide = bbcjs.plugins.wwguides.shockwave;
this.src = src;
this.version = (version)? version : 0;
this.width = (width)? width : "100%";
this.height = (height)? height : "100%";
bbcjs.plugins.numShockwaveMovies++;
this.id = "shockwavemovie_"+bbcjs.plugins.numShockwaveMovies;
};
bbcjs.plugins.ShockwaveMovie.prototype.tagData = function ()
{
return {
object : {
classid : 'clsid:166B1BCA-3F9C-11CF-8075-444553540000',
codebase : 'http://active.macromedia.com/director/cabs/sw.cab',
id : this.id,
width : this.width,
height : this.height,
params : {
src : this.src
}
},
embed : {
name : this.id,
width : this.width,
height : this.height,
src : this.src
}
};
};
bbcjs.plugins.ShockwaveMovie.prototype.embed = function ()
{
if (this.version <= this.detected)
{
var code = bbcjs.plugins.generateObjectTag(this.tagData());
this.htmlString = code;
document.write(code);
}
else document.write(bbcjs.plugins.generateErrorString(this));
return this;
};
bbcjs.plugins.ShockwaveMovie.prototype.insert = function (element)
{
if (this.version <= this.detected)
{
var code = bbcjs.plugins.generateObjectTag(this.tagData());
this.htmlString = code;
$(element).innerHTML = code;
}
else $(element).innerHTML =  bbcjs.plugins.generateErrorString(this);
return this;
};
bbcjs.plugins.embedShockwaveMovie = function(mov, version, width, height)
{
bbcjs.trace("<b>bbcjs.plugins.embedShockwaveMovie</b> called...",3);
if (typeof(mov)=="string") mov = new bbcjs.plugins.ShockwaveMovie(mov, version, width, height);
return mov.embed();
};
bbcjs.plugins.WindowsMedia = function (src, version, width, height)
{
this.type = 'wmp';
this.name = 'Windows Media';
this.detected = bbcjs.plugins.getWindowsMediaVersion();
this.noPluginMsg = bbcjs.plugins.noWMPString;
this.lowversion = bbcjs.plugins.lowversionStr;
this.wwguide = bbcjs.plugins.wwguides.wmp;
this.src = src;
this.version = (version)? version : 10;
this.width = (width)? width : "100%";
this.height = (height)? height : "100%";
this.enabled = 1;
this.fullscreen = 0;
this.border = 0;
this.mayscript = 1;
this.autostart = 1;
this.playcount = 1;
this.showcontrols = 1;
this.showstatusbar = 1;
this.showdisplay = 0;
this.sendplaystatechangeevents = true;
bbcjs.plugins.numWindowsMedia++;
this.id = "windowsmedia_"+bbcjs.plugins.numWindowsMedia;
};
bbcjs.plugins.WindowsMedia.prototype.tagData = function ()
{
return {
object : {
classid : 'CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6',
id : this.id,
width : this.width,
height : this.height,
border : this.border,
mayscript : this.mayscript,
standby : "Ready...",
params : {
URL : this.src,
enabled : this.enabled,
AutoStart : this.autostart,
PlayCount : this.playcount,
FullScreen : this.fullscreen,
ShowStatusBar : this.showstatusbar,
ShowControls : this.showcontrols,
ShowDisplay : this.showdisplay,
SendPlayStateChangeEvents : this.sendplaystatechangeevents
}
},
embed : {
type : 'application/x-mplayer2',
name : this.id,
width : this.width,
height : this.height,
FileName : this.src,
enabled : this.enabled,
AutoStart : this.autostart,
PlayCount : this.playcount,
FullScreen : this.fullscreen,
mayscript : this.mayscript,
ShowStatusBar : this.showstatusbar,
ShowControls : this.showcontrols,
ShowDisplay : this.showdisplay
}
};
};
bbcjs.plugins.WindowsMedia.prototype.embed = function ()
{
if (this.showcontrols) this.height += 45;
if (this.showstatusbar) this.height += 24;
if (this.detected > -1)
{
var code = bbcjs.plugins.generateObjectTag(this.tagData());
this.htmlString = code;
document.write(code);
}
else document.write(bbcjs.plugins.generateErrorString(this));
if (this.showcontrols) this.height -= 45;
if (this.showstatusbar) this.height -= 24;
return this;
};
bbcjs.plugins.WindowsMedia.prototype.insert = function (element)
{
if (this.showcontrols) this.height += 45;
if (this.showstatusbar) this.height += 24;
if (this.detected > -1)
{
var code = bbcjs.plugins.generateObjectTag(this.tagData());
this.htmlString = code;
$(element).innerHTML = code;
}
else $(element).innerHTML =  bbcjs.plugins.generateErrorString(this);
if (this.showcontrols) this.height -= 45;
if (this.showstatusbar) this.height -= 24;
return this;
};
bbcjs.plugins.embedWindowsMedia = function(mov, version, width, height)
{
bbcjs.trace("<b>bbcjs.plugins.embedWindowsMedia</b> called...",3);
if (typeof(mov)=="string") mov = new bbcjs.plugins.WindowsMedia(mov, version, width, height);
return mov.embed();
};
