// PLUGIN FRAMEWORK, Version 0.4F for Flash; Copyright (c) 2006 Matthias Platzer <matthias@knallgrau.at>; http://www.knallgrau.code/prototype/plugins_js

var PluginFactory=function(){this.isInstalled=function(name){return Plugin.getInfo(name).isInstalled;}
this.getVersion=function(name){return Plugin.getInfo(name).version;}
this.getInfo=function(name){var info=Plugin.PLUGINS[name];var isInstalled=false;var version=null;if(supportsNavigatorPlugins()){var plugin=findNavigatorPluginByName((name=="RealPlayer")?"RealPlayer Version Plugin":name);if(plugin){isInstalled=true;version=getVersionFromPlugin(plugin);}}else{isInstalled=hasActiveXObject(Plugin.PLUGINS[name]&&Plugin.PLUGINS[name].progID);if(isInstalled){if(Plugin.PLUGINS[name].getActiveXVersionInfo){version=Plugin.PLUGINS[name].getActiveXVersionInfo();}else{var progID=getProgIdForActiveXObject(Plugin.PLUGINS[name].progID);version=getVersionFromPlugin(progID);}}else{version=getActiveXPluginByClassId(Plugin.PLUGINS[name]&&Plugin.PLUGINS[name].classID);if(version)version=version.replace(/,/g,".");isInstalled=(version!=undefined);}}
var result={};for(var i in info){result[i]=info[i];}
result["isInstalled"]=isInstalled;result["version"]=version;result["name"]=name;return result;}
this.embed=function(plugin,options,target){options=options||{};var embedOptions=Object.extend({},options);var src=embedOptions.src;delete embedOptions.src;var id=embedOptions.id;delete embedOptions.id;var name=embedOptions.name||id;delete embedOptions.name;var width=embedOptions.width;delete embedOptions.width;var height=embedOptions.height;delete embedOptions.height;var type=embedOptions.type||(Plugin.PLUGINS[plugin]&&Plugin.PLUGINS[plugin].mimeType)||"";delete embedOptions.type;var activeXType=embedOptions.activeXType||(Plugin.PLUGINS[plugin]&&Plugin.PLUGINS[plugin].activeXType)||type;delete embedOptions.activeXType;var forceEmbedTag=(Plugin.PLUGINS[plugin]&&Plugin.PLUGINS[plugin].forceEmbedTag&&Plugin.PLUGINS[plugin].forceEmbedTag==true)?true:false;var embedOptions=Object.extend(((Plugin.PLUGINS[plugin]&&Plugin.PLUGINS[plugin].standardEmbedAttributes)||{}),embedOptions);switch(plugin){case"Flash":if(!supportsNavigatorPlugins()){embedOptions.movie=src;src=null;}
break;default:break;}
var html="";if(supportsNavigatorPlugins()||forceEmbedTag){html+='<embed'+getAttributeHtml("src",src)+getAttributeHtml("id",id)+getAttributeHtml("name",name)+getAttributeHtml("width",width)+getAttributeHtml("height",height)+getAttributeHtml("pluginspage",Plugin.PLUGINS[plugin]&&Plugin.PLUGINS[plugin].pluginsPage)+getAttributeHtml("type",type);for(var i in embedOptions){html+=' '+i+'="'+embedOptions[i]+'"';}
html+='></embed>\n';}else{html+='<object classid="clsid:'+(Plugin.PLUGINS[plugin]&&Plugin.PLUGINS[plugin].classID)+'"';html+=getAttributeHtml("id",id)+getAttributeHtml("name",name)+getAttributeHtml("width",width)+getAttributeHtml("height",height)+getAttributeHtml("codebase",(Plugin.PLUGINS[plugin]&&Plugin.PLUGINS[plugin].codeBase))+getAttributeHtml("type",activeXType)+'>\n';html+=(src)?'  <param name="src" value="'+src+'">\n':'';for(var i in embedOptions){html+='  <param name="'+i+'" value="'+embedOptions[i]+'" />';}
html+='</object>\n';}
if(target){if(typeof target=="string")target=document.getElementById(target);target.innerHTML=html;}else{document.write(html);}}
var getAttributeHtml=function(name,value){return(value)?(" "+name+"=\""+value+"\""):"";}
this.PLUGINS={"Director":{description:"Macromedia Director",progID:["SWCtl.SWCtl.11","SWCtl.SWCtl.10","SWCtl.SWCtl.9","SWCtl.SWCtl.8","SWCtl.SWCtl.7","SWCtl.SWCtl.6","SWCtl.SWCtl.5","SWCtl.SWCtl.4"],classID:"166B1BCA-3F9C-11CF-8075-444553540000",pluginsPage:"http://www.macromedia.com/shockwave/download/",codeBase:"http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0",mimeType:"application/x-director"},"Flash":{description:"Macromedia Shockwave Flash",progID:["ShockwaveFlash.ShockwaveFlash.9","ShockwaveFlash.ShockwaveFlash.8.5","ShockwaveFlash.ShockwaveFlash.8","ShockwaveFlash.ShockwaveFlash.7","ShockwaveFlash.ShockwaveFlash.6","ShockwaveFlash.ShockwaveFlash.5","ShockwaveFlash.ShockwaveFlash.4"],classID:"D27CDB6E-AE6D-11CF-96B8-444553540000",pluginsPage:"http://www.macromedia.com/go/getflashplayer",codeBase:"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0",mimeType:"application/x-shockwave-flash",standardEmbedAttributes:{quality:"high"},acceptedMimeTypes:[{type:"application/x-shockwave-flash",suffixes:"swf"},{type:"application/futuresplash",suffixes:"spl"}]}}
var supportsNavigatorPlugins=function(){return(navigator.plugins&&(navigator.plugins.length>0));}
var supportsActiveX=function(){return((typeof'ActiveXObject'!='undefined')&&(navigator.userAgent.indexOf('Win')!=-1));}
var getIEClientCaps=function(){var clientcaps=document.getElementById("__Plugin_ClientCaps");if(!clientcaps){var clientcaps=document.createElement("DIV");clientcaps.id="__Plugin_ClientCaps";if(clientcaps.addBehavior){clientcaps.addBehavior("#default#clientCaps");document.body.appendChild(clientcaps);}
clientcaps=document.getElementById("__Plugin_ClientCaps");}
return clientcaps;}
var getActiveXPluginByClassId=function(classID){if(!classID)return null;if(!classID.match(/{[^}]+}/))classID="{"+classID+"}";var clientcaps=getIEClientCaps();try{var result=clientcaps.getComponentVersion(classID,"ComponentID")
return result||null;}catch(err){}
return null;}
var hasActiveXObject=function(progID){progID=getProgIdForActiveXObject(progID);return(progID!=null);}
var getProgIdForActiveXObject=function(progID){if(!progID)return null;for(var i=0;i<progID.length;i++){try{var obj=new ActiveXObject(progID[i]);return progID[i]||null;}
catch(e){}}
return null;}
var getVersionFromPlugin=function(plugin){if(!plugin.name)plugin={name:plugin,description:name};var matches=/[\d][\d\.]*/.exec(plugin.name);if(matches&&plugin.name.indexOf("Java")==-1)return matches[0];matches=/[\d\.]+/.exec(plugin.description);return matches?matches[0]:"";}};if(!window.Plugin){var Plugin=new Object();}
if(!Object.extend){Object.extend=function(destination,source){for(property in source){destination[property]=source[property];}
return destination;}}
Object.extend(Plugin,(new PluginFactory()));