<%@ Page Language="C#" AutoEventWireup="true" Inherits="page" Codebehind="page.aspx.cs" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">

    <title>音乐播放</title>
	<link href="style/layout.css" rel="stylesheet" type="text/css" />
	<link href="style/font.css" rel="stylesheet" type="text/css">
	<link rel="stylesheet" type="text/css" href="style/webMain.css" />
    <link rel="stylesheet" type="text/css" href="style/labelStyle.css" />
    <script language="javascript" type="text/javascript" src="system/js/JFramework.js"></script>
    <script language="javascript" type="text/javascript" src="system/js/sys.js"></script>
    <script language="javascript" type="text/javascript" src="js/page.js"></script>
	<script src="js/flash.js" type="text/javascript"></script>

<script language="javascript" type="text/javascript" >
var obj
var start=0;
var list=new Array();
var i=0;
var out;

  function loadPage(){
      
    var objAjax=new JAjax();
	out=objAjax.getText("post",sysPath+"webServer.aspx?type=readMusicList",null,null);
	
	//alert(out);
	if (out==""){
	      alert("没有可播放的歌曲")
	    return;
	}
	out=comminute(out,c1,c2);
	if (out.length==1){
	    alert("没有可播放的歌曲")
	    return;
	}

	for (var x=0;x<out.length-1;x++){
	   // alert(out[x][1]);
	    list[x]=out[x][1];
	    var opt=document.createElement("option");
	    opt.value=x;
	    opt.text=out[x][0];
	    selectMusic.options.add(opt);
	}
	selectMusic.options[out.length-2].selected=true;
  
     obj=document.getElementById("mPlayer")
     obj.URL=list[out.length-2];
     i++;
     start=0;
  }
  
  function b(){
//   PlayState 的值
//1=停止
//2=暂停中
//3=正在播放
//4=向前搜索
//5=向后搜索
//6=缓冲中
//7=等待中
//8=播放完毕
//9=转换曲目
//10=准备就绪
 
   switch(obj.PlayState){
     
       case 3:
          start=0;
          break;
       case 8:
           start=1;
           break;
       case 1:
           loadmp3();
           break;
     }
   
}



function loadmp3(){
    if (i>=list.length){
        i=0;
    }
     for (var x=0;x<	selectMusic.options.length;x++){
        if (x==i){
    	    selectMusic.options[i].selected=true;
    	}else{
    	    selectMusic.options[x].selected=false;
    	}
    }
    if (start==1){
        obj.URL=list[i];
        setTimeout("document.getElementById('mPlayer').controls.play();i=i+0.5;",1000); 
        
    }else{
          obj.URL=list[i];
           i++;
    }
   
   
}

function selectPlay(obj){
    var x=parseInt(obj.value);
    i=x;
    loadmp3();
    
}

</script>
    
</head>
<body>
<div id="wrap">
	<div class="header">
		<div class="header_1">
			<div style="width:550px; height:78px; float:left;">
				<script type="text/javascript">swf(550,78,'/images/banner.swf','intro');</script>
			</div>
		</div>
		<div class="header_2"><%lb("导航");%></div>
	</div>

    
   <!--音乐播放器内容 以下代码除样式表外, 不能修改--> 
   <div class="body">
		<div class="body_l"></div>
		<div class="body_m">
			<div class="body_m1"></div>
			<div class="body_m2">
				<div id="musicDiv" style="margin-top:15px;">
					<object id="mPlayer" width="360px" height="64px" border="0" type="application/x-oleobject"
						classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
						<param name="uiMode" value="full" />
						<param name="URL" value="" />
						<param name="rate" value="1" />
						<param name="balance" value="0" />
						<param name="currentPosition" value="0" />
						<param name="defaultFrame" value="" />
						<param name="playCount" value="1" />
						<param name="autoStart" value="-1" />
						<param name="currentMarker" value="0" />
						<param name="invokeURLs" value="-1" />
						<param name="baseURL" value="" />
						<param name="volume" value="80" />
						<param name="mute" value="0" />
						<param name="stretchToFit" value="-1" />
						<param name="windowlessVideo" value="0" />
						<param name="enabled" value="-1" />
						<param name="enableContextMenu" value="false" />
						<param name="fullScreen" value="0" />
						<param name="SAMIStyle" value="" />
						<param name="SAMILang" value="" />
						<param name="SAMIFilename" value="" />
						<param name="captioningID" value="" />
						<param name="enableErrorDialogs" value="0" />
					</object>
			
					<script type="text/ecmascript" language="JavaScript" for="mPlayer" event="playStateChange">
						b();
					</script>
			
					<div>
						<select id="selectMusic" size="10" multiple="multiple" style="width: 360px;" onChange="selectPlay(this)">
						</select>
					</div>
							
					<script language="javascript" type="text/javascript">
						 loadPage();
					</script>
				</div>
			</div>
			
		</div>
		<div class="body_r"></div>
    <!--音乐播放器内容完 以上代码除样式表外, 不能修改--> 
	<!--页面底部-->
	<div class="footer">
		<div class="footer_1">
			<div class="footer_11">咨询电话：023-67876119</div>
			<div class="footer_12">
				<span class="footer121"><a href="../">首&nbsp;&nbsp;&nbsp;&nbsp;页</a></span>
				<span class="footer121"><a href="../article.aspx?menuid=1267&tab=tab_news&tabid=777">联系我们</a></span>
				<span class="footer121"><a href="../bbs/index.aspx">网站论坛</a></span>
				<span class="footer121"><a href="../map.aspx">网站地图</a></span>
			</div>
			<div class="footer_13">
				
			</div>
		</div>
		<div class="footer_2"><%lb("读取一个文件");%></div>
	</div>
</div>
</div>
    
</body>
</html>
