
function FP()
{
	this.ID = document.getElementById(arguments[0]);
	if(!this.ID)
	{
		alert(this.ID);
		return;
	}
	this.i = 0;
	if ( typeof arguments[1] == "object" )
	{
		this.PlayList = arguments[1];
	}else{
		return ;
	}
	this.PlayNum = -1;
	this.PlayStatus = 'stop';
	this.W = "400";
	this.H = "325";
	if ( typeof arguments[2] == "number" )
	{
		this.W = arguments[2];
	}
	if ( typeof arguments[3] == "number" )
	{
		this.H = arguments[3];
	}
}

FP.prototype.PlayEx = function(nd)
{
	if ( nd < 1 )
	{
		return false;
	}
	if ( nd > this.PlayList.length )
	{
		nd = 0;
	}
	this.PlayNum = nd;
	var obj = this.PlayList[this.PlayNum];
	this.play(obj[0],obj[1],obj[2]);
}

FP.prototype.PlayNext = function()
{
	this.PlayNum++;
	if ( this.PlayNum >= this.PlayList.length )
	{
		this.PlayNum = 0;
	}
	var obj = this.PlayList[this.PlayNum];
	this.play(obj[0],obj[1],obj[2]);
}


FP.prototype.single = function()
{
	var cycle = 0;
	var srcurl = 'http://www.eootv.com/fmtv/flash/player3_alone.swf?ifAutoPlay=true&cycle='+cycle;
	srcurl += "&vidFileName="+this.RID;
	srcurl += "&CID="+this.CID;

	var srcurl = 'http://61.150.91.28/fmtv/player3_alone32.swf?ifAutoPlay=true&cycle=1';
	srcurl += "&vidFileName="+this.RID;
	srcurl += "&CID="+this.CID;

	var fo = new SWFObject(srcurl, this.ID, this.W, this.H, 7, "#FFFFFF");
	fo.addParam("allowFullScreen","true");
	fo.addParam("allowscriptaccess","always");
	if(!fo.write(this.ID))
	{
	}
}

FP.prototype.DoFSCommand = function(command,args)
{
	switch(command)
	{
		case "status":
			this.PlayStatus = args;
			if ( this.PlayStatus == "pover" )
			{
				this.PlayNext();
			}
			break;
		default:
			break;
	}
}

FP.prototype.mutli = function()
{
	var skinid = '10';
	var radom  = '0';
	var flsurl = 'http://61.150.91.28/fmtv/player3_fangkuai.swf?ifRandom='+radom;
	flsurl += "&CID="+this.CID;
	flsurl += "&rid="+this.RID;
	flsurl += "&skinID="+skinid;
	var fo = new SWFObject(flsurl, this.ID, this.W, this.H, 7, "#FFFFFF");
	fo.addParam("allowFullScreen","true");
	fo.addParam("allowscriptaccess","always");
	if(!fo.write(this.ID))
	{
	}
}

FP.prototype.getfpurl = function()
{
	switch(this.CY)
	{
		case "0":
		case "2":
			var flsobj = "http://static.youku.com/v1.0.0001/v/swf/qplayer.swf";
			var fo = new SWFObject(flsobj, this.ID, this.W, this.H, 7, "#FFFFFF");
			fo.addVariable("VideoIDS",this.RID);
			fo.addVariable("isAutoPlay",true);
			fo.addVariable("Version","/v1.0.0385");
			fo.addVariable("winType","interior");
			fo.addParam("allowFullScreen","true");
			fo.addParam("allowscriptaccess","always");
			if(!fo.write(this.ID))
			{
			}
			break;
		case "1":
				if ( this.RID == '' || this.RID.length < 6 )
				{
					this.mutli();
				}
				else
				{
					this.single();
				}
			break;
		default:
			break;
	}
}

FP.prototype.play = function(cy,cid,rid)
{
	this.CY = cy;
	this.CID = cid;
	this.RID = rid;
	this.getfpurl();
	return false;
}

