var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
@end @*/
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}



function createQueryString()
{
	 var lyric=document.getElementById("lyric").value;
	 var songid=document.getElementById("songid").value;
	 var queryString="tag=lyric&lyric=" + lyric + "&songid="+songid;
	 return queryString;
}


function ListenLog(songid, userid) {
	  var url = "/countnum.php?songid="+songid+"&uid="+userid;
	  xmlHttp.open("GET", url, true);
	  xmlHttp.send(null);

}


function delboxsong(songid) {
	  var url = "/info_oper.php?tag=delboxsong&songid="+songid;
	  xmlHttp.open("GET", url, true);
	  xmlHttp.send(null);

}

function editLyric() {
	  var lyric = document.getElementById("lyric").value;
	  if ((lyric == null) || (lyric == "")) return;
	
	  var url = "/info_oper.php";
	
	  xmlHttp.open("POST", url, true);
	
	  xmlHttp.onreadystatechange = updatePage;
	
	  var queryString=createQueryString();
	  xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	  xmlHttp.send(queryString);
}


function updatePage() {
  

	   document.getElementById('lyric_form').style.display = "none";
	   document.getElementById('info').style.display = "block";
	   
	   
	  if (xmlHttp.readyState == 4)
	  {
		setTimeout("Response()",1000)
	  }
}


function Response()
{
	document.getElementById('old_lyric').style.display = "block";
	document.getElementById('info').style.display = "none";
	
	var response = xmlHttp.responseText;
	document.getElementById("old_lyric").innerHTML = response;
	
}



function GetMsgNum() {
	  var url = "/info_oper.php?tag=msg_num";
	  xmlHttp.open("GET", url, true);
	  xmlHttp.onreadystatechange = CountNewMsg;
	  xmlHttp.send(null);
	  
	  
}
function CountNewMsg() {
  
	if (xmlHttp.readyState == 4)
	{
	  NewMsgNum = xmlHttp.responseText;
	  
	  document.getElementById("msgnum").innerHTML = NewMsgNum+"·âÎ´¶Á";
	  
	  if( NewMsgNum > 0 )
	  {
		  document.getElementById('msgnum').style.color = "red";
		  window.open('/msg_pop.php','GreatWall','width=280,height=150,top=10,left=10');
	  }
	}
	
}


function calledit1()
{
	document.getElementById('lyric_form').style.display = "block";
	document.getElementById('old_lyric').style.display = "none";

}
function calledit2()
{
	document.getElementById('lyric_form').style.display = "block";
	document.getElementById('no_lyric').style.display = "none";

}
function CancelEdit()
{
	document.getElementById('lyric_form').style.display = "none";
	document.getElementById('old_lyric').style.display = "block";
	document.getElementById('no_lyric').style.display = "block";
}

function PlayErrorLog(songid) {
	   /*alert(document.getElementById("MediaPlayer1"));*/
	  var play_url=document.getElementById("MediaPlayer1").FileName;
	  var url = "/count_play_error.php?songid="+songid+"&url="+play_url+"&error=1&rand="+Math.random();
	  xmlHttp.open("GET", url, true);
	  xmlHttp.send(null);
	  
}

function PlayLog(ns,songid) {
	  if(ns==5) {
		  var play_url=document.getElementById("MediaPlayer1").FileName;
		  var url = "/count_play_error.php?songid="+songid+"&url="+play_url+"&rand="+Math.random();
		  xmlHttp.open("GET", url, true);
		  xmlHttp.send(null);
	  }
}