function doSendFriend(url)
{	
	var fields = new Array();
	//----------------------------------
	// Populate fields
	//----------------------------------
	
	fields['message']         = document.getElementById("message").value;
	fields['mail_rep']        = document.getElementById("mail_rep").value;
	
	//----------------------------------
	// Is there a post?
	//----------------------------------
	var content;

	content = fields['mail_rep'];
	if ( content.replace( /^\s*|\s*$/g, "" ) == "" )
	{
		alert( "Chua dien Email nguoi nhan" );
		document.getElementById("mail_rep").focus();
		return false;
	}

	content = fields['message'];
	if ( content == "" )
	{
		alert( "Ban chua ghi loi nhan!" );
		document.getElementById("message").focus();
		return false;
	}
	/*--------------------------------------------*/
	// Main function to do on request
	// Must be defined first!!
	/*--------------------------------------------*/
	
	do_request_function = function()
	{
		//----------------------------------
		// Ignore unless we're ready to go
		//----------------------------------
		
		if ( ! sendXML.readystate_ready_and_ok() )
		{
			sendXML.show_loading();
			return;
		}
		
		sendXML.hide_loading();
		
		//----------------------------------
		// INIT
		//----------------------------------
		
		var html = sendXML.xmlhandler.responseText;
		
		//-----------------------------------------
		// Execute JS...
		//-----------------------------------------
		

		if ( html == 'mail-rep' )
		{
			alert( "Mail gui khong dung!" );	
		}
		if ( html == 'message' )
		{
			alert( "Xin loi, ban chua ghi loi nhan gi!" );	
		}
		if ( html == 'done' )
		{			
			document.getElementById("message").value = "";			
			document.getElementById("mail_rep").value = "";
			alert("Mail da duoc gui di, hay tiep tuc gui cho nguoi ban khac nua nhe! Cam on ban da su dung dich vu cua Viet Giai Tri!.");
		}
		
	};
	//----------------------------------
	// LOAD XML
	//----------------------------------
	
	sendXML = new ajax_request();
	sendXML.onreadystatechange( do_request_function );
	var xmlreturn = sendXML.process( url, 'POST', sendXML.format_for_post(fields) );
	
	return false;
}


function doRate(url)
{	
  do_request_function = function(){  	
		if ( ! xmlobj.readystate_ready_and_ok() )
		{
			xmlobj.show_loading();
			return;
		}
		
		xmlobj.hide_loading();

 		var html = xmlobj.xmlhandler.responseText;
		if ( html == 'no-guest' ){
			alert("Sorry! Guest dose not rate.");
			return false;
		}
		if ( html == 'no-permission' ){
			alert("Sorry! Permission deny.");
			return false;
		}
		if ( html == 'voted' ){
			alert("You have already rate.");
			return false;
		}
		if ( html == 'no-vote' ){
			alert("No Vote");
			return false;
		}
		if ( html == 'no-song' ){
			alert("Song not found!");
			return false;
		}

		var content = new Array();
		content = html.split('|');
					
		document.getElementById('r_star').innerHTML = content[0];
		document.getElementById('r_text').innerHTML = content[1];
		alert("Thank for rating!");
	}

  xmlobj = new ajax_request();
  xmlobj.onreadystatechange( do_request_function );
  var xmlreturn = xmlobj.process( url );
  return false;
}

function addToPlaylist(url)
{
  do_request_function = function(){ 
		if ( ! pobj.readystate_ready_and_ok() )
		{
			document.getElementById( 'playlist' ).innerHTML =  "Loading...";
			return;
		}
		
	  document.getElementById( 'playlist' ).innerHTML =  "<img src='"+ipb_var_image_url+"/music/s_ok_add_playlist.gif' border='0' />";
	}

  pobj = new ajax_request();
  pobj.onreadystatechange( do_request_function );
  var xmlreturn = pobj.process( url );
  return false;
}