/*
	Compatibile XHTML Flash displayer
	Author 	: Razvan Stanga
	Website : http://www.phprebel.org/
	Date 	: 2006-03-07 17:39
*/

function Flash () {
	this._flashinstalled = 0;
	this._swf = '';
	this._width = 0;
	this._height = 0;
	this._url = '';
	this._image = '';
	this._params = new Array();
}

Flash.prototype.setSWF = function (_swf, _width, _height) {
	this._swf 		= _swf;
	this._width 	= _width;
	this._height 	= _height;
}

Flash.prototype.setImage = function (_image, _url) {
	this._image 	= _image;
	this._url 		= _url;
}

Flash.prototype.setParam = function (paramName, paramValue) {
	this._params[this._params.length] = paramName+'|||'+paramValue;
}

Flash.prototype.display = function () {
	var _txt 	= '';
	var params = '';
	_txt += '<object>\n';
	_txt += '<param width="'+this._width+'" height="'+this._height+'" name="movie" value="'+this._swf+'" />\n'
	_txt += '<param name="quality" value="high" />\n';
	for ( i=0;i<this._params.length;i++ ) {
		_param = this._params[i].split ('|||');
		_txt += '\t<param name="'+_param[0]+'" value="'+_param[1]+'" />\n';
		params += _param[0]+'="'+_param[1]+'" ';
	}

	_txt += '<embed width="'+this._width+'" height="'+this._height+'" src="'+this._swf+'" '+params+' quality="high" type="application/x-shockwave-flash"></embed></object><br>';

	//if(this._flashinstalled < 2){
	//	_txt = "<img src='" +this._image + "' border='0'>";
	//	if(this._url.length > 0){
	//		_txt = "<a href='" + this._url + "'>" + _txt + "</a>\n";
	//	}
	//}
	
	document.write (_txt);
}

Flash.prototype.checkFlash = function () {
		
	MSDetect = "false";
	if (navigator.plugins && navigator.plugins.length)
	{
		x = navigator.plugins["Shockwave Flash"];
		if (x)
		{
			this._flashinstalled = 2;
		}
		else
			this._flashinstalled = 1;
		if (navigator.plugins["Shockwave Flash 2.0"])
		{
			this._flashinstalled = 2;
		}
	}
	else if (navigator.mimeTypes && navigator.mimeTypes.length)
	{
		x = navigator.mimeTypes['application/x-shockwave-flash'];
		if (x && x.enabledPlugin)
			this._flashinstalled = 2;
		else
			this._flashinstalled = 1;
	}
	else
		MSDetect = "true";
		
	//alert(this._flashinstalled);
	
}