/*
This file contains functions to generate OBJECT and EMBED tags for QuickTime content.
These functions assemble the tags from parameters passed to them as parameters.
QT_WriteOBJECT() - generate HTML tags and insert them into the calling document
QT_WriteOBJECT_XHTML() - generate XHTML tags and insert them into the calling document
QT_GenerateOBJECTText() - generate HTML tags and return them as a string
QT_GenerateOBJECTText_XHTML() - generate XHTML tags and return them as a string
AC_QuickTimeVersion() - return the version of this file as a floating point number.
To call one of these functions, pass the url, width, height, and required ActiveX
control version as parameters 1 through 4, and pass all other attributes and
parameters that you would otherwise specify for the OBJECT, PARAM, and EMBED
tags as pairs of parameters:
These functions automatically add the "classid", "codebase", and "pluginspage" tags to
the OBJECT and/or EMBED tags with standard values if they are not specified in the
parameter list, so you need not supply these tags unless you require non-standard values.
Although the OBJECT and EMBED tags typically have the same attributes and parameters, it
is sometimes useful to have different values for each.
Any attribute name prefixed with "obj#" is added to the OBJECT tag only, any attribute
name prefixed with "emb#" is added to the EMBED tag only.
*/
/************** 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 = 0.8;
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 = ' \n'
+ _QTAddObjectParam("src", generateXHTML);
var embedTag = '