
function GetXmlHttpObject()
{
	
	var xmlHttp=null;
	try
	{
	 // Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
	 //Internet Explorer
	 try
	  {
	  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	 catch (e)
	  {
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
 }
return xmlHttp;
}


	function Mp3Player(songid)
	{
var rand_no = Math.ceil(1000*Math.random())
document.getElementById("mp3palyer").style.display='block';
document.getElementById("mp3palyer").style.background='url(images/yplayer_bg.jpg)';
/*	*/	xmlHttp=GetXmlHttpObject()
		// if browser not found
		if (xmlHttp==null)
		{
			 alert ("Browser does not support HTTP Request")
			 return
		 } 
		 // Server Url
		var url="include/player.php"
		// Query string variable 
		url=url+"?play="+songid+"&rd="+rand_no;
		xmlHttp.onreadystatechange=PlayerResult 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		
	}
	function DownloadSong(songid)
	{
var rand_no = Math.ceil(1000*Math.random())
document.getElementById("mp3palyer").style.display='block';
document.getElementById("mp3palyer").style.background='url(images/player_bg.jpg)';
/*	*/	xmlHttp=GetXmlHttpObject()
		// if browser not found
		if (xmlHttp==null)
		{
			 alert ("Browser does not support HTTP Request")
			 return
		 } 
		 // Server Url
		var url="include/player.php"
		// Query string variable 
		url=url+"?download="+songid+"&rd="+rand_no;
		xmlHttp.onreadystatechange=PlayerResult 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		
	}
	
	function PlayerResult() 
	{ 
		document.getElementById("mp3palyer").innerHTML="<center><img src=images/loadingbar.gif /></center>";
		
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			// Assign server reponse to div.
			 document.getElementById("mp3palyer").innerHTML=xmlHttp.responseText 
		 } 
	}
function Mp3PlayerClose(){
	document.getElementById("mp3palyer").style.display='none';
	document.getElementById("mp3palyer").innerHTML="<center><img src=images/loadingbar.gif /></center>";
	}
