<%Set fs=CreateObject("Scripting.FileSystemObject")
zjpath=Server.Mappath("mid")
zj=replace(replace(replace(Request("zj"),".",""),"/",""),"\","")
%><html>
<head>
<title>点歌</title>
<meta http-equiv='content-type' content='text/html; charset=gb2312'>
<script language="javaScript">
var zj="<%=zj%>";
function gozj(){
 url="songlist.asp?zj=" + document.songlist.songzj.options[document.songlist.songzj.selectedIndex].value;
 this.location.href=url;
}
function wz(v){
 if(v == zj){
  document.write("<option value=\"" + v + "\" Selected>" + v + "</option>");
 }
 else{
  document.write("<option value=\"" + v + "\">" + v + "</option>");
 }
}
function check(){
 if(document.songlist.song.selectedIndex == -1){
  alert("请选择所需曲目。");
  return false;
 }
 return true;
}
function ws(v){
 var newv = escape(v);
 var fv = v.substring(0, v.length - 4);
 if(newv == v || v.indexOf("'") != -1){
  if(fv.length > 11){fv = fv.substring(0,11) + "…"}
  document.write("<option value=\"" + v + "\">" + fv + "</option>");
 }
 else{
  if(fv.length > 5){fv = fv.substring(0,5) + "…"}
  document.write("<option value=\"" + v + "\">" + fv + "</option>");
 }
}
function s(){
 if(check()){
 v = document.songlist.song.options[document.songlist.song.selectedIndex].value;
 v = v.substring(0, v.length - 4);
 while(v.indexOf("_") != -1){v = v.replace("_"," ")}
 alert("完整曲名:[ " + v + " ]");}
}
function playsong(){
 if (check()){
 zj = document.songlist.songzj.options[document.songlist.songzj.selectedIndex].value;
 sn = document.songlist.song.options[document.songlist.song.selectedIndex].value;
 if(document.songlist.loopok[1].checked){
  cs = "infinite";
  csn = "百听不厌";
 }
 else{
  cs = "1";
  csn = "只听一遍";
 }
 url = "mid/" + escape(zj) + "/" + escape(sn);
 parent.song.document.open();
 parent.song.document.writeln("<bgsound src=\"" + url + "\" loop=" + cs + ">");
 parent.song.document.close();
 var shmsg="【点歌】正在下载并播放曲目<font color=A00000>《" + sn.substring(0, sn.length - 4) + "》</font>，播放方式：<font color=A00000>" + csn + "</font>，请稍候……";
 parent.addsay(-1,shmsg,'',parent.myname,0,'black','',-2,parent.gettimestr());
 }
}
function stopsong(){
 parent.song.location.href="about:blank";
}
</script>
<link rel="stylesheet" href="chat.css">
</head>
<script>document.write("<body style='"+parent.gbt()+"margin:0'>");</script>
<table height=100% width=100%><tr><td valign=top>
<br><font color="#336699" style="font-size:12pt">点歌系统</font>
<hr size=1 color=336699>
<table border="0" width="100%">
<form method="post" action="songsend.asp" name="songlist" onsubmit="return check()" >
<tr>
<td>
<div>
<p><a href="javascript:history.go(0)" title="显示最新的曲目列表"><font color="#cc00cc">刷新:<%=date%></font></a></p>
<p><font color="#336699">选择专辑：</font><br>
<select name="songzj" style="font-size:9pt" onchange="javascript:gozj()">
<%Set f=fs.GetFolder(zjpath)
Set fc=f.SubFolders
For Each f1 in fc
fn=f1.name
if zj="" then
 zj=fn
 response.write "<script>zj='"&fn&"'</script>"
end if%>
<script>wz('<%=fn%>')</script>
<%next%></select>
</p>
</div>
<p> <font color="#336699">选择曲目：</font><br>
<select name="song" style="font-size:9pt" size=6><%songpath=Server.Mappath("mid/"&zj)
Set f=fs.GetFolder(songpath)
Set fc=f.Files
For Each f1 in fc
fn=f1.name%><script>ws('<%=replace(fn,"'","\'")%>')</script>
<%next
Set f=nothing
Set fc=nothing
Set fs=nothing%></select>
</p>
<p><font color="#336699">播放方式：</font><br>
<input type="radio" name="loopok" value="1" checked style="border:0px">
只听一遍<br>
<input type="radio" name="loopok" value="infinite" style="border:0px">
百听不厌</p>
<table border="0" cellpadding="4">
<tr>
<td>
<input class=navy1 type="button" name="play" value="播放" onclick="playsong()">
</td>
<td align="right">
<input class=navy1 type="button" name="stop" value="停止" onclick="stopsong()">
</td>
</tr>
<tr>
<td colspan="2">
<input class=navy1 type="button" value="完整歌曲名" name="songname" onclick="s()">
</td>
</tr>
<tr>
<td colspan="2">
<input class=navy1 type="submit" value="好歌赠好友" name="cmdYes" >
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
</body>
</html>