PlayerVersion = function(arrVersion){ if(arrVersion == null) { this.major = 0; this.minor = 0; this.revision = 0; } else { this.major = arrVersion[0] || 0; this.minor = arrVersion[1] || 0; this.revision = arrVersion[2] || 0; } } PlayerVersion.prototype = { getVersion: function() { return this.major + "," + this.minor + "," + this.revision; }, versionIsValid: function(player){ var passes = true; if(this.major < player.major) { passes = false; } else if(this.major == player.major) { if(this.minor < fv.minor) { passes = false; } else if (this.minor == player.minor) { if(this.revision < player.revision) { passes = false; } } } return passes; } } WriteFlash = function(sourcePath, playerWidth, playerHeight, bckColor, quality, id, requiredVer ) { this.trace = false; this.parameters = new Array(); this.variables = new Array(); if (id == null ) {this.id = null; } else {this.id = id; } if (playerWidth == null ) {this.width = 0; } else {this.width = playerWidth; } if (playerHeight == null ) {this.height = 0; } else {this.height = playerHeight; } if (sourcePath == null ) {this.path = ""; } else {this.path = sourcePath; } if ( requiredVer == null ) {this.requiredVersion = new PlayerVersion([6,0,0]);} else {this.requiredVersion = requiredVer;} if (bckColor == null ) {bckColor = "#ffffff";} this.parameters['bgcolor'] = bckColor; if (quality == null ) { quality = "high"; } this.parameters['quality'] = quality; } WriteFlash.prototype = { writePlugin: function(htmlElement) { if(this.path == "" ) {return;} this.useQueryString(); if ( document.getElementById(htmlElement) !== null ) { document.getElementById(htmlElement).innerHTML = this.getPluginCode(); return; } else { return this.getPluginCode(); } }, getPluginCode: function() { var node = ""; if( this.isIE() ) { node = ' 0 ) {node += '?' + this.getPairList( this.getVariables() );} node += '" />'; for(key in this.parameters ){node += '\n\t';} node += "\n"; } else { node = '= 1) { this.path = path; } }, isIE: function() { return navigator.appName == "Microsoft Internet Explorer"; }, addParameter: function(name, value) { this.parameters[name] = value; }, addVariable: function(name, value) { this.variables[name] = value; }, setSize: function(width, height) { if( width > 0 ) { this.width = width; } if( height > 0 ) { this.height = height; } }, setBackground: function(newColor) { var hex_alphabets = "0123456789ABCDEF"; var check = true; if(newColor.charAt(0) != "#") { check = false; } for(var i=1;i<6;i++) { if(hex_alphabets.indexOf(newColor.charAt(i)) == -1 ) { check = false; } } if ( check ) { this.addParameter('bgcolor', newColor); } }, setBackgroundRGB: function(newColor) { var hex_alphabets = "0123456789ABCDEF"; var hex = "#"; var int1,int2; for(var i=0;i<3;i++) { if(triplet[i] > 255) { triplet[i] = 255; } int1 = triplet[i] / 16; int2 = triplet[i] % 16; hex += hex_alphabets.charAt(int1) + hex_alphabets.charAt(int2); } this.addParameter('bgcolor', hex); }, setQuality: function(quality) { var arr = new Array("low", "high", "autolow", "autohigh", "best" ); if( indexOf(arr, quality) != -1 ) { this.addParameter('quality', quality); } } } indexOf = function(arr, item) { if( Array.prototype.indexOf != null) { return arr.indexOf(item); } else { for(var i = 0; i < arr.length; i++) { if(arr[i] == item) { return i; } } return -1; } } playerVersionInstalled = function() { var playerVersion = new PlayerVersion([0,0,0]); if (window.ActiveXObject){ try { var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); playerVersion = new PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(",")); } catch (e) {/* ignore the error */} } else if(navigator.plugins && navigator.mimeTypes.length){ var x = navigator.plugins["Shockwave Flash"]; if(x && x.description) { playerVersion = new PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")); } } return playerVersion; } var wf = new WriteFlash( );