   1.
      /**
   2.
       * FlashObject v1.2.3: Flash detection and embed - http://blog.deconcept.com/flashobject/
   3.
       *
   4.
       * FlashObject is (c) 2005 Geoff Stearns and is released under the MIT License:
   5.
       * http://www.opensource.org/licenses/mit-license.php
   6.
       *
   7.
       */
   8.
      if(typeof com == "undefined") var com = new Object();
   9.
      if(typeof com.deconcept == "undefined") com.deconcept = new Object();
  10.
      if(typeof com.deconcept.util == "undefined") com.deconcept.util = new Object();
  11.
      if(typeof com.deconcept.FlashObjectUtil == "undefined") com.deconcept.FlashObjectUtil = new Object();
  12.
      com.deconcept.FlashObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, redirectUrl, detectKey){
  13.
      this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
  14.
      this.skipDetect = com.deconcept.util.getRequestParameter(this.DETECT_KEY);
  15.
      this.params = new Object();
  16.
      this.variables = new Object();
  17.
      this.attributes = new Array();
  18.
       
  19.
      if(swf) this.setAttribute('swf', swf);
  20.
      if(id) this.setAttribute('id', id);
  21.
      if(w) this.setAttribute('width', w);
  22.
      if(h) this.setAttribute('height', h);
  23.
      if(ver) this.setAttribute('version', new com.deconcept.PlayerVersion(ver.toString().split(".")));
  24.
      if(c) this.addParam('bgcolor', c);
  25.
      var q = quality ? quality : 'high';
  26.
      this.addParam('quality', q);
  27.
      this.setAttribute('redirectUrl', '');
  28.
      if(redirectUrl) this.setAttribute('redirectUrl', redirectUrl);
  29.
      if(useExpressInstall) {
  30.
      // check to see if we need to do an express install
  31.
      var expressInstallReqVer = new com.deconcept.PlayerVersion([6,0,65]);
  32.
      var installedVer = com.deconcept.FlashObjectUtil.getPlayerVersion();
  33.
      if (installedVer.versionIsValid(expressInstallReqVer) && !installedVer.versionIsValid(this.getAttribute('version'))) {
  34.
      this.setAttribute('doExpressInstall', true);
  35.
      }
  36.
      } else {
  37.
      this.setAttribute('doExpressInstall', false);
  38.
      }
  39.
      }
  40.
      com.deconcept.FlashObject.prototype.setAttribute = function(name, value){
  41.
      this.attributes[name] = value;
  42.
      }
  43.
      com.deconcept.FlashObject.prototype.getAttribute = function(name){
  44.
      return this.attributes[name];
  45.
      }
  46.
      com.deconcept.FlashObject.prototype.getAttributes = function(){
  47.
      return this.attributes;
  48.
      }
  49.
      com.deconcept.FlashObject.prototype.addParam = function(name, value){
  50.
      this.params[name] = value;
  51.
      }
  52.
      com.deconcept.FlashObject.prototype.getParams = function(){
  53.
      return this.params;
  54.
      }
  55.
      com.deconcept.FlashObject.prototype.getParam = function(name){
  56.
      return this.params[name];
  57.
      }
  58.
      com.deconcept.FlashObject.prototype.addVariable = function(name, value){
  59.
      this.variables[name] = value;
  60.
      }
  61.
      com.deconcept.FlashObject.prototype.getVariable = function(name){
  62.
      return this.variables[name];
  63.
      }
  64.
      com.deconcept.FlashObject.prototype.getVariables = function(){
  65.
      return this.variables;
  66.
      }
  67.
      com.deconcept.FlashObject.prototype.getParamTags = function(){
  68.
      var paramTags = ""; var key; var params = this.getParams();
  69.
      for(key in params) {
  70.
      paramTags += '<param name="' + key + '" value="' + params[key] + '" />';
  71.
      }
  72.
      return paramTags;
  73.
      }
  74.
      com.deconcept.FlashObject.prototype.getVariablePairs = function(){
  75.
      var variablePairs = new Array();
  76.
      var key;
  77.
      var variables = this.getVariables();
  78.
      for(key in variables){
  79.
      variablePairs.push(key +"="+ variables[key]);
  80.
      }
  81.
      return variablePairs;
  82.
      }
  83.
      com.deconcept.FlashObject.prototype.getHTML = function() {
  84.
      var flashHTML = "";
  85.
      if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
  86.
      if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "PlugIn"); }
  87.
      flashHTML += '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" id="'+ this.getAttribute('id') + '" name="'+ this.getAttribute('id') +'"';
  88.
      var params = this.getParams();
  89.
      for(var key in params){ flashHTML += ' '+ key +'="'+ params[key] +'"'; }
  90.
      pairs = this.getVariablePairs().join("&");
  91.
      if (pairs.length > 0){ flashHTML += ' flashvars="'+ pairs +'"'; }
  92.
      flashHTML += '></embed>';
  93.
      } else { // PC IE
  94.
      if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "ActiveX"); }
  95.
      flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" id="'+ this.getAttribute('id') +'">';
  96.
      flashHTML += '<param name="movie" value="' + this.getAttribute('swf') + '" />';
  97.
      var tags = this.getParamTags();
  98.
      if(tags.length > 0){ flashHTML += tags; }
  99.
      var pairs = this.getVariablePairs().join("&");
 100.
      if(pairs.length > 0){ flashHTML += '<param name="flashvars" value="'+ pairs +'" />'; }
 101.
      flashHTML += '</object>';
 102.
      }
 103.
      return flashHTML;
 104.
      }
 105.
      com.deconcept.FlashObject.prototype.write = function(elementId){
 106.
      if(this.skipDetect || this.getAttribute('doExpressInstall') || com.deconcept.FlashObjectUtil.getPlayerVersion().versionIsValid(this.getAttribute('version'))){
 107.
      if(document.getElementById){
 108.
      if (this.getAttribute('doExpressInstall')) {
 109.
      this.addVariable("MMredirectURL", escape(window.location));
 110.
      document.title = document.title.slice(0, 47) + " - Flash Player Installation";
 111.
      this.addVariable("MMdoctitle", document.title);
 112.
      }
 113.
      document.getElementById(elementId).innerHTML = this.getHTML();
 114.
      }
 115.
      }else{
 116.
      if(this.getAttribute('redirectUrl') != "") {
 117.
      document.location.replace(this.getAttribute('redirectUrl'));
 118.
      }
 119.
      }
 120.
      }
 121.
      /* ---- detection functions ---- */
 122.
      com.deconcept.FlashObjectUtil.getPlayerVersion = function(){
 123.
      var PlayerVersion = new com.deconcept.PlayerVersion(0,0,0);
 124.
      if(navigator.plugins && navigator.mimeTypes.length){
 125.
      var x = navigator.plugins["Shockwave Flash"];
 126.
      if(x && x.description) {
 127.
      PlayerVersion = new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
 128.
      }
 129.
      }else if (window.ActiveXObject){
 130.
      try {
 131.
      var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
 132.
      PlayerVersion = new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
 133.
      } catch (e) {}
 134.
      }
 135.
      return PlayerVersion;
 136.
      }
 137.
      com.deconcept.PlayerVersion = function(arrVersion){
 138.
      this.major = parseInt(arrVersion[0]) || 0;
 139.
      this.minor = parseInt(arrVersion[1]) || 0;
 140.
      this.rev = parseInt(arrVersion[2]) || 0;
 141.
      }
 142.
      com.deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
 143.
      if(this.major < fv.major) return false;
 144.
      if(this.major > fv.major) return true;
 145.
      if(this.minor < fv.minor) return false;
 146.
      if(this.minor > fv.minor) return true;
 147.
      if(this.rev < fv.rev) return false;
 148.
      return true;
 149.
      }
 150.
      /* ---- get value of query string param ---- */
 151.
      com.deconcept.util.getRequestParameter = function(param){
 152.
      var q = document.location.search || document.location.href.hash;
 153.
      if(q){
 154.
      var startIndex = q.indexOf(param +"=");
 155.
      var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
 156.
      if (q.length > 1 && startIndex > -1) {
 157.
      return q.substring(q.indexOf("=", startIndex)+1, endIndex);
 158.
      }
 159.
      }
 160.
      return "";
 161.
      }
 162.
       
 163.
      /* add Array.push if needed (ie5) */
 164.
      if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}
 165.
       
 166.
      /* add some aliases for ease of use / backwards compatibility */
 167.
      var getQueryParamValue = com.deconcept.util.getRequestParameter;
 168.
      var FlashObject = com.deconcept.FlashObject;