﻿/*Flash新闻*/
function NewsFlash(img1,img2,img3,img4,img5,content1,content2,content3,content4,content5,htm1,htm2,htm3,htm4,htm5){
  imgUrl1="images/"+img1;
  imgtext1=content1
  imgLink1=escape(htm1);
  imgUrl2="images/"+img2;
  imgtext2=content2
  imgLink2=escape(htm2);
  imgUrl3="images/"+img3;
  imgtext3=content3
  imgLink3=escape(htm3);
  imgUrl4="images/"+img4;
  imgtext4=content4
  imgLink4=escape(htm4);
  imgUrl5="images/"+img5;
  imgtext5=content5
  imgLink5=escape(htm5);

  var focus_width=240
  var focus_height=200
  var text_height=18
  var swf_height = focus_height+text_height
 
  var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3+"|"+imgUrl4+"|"+imgUrl5
  var links=imgLink1+"|"+imgLink2+"|"+imgLink3+"|"+imgLink4+"|"+imgLink5
  var texts=imgtext1+"|"+imgtext2+"|"+imgtext3+"|"+imgtext4+"|"+imgtext5
 
  document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
  document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="Flash/focus.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');
  document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
  document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
  document.write('</object>');
}

/*鼠标悬停图片渐隐*/
function high(which){
which.filters.alpha.opacity=100
}
function low(which){
which.filters.alpha.opacity=50
}

/*图层渐显*/
function MM_findObj(n, d) {
  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 loadwin(obj){
	with(MM_findObj(obj))with(style){
		filters[0].apply();
		display='';
		filters[0].play();
		document.getElementById("player").controls.play();
		document.getElementById("player").controls.stop();
	}
}
function loadwin1(obj){
	with(MM_findObj(obj))with(style){
		filters[0].apply();
		display='';
		filters[0].play();
	}
}

/*可拖动层(只要样式类名为dragclass,且设置宽和高都可拖动)*/
  function $(d){return document.getElementById(d);}
  function gs(d){var t=$(d);if (t){return t.style;}else{return null;}}
  function gs2(d,a){
    if (d.currentStyle){ 
      var curVal=d.currentStyle[a]
    }else{ 
      var curVal=document.defaultView.getComputedStyle(d, null)[a]
    } 
    return curVal;
  }
  if  (document.getElementById){
    (
      function(){
        if (window.opera){ document.write("<input type='hidden' id='Q' value=' '>"); }
      
        var n = 500;
        var dragok = false;
        var y,x,d,dy,dx;
        
        function move(e)
        {
          if (!e) e = window.event;
          if (dragok){
            d.style.left = dx + e.clientX - x + "px";
            d.style.top  = dy + e.clientY - y + "px";
            return false;
          }
        }
        
        function down(e){
          if (!e) e = window.event;
          var temp = (typeof e.target != "undefined")?e.target:e.srcElement;
          if (temp.tagName != "HTML"|"BODY" && temp.className != "dragclass"){
            temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
          }
          if('TR'==temp.tagName){
            temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
            temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
            temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
          }
        
          if (temp.className == "dragclass"){
            if (window.opera){ document.getElementById("Q").focus(); }
            dragok = true;
            temp.style.zIndex = n++;
            d = temp;
            dx = parseInt(gs2(temp,"left"))|0;
            dy = parseInt(gs2(temp,"top"))|0;
            x = e.clientX;
            y = e.clientY;
            document.onmousemove = move;
            return false;
          }
        }
        function up(){
          dragok = false;
          document.onmousemove = null;
        }
        
        document.onmousedown = down;
        document.onmouseup = up;
      }
    )();
  }

/*选择歌词*/
function changelrc(num){
  lrcUrl="LRC/"+document.getElementById("pa"+num).innerHTML;
}

/*歌词效果*/
var lrcUrl="LRC/glswxxg.txt";

function lrcClass(tt)  //LRC歌词处理 类 
{ 
  this.gsh="歌手:~1~\n曲名:~2~\n专辑:~3~\n编者:~4~"; 
  this.inr = [];  //行 
  this.oTime = 0;  //余补时间 
  this.hailang; 
  this.dts = -1;  //当前行显示的s 
  this.dte = -1;  //当前行显示的e 
  this.dlt = -1;  //当前行 
  this.ddh;  //当前行数据 
  this.fjh; 
  this.haohaiplay; 
  this.oceanx; 
  this.cnane; 
//以上几个属性是为了判断是否还在上次显示的时间范围，以减少循环次数 

  if(/\[offset\:(\-?\d+)\]/i.test(tt))  //取offset余补时间 
    this.oTime = RegExp.$1/1000; 
  this.gsh = this.gsh.replace("~1~",(/\[ar:([^\[\]:]+)\]/i.test(tt))?RegExp.$1:"----"); 
  this.gsh = this.gsh.replace("~2~",(/\[ti:([^\[\]:]+)\]/i.test(tt))?RegExp.$1:"----"); 
  this.gsh = this.gsh.replace("~3~",(/\[al:([^\[\]:]+)\]/i.test(tt))?RegExp.$1:"----"); 
  this.gsh = this.gsh.replace("~4~",(/\[by:([^\[\]:]+)\]/i.test(tt))?RegExp.$1:"----"); 

  tt = tt.replace(/\[\:\][^$\n]*(\n|$)/g,"$1");  //去掉注解 
  tt = tt.replace(/\[[^\[\]\:]*\]/g,""); 
  tt = tt.replace(/\[[^\[\]]*[^\[\]\d]+[^\[\]]*\:[^\[\]]*\]/g,""); 
  tt = tt.replace(/\[[^\[\]]*\:[^\[\]]*[^\[\]\d\.]+[^\[\]]*\]/g,""); 
  tt = tt.replace(/<[^<>]*[^<>\d]+[^<>]*\:[^<>]*>/g,""); 
  tt = tt.replace(/<[^<>]*\:[^<>]*[^<>\d\.]+[^<>]*>/g,"");  //去掉除时间标签的其它标签 

  while(/\[[^\[\]]+\:[^\[\]]+\]/.test(tt)) 
  { 
    tt = tt.replace(/((\[[^\[\]]+\:[^\[\]]+\])+[^\[\r\n]*)[^\[]*/,"\n"); 
    var zzzt = RegExp.$1; 
    /^(.+\])([^\]]*)$/.exec(zzzt); 
    var ltxt = RegExp.$2; 
    var eft = RegExp.$1.slice(1,-1).split("]["); 
    for(var ii=0; ii<eft.length; ii++) 
    { 
      var sf = eft[ii].split(":"); 
      var tse = parseInt(sf[0],10) * 60 + parseFloat(sf[1]); 
      var sso = { t:[] , w:[] , n:ltxt } 
      sso.t[0] = tse-this.oTime; 
      this.inr[this.inr.length] = sso; 
    } 
  } 
  this.inr = this.inr.sort( function(a,b){return a.t[0]-b.t[0];} ); 

  for(var ii=0; ii<this.inr.length; ii++) 
  { 
    while(/<[^<>]+\:[^<>]+>/.test(this.inr[ii].n)) 
    { 
      this.inr[ii].n = this.inr[ii].n.replace(/<(\d+)\:([\d\.]+)>/,"%=%"); 
      var tse = parseInt(RegExp.$1,10) * 60 + parseFloat(RegExp.$2); 
      this.inr[ii].t[this.inr[ii].t.length] = tse-this.oTime; 
    } 
  } 
  this.print(""); 
} 
lrcClass.prototype.run = function() 
{ 
  try { 
    if(this.oceanx==0) 
      this.runing(this.haohaiplay.controls.currentPosition, this.haohaiplay.currentMedia.duration); 
    else 
      this.runing(this.haohaiplay.GetPosition()/1000, this.haohaiplay.GetLength()/1000); 
  } catch(hh){} 
} 
lrcClass.prototype.runing = function(tme, plen) 
{ 
  if(tme<this.dts || tme>=this.dte) 
  { 
    var ii; 
    for(ii=this.inr.length-1; ii>=0 && this.inr[ii].t[0]>tme; ii--){} 
    if(ii<0) return; 
    this.ddh = this.inr[ii].t; 
    this.fjh = this.inr[ii].w; 
    this.dts = this.inr[ii].t[0]; 
    this.dte = (ii<this.inr.length-1)?this.inr[ii+1].t[0]:plen; 
    this.print(this.retxt(ii)); 
    if(this.dlt==ii-1) 
    { 
      clearTimeout(this.hailang); 
      this.golrcoll(0); 
    } 
    this.dlt = ii; 
  } 
  var bbw = 0; 
  var ki; 
  for(ki=0; ki<this.ddh.length && this.ddh[ki]<=tme; ki++) 
    bbw += this.fjh[ki]; 
  var kt = ki-1; 
  var sc = ((ki<this.ddh.length)?this.ddh[ki]:this.dte) - this.ddh[kt]; 
  var tc = tme - this.ddh[kt]; 
  bbw -= this.fjh[kt] - tc / sc * this.fjh[kt]; 
  if(bbw>lrcbox.offsetWidth) 
    bbw = lrcbox.offsetWidth; 
} 
lrcClass.prototype.retxt = function(i) 
{ 
  return (i<0 || i>=this.inr.length)?"":this.inr[i].n; 
} 
lrcClass.prototype.print = function(txt) 
{ 
  lrcbox.innerText = txt; 

} 
var lrcobj; 
function play(m) 
{ 
  lrcobj = new lrcClass(m); 
  lrcobj.cnane = "lrcobj"; 
  lrcobj.haohaiplay = document.getElementById('player'); 
  lrcobj.oceanx = 0; 
  //0为使用 Media Player 控件，1为使用 Real Player 控件 
  setInterval("lrcobj.run();",100); 
} 
function readLRC() 
{ 
try { 
  idDownload.startDownload(lrcUrl,play);  
} catch(hh){ 
  alert("无法读取非本域歌词"); 
} 
} 

/*播放器背景效果*/
function musicPlayer1(control){
  control.style.backgroundColor="#606383";
}
function musicPlayer2(control){
  control.style.background="none";
}

/*播放器缩放拖动效果*/
function changeplayer(num){
  switch(num)   
  {
    case 1:
    document.getElementById("MusicPlayerwin").style.display="none";
    document.getElementById("MainPlayer").style.height="19px";
    break;
    
    case 2:
    document.getElementById("MusicPlayerwin").style.display="block";
    document.getElementById("MainPlayer").style.height="349px";
    break;
    
    case 3:
    document.getElementById("MusicPlayer").style.display="none";
    document.getElementById("player").controls.stop();
    break;
  }
}

/*获取网页参数*/
function getUrlPara(paraName){ 
 var sUrl  =  location.href;
 var sReg  =  "(?:\\?|&){1}"+paraName+"=([^&]*)"
 var re=new RegExp(sReg,"gi");
 re.exec(sUrl);
 return RegExp.$1;
}

/*加载、卸载页面效果*/
function loadPage(){
 document.getElementById("firstpage").style.display="none";
 document.getElementById("mainpage").style.visibility="visible";
}
function unloadPage(){
 document.getElementById("firstpage").style.display="block";
 document.getElementById("mainpage").style.visibility="hidden";
}

/*显示隐藏发表留言框*/
function showBack(){
 if(document.getElementById("backcontent").style.display=="none"){
   document.getElementById("backcontent").style.display="block";
   document.getElementById("ly").innerHTML="查看留言";
 }
 else{
   document.getElementById("backcontent").style.display="none";
   document.getElementById("ly").innerHTML="我要留言";
 }
}

/*2层交替隐藏显示*/
function inoutDiv(div1,div2){
   document.getElementById(div1).style.display="none";
   document.getElementById(div2).style.display="block";
}

/*显示指定层*/
function showrightdiv(div){
  document.getElementById(div).style.display="block";
}
/*隐藏指定层*/
function hiderightdiv(div){
  document.getElementById(div).style.display="none";
}

/*显示报名详细情况*/
function showwebbackdetails(value1,value2,value3,value4,value5,value6,value7,value8,value9,value10,value11,value12){
    document.getElementById("TextBox1").value=value1;
    document.getElementById("TextBox2").value=value2;
    document.getElementById("TextBox3").value=value3;
    document.getElementById("TextBox4").value=value4;
    document.getElementById("TextBox5").value=value5;
    document.getElementById("TextBox6").value=value6;
    document.getElementById("TextBox7").value=value7;
    document.getElementById("TextBox8").value=value8;
    document.getElementById("TextBox9").value=value9;
    document.getElementById("TextBox10").value=value10;
    document.getElementById("TextBox11").value=value11;
    document.getElementById("TextBox12").value=value12;
    document.getElementById('detail').style.display="block";
}
