/* DON'T EDIT THIS GENERATED FILE! Changes will be lost. */

function ObjectElement(type, data, width, height) {
  this.type = type || this._lookupMimeType(data);
  this.data = data || "";
  this.width = width || "";
  this.height = height || "";
  this.classId = this._lookupClassId(type);
  this.altText = this._lookupAltText(type);
  this.params       = new Object();
  this.embedParams  = new Object();
  this.style        = new Object();

  if (this.width) {
    this.addStyle("width", this.width + ((this._hasUnit(this.width)) ? "" : "px"));
  }
  if (this.height) {
    this.addStyle("height", this.height + ((this._hasUnit(this.height)) ? "" : "px"));
  }
}


ObjectElement.prototype.CLASSID_FLASH = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
ObjectElement.prototype.CLASSID_QUICKTIME = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";
ObjectElement.prototype.CLASSID_MPLAYER = "clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6";
ObjectElement.prototype.CLASSID_REALPLAYER = "clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA";

ObjectElement.prototype.MIMETYPE_FLASH = "application/x-shockwave-flash";
ObjectElement.prototype.MIMETYPE_QUICKTIME = "video/quicktime";
ObjectElement.prototype.MIMETYPE_MPLAYER = "application/x-mplayer2";
ObjectElement.prototype.MIMETYPE_REALPLAYER_RPM = "audio/x-pn-realaudio-plugin";
ObjectElement.prototype.MIMETYPE_REALPLAYER_RA = "audio/x-pn-realaudio";
ObjectElement.prototype.MIMETYPE_REALPLAYER_RAM = "audio/vnd.rn-realaudio";
ObjectElement.prototype.MIMETYPE_REALPLAYER_RV = "video/vnd.rn-realvideo";

