	function AlvinInit()
	{
		AlvinPlayer = document.getElementById("AlvinWmaPlayer");		
		AlvinControls = AlvinPlayer.Controls;			
		AlvinCurrentMedia = AlvinPlayer.currentMedia;	
		AlvinNetwork = AlvinPlayer.Network;				
		AlvinSettings = AlvinPlayer.Settings;		
		AlvinGetBackInfo();
		AlvinSettings.autoStart = true;	
	}
	
	function AlvinNewPlay(AlvinSongPath)
	{
		AlvinPlayer.url = AlvinSongPath;
		AlvinPlay();
	}
	
	function AlvinPlay()
	{
		AlvinControls.play();
	}
	function AlvinPause()
	{
		AlvinControls.pause();
	}
	function AlvinStop()
	{
		AlvinControls.stop();
	}
	function AlvinGoPosition(args)
	{
		AlvinControls.currentPosition = args;
		AlvinMediaNow();
	}
	function AlvinVolume(tempAlvinVolume)
	{
		AlvinSettings.volume = tempAlvinVolume;
	}
	function AlvinClear()
	{
		id3 = "";
		AlvinDuration = 0;	
		AlvinDurationString = "00:00";	
		AlvinPosition = 0;			
		AlvinPositionString = "00:00";
		AlvinDownload = 0;
	};
	function AlivnWMARL(args)
	{
		AlvinPlayer.Settings.balance  =  args;
	}

	function AlvinMediaNow()
	{
		AlvinPosition = AlvinControls.currentPosition;
		if(AlvinDuration > 0)
		{
			AlvinPositionPer = Math.floor((AlvinPosition * 100) / AlvinDuration);
		}
		else
		{
			AlvinPositionPer = 0;
		}
		AlvinPositionString = AlvinControls.currentPositionString;
		if(AlvinPositionString.length < 1)
		{
			AlvinPositionString = "00:00";
		}
		AlvinDownload = AlvinNetwork.downloadProgress;
		
		AlvinGetBackInfo();
	}
	function AlvinTime()
	{
		AlvinPosition = AlvinControls.currentPosition;
		if(AlvinDuration > 0)
		{
			AlvinPositionPer = Math.floor((AlvinPosition * 100) / AlvinDuration);
		}
		else
		{
			AlvinPositionPer = 0;
		}
		AlvinPositionString = AlvinControls.currentPositionString;
		if(AlvinPositionString.length < 1)
		{
			AlvinPositionString = "00:00";
		}
		AlvinDownload = AlvinNetwork.downloadProgress;
		
		AlvinGetBackInfo();
	}
	function AlvinGetBackInfo()
	{	var str = AlvinPositionString + "  " + AlvinDurationString;
		var AlvinFlash = document.getElementById("AlvinFlash");
		AlvinFlash.SetVariable("wbP",AlvinPosition);
		AlvinFlash.SetVariable("wbD",AlvinDuration);		
		AlvinFlash.SetVariable("wbPS",str);
		AlvinFlash.SetVariable("wbPP",AlvinPositionPer); 		
		AlvinFlash.SetVariable("wbDL",AlvinDownload);		
		AlvinFlash.SetVariable("wbPST",AlvinPlayState);		
	}
	function AlivnSendID3()
	{
		id3 = "";
		var al = AlvinPlayer.currentMedia.getItemInfo("Album");
     		var ti = AlvinPlayer.currentMedia.getItemInfo("title");
     		var ft = AlvinPlayer.currentMedia.getItemInfo("FileType");
     		var cp = AlvinPlayer.currentMedia.getItemInfo("Copyright");
     		var au = AlvinPlayer.currentMedia.getItemInfo("Author");
		var de = AlvinPlayer.currentMedia.getItemInfo("Description");
		var sz = AlvinPlayer.currentMedia.getItemInfo("FileSize")/1024/10.24;
		//var id3timet = AlvinDuration - AlvinDuration%1;
		var id3timet = Math.round(AlvinDuration);
		var id3timem = id3timet%60;
		var id3timef = (id3timet - id3timem)/60;
		var id3time = id3timef + "分" + id3timem + "秒";
		sz = Math.round(sz)/100;
		sz += " MB"
		//alert(AlvinCurrentMedia.getItemInfo("sourceURL");
		if (ti != "") id3 += "<p align='right'>歌名: "+ti+"</p>";
		if (au != "") id3 += "<p align='right'>歌手: "+au+"</p>";
		if (al != "") id3 += "<p align='right'>专辑: "+al+"</p>";
		if (cp != "") id3 += "<p align='right'>版权: "+cp+"</p>";
		if (de != "") id3 += "<p align='right'>注释: "+de+"</p>";
		if (ft != "") id3 += "<p align='right'>类型: "+ft+" 格式文件</p>";
     		if (sz != "") id3 += "<p align='right'>大小: "+sz+"</p>";
		id3 += "<p align='right'>持续时间: "+id3time+"</p>";
		AlvinFlash.SetVariable("ID3str",id3);
	}
	function AlvinSendPlayNext()
	{	
		AlvinClear();
		AlvinStopInterval();
		var AlvinFlash = document.getElementById("AlvinFlash");
		AlvinFlash.SetVariable("wbIPN","1");	
	}
	function AlvinStartOvertime()
	{
		AlvinOvertimeInterval = window.setTimeout("AlvinSendPlayNext()",60000); //设置缓冲超过 60 秒,便跳过下一首
	}
	function AlvinStopOvertime()
	{
		window.clearTimeout(AlvinOvertimeInterval);
	}
	function AlvinStartInterval()
	{
		AlvinInterval = window.setInterval("AlvinMediaNow()", 100);
	}
	function AlvinStopInterval()
	{
		window.clearInterval(AlvinInterval);
	}