// TheGamingLib
if(typeof TheGamingLib=="undefined"){
var TheGamingLib={};
};
// TheGamingLib.Utilities
TheGamingLib.Utilities = function(){}
// TheGamingLib.Utilities.ShockwaveFlash
TheGamingLib.Utilities.ShockwaveFlash = function(){}
//
// TheGamingLib.Utilities.ShockwaveFlash.getFlashVersion
TheGamingLib.Utilities.ShockwaveFlash.getFlashVersion = function(ver){
if(typeof ver == 'undefined') ver=5;
var flashversion = 0;
if(navigator.plugins && navigator.mimeTypes.length) {
var descr = navigator.plugins["Shockwave Flash"];
if(descr && descr.description) {
var txt = descr.description;
flashversion = txt.substring((txt.indexOf('Flash ')+6),txt.indexOf('.'));
}
}else{
result = false;
for(var i = ver; i < 21 && result != true; i++){
execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
flashversion = i;
}
if(result == false){
flashversion = (ver-1);
}
}
return flashversion;
}
// TheGamingLib.Utilities.ShockwaveFlash.FlashObject
/* 
	var fo = new TheGamingLib.Utilities.ShockwaveFlash.FlashObject('movie.swf', 'swfId', '896px', '150px', 8);
	fo.addParam('wmode','transparent');
	fo.write("flashcontent");
*/
TheGamingLib.Utilities.ShockwaveFlash.FlashObject = function(swf, id, w, h, ver, defParam){
this.swf = swf;
this.id = id;
this.width = w;
this.height = h;
this.align = 'middle';
this.version = ver;
// params and variables.
this.params = new Object();
this.variables = new Object();
// default params.
if(defParam != false){
this.addParam('allowScriptAccess','sameDomain');
this.addParam('menu','false');
this.addParam('quality','high');
}
}
// FlashObject prototype
var SFOP = TheGamingLib.Utilities.ShockwaveFlash.FlashObject.prototype;
SFOP.addParam = function(name, value) {this.params[name] = value;}
SFOP.getParams = function() {return this.params; }
SFOP.getParam = function(name) {return this.params[name];}
SFOP.addVariable = function(name, value) {this.variables[name] = value;}
SFOP.getVariable = function(name) {return this.variables[name];}
SFOP.getVariables = function() {return this.variables;}

SFOP.getParamTags = function(){
var paramTags = "";
for(var param in this.getParams()) {
paramTags += '<param name="' + param + '" value="' + this.getParam(param) + '" />';
}
return (paramTags == "") ? false:paramTags;
}

SFOP.getVariablePairs = function(){
var variablePairs = new Array();
for(var name in this.getVariables()){ 
variablePairs.push(name + "=" + this.getVariable(name)); 
}
return (variablePairs.length > 0) ? variablePairs.join("&"):false;
}
// FlashObject HTML;
SFOP.getHTML = function() {
var flashHTML = "";
if(navigator.plugins && navigator.mimeTypes.length){ // netscape plugin architecture
flashHTML = '<embed type="application/x-shockwave-flash" src="' + this.swf + '" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '"';
for(var param in this.getParams()){
flashHTML += ' ' + param + '="' + this.getParam(param) + '"';
}
if(this.getVariablePairs()){
flashHTML += ' flashVars="' + this.getVariablePairs() + '"';
}
flashHTML += '></embed>';
}else{ // PC IE
flashHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" name="' + this.id + '" align="' + this.align + '">';
flashHTML += '<param name="movie" value="' + this.swf + '" />';
if(this.getParamTags()) {
flashHTML += this.getParamTags();
}
if(this.getVariablePairs() != null) {
flashHTML += '<param name="flashVars" value="' + this.getVariablePairs() + '" />';
}
flashHTML += '</object>';
}
return flashHTML;	
}
// FlashObject write
SFOP.write = function(elementId, doDetect) {
if((TheGamingLib.Utilities.ShockwaveFlash.getFlashVersion(this.version) >= this.version) || (doDetect=='false')){
if(elementId){
document.getElementById(elementId).innerHTML = this.getHTML();
}else{
document.write(this.getHTML());
}
}
}
// End TheGamingLib.Utilities.ShockwaveFlash.FlashObject

/* add Array.push if needed */
if(Array.prototype.push == null){
Array.prototype.push = function(item) { this[this.length] = item; return this.length; }
}
