function SWFObj(div, swf, v, w, h, bgclr, altContent, isExpress, iswf, iw, ih) {

this.isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
this.isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
this.isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
this.urlData = "";
this.MMdoctitle = "";
this.MMPlayerType = "";
this.MMredirectURL = "";

this.ControlVersion = function() {
	var version;
	var axo;
	var e;

	try {
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) { }

	if (!version) {
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			version = "WIN 6,0,21,0";
			axo.AllowScriptAccess = "always";
			version = axo.GetVariable("$version");
		} catch (e) { }
	}

	if (!version) {
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) { }
	}

	if (!version)
	{
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) { }
	}

	if (!version) {
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	return version;
}

this.GetSwfVer = function() {
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;			
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
			var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if (this.isIE && this.isWin && !this.isOpera) {
		flashVer = this.ControlVersion();
	}	
	return flashVer;
}

this.DetectFlashVer = function(reqMajorVer, reqMinorVer, reqRevision) {
	versionStr = this.GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(this.isIE && this.isWin && !this.isOpera) {
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

this.versionArray = v.split(".");
this.requiredMajorVersion = this.versionArray[0];
this.requiredMinorVersion = this.versionArray[1];
this.requiredRevision = this.versionArray[2];
this.hasProductInstall = this.DetectFlashVer(6, 0, 65);
this.hasReqestedVersion = this.DetectFlashVer(this.requiredMajorVersion, this.requiredMinorVersion, this.requiredRevision);

this.attributes = new Array();
this.attributes["bgcolor"] = bgclr;
this.attributes["wmode"] = "window";
this.attributes["loop"] = "false";
this.attributes["menu"] = "false";
this.attributes["quality"] = "high";
this.attributes["scale"] = "noScale";
this.attributes["allowScriptAccess"] = "sameDomain";
this.attributes["align"] = "middle";
this.attributes["FlashVars"] = "";
this.attributes["type"] = "application/x-shockwave-flash";
this.attributes["pluginspage"] = "http://www.adobe.com/go/getflashplayer";
this.attributes["codebase"] = "http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab";

this.AC_AddExtension = function(src, ext) {
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

this.AC_GetArgs = function(args, ext, classid, mimeType) {
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i in args){
    switch (i){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[i] = args[i];
        break;
      case "src":
		args[i] = this.AC_AddExtension(args[i], ext);  
		ret.embedAttrs["src"] = args[i];
		break;
      case "movie":	
        args[i] = this.AC_AddExtension(args[i], ext);
        ret.params["movie"] = args[i];
        break;
      case "name":
	    ret.embedAttrs[i] = args[i];
        break;
	  case "codebase":
	  case "type":
	  case "id":
        ret.objAttrs[i] = args[i];
        break;
      case "width":
      case "height":
      case "align":
        ret.embedAttrs[i] = ret.objAttrs[i] = args[i];
        break;
      default:
        ret.embedAttrs[i] = ret.params[i] = args[i];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  if (ret.embedAttrs["FlashVars"].length>3 && this.urlData.length>0)  ret.params["FlashVars"] = ret.embedAttrs["FlashVars"] += "&";
  if (this.urlData.length>0) ret.params["FlashVars"] = ret.embedAttrs["FlashVars"] += this.urlData;
  return ret;
}

this.AC_Generateobj = function(objAttrs, params, embedAttrs, _w, _h) { 
    var str = '';
    if (this.isIE && this.isWin && !this.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.getElementById(div).width = _w;
	document.getElementById(div).height = _h;
    document.getElementById(div).innerHTML = str;
}

this.setAttribute = function(name, value) {
	this.attributes[name] = value;
}

this.outputHTML = function() {
	var urlParams = location.search.substring(1, location.search.length);
	var domain = "baseUrl=http://"+location.host+"/";
	
	if (urlParams.length>0) {
		this.urlData = domain + "&" +urlParams;
	} else {
		this.urlData = domain;
	}
	
	if(this.hasProductInstall && !this.hasReqestedVersion && isExpress) {
		this.MMPlayerType = (this.isIE == true) ? "ActiveX" : "PlugIn";
		this.MMredirectURL = window.location;
		document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		this.MMdoctitle = document.title;
		this.attributes["FlashVars"] = "MMredirectURL="+this.MMredirectURL+"&MMplayerType="+this.MMPlayerType+"&MMdoctitle="+this.MMdoctitle;
		this.attributes["name"] = this.attributes["src"] = this.attributes["id"] = this.attributes["movie"] = iswf;
		this.attributes["width"] = iw;
		this.attributes["height"] = ih;
		var ret = this.AC_GetArgs(this.attributes, ".swf", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash");
	  	this.AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs, iw, h);
	} else if (this.hasReqestedVersion) {
		this.attributes["name"] = this.attributes["src"] = this.attributes["id"] = this.attributes["movie"] = swf;
		this.attributes["width"] = w;
		this.attributes["height"] = h;
		var ret = this.AC_GetArgs(this.attributes, ".swf", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash");
	  	this.AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs, w, h);
	} else {
		document.getElementById(div).innerHTML = altContent;
	}
}

this.regExReplace = function(str, reg, rep) {
	var s = unescape(str);
	var re = new RegExp(eval(unescape(reg)));
	return s.replace(re, unescape(rep));
}

this.regExpMatch = function(str, reg) {
	var s = unescape(str);
	var arr = s.match(eval(unescape(reg)));
	return this.encodeArray(arr);
}

this.encodeArray = function(arr) {
	for (var i=0; i<arr.length;i++) {
		arr[i] = encodeURIComponent(arr[i]);
	}
	return arr;
}

this.window_stack = new Array();
this.createPopupWindow = function(url,name,props) {
	var newWin = window.open(url,name,props);
	this.window_stack[name] = newWin;
}
this.closePopup = function(name) {
	this.window_stack[name].close();
}

this.setUserIcon = function(iconPath) {
	var AIM_location = "aim:BuddyIcon?Src="+iconPath;
	location.href = AIM_location;
	return true;
}

}





