// JavaScript Document
function showFontSizeSwitch(){
	document.write("字体：【<a href=\"javascript:doZoom(24)\">大</a> <a href=\"javascript:doZoom(16)\">中</a> <a href=\"javascript:doZoom(12)\">小</a>】\n");
}
function doZoom(size){
	//document.getElementById('neirongText').style.fontSize=size+'px'
	var   content   =   document.getElementById('neirongText');
	doChangeFontSize(content,size)
}
function doChangeFontSize(content,size){
	content.style.fontSize=size+'px';
	var all = content.all.length;
	if (all>0){
		for (var i=0; i <all; i++){
			if (typeof content.childNodes[i] != "undefined"){
				if (typeof content.childNodes[i].tagName != "undefined" && content.childNodes[i].tagName!="<BR>")
				{
					if (typeof content.childNodes[i]=="object"){
						doChangeFontSize(content.childNodes[i],size)
					}else{
						content.childNodes[i].style.fontSize=size+'px';
					}
				}
			}
		}
	}else{
		content.style.fontSize=size+'px';
	}
}
function imgzoom(img){
	var a=new Image();
	a.src=img.src
	if(a.width > 520){
		img.style.width=520;
	}
	return false;
}

//弹出窗口
function js_open(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
  return false;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

//打开就播放
function loadPlay()
{
   try{
     setColor(0); 
     document.WMP.URL=MusicList.value; //指定(播放)列表中的第一首歌曲
     document.WMP.controls.play(); //播放
   }catch(e){}

   //try{}catch(e){}表示忽略程序运行中出现的错误
}

//以下函数获取当前播放歌曲在列表中的索引
function getMusicIndex()
{
   try{
     var MusicIndex=0; //存储当前播放歌曲的位置
     /*
      遍历整个播放列表.
      获取当前播放歌曲在列表中的下标位置
      用document.WMP.URL来和列表项的值比较
     */
     for(i=0;i<MusicList.length;i++)
     {
       if(document.WMP.URL==document.all.MusicList.options[i].value)
       {      
         MusicIndex=i; //记录下当前播放歌曲的位置
         break;
       }    
     }
     return MusicIndex; //整个函数返回当前播放歌曲的下标位置
   }catch(e){}
   setTimeout('getMusicIndex()',1000); //每隔1秒就检测一下当前播放歌曲的位置
}
getMusicIndex(); //调用getMusicIndex()函数

//设置当前播放与不播放的歌曲的颜色
function setColor(me)
{
   for(i=0;i<MusicList.length;i++)
   {
     MusicList.options[i].style.color="purple";
     if(i==me)
     {      
       MusicList.options[i].style.color="green";  
       continue;
     }    
   }
}
//播放上一曲
function playPrevious()
{
    try{
     var PlayIndex=getMusicIndex(); //将当前播放歌曲的位置存储到PlayIndex变量中
     PlayIndex--; //当前播放歌曲的位置-1就表示起上一曲的位置
     setColor(PlayIndex);
     document.WMP.URL=MusicList.options[PlayIndex].value;
     document.WMP.controls.play();    
   }catch(e){}
}
//播放下一曲
function playNext()
{
    try{
     var PlayIndex=getMusicIndex(); //将当前播放歌曲的位置存储到PlayIndex变量中
     PlayIndex++; //当前播放歌曲的位置+1就表示起下一曲的位置
     setColor(PlayIndex);
     document.WMP.URL=MusicList.options[PlayIndex].value;
     document.WMP.controls.play();    
   }catch(e){}
}
//控制播放,暂停,停止
function control(me)
{
   switch (me)
   {
     case 1 :   //暂停
       document.WMP.controls.pause();
	   mu.src=("images/bmusicz.jpg");
       break;
     case 2 : //播放
       document.WMP.controls.play();
	   mu.src=("images/bmusic.jpg");
       break;    
     case 0 : //停止
       document.WMP.controls.stop();
	   mu.src=("images/bmusicn.jpg");
       break;    
   }
}
//显示隐藏层
function show(i){
    var obj=document.getElementById("div1")
        obj.style.display="block";
}
function hide(i){
    var obj=document.getElementById("div1")
        obj.style.display="none";
}