ObjectElement.prototype.ALTTEXT_FLASH = '<p>Sie haben kein Flash installiert. Um diese Seite nutzen zu k&ouml;nnen, laden Sie bitte das kostenlose Flash-Plugin von folgender URL: https://www.macromedia.com/go/getflashplayer</p>';
ObjectElement.encodeHtml = function(text, noQuotes) {
    text = new String(text);
    text = text.replace(/&/g, '&amp;');
    text = text.replace(/</g, '&lt;');
    text = text.replace(/>/g, '&gt;');
    if (noQuotes !== true) {
        text = text.replace(/"/g, '&quot;'); // end quoting in editor: "
    }
    return text;
}

ObjectElement.prototype.addParam = function(name, value) {
  this.params[name] = value;
}

ObjectElement.prototype.addEmbedParam = function(name, value) {
  this.embedParams[name] = value;
}

ObjectElement.prototype.addStyle = function(name, value) {
  this.style[name] = value;
}

ObjectElement.prototype._lookupAltText = function(type) {
  switch (type) {
    case this.MIMETYPE_FLASH:
      return this.ALTTEXT_FLASH;
  }
  return "";
}

ObjectElement.prototype._lookupClassId = function(type) {
  switch (type) {
    case this.MIMETYPE_FLASH:
      return this.CLASSID_FLASH;
    case this.MIMETYPE_QUICKTIME:
      return this.CLASSID_QUICKTIME;
    case this.MIMETYPE_MPLAYER:
      return this.CLASSID_MPLAYER;
    case this.MIMETYPE_REALPLAYER_RPM:
    case this.MIMETYPE_REALPLAYER_RA:
    case this.MIMETYPE_REALPLAYER_RAM:
    case this.MIMETYPE_REALPLAYER_RV:
      return this.CLASSID_REALPLAYER;
  }
  return "";
}

ObjectElement.prototype._lookupMimeType = function(url) {
  if (url) {
    if (url.search(/(\.swf$|\.swf\?|\.swf\#)/) != -1) {
      return this.MIMETYPE_FLASH;
    }
    else if (url.search(/(\.mov$|\.mov\?|\.mov\#)/) != -1) {
      return this.MIMETYPE_QUICKTIME;
    }
    else if (url.search(/(\.rpm$|\.rpm\?|\.rpm\#)/) != -1) {
      return this.MIMETYPE_REALPLAYER_RPM;
    }
    else if (url.search(/(\.rm$|\.rm\?|\.rm\#)/) != -1) {
      return this.MIMETYPE_REALPLAYER_RM;
    }
    else if (url.search(/(\.ra$|\.ra\?|\.ra\#)/) != -1) {
      return this.MIMETYPE_REALPLAYER_RA;
    }
    else if (url.search(/(\.rv$|\.rv\?|\.rv\#)/) != -1) {
      return this.MIMETYPE_REALPLAYER_RV;
    }
  }
  return "";
}

ObjectElement.prototype._hasUnit = function(str) {
  return isNaN(str);
}

ObjectElement.prototype._getAltTextNode = function() {
  switch (this.type) {
    case this.MIMETYPE_FLASH:
      var paragraphNode = document.createElement("p");
      var preTextNode = document.createTextNode("Sie haben kein Flash installiert.Zur Installation des");
      var postTextNode = document.createTextNode(".")
      var anchorTextNode = document.createTextNode("Flash-Plugin")
      var anchorNode = document.createElement("a");

      anchorNode.setAttribute("href", "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash");
      anchorNode.setAttribute("target", "_blank");
      anchorNode.appendChild(anchorTextNode);

      paragraphNode.appendChild(preTextnode);
      paragraphNode.appendChild(anchorNode);
      paragraphNode.appendChild(postTextNode);
      return paragraphNode;
  }
  return "";
}

ObjectElement.prototype._hasEmbedTag = function() {
  return (this.type != this.MIMETYPE_FLASH);
}

ObjectElement.prototype._hasClassId = function() {
  return (this.classId && (this.classId != this.CLASSID_FLASH));
}

ObjectElement.prototype._createObjectTagStr = function() {
  var classIdAttr = (this._hasClassId()) ? 'classid="' + this.classId + '" ': '';
  var styleAttr = this._createStyleStr();
  var objectTagStr = "";
  objectTagStr += '<ob' + 'ject ' + classIdAttr + 'data="' + this.data + '"' +
                  (this.width != '' ? ' width="' + this.width + '"' : '') +
                  (this.height != '' ? ' height="' + this.height + '"' : '') +
                  ' type="' + this.type + '" style="' + styleAttr  + '">';
  for (var name in this.params) {
    if (!this.params.hasOwnProperty(name)) { continue; }
    objectTagStr += '<param name="' + ObjectElement.encodeHtml(name) + '" value="' + ObjectElement.encodeHtml(this.params[name]) + '" />';
  }
  if (this._hasEmbedTag()) {
    objectTagStr += this._createEmbedTagStr();
  }
  objectTagStr += this.altText;

  objectTagStr += '</ob' + 'ject>';
  return objectTagStr;
}

ObjectElement.prototype._createEmbedTagStr = function() {
  var styleAttr = this._createStyleStr();
  var embedTagStr = '<embed type="' + this.type + '" src="' + this.data + '" width="' + this.width + '" height="' + this.height + '" style="' + styleAttr + '"';
  for (var name in this.embedParams) {
    if (!this.embedParams.hasOwnProperty(name)) { continue; }
    embedTagStr += ' ' + ObjectElement.encodeHtml(name) + '="' + ObjectElement.encodeHtml(this.embedParams[name]) + '"';
  }
  embedTagStr += '></embed>';
  return embedTagStr;
}

ObjectElement.prototype._createStyleStr = function() {
  var styleStr = "";
  for (var name in this.style) {
    if (!this.style.hasOwnProperty(name)) { continue; }
    styleStr += name + ": " + this.style[name] + "; ";
  }
  return (styleStr.length > 0) ? styleStr.substring(0, styleStr.length-1) : styleStr;
}

ObjectElement.prototype._createObjectTag = function() {
  var objectTag = document.createElement("object");
  var styleAttr = this._createStyleStr();
  if (this._hasClassId()) {
    objectTag.setAttribute("classid", this.classId);
  }
  if (styleAttr) {
    objectTag.setAttribute("style", styleAttr);
  }
  if (this.type) {
    objectTag.setAttribute("type", this.type);
  }
  if (this.data) {
    objectTag.setAttribute("data", this.data);
  }
  for (var name in this.params) {
    if (!this.params.hasOwnProperty(name)) { continue; }
    var paramTag = this._createParamTag(name, this.params[name]);
    objectTag.appendChild(paramTag);
  }
  if (this._hasEmbedTag()) {
    var embedTag = this._createEmbedTag();
    objectTag.appendChild(embedTag);
  }
  return objectTag;
}

ObjectElement.prototype._createParamTag = function(name, value) {
  var paramTag = document.createElement("param");
  paramTag.setAttribute("name", name);
  paramTag.setAttribute("value", value);
  return paramTag;
}

ObjectElement.prototype._createEmbedTag = function() {
  var embedTag = document.createElement("embed");
  var styleAttr = this._createStyleAttr();
  if (this.type) {
    embedTag.setAttribute("type", this.type);
  }
  if (this.data) {
    embedTag.setAttribute("src", this.data);
  }
  if (styleAttr) {
    embedTag.setAttributeNode(styleAttr);
  }
  if (this.width) {
    embedTag.setAttribute("width", this.width);
  }
  if (this.height) {
    embedTag.setAttribute("height", this.height);
  }
  for (var name in this.embedParams) {
    if (!this.embedParams.hasOwnProperty(name)) { continue; }
    embedTag.setAttribute(name, this.embedParams[name]);
  }
  return embedTag;
}

ObjectElement.prototype.getNode = function() {
  return this._createObjectTag();
}

ObjectElement.prototype.getNodeAsString = function() {
  return this._createObjectTagStr();
}

ObjectElement.prototype.render = function() {
    var tag = this.getNodeAsString();
    document.writeln(tag);
}

ObjectElement.prototype.renderReplace = function(target) {
  var replaceTag = typeof(target)=='string' ? document.getElementById(target) : target;
  var parentNode = replaceTag.parentNode;
  replaceTag.outerHTML ? replaceTag.outerHTML = this._createObjectTagStr() 
                       : parentNode.replaceChild(this._createObjectTag(), replaceTag);
}

function FlashObjectElement(data, width, height) {
  this.data = data || "";
  this.width = width || "";
  this.height = height || "";
  this.style = []; 
  if (this.data) {
    this.addParam("movie", this.data);
  }
  if (this.width) {
    this.addStyle("width", this.width + ((this._hasUnit(this.width)) ? "" : "px"));
  }
  if (this.height) {
    this.addStyle("height", this.height + ((this._hasUnit(this.height)) ? "" : "px"));
  }
  this.setOpaque();
}

FlashObjectElement.prototype = new ObjectElement('application/x-shockwave-flash');
FlashObjectElement.prototype.setTransparent = function() {
    this.addParam('wmode', 'transparent');
}

FlashObjectElement.prototype.setOpaque = function() {
    this.addParam('wmode', 'opaque');
}

FlashObjectElement.prototype.setWindow = function() {
    this.addParam('wmode', 'window');
}

FlashDetection = new function() {
    this.NOT_INSTALLED = 0;     
    this.CHECK_FAILED  = null;  
    this.NOT_CHECKED   = false; 
    this.version   = this.NOT_CHECKED; 
    this.installed = null;             
    this.checkVersion = function() {
        this.version   = this._getVersion();
        this.installed = !!this.version;
    }
    this._getVersion = function() {
        try {
            if (navigator.plugins && navigator.plugins.length) {
                return this._getVersion_navigator();
            }
            if (document.all && !window.opera) {
                return this._getVersion_ieWin();
            }
            var ua = navigator.userAgent ? navigator.userAgent.toLowerCase() : '';
            if (++(ua.indexOf('webtv/2.6'))) { return 4; }
            if (++(ua.indexOf('webtv/2.5'))) { return 3; }
            if (++(ua.indexOf('webtv')))     { return 2; }
        } catch(e) {
            return this.CHECK_FAILED;
        }
        return this.NOT_INSTALLED;
    }
    this._getVersion_navigator = function() {
        if (navigator.mimeTypes && navigator.mimeTypes[0] && navigator.mimeTypes[0].enabledPlugin === undefined) {
            return this.NOT_INSTALLED;
        }
        var plugin = navigator.plugins['Shockwave Flash 2.0']
                  || navigator.plugins['Shockwave Flash'];
        if (plugin && plugin.description) {
            return parseInt(plugin.description.substring(16));
        } else {
            return this.NOT_INSTALLED;
        }
    }
    this._getVersion_ieWin = function() {
        var temp = window['flashversion']; 
        window.flashversion = this.NOT_INSTALLED;
        window.execScript('\
            on error resume next\n\
            For vbLoop = 2 to 12\n\
                If Not(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & vbLoop))) Then\n\
                Else\n\
                    flashversion = vbLoop\n\
                End If\n\
            Next\n\
        ', 'VBScript');
        var version = window.flashversion;
        window.flashversion = temp;
        return version;
    }
    this.checkVersion();
}
