/**
 * flash object fetch
 * method : var objectName = new FlashObject(flashUrl, id, w, h, _version, _bgcolor, _useExpressInstall, _quality, _xiRedirectUrl, _redirectUrl, _reqParam);  
 * generate : cream.com
 **/
if (typeof com == "undefined")
{
	var com = new Object();
}
if (typeof com.cream == "undefined")
{
	com.cream = new Object();
}
if (typeof com.cream.util == "undefined")
{
	com.cream.util = new Object();
}
if (typeof com.cream.FlashObjectUtil == "undefined")
{
	com.cream.FlashObjectUtil = new Object();
}
com.cream.FlashObject = function(flashUrl, id, w, h, _version, _bgcolor, _useExpressInstall, _quality, _xiRedirectUrl, _redirectUrl, _reqParam)
{
	if (!document.createElement || !document.getElementById)
	{
		return;
	}
	this.findKey = _reqParam ? _reqParam : "detectflash";
	this.skipDetect = com.cream.util.getRequestParameter(this.findKey);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	this.useExpressInstall = _useExpressInstall;
	if (flashUrl)
	{
		this.setAttribute("swf",flashUrl);
	}
	if (id)
	{
		this.setAttribute("id",id);
	}
	if (w)
	{
		this.setAttribute("width",w);
	}
	if (h)
	{
		this.setAttribute("height",h);
	}
	if (_version)
	{
		this.setAttribute("version", new com.cream.PlayerVersion(_version.toString().split(".")));
	}
	this.installedVer = com.cream.FlashObjectUtil.getPlayerVersion(this.getAttribute("version"), _useExpressInstall);
	if (_bgcolor)
	{
		this.addParam("bgcolor", _bgcolor);
	}
	var q = _quality ? _quality : "high";
	this.addParam("quality",q);
	var _d = (_xiRedirectUrl) ? _xiRedirectUrl : window.location;
	this.setAttribute("xiRedirectUrl",_d);
	this.setAttribute("redirectUrl","");
	if (_redirectUrl)
	{
		this.setAttribute("redirectUrl",_redirectUrl);
	}
};
com.cream.FlashObject.prototype = {
	setAttribute:function(_attName, _attVal)
	{
		this.attributes[_attName] = _attVal;
	},
	getAttribute:function(_attName)
	{
		return this.attributes[_attName];
	},
	addParam:function(_paraName, _paraVal)
	{
		this.params[_paraName] = _paraVal;
	},
	getParams:function()
	{
		return this.params;
	},
	addVariable:function(_variName, _variVal)
	{
		this.variables[_variName] = _variVal;
	},
	getVariable:function(_variName)
	{
		return this.variables[_variName];
	},
	getVariables:function()
	{
		return this.variables;
	},
	createParamTag:function(_attName, _attVal)
	{
		var p = document.createElement("param");
		p.setAttribute("name", _attName);
		p.setAttribute("value", _attVal);
		return p;
	},
	getVariablePairs:function()
	{
		var _variPairs = new Array();
		var key;
		var _variables = this.getVariables();
		for(key in _variables)
		{
			_variPairs.push(key+"="+_variables[key]);
		}
		return _variPairs;
	},
	getFlashHTML:function()
	{
		var _html = "";
		var _params = this.getParams();
		var _variables = this.getVariablePairs().join("&");
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) /** Not IE **/
		{
			if (this.getAttribute("doExpressInstall"))
			{
				this.addVariable("MMplayerType","PlugIn");
			}
			_html = "<embed type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
			_html += " id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
			for(var key in _params)
			{
				_html += [key]+"=\""+_params[key]+"\" ";
			}
			if (_variables.length>0)
			{
				_html += "flashvars=\""+_variables+"\"";
			}
			_html += "/>";
		}
		else /** IE **/
		{
			if (this.getAttribute("doExpressInstall"))
			{
				this.addVariable("MMplayerType","ActiveX");
			}
			_html = "<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
			_html += "<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
			for(var key in _params)
			{
				_html += "<param name=\""+key+"\" value=\""+_params[key]+"\" />";
			}
			if (_variables.length>0)
			{
				_html += "<param name=\"flashvars\" value=\""+_variables+"\" />";
			}
			_html += "</object>";
		}
		return _html;
	},
	write:function(_writeDest)
	{
		if (this.useExpressInstall)
		{
			var _defaultVersion = new com.cream.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(_defaultVersion) && !this.installedVer.versionIsValid(this.getAttribute("version")))
			{
				this.setAttribute("doExpressInstall",true);
				this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
				document.title = document.title.slice(0, 47)+" - Flash Player Installation";
				this.addVariable("MMdoctitle",document.title);
			}
		}
		else
		{
			this.setAttribute("doExpressInstall",false);
		}
		if (this.skipDetect || this.getAttribute("doExpressInstall") || this.installedVer.versionIsValid(this.getAttribute("version")))
		{
			var n = (typeof _writeDest == "string") ? document.getElementById(_writeDest) : _writeDest;
			n.innerHTML = this.getFlashHTML();
		}
		else
		{
			if (this.getAttribute("redirectUrl") != "")
			{
				document.location.replace(this.getAttribute("redirectUrl"));
			}
		}
	}
};
com.cream.FlashObjectUtil.getPlayerVersion = function(_version, _useExpressInstall)
{
	var _basicVersion = new com.cream.PlayerVersion(0,0,0);
	if (navigator.plugins&&navigator.mimeTypes.length)
	{
		var x = navigator.plugins["Shockwave Flash"];
		if (x&&x.description)
		{
			_basicVersion = new com.cream.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));
		}
	}
	else
	{
		try
		{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			for(var i=3; axo != null; i++)
			{
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
				_basicVersion = new com.cream.PlayerVersion([i,0,0]);
			}
		}
		catch(e)
		{
		}
		if (_version && _basicVersion.major > _version.major)
		{
			return _basicVersion;
		}
		if (!_version || ((_version.minor != 0 || _version.rev != 0) && _basicVersion.major == _version.major) || _basicVersion.major != 6 || _useExpressInstall)
		{
			try
			{
				_basicVersion = new com.cream.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
			}
			catch(e)
			{
			}
		}
	}
	return _basicVersion;
};
com.cream.PlayerVersion = function(_version)
{
	this.major = parseInt(_version[0], 10) || 0;
	this.minor = parseInt(_version[1], 10) || 0;
	this.rev = parseInt(_version[2], 10) || 0;
};
com.cream.PlayerVersion.prototype.versionIsValid = function(fv)
{
	if (this.major < fv.major)
	{
		return false;
	}
	if (this.major > fv.major)
	{
		return true;
	}
	if (this.minor < fv.minor)
	{
		return false;
	}
	if (this.minor > fv.minor)
	{
		return true;
	}
	if (this.rev < fv.rev)
	{
		return false;
	}
	return true;
};
com.cream.util = {
	getRequestParameter:function(_findKey)
	{
		var q = document.location.search || document.location.href.hash;
		if (q)
		{
			var _key_findKey = q.indexOf(_findKey+"=");
			var _pos = (q.indexOf("&",_key_findKey) > -1) ? q.indexOf("&",_key_findKey) : q.length;
			if (q.length > 1 && _key_findKey > -1)
			{
				return q.substring(q.indexOf("=",_key_findKey)+1, _pos);
			}
		}
		return "";
	},
	removeChildren:function(n)
	{
		while (n.hasChildNodes())
		{
			n.removeChild(n.firstChild);
		}
	}
};
if (Array.prototype.push == null)
{
	Array.prototype.push = function(_len)
	{
		this[this.length] = _len;
		return this.length;
	};
}
var getQueryParamValue = com.cream.util.getRequestParameter;
var FlashObject = com.cream.FlashObject;