﻿var FlashPlayer = {
	player : "",		//播放器地址
	allowFullScreen : true,		//自动铺满屏幕，默认为true
	vedio : "",			//视频文件地址
	title : "",			//标题
	width : 100,		//宽
	height : 100,		//高
	Logo : {
		url : "logoPlugIn.swf",	//
		logoText : "Logo",		//logo文字,不支持中文
		logoTextAlpha : 0.75,	//logo透明度
		logoTextFontSize : 30,	//logo文字大小
		logoTextLink : "about:blank",	//logo链接地址，貌似现在没用
		logoTextColor : "0xffffff",		//logo文字颜色，16进制表示
		textMargin : "20 20 auto auto"	//logo文字位置
	},
	init : function(action){
		if(typeof(action) != "string"){alert("缺少必要参数"); return false;}
		var obj = FlashPlayer.$(action);
		if(!obj){alert("参数错误"); return false;}
		with(FlashPlayer){
			if(player.length<1){obj.innerHTML = error.err_0001.code + ":" + error.err_0001.msg;return false;}
			if(vedio.length<1){obj.innerHTML = error.err_0002.code + ":" + error.err_0002.msg;return false;}
		}
		var Html = '<object type="application/x-shockwave-flash" data="'+FlashPlayer.player+'" width="'+FlashPlayer.width+'" height="'+FlashPlayer.height+'" id="vcastr3"><param name="movie" value="'+FlashPlayer.player+'"/><param name="allowFullScreen" value="'+FlashPlayer.allowFullScreen+'" /><param name="FlashVars" value="xml=<vcastr><channel><item><source>'+FlashPlayer.vedio+'</source><duration></duration><title>'+FlashPlayer.title+'</title></item></channel><config></config><plugIns><logoPlugIn><url>'+FlashPlayer.Logo.url+'</url><logoText>'+FlashPlayer.Logo.logoText+'</logoText><logoTextAlpha>'+FlashPlayer.Logo.logoTextAlpha+'</logoTextAlpha><logoTextFontSize>'+FlashPlayer.Logo.logoTextFontSize+'</logoTextFontSize><logoTextLink>'+FlashPlayer.Logo.logoTextLink+'</logoTextLink><logoTextColor>'+FlashPlayer.Logo.logoTextColor+'</logoTextColor><textMargin>'+FlashPlayer.Logo.textMargin+'</textMargin></logoPlugIn></plugIns></vcastr>"/></object>';
		obj.innerHTML = Html;
	},
	$ : function(id){
		return document.getElementById(id);
	}
}
var error = FlashPlayer.prototype = {
	err_0001 : {code:"错误代码 0001",msg:"缺少播放器地址"},
	err_0002 : {code:"错误代码 0002",msg:"缺少视频文件地址"}
}
