//v1.7.0
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.

// BuildingBox Flash detection v1.0
// captures disabled flash
// added flash version to args
// added noplayercopy to args - displays copy if Flash version to low, disabled or not available
// added noplayerid to args - displays innerHTML of element if Flash version to low, disabled or not available
// added noplayerredirect to args - redirects to new page
// default Flash Version 8

// added by BuildingBox
var bboxFlash = {
name:"bboxFlash",
dom:false,
installUrl:'http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash',
targetVersion:8
};
bboxFlash.ENV=function(){
bboxFlash.global={};
bboxFlash.global.platform="other";
if(navigator.appVersion.indexOf("Windows") != -1){bboxFlash.global.platform="Windows";}
}
bboxFlash.getDomain=function(){return document.domain;}
bboxFlash.getURL=function(){return window.location.href;}
bboxFlash.getServeLoc=function(){
bboxFlash.serverlocation=_SERVERLOC;
return bboxFlash.serverlocation;
}
bboxFlash.setIsIpAdvertiseCombined = function(isAdvertise){
this.isIpAdvertiseCombined = isAdvertise;
}
bboxFlash.getIsIpAdvertiseCombined = function(){
return this.isIpAdvertiseCombined;
}
bboxFlash.setIsGB = function(isGB){
this.isGB = isGB;
}
bboxFlash.getIsGB = function(){
return this.isGB;
}
bboxFlash.getPlatform=function(){return bboxFlash.global.platform;}
bboxFlash.env=new bboxFlash.ENV();
bboxFlash.Event=function(){this.o=[];}
bboxFlash.Event.prototype=bboxFlash;
bboxFlash.Event.prototype.addListener=function(evt,id,obj,method,returns){
var i=5;
var x=0;
while(i<arguments.length){this.o[x]=arguments[i];i++;x++;}
var o=this.o;
var m=method;
if(this.dom)document.getElementById(id)[evt] = function(e){
if(!e){
e=window.event;
}
o[o.length]=e;
obj[m](o);
var arr=[];
for(var i=0;i<(o.length-1);i++){
arr[i]=o[i];
}
o=arr;
return returns;
}
}
bboxFlash.Client=function(){
if(document.getElementById){bboxFlash.dom={};bboxFlash.dom.w3c=true;}else {bboxFlash.dom.w3c=false;}
if(!window.Error){window.Error="error";}
if(window.Error != "error"){bboxFlash.true1_5=true;}else{bboxFlash.true1_5=false;}
if(window.ActiveXObject){bboxFlash.hasAX = true;}
this.maxVersion = 9;
this.minVersion = 1;
var actualVersion;
if(bboxFlash.hasAX && bboxFlash.getPlatform() == "Windows"){
var f="for(var i = this.maxVersion; i > this.minVersion ; i--){ try {var flsh = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.'+i) ; return i; }catch(oError){ } }return 0;";
this.func=new Function(f);
actualVersion = this.func();
}
if(navigator.plugins){
if(navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]){
var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
actualVersion = flashVersion;
}
}
if(navigator.userAgent.indexOf("WebTV") != -1){
actualVersion = 3;
}
bboxFlash._flashVersion = actualVersion;
}
bboxFlash.clnt=new bboxFlash.Client();
bboxFlash.hasActiveX=function(){if(bboxFlash.hasAX){return true;}return false;}
bboxFlash.hasDOM=function(){if(bboxFlash.dom){return true;}return false;}
bboxFlash.isW3C=function(){if(bboxFlash.dom.w3c){return true;}return false;}
function trace(){};
bboxFlash.getFlashVersion=function(){
if(bboxFlash._flashVersion){
return bboxFlash._flashVersion;
}
return false;
}
// added by BuildingBox

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }
  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
    // added by BuildingBox
    var f = bboxFlash.getFlashVersion();
    if(f && f >= ret.version)
    {    
        AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
    }
    else
    {       
        if(ret.noPlayerRedirect && ret.noPlayerRedirect != "")  window.location = ret.noPlayerRedirect;
        if(ret.noPlayerCopy != "") document.write(ret.noPlayerCopy);
        if(bboxFlash.dom.w3c && document.getElementById(ret.noPlayerId)) document.write(document.getElementById(ret.noPlayerId).innerHTML);
    }
    // added by BuildingBox
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  ret.version = 8;                          // added by BuildingBox
  ret.noPlayerCopy = "";                    // added by BuildingBox
  ret.noPlayerId = "";                      // added by BuildingBox
  ret.noPlayerRedirect = "";                // added by BuildingBox  
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblclick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      case "version":                       // added by BuildingBox
        ret.version = args[i+1];            // added by BuildingBox
        break;                              // added by BuildingBox
      case "noplayercopy":                  // added by BuildingBox
        ret.noPlayerCopy = args[i+1];       // added by BuildingBox
      case "noplayerid":                    // added by BuildingBox
        ret.noPlayerId = args[i+1];         // added by BuildingBox
        break;                              // added by BuildingBox
      case "noplayerredirect":              // added by BuildingBox
        ret.noPlayerRedirect = args[i+1];   // added by BuildingBox
        break;                              // added by BuildingBox
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
