/************ NHAMVT *********************/
function PlaytopGetInfo()
{
	thisMovie("playlist").playTopCallInfo();
}
function PlaylistCall(album, link, info, songId, userId, autoplay) 
{
		callTopPlay(songId, link, info, album,autoplay)
		setCurrentMp3(songId,userId,link);
}
function playlistPlay()
{
	//alert ("Playist Play");
	thisMovie("playerTop").pauseTopPlayer();
}
function topPlayerPlay()
{
	//alert ("TopPlay");
	thisMovie("playlist").pausePlaylist();
}

function callTopPlay(songId, link, info, album, autoplay)
{
	thisMovie("playerTop").goFlash(songId, link, info,album, autoplay);
}

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}

/**************** END NHAMVT ************************/
/**************** TOANTK ***************************/


function doGive()
{
	if(mid==''){
		alert("Bạn phải đăng nhập mới có thể tặng quà!");
		return false;
	}
	var rec_id=curMp3Id;
	var bbCodeGift	= $("#bbCodeGift").val();
	var member_give	= $("#txtListMember").val();
	var msg_give	= $("#txtMessageGive").val();	
	var minus_point	;
		if(numSendGift > 0){
			if(mid == ownerMp3)
				minus_point = 10;
			else
				minus_point = 30;
		}else{
			minus_point = 0;
		}
		
	var arr_member = (member_give.substr(0,member_give.length-2)).split(",");
	var true_minus_point = minus_point*arr_member.length;
	if((member_give=="Bạn có thể nhập nhiều thành viên cách nhau bằng dấu phẩy")||(member_give=='')){
		alert("Bạn chưa nhập vào thành viên nhận quà!");
		$("#txtListMember").focus();
		return;
	}	
	if(msg_give==''){
		alert("Bạn chưa nhập vào nội dung tin nhắn!");
		$("#txtMessageGive").focus();
		return;
	}
	if (arr_member.length > 5){
		alert("Bạn chỉ được tặng tối đa cho 5 người mỗi lần !");
		$("#txtListMember").focus();
		return;
	}
	msg_give=strip_script(msg_give);	
	if (minus_point > 0){
		if (confirm("Bạn sẽ bị trừ đi "+ true_minus_point +" điểm . Bạn có muốn tiếp tục không !") == true)	{			
			request = oRootEngine.linkAjaxFile + "?cmd=give&type=1&recording_id="+rec_id;
			$.post(request, {member_give_id: member_give, msg_give: msg_give, bbCodeGift: bbCodeGift, minus_point: minus_point}, function(html){
				LoadGive(html);
			});
		}else{
			$("#txtMessageGive").focus();
			return;
		}
	}else{
		request = oRootEngine.linkAjaxFile + "?cmd=give&type=1&recording_id="+rec_id;
		$.post(request, {member_give_id: member_give, msg_give: msg_give, bbCodeGift: bbCodeGift, minus_point: minus_point}, function(html){
			LoadGive(html);
		});
	}
}

function LoadGive(html){
	if(!isNaN(html)){
		$("#txtListMember").val("");
		$("#txtMessageGive").val("");				
		numSendGift++;
		alert('Bạn đã tặng quà thành công');
	}else{
		if(html=='Fail'){
			alert('Trong danh sách thành viên tặng quà có bạn. Bạn không thể tặng quà cho chính mình');
		}else if(html=='ErrorMem'){
			alert('Danh sách thành viên không chính xác... Hãy kiểm tra lại.');
		}else if(html=='FailPoint1' || html=='FailPoint2'){
			alert('Bạn không đủ điểm để tặng quà... Hãy kiểm tra lại.');
		}
	}
}

function doMessage1(){
	var x_receiver = $( '#memMessage' ).val();
	var x_title = $( '#x_title1' ).val();
	var x_description = $( '#x_description1' ).val();
	if( !isEmpty(x_title) ) {
		alert('Bạn chưa nhập Tiêu đề của tin nhắn!');
		$( '#x_title1' ).focus();
		return ;
	}
	if( !isEmpty(x_description) ) {
		alert('Bạn chưa nhập Nội dung của tin nhắn!');
		$( '#x_description1' ).focus();
		return ;
	}
	request = oRootEngine.linkAjaxFile + "?cmd=memberMessage";
	$.post(request, {x_receiver: x_receiver, x_title: x_title, x_description: x_description}, function(html){
		if (html == 'ErrorMem'){
			alert('Bạn không thể gửi tin nhắn cho chính mình');
		}
		if (html == 'Done'){
			$('#x_title1').val('');
			$('#x_description1').val('');
			$('#messageDiv').hide();
			//alert('Bạn đã gửi tin nhắn thành công');
		}else{
			$('#x_title1').val('');
			$('#x_description1').val('');
			$('#messageDiv').hide();
			alert('Bạn sẽ gửi tin nhắn sau 20 giây');
		}					  
	});
}

function showRateMp3(){
	request = oRootEngine.linkAjaxFile + "?cmd=rateMp3&task=getStatus";
	$.post(request, {curMp3Id: curMp3Id}, function(result){
		if(result==1){
			$("#showRate").show();
		}else{
			$("#showRate").hide();
		}
	});
}

function setFavouriteMp3(){
	if(mid==0){
		alert("Bạn phải đăng nhập thì mới có thể thêm bài hát vào danh sách yêu thích !");
		return;
	}
	request = oRootEngine.linkAjaxFile + "?cmd=setFavouriteMp3";
	$.post(request, {curMp3Id: curMp3Id}, function(result){
		if(result==1){
			alert("Thêm vào danh sách yêu thích thành công.");
		}else if(result==0){
			alert("Bạn phải đăng nhập thì mới có thể thêm bài hát vào danh sách yêu thích !");
			return;
		}else if(result ==2){
			alert("Bạn đã thêm bài hát này vào danh sách yêu thích rồi !");
			return;
		}else{
			alert("Thêm vào danh sách yêu thích thất bại. Bạn hãy thử lại!");
			return;
		}
	});
}

function rateMp3(){
	if(mid==0){
		alert("Bạn phải đăng nhập thì mới có thể bình chọn!");
		return;
	}else{
		request = oRootEngine.linkAjaxFile + "?cmd=rateMp3&task=rate";
		$.post(request, {curMp3Id: curMp3Id}, function(result){
			switch(result){
				case '1':
					$("#showRate").hide();
					var numVote = parseInt($("#numVote").text())+1;
					if(numVote==1)
					{
						var newStar = "<img src='"+oRootEngine.m_sFilePathLayout+"images/icon_star.png' /> <img src='"+oRootEngine.m_sFilePathLayout+"images/icon_star.png' /> <img src='"+oRootEngine.m_sFilePathLayout+"images/icon_star.png' /> <img src='"+oRootEngine.m_sFilePathLayout+"images/icon_star.png' /> <img src='"+oRootEngine.m_sFilePathLayout+"images/icon_star.png' />";
						$("#numStar").html(newStar);
					}
					$("#numVote").html(numVote);
					break;
				case '2': 
					alert("Bạn đã bình chọn bài hát này rồi!");
					return;
				case '3': 
					alert("Bạn không thể bình chọn cho bài hát của chính mình!");
					return;
				case '0':
					alert("Bạn phải đăng nhập mới có thể bình chọn");
					return;
				default:
					alert("123");
					break;
			}
		});
	}
}

function updateListented(){
	
		request = oRootEngine.linkAjaxFile + "?cmd=rateMp3&task=addListened";
		$.post(request, {curMp3Id: curMp3Id}, function(result){	});
	
}

function doBook1(){
	var msg_book= $("#txtBook").val();
	var memBook	= $("#memBook").val();
	if(msg_book==''){
		alert("Bạn chưa nhập vào nội dung lưu bút!");
		$("#txtBook").focus();
		return;
	}
	msg_book=strip_script(msg_book);
	//var url_extent = "&tf="+marray[3]+"&tr="+marray[2]+"&av="+marray[4]+"&po="+marray[1]+"&ic="+marray[5]+"&na="+marray[6];
	var url_extent = "&av="+oRootEngine.avatar;
	request = oRootEngine.linkAjaxFile +"?cmd=membercomment&member="+memBook+url_extent+"&task=insert";
	$('#txtBook').val('');
	$('#bookDiv').hide();
	$.post(request, {bbCode: "", message: msg_book}, function(id){
		alert('Bạn đã gửi lưu bút thành công');
	});
}

function init() {
  if (window.Event) {
    document.captureEvents(Event.MOUSEMOVE);
  }
  document.onmousemove = getXY;
}

function getXY(e) {
  e = e || window.event;
      var cursor = {x:0, y:0};
      if (e.pageX || e.pageY) {
          cursor.x = e.pageX;
          cursor.y = e.pageY;
      }
      else {
          cursor.x = e.clientX +
              (document.documentElement.scrollLeft ||
              document.body.scrollLeft) -
              document.documentElement.clientLeft;
          cursor.y = e.clientY +
              (document.documentElement.scrollTop ||
              document.body.scrollTop) -
              document.documentElement.clientTop;
      }

  $('#posX').val(cursor.x + "px");
  $('#posY').val(cursor.y + "px");
}


function showPanel(i)
{	
	switch (i){
		case 2:
			if($("#panel_2").is(":hidden"))
			{
				$("#panel_2").show();$("#label_2").addClass("nbl-active");
				$("#panel_1").hide();$("#label_1").removeClass("nbl-active");
				$("#panel_3").hide();$("#label_3").removeClass("nbl-active");
			}
		break;
		
		case 3:
			if($("#panel_3").is(":hidden"))
			{
				$("#panel_3").show();$("#label_3").addClass("nbl-active");
				$("#panel_1").hide();$("#label_1").removeClass("nbl-active");
				$("#panel_2").hide();$("#label_2").removeClass("nbl-active");
			}
		break;
		
		case 1:
		default:
			if($("#panel_1").is(":hidden"))
			{
				$("#panel_1").show();$("#label_1").addClass("nbl-active");
				$("#panel_2").hide();$("#label_2").removeClass("nbl-active");
				$("#panel_3").hide();$("#label_3").removeClass("nbl-active");
			}
		break;		
	}
	
}

function openBox(id,memID,memName){
	$("#"+id).css("left", $("#posX").val());
	$("#"+id).css("top", $("#posY").val());
	if (id == 'bookDiv'){		
		closeBox("messageDiv");		
		$("#bookDiv").show();
		$("#memBook").val(memID);
		$("#memNameBook").html(memName);		
	}
	if (id == 'messageDiv'){
		closeBox("bookDiv");
		$("#messageDiv").show();
		$("#memMessage").val(memName);
		$("#memNameMessage").html(memName);
	}
}

function showListPlaylist(mp3id){
	if(mp3id==0)
	{
		$("#listPlaylist").css("left", $("#posX").val());
		$("#listPlaylist").css("top", $("#posY").val());
		mp3IdAdd = curMp3Id;
	}else{
		var Xpos = $("#posX").val();
		var XposVal = parseInt(Xpos.replace("px",""));
		var newXposVal = XposVal-200; 
		var newXpos		= newXposVal+"px";
		$("#listPlaylist").css("left",newXpos);
		$("#listPlaylist").css("top", $("#posY").val());
		mp3IdAdd = mp3id;
	}
	$("#listPlaylist").show();
}

function addToMyPlaylist(plId){
	request = oRootEngine.linkAjaxFile + "?cmd=myPlaylist&task=addMp3&mp3_id="+mp3IdAdd+"&p_id="+plId;
	$.get(request,function(data){
		if(data==2)
		{
			alert("Thêm bài hát vào playlist thành công.");
			$("#listPlaylist").hide();
		}
        else if (data==3)
        {
              alert("Bài hát này đã có trong playlist của bạn.");
              return;
        }
		else
        {
			alert("Không thành công. Bạn hãy thử lại!");
            return;
        }
	});
}

function addBlast(mp3id){
	if(mid==''){
		alert("Bạn phải đăng nhập mới có thể đưa bài hát vào Blast !");
		return false;
	}
		
	if (confirm("Bạn có muốn đặt bài hát này vào Blast của bạn không ?") == true){
		var request = oRootEngine.linkAjaxFile +"?cmd=setmBlast&mp3id="+mp3id;
		$.get(request, function(result){
			if(result==1) alert("Bạn đã đặt bài hát này vào Blast của bạn !");
		});
	}	
}

function closeBox(id){
	if (id == 'bookDiv'){
		$("#bookDiv").hide();
		$("#txtBook").val('');
	}
	if (id == 'messageDiv'){
		$("#messageDiv").hide();
		//$("#x_title1").val('');
		//$("#x_description1").val('');
	}
}

function hideDelButton()
{	
	if(mid != ownerMp3){
		$(".delButton").html("");
	}else{
		$(".delButton").show();
	}
}

function fixdate(int){
	if(int<10){
		var str = "0" + int;
	}else
		var str = int;
	return str;		
}

function deleteComment(cid){
	if(mid != ownerMp3){
		alert("Bạn không được quyền xóa comment của event này!");
		return;
	}else
	{
		var request = oRootEngine.linkAjaxFile +"?cmd=mp3comment&mp3Id="+curMp3Id+"&task=remove";
		$.post(request, {cid: cid}, function(result){ 
			if(result=='False'){
				alert("Bạn không được quyền xóa comment của event này!");
				return;
			}else
			{
				$("#commentMp3").html(result);	
				$(".delButton").show();
			}
		});
		
	}
}
function strip_script(string){
	return string.replace(/<\s*script[^>]*>(.*?)<\s*\/\s*script>/g, '');
}
function doMemberComment(){
	           
	var bbCode = $("#bbCode").val();
	var msg = $("#x_comment").val();
	if(mid==''){
		alert("Bạn phải đăng nhập mới có thể bình luận!");
		return;
	}
	if(msg==''){
		alert("Bạn chưa nhập nội dung !");
		$("#x_comment").focus();
		return;
	}
	if(msg.length > 350){
		alert("Nội dung bình luận không được dài quá 350 ký tự!");
		$("#x_comment").focus();
		return;
	}
	msg=strip_script(msg);
	var new_comment = new Array();
	var date = new Date();
	var month = date.getMonth() + 1;
	var cur_time = date.getFullYear()+"-"+fixdate(month)+"-"+fixdate(date.getDate())+" "+fixdate(date.getHours())+":"+fixdate(date.getMinutes())+":"+fixdate(date.getSeconds());
	var url_extent = "&av="+oRootEngine.avatar;
		
	if(mid!=ownerMp3)
	{
	    request = oRootEngine.linkAjaxFile +"?cmd=mp3comment&mp3Id="+curMp3Id+url_extent+"&task=insert";
	    $.post(request, {bbCode: bbCode, message: msg}, function(id){ });
		new_comment[0] = 0;
		new_comment[1] = curMp3Id;
		new_comment[2] = mid;
		new_comment[3] = bbCode+"&nbsp; "+msg;
		new_comment[4] = cur_time;
		new_comment[5] = oRootEngine.username;
		new_comment[6] = oRootEngine.avatar;		
		var content = createElement(new_comment) + $("#commentMp3").html();
		$("#commentMp3").html(content);	
		$("#x_comment").val("");
	}else
	{
		request = oRootEngine.linkAjaxFile +"?cmd=mp3comment&mp3Id="+curMp3Id+url_extent+"&task=insert";
	    $.post(request, {bbCode: bbCode, message: msg}, function(id){ 
			new_comment[0] = id;
			new_comment[1] = curMp3Id;
			new_comment[2] = mid;
			new_comment[3] = bbCode+"&nbsp; "+msg;
			new_comment[4] = cur_time;
			new_comment[5] = oRootEngine.username;
			new_comment[6] = oRootEngine.avatar;		
			var content = createElement(new_comment) + $("#commentMp3").html();
			$("#commentMp3").html(content);	
			$("#x_comment").val("");
		});
	}
}

function createElement(content){
	var id 			= content[0];
	var mp3Id 		= content[1];
	var memberId 	= content[2];
	var comment 	= bbDecode(translate(content[3]));	
	var created		= content[4];
	var username 	= content[5];
	var avatar 		= content[6];
	var link		= oRootEngine.m_sAbsPath + username+".htm";

	var ava = (avatar=="") ? "nophoto.png": avatar;
	var element = 	"<div class='mp3-bluan clearfix' id='comment_"+id+"'>";
		element	+=		"<div class='mp3-bl-avatar'>";
		element	+=			"<img src='"+oRootEngine.sPathMedia+"uploadedImages/avatar/"+ava+"' width='57px' height='57px' />";
		element	+=		"<div class='mp3-bl-tail'>&nbsp;</div>";
		element	+=		"</div>";
		element	+= 		"<div class='mp3-bl-info'>";
		element	+=			"<div class='mp3-bl-ifcontent'>";
		if(id==0)
			element	+=			"<h4><a href='"+link+"'>"+username+"</a>  viết lúc "+created+"</h4>";
		else
			element +=			"<h4><a href='"+link+"'>"+username+"</a>  viết lúc "+created+" <span class='delButton'><a href='#null' onclick='deleteComment("+id+")'>Xóa</a></span></h4>";
		element	+=				comment;
		element	+=			"</div>";
		element	+= 			"<div class='mp3-bl-ifbt'><a href=\"javascript:openBox('bookDiv',"+memberId+",'"+username+"');\">Viết lưu bút</a> - <a  href=\"javascript:openBox('messageDiv',"+memberId+",'"+username+"');\">Nhắn tin</a></div>";
		element	+=		"</div>";
		element	+=	"</div>";	
		element	+= 	"<div style='display:none;'>identify</div>";
	return element;
}

// DOng Ta
function pagingChangePage9( id ) {			
	var oForm = document.getElementById( "mainForm" );
	if( id ) {
		createHidden( 'page', id );
	}else {
		createHidden( 'page', oForm.x_pagingPage.value );
	}
	oForm.sys_sOption.value = "mp3";
	oForm.sys_sTask.value	= "showallcomment";
	oForm.submit();
}

function setCurrentMp3(newMp3Id,newOwnerMp3Id,linkFile){
	curMp3Id 	= newMp3Id;
	oRootEngine.curMp3Id	= newMp3Id;
	mp3IdAdd 	= mp3IdAdd;
	oRootEngine.curMp3Id	= newMp3Id;
	ownerMp3	= newOwnerMp3Id;
	oRootEngine.ownerMp3	= newOwnerMp3Id;	
	showMp3Comment(curMp3Id);
	loadMp3Info();	
	showPanel(1);	
	updateListented();
	showRateMp3();	
	$("#downloadFile").html("<a href='"+linkFile+"'></a>");
}

function showMp3Comment(newMp3Id)
{
	$("#commentMp3").html("<div style='text-align:center'><img src='"+oRootEngine.m_sFilePathLayoutImages+"ajax-loading.gif' alt='' /></div>");
	request = oRootEngine.linkAjaxFile +"?cmd=mp3comment&mp3Id="+newMp3Id+"&task=show";
    $.post(request, function(result){ 		
		$("#commentMp3").html(result);
		hideDelButton();				
	});
}

function doRef(){
	if(mid==''){
		alert("Bạn phải đăng nhập mới có thể chia sẻ ca khúc!");
		return false;
	}
	var rec_id = curMp3Id;
	var member_ref	= $("#txtMember").val();
	var msg_ref	= $("#txtMessage").val();
	var arr_member = (member_ref.substr(0,member_ref.length-2)).split(",");
	if((member_ref=="Bạn có thể nhập nhiều thành viên cách nhau bằng dấu phẩy")||(member_ref=='')){
		alert("Bạn chưa nhập vào thành viên nhận chia sẻ ca khúc!");
		$("#txtMember").focus();
		return;
	}	
	if(arr_member.length > 10){
		alert("Bạn chỉ có thể chia sẻ ca khúc cho tối đa 10 người !");
		$("#txtMember").focus();
		return;
	}
	if(msg_ref==''){
		alert("Bạn chưa nhập vào nội dung tin nhắn!");
		$("#txtMessage").focus();
		return;
	}
	member_ref=strip_script(member_ref);
	msg_ref=strip_script(msg_ref);		
	request = oRootEngine.linkAjaxFile + "?cmd=reference&type=1&recording_id="+rec_id+"&av="+oRootEngine.avatar;
	$.post(request, {member_ref_id: member_ref, msg_ref: msg_ref}, function(html){
		LoadRef(html);
	});
}

function loadMp3Info(){
	$("#mp3Info").html("<div style='text-align:center'><img src='"+oRootEngine.m_sFilePathLayoutImages+"ajax-loading.gif' alt='' /></div>");
	request = oRootEngine.linkAjaxFile + "?cmd=mp3_info";
	$.post(request, {mp3Id: curMp3Id}, function(result){
		$("#mp3Info").html(result);
	});
}

function LoadRef(html){		
	if(html=='Done'){
		$("#txtMember").val("");
		$("#txtMessage").val("");	
		alert('Bạn đã chia sẻ bài hát thành công');
	}else{
		if(html=='ErrorMem'){			
			$("#txtMember").focus();
			alert('Danh sách thành viên không chính xác... Hãy kiểm tra lại.');
			return;
		}else if(html=='ErrorLimit'){
			$("#txtMember").focus();
			alert('Bạn chỉ có thể chia sẻ 30 lần trong một ngày.');
			return;
		}else{
			$("#txtMember").val("");
			$("#txrMessage").val("");
			alert('Bạn đã chia sẻ bài hát thành công.\nNhưng bạn không thể chia sẻ cho '+html+' được vì bạn đã bị '+html+' từ chối nhận chia sẻ.');
		}
	}	
}

function LoadSameNewMp3(div, page){	
	$.ajax({
		type: 	"GET",
		url: 	oRootEngine.linkAjaxFile,
		data: 	"cmd=sameMemberMp3&type=new&mp3Id="+curMp3Id+"&page="+page,
		cache:	true,
		success: function(list_mp3){			
			DrawRecording(list_mp3,div,page,"LoadSameNewMp3");
		}
	});	
}

function LoadSameHotMp3(div, page){	
	$.ajax({
		type: 	"GET",		
		url: 	oRootEngine.linkAjaxFile,
		data: 	"cmd=sameMemberMp3&type=hot&mp3Id="+curMp3Id+"&page="+page,
		cache:	true,
		success: function(list_mp3){			
			DrawRecording(list_mp3,div,page,"LoadSameHotMp3");	
		}
	});	
}

function LoadMp3Related(div){	
	$.ajax({
			type: 	"GET",		
			url: 	oRootEngine.linkAjaxFile,
			data: 	"cmd=mp3Related&mp3Id="+curMp3Id,
			cache:	true,
			success: function(list_result){
				DrawListMp3Related(list_result,div);
			}
		});	
}

function DrawListMp3Related(list_result,div){
	var total 	= $(list_result).find("config").attr("total");
	rowppage	= 10;		
	var sRecords	= '<ul class="moinhatcua">';
			
	var i= 0 ;
	$(list_result).find("detail").each(function(){							
		i++;
		var id			= $(this).attr('id');
		var typeR		= $(this).attr('type');
		var avatar		= $(this).attr('avatar');
		var song_name	= $(this).attr('song_name');
		var singer_name	= $(this).attr('singer_name');	
		var linkDetail	= $(this).attr('linkDetail');	
		var listen_time	= $(this).attr('listen_time');
		var comment_time= $(this).attr('comment_time');
		var total_vote	= $(this).attr('total_vote');
		var created		= $(this).attr('created');
		
		if(total_vote>0)
			img_star	= "<img src = '"+sPathLayout+"images/star_s1.gif' alt='' /><img src = '"+sPathLayout+"images/star_s1.gif' alt='' /><img src = '"+sPathLayout+"images/star_s1.gif' alt='' /><img src = '"+sPathLayout+"images/star_s1.gif' alt='' /><img src = '"+sPathLayout+"images/star_s1.gif' alt='' /> (5/5)";
		else
			total_vote	= "<img src = '"+sPathLayout+"images/star_s2.gif' alt='' /><img src = '"+sPathLayout+"images/star_s2.gif' alt='' /><img src = '"+sPathLayout+"images/star_s2.gif' alt='' /><img src = '"+sPathLayout+"images/star_s2.gif' alt='' /><img src = '"+sPathLayout+"images/star_s2.gif' alt='' /> (0/5)";
			
		
		idSpan	= "Related_";
		var imgplay = "";
		var image = "";
		if(typeR==2)
		{
			imgplay = "<span id='"+idSpan+i+"' onclick=\"quickPlay("+id+",'"+idSpan+"',"+rowppage+","+i+",0)\" class='btdg-play' style='margin-left:15px; margin-top:10px;'><a href='#null' ></a></span>";
			image = "<a href='"+linkDetail+"' ><span style='position:absolute;'><img style='border:none;' src='"+oRootEngine.m_sFilePathLayout+"images/rec.gif' /></span><img src='"+ sPath + "uploadedImages/recording_avatar/"+avatar+"' class='stroke' width='52' height='34' onmouseout='changeBoderColor(this,1)' onmouseover='changeBoderColor(this,0)'/></a>";
		}
		else if(typeR==3)
		{
			imgplay = "<span id='"+idSpan+i+"' onclick=\"quickPlay("+id+",'"+idSpan+"',"+rowppage+","+i+",1)\" class='btdg-play' style='margin-left:15px; margin-top:10px;'><a href='#null' ></a></span>";
			image = "<a href='"+linkDetail+"' ><span style='position:absolute;'><img style='border:none;' src='"+oRootEngine.m_sFilePathLayout+"images/mp3.gif' /></span><img src='"+ sPath + "uploadedImages/mp3/"+avatar+"' class='stroke' width='52' height='34' onmouseout='changeBoderColor(this,1)' onmouseover='changeBoderColor(this,0)'/></a>";
		}else
		{			
			imgplay = "";
			image = "<a href='"+linkDetail+"' ><span style='position:absolute;'><img style='border:none;' src='"+oRootEngine.m_sFilePathLayout+"images/kar.gif' /></span><img src='"+ sPath + "uploadedImages/mp3/"+avatar+"' class='stroke' width='52' height='34' onmouseout='changeBoderColor(this,1)' onmouseover='changeBoderColor(this,0)'/></a>";
		}
		
		if(typeR==2 || ( typeR==3 && (id != curMp3Id) ))
		{
			linkUser	= oRootEngine.m_sAbsPath+singer_name+'.htm';
            
			sRecords += 			'<li class="clearfix" >';
            sRecords +=             '<div class="mnc-image">'+image+'</div>';
            sRecords +=                '<div class="mmc-info">';
            sRecords +=                    '<a href="'+linkDetail+'">'+song_name+'</a> - <a href='+linkUser+'>'+singer_name+'</a>';
            sRecords +=                    '<div>'+listen_time+' lượt nghe | '+comment_time+' bình luận | '+created+'</div>';
            //sRecords +=                    '<div class="mmc-other clearfix">';
            //sRecords +=                        '<div class="mnc-star">';
            //sRecords +=                            img_star;
            //sRecords +=                        '</div>';
            //sRecords +=                        '<div class="mnc-time">'+created+'</div>';
            //sRecords +=                    '</div>';
            sRecords +=                '</div>';	            
            sRecords +=                imgplay;
            sRecords +=                '<div style="text-align:left; width:310px;"><a href="#null" style="font-weight:normal;font-size:11px;" onclick="showQuickComment('+id+','+typeR+');" >Bình luận nhanh</a></div>';
           sRecords +=                '<div style="padding-left:10px;line-height:5px;" id="muiten_'+id+'"></div>';
            sRecords +=                '<div id=comment_'+id+'_'+typeR+' style="padding:0;"></div>';
            sRecords +=                '<div id="div_'+id+'_'+typeR+'" class="quickComment"><input type="text" size="39" name="txt_quickcomment_'+id+'_'+typeR+'"  id="txt_quickcomment_'+id+'_'+typeR+'"/> <input type="button" class="btnQuickComment" name="btnSend" id="btnSend" value="Gửi" onclick="quickComment('+id+','+typeR+');"/></div>';
            sRecords +=            '</li>';
		}else if (typeR==1)
		{
			sRecords += 			'<li class="clearfix">';
            sRecords +=             '<div class="mnc-image">'+image+'</div>';
            sRecords +=                '<div class="mmc-info">';
            sRecords +=                    '<a href="'+linkDetail+'">'+song_name+' - '+singer_name+'</a>'; 
            sRecords +=						'<div>'+listen_time+' lượt thu </div>';
            sRecords +=                '</div>';	            
            sRecords +=                imgplay;
            sRecords +=            '</li>';
		}
		else
		{}
		
	});
	sRecords += '</ul>';
	
	if(i!=0)
		$("#"+div).html(sRecords);	
	else
		$("#"+div).html("<div style='text-align:center'>Không có bản thu liên quan</div>");	
}

function showQuickComment(idSong,typeR)
{
	$(".quickComment").hide();
    $("#div_"+idSong+"_"+typeR).show();

	$("#txt_quickcomment_"+idSong+"_"+typeR).focus();
	if($("#txt_quickcomment_"+idSong+"_"+typeR).hasClass("clicked")==false)
	{
		$("#txt_quickcomment_"+idSong+"_"+typeR).keypress(function (e) 
		{		
	      	if (e.which == 13)
	      		quickComment(idSong,typeR);      	 
	    });
	    $("#txt_quickcomment_"+idSong+"_"+typeR).addClass("clicked");
	}
}

function quickComment(idSong,typeR)
{
    $("#muiten_"+idSong).html('<img src="'+oRootEngine.m_sFilePathLayout+'images/qcmui-ten.gif" />');
    var txtComment = $("#txt_quickcomment_"+idSong+"_"+typeR).val();
    if(jQuery.trim(txtComment) == ''){
        alert("Nội dung bình luận không nên để trống!");
        $("#txt_quickcomment_"+idSong+"_"+typeR).focus();
    }else{
    	if(typeR==3)
    	{
    		request = oRootEngine.linkAjaxFile + "?cmd=mp3comment&mp3Id="+idSong+"&av="+oRootEngine.avatar+"&task=insert";
    		$.post(request, {bbCode: '', message: txtComment}, function(html){
    			curHtml = $("#comment_"+idSong+"_"+typeR).html();
                curHtml += '<div class="qcContent">'+txtComment+'</div>'

    			$("#comment_"+idSong+"_"+typeR).html(curHtml);
    			$("#txt_quickcomment_"+idSong+"_"+typeR).val('');
    		});
    	}else if(typeR==2)
    	{
    		request = oRootEngine.linkAjaxFile + "?cmd=comrecord&rid="+idSong+"&av="+oRootEngine.avatar+"&task=add";
    		$.post(request, {bbCode: '', message: txtComment}, function(html){
    			curHtml = $("#comment_"+idSong+"_"+typeR).html();
    			curHtml += "<div class='qcContent'>"+txtComment+"</div>";
    			$("#comment_"+idSong+"_"+typeR).html(curHtml);
    			$("#txt_quickcomment_"+idSong+"_"+typeR).val('');
    		});
    	}
    	else
    	{}
    }
}

function DrawRecording(list_mp3,div,page,func_name){				
	if(page<=0) page=1;
	var total_page 	= $(list_mp3).find("config").attr("total_page");	
	var linkAll 	= $(list_mp3).find("config").attr("linkAll");	
	var paging 		= pagging_ajax(total_page, page, div , func_name);	
	var	rowppage	= 6;
	var sRecords	= '';
	if(total_page>0)
	{
		sRecords += '<div class="neo-vtx-top clearfix"><div class="neo-vtx-paging">'+paging+'</div></div><ul class="moinhatcua">';		
		var i= 0 ;
		$(list_mp3).find("detail").each(function(){							
			i++;
			var id			= $(this).attr('id');
			var avatar		= ($(this).attr('avatar') != "" && $(this).attr('avatar') != "undefined")? $(this).attr('avatar'):'noPhoto.png';
            var song_name	= $(this).attr('song_name');
			var singer_name	= $(this).attr('singer_name');
			var total_listened	= $(this).attr('total_listened');
			var total_comments	= $(this).attr('total_comments');
			var total_rated	= $(this).attr('total_rated');
			var created		= $(this).attr('created');
			var linkRecord	= $(this).attr('linkRecording');
			if(total_rated>0)
				img_star	= "<img src = '"+sPathLayout+"images/star_s1.gif' alt='' /><img src = '"+sPathLayout+"images/star_s1.gif' alt='' /><img src = '"+sPathLayout+"images/star_s1.gif' alt='' /><img src = '"+sPathLayout+"images/star_s1.gif' alt='' /><img src = '"+sPathLayout+"images/star_s1.gif' alt='' /> (5/5)";
			else
				img_star	= "<img src = '"+sPathLayout+"images/star_s2.gif' alt='' /><img src = '"+sPathLayout+"images/star_s2.gif' alt='' /><img src = '"+sPathLayout+"images/star_s2.gif' alt='' /><img src = '"+sPathLayout+"images/star_s2.gif' alt='' /><img src = '"+sPathLayout+"images/star_s2.gif' alt='' /> (0/5)";
				
			if(func_name == "LoadSameNewMp3")
				idSpan	= "New_";
			else if(func_name == "LoadSameHotMp3")
				idSpan	= "Hot_"
			var imgplay = "<span id='"+idSpan+i+"' onclick=\"quickPlay("+id+",'"+idSpan+"',"+rowppage+","+i+",1)\" class='btdg-play' style='margin-left:15px; margin-top:10px;'><a href='#null' ></a></span>";
						
			var image = "<a href='"+linkRecord+"' ><img src='"+ sPath + "uploadedImages/mp3/"+avatar+"' class='stroke' width='52' height='34' onmouseout='changeBoderColor(this,1)' onmouseover='changeBoderColor(this,0)'/></a>";
			
			if(id != curMp3Id)
			{
				sRecords += 			'<li class="clearfix">';
	            sRecords +=             '<div class="mnc-image">'+image+'</div>';
	            sRecords +=                '<div class="mmc-info">';
	            sRecords +=                    '<a href="'+linkRecord+'">'+song_name+'</a>';
	            sRecords +=                    '<div>'+total_listened+' lượt nghe | '+total_comments+' bình luận</div>';
	            sRecords +=                    '<div class="mmc-other clearfix">';
	            sRecords +=                        '<div class="mnc-star">';
	            sRecords +=                            img_star;
	            sRecords +=                        '</div>';
	            sRecords +=                        '<div class="mnc-time">'+created+'</div>';
	            sRecords +=                    '</div>';
	            sRecords +=                '</div>';	            
	            sRecords +=                imgplay;
	            sRecords +=            '</li>';
			}
			
		});
		sRecords += '</ul>';
	}else{
		sRecords = '<div style="text-align:center;">Chưa có bản thu khác</div>';
	}	
	$("#"+div).html(sRecords);	
}

function ActionForSlideInput(){
	$("input.un-urlslide").change(function(){
		var img = $(this).val();
		var idElem = $(this).attr("id");
		var arr = idElem.split("_");
		var id = arr[1];
		
		if(img.substr(0,5)!="http:" && img!=""){
			alert("Đường dẫn ảnh Slide của bạn không đúng. Xin hãy kiểm tra lại ngay.");
			$("#"+idElem).focus();
			$("#sIamge_"+id).hide();
		}else if( img.length<5 && img!=""){
			alert("Đường dẫn ảnh Slide của bạn không đúng. Xin hãy kiểm tra lại ngay.");
			$("#"+idElem).focus();
			$("#sIamge_"+id).hide();
		}else if(img==""){
			$("#sIamge_"+id).hide();
		}else{
			if ($("#sIamge_"+id).attr("name") != null ){
				$("#sIamge_"+id).attr("src",img);
				$("#sIamge_"+id).show();
			}else{
				$("#view_slide").append("<img class='sImage' id='sIamge_"+id+"' src='"+img+"' >");
			}
		}
		
	}).click( function(){ $(this).select(); });		

	
}

function openEditBlock(){
	$("#mp3_nhung").hide();
	$("#frm_ringtone").hide();
	if ( $("div.mp3-blockEditSlide").css("display")	== "none")
		$("div.mp3-blockEditSlide").show();
	else
		$("div.mp3-blockEditSlide").hide();
}

function checkEditMp3(){
	var sUrl = ''; var strSlide = ''; var eAvatar = '';
	for(var i=1;i<=9;i++){
		sUrl = $("#sUrl_"+i).val();
		if(checkValidSilde(sUrl)){
			strSlide +=   sUrl+"[-s-]";
		}
	}
	strSlide 	= strSlide.substr(0,strSlide.lastIndexOf("[-s-]"));
	eAvatar		= $("#eAvatar").val();
	
	if (eAvatar != ''){
		if ( !check_is_valid_file(document.getElementById('eAvatar')) ){
			return false;
		}
	}
	$("#hdSlide").val(strSlide);
	$("#editMp3").submit();
}

function checkValidSilde(str){
	if(str.substr(0,5)!="http:" && str!=""){
		return false;
	}else if( str.length<5 && str!=""){
		return false;
	}else if(str==""){
		return false;
	}else{
		return true;
	}
}

function check_is_valid_file(obj){
	var check = obj.value;
	var dump  = check.split('/');
	var file_name = dump.pop();
	var tail = file_name.split('.');
	var str = '';
	var validFormat = '';
	tail = tail.pop();
	tail = tail.toLowerCase();
	str = 'jpggifpngjpeg';
	validFormat = 'JPG hoặc GIF hoặc PNG hoặc JPEG';
			
	if(str.match(tail) == null){
		obj.value = '';
		alert('Bạn hãy chọn đúng định dạng file '+validFormat+'.\nFile bạn chọn có dịnh dạng ".'+tail+'"');
		return false;
	}
	return true;
}

function clear_text(elm){if($(elm).val()=="Bạn hãy nhập lời nhắn vào đây") $(elm).val("");}
function check_text(elm){if($(elm).val()=="") $(elm).val("Bạn hãy nhập lời nhắn vào đây");}
function selectbox(id){
	$(".type_box").hide();
	$("#"+id).show();
	if(id=="box_1"){
		pl_width = 285;
		pl_heigth = 104;
		player = 'playerNhung';
		var type = 2;
	}else if(id=="box_2"){
		pl_width = 234;
		pl_heigth = 45;
		player = 1;
		var type = 1;
		sel_player(1);
	}else if(id=="box_3"){
		pl_width = 480;
		pl_heigth = 400;
		player = 'playerNhungSlide_be';
		var type = 3;
		setsizenhung(1);
	}
	export_code(type);
}
function sel_player(id){
	$("#player_demo_1").attr("src", "../static/layouts/images/player_nhung/"+id+"-to.jpg");
	$("#text_msg").removeClass("text_player_2");
	$("#text_msg").removeClass("text_player_3");
	$("#text_msg_1").removeClass("text_player_1");
	$("#text_msg_1").removeClass("text_player_2");
	$("#text_msg_1").removeClass("text_player_3");
	if(id==3 || id==4 || id==8){
		$("#text_msg_1").addClass("text_player_1");
	}else if(id==5 || id==6){
		$("#text_msg").addClass("text_player_2");
		$("#text_msg_1").addClass("text_player_2");
	}else if(id==9){
		$("#text_msg").addClass("text_player_3");
		$("#text_msg_1").addClass("text_player_3");
	}
	player = id;
	export_code(1);
}
function input_text(elm){
	var text = $(elm).val();
	$("#text_msg_1").html(text);
	msg = text;
	export_code(1);
}
function export_code(type){

    var autoplay ;
    if(type==1)
    {
      if($("#chkautoplay1").attr("checked")==true)
          autoplay = "&autoPlay=1";
      else
          autoplay = "";
    }
    else
        autoplay = "";

	var param = (type==1) ? "mini_player/"+player+'.swf?info='+encodeURI(song_name)+'&messenger='+encodeURI(msg)+'&link='+link_song+'&id='+song_id+autoplay : player+'.swf?id='+song_id+autoplay;
	var blog_code  = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+pl_width+'" height="'+pl_heigth+'" id="'+player+'" align="middle">';
        blog_code += '<param name="allowScriptAccess" value="sameDomain" />';
        blog_code += '<param name="allowFullScreen" value="false" />';
        blog_code += '<param name="movie" value="'+sServerPath+param+'" />';
        blog_code += '<param name="quality" value="high" />';
		blog_code += '<param value="transparent" name="wmode"/>';
        blog_code += '<param name="bgcolor" value="#ffffff" />';
        blog_code += '<embed src="'+sServerPath+param+'" quality="high" wmode="transparent" bgcolor="#ffffff" width="'+pl_width+'" height="'+pl_heigth+'" name="'+player+'" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
    	blog_code += '</object>';
    //alert(blog_code);
	if(type==1)
		$("#blog_code").val(blog_code);
	else if(type==2)
		$("#blog_code_1").val(blog_code);
	else if(type==3)
		$("#blog_code_2").val(blog_code);
}
function copy_text(elm){
	$(elm).select();
	$.copy($(elm).val());
}
function openNhung(){
	$("#frm_ringtone").hide();
	$("#frm_addfeed").hide();
	$("div.mp3-blockEditSlide").hide();
	var sts = $("#mp3_nhung").css("display");
	if(sts=="none")
		$("#mp3_nhung").slideDown();
	else
		$("#mp3_nhung").slideUp();
}
function show_msgcopy(type){
	if(type==1){
		$("div.nhung.clearfix").append("<div class='msg_nhungmp3'>Mã nhúng đã được copy.</div>");
	}else
		$(".msg_nhungmp3").remove();
}

function setsizenhung(type){
	if(type==1){ //be
		pl_width = 480;
		pl_heigth = 400;
		$("#sizenhung:first").attr("checked","checked");
		$("#withslide_demo").attr("src", "../static/layouts/images/demo-flash_be.gif");
		player = 'playerNhungSlide_be';
	}else{ //to
		pl_width = 600;
		pl_heigth = 445;
		$("#withslide_demo").attr("src", "../static/layouts/images/demo-flash_to.gif");
		player = 'playerNhungSlide_to';
	}
	export_code(3);
}
function openringtone(id,url){
	$("#mp3_nhung").hide();
	$("#frm_addfeed").hide();
	$("div.mp3-blockEditSlide").hide();
	var sts = $("#frm_ringtone").css("display");
	if(sts=='none'){
		$("#ringtone_flash").show();
		$("#ringtone_result").hide();
		$("#frm_ringtone").slideDown();
	}else
		$("#frm_ringtone").slideUp();
}
function openaddfeed(){
	$("#mp3_nhung").hide();
	$("#frm_ringtone").hide();
	$("div.mp3-blockEditSlide").hide();
	var sts = $("#frm_addfeed").css("display");
	if(sts=='none'){
		$("#frm_addfeed").slideDown();
	}else
		$("#frm_addfeed").slideUp();
		
	var param = 'playerNhung.swf?id='+song_id+'&Autoplay=1';
	var blog_code  = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="285" height="104" id="playerNhung" align="middle">';
        blog_code += '<param name="allowScriptAccess" value="sameDomain" />';
        blog_code += '<param name="allowFullScreen" value="false" />';
        blog_code += '<param name="movie" value="'+sServerPath+param+'" />';
        blog_code += '<param name="quality" value="high" />';
		blog_code += '<param value="transparent" name="wmode"/>';
        blog_code += '<param name="bgcolor" value="#ffffff" />';
        blog_code += '<embed src="'+sServerPath+param+'" quality="high" wmode="transparent" bgcolor="#ffffff" width="285" height="104" name="playerNhung" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
    	blog_code += '</object>';
		$("#blog_code_5").val(blog_code);
}
function ringtone(start, duration, ext){
	var request = oRootEngine.linkAjaxFile + "?cmd=ringtone&sta="+start+"&dur="+duration+"&ext="+ext+"&url="+link_song;
	$.get(request, function(data){
		if(data > 0){
			$("#ringtone_result > div.smscode").html("SN "+data);
			if(mid>0)
				$("#ringtone_result > div.ringtone-result-3").html("Hệ thống sẽ gửi nhạc chuông về máy bạn sau ít phút");
			$("#ringtone_flash").hide();
			$("#ringtone_result").show();
		}else
			alert("Có lỗi xảy ra, mời bạn thử lại.");
	});
}

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName]
	}else{
		return document[movieName]
	}
}

/*BEGIN Hieu 23-02-09*/
function selectbox_mm(id){
	$(".type_box").hide();
	$("#"+id).show();
	sel_player_mm(1);
}

function sel_player_mm(id){
    var autoplay;
    if($("#chkautoplay2").attr("checked")==true)
          autoplay = "&autoPlay=1";
    else
          autoplay = "";

	var param = "images/music_mood_flash/"+id+'.swf?info='+song_name+'&messenger='+msg+'&link='+link_song+'&id='+song_id+autoplay;
	$("#player_mm_1").attr("src", "../static/layouts/images/music_mood/large_icon/"+id+".jpg");
	var blog_code  = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="160" height="40" id="'+id+'" align="middle">';
	blog_code += '<param name="allowScriptAccess" value="sameDomain" />';
	blog_code += '<param name="allowFullScreen" value="false" />';
	blog_code += '<param name="movie" value="'+sPathLayout+param+'" />';
	blog_code += '<param name="quality" value="high" />';
	blog_code += '<param value="transparent" name="wmode"/>';
	blog_code += '<param name="bgcolor" value="#ffffff" />';
	blog_code += '<embed src="'+sPathLayout+param+'" quality="high" wmode="transparent" bgcolor="#ffffff" width="160" height="40" name="'+id+'" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	blog_code += '</object>';
    //alert(blog_code);
	$("#blog_code_4").val(blog_code);
}
/*END Hieu 23-02-09*/
function addFeed(){
	if(sid != 0){
		var contentBlast = $("#contentBlast").val();
		var contentMedia = $("#blog_code_5").val();
		if(jQuery.trim(contentBlast) == ""){
			alert("Nội dung không được rỗng!");
			$("#contentBlast").focus();
			return false;
		}else{
			request = oRootEngine.linkAjaxFile + "?cmd=checkUrlEmbed";
			$.post(request, {auth: sid, contentBlast: contentBlast, numMedia: 1, contentMedia1: contentMedia, pType: 13, content_id: curMp3Id }, function(result){
				$("#contentBlast").val("");
				alert("Bạn đã thêm bài hát vào feed");
			});
		}
	}else{
		alert("Bạn phải đăng nhập mới có thể thêm bài hát vào feed!");
		return false;
	}
}

switch( oRootEngine.sys_sTask ){
	case 'detailMp3':			
		var curMp3Id 	= oRootEngine.curMp3Id;
		var mp3IdAdd 	= oRootEngine.mp3IdAdd;
		var sPath 		= oRootEngine.sPathMedia;
		var sPathLayout	= oRootEngine.m_sFilePathLayout;
		var sServerPath = oRootEngine.m_sAbsPath;
		var mid 		= oRootEngine.memberId;
		var sid 		= oRootEngine.sid;
		var ownerMp3	= oRootEngine.ownerMp3;
		var	numSendGift = oRootEngine.numSendGift;
		var options_xml = null;
        var tangqua_json = null;//new bsn.AutoSuggest('x_title1', options_xml);
        var chiase_json = null;
		$("#closeListPlaylist").click(function(){$("#listPlaylist").hide();});
		hs.graphicsDir = oRootEngine.m_sFilePathJs+'highslide/graphics/';
		hs.outlineType = 'rounded-white.v1';
		hs.outlineWhileAnimating = true;
		getIcon_comment("div_icon_comment");	
		getIcon_gift("div_icon_gift");
		
		var msg = "SanNhac.com";
		var pl_width = 234;
		var pl_heigth = 45;
		var player = 1;
		var song_name = oRootEngine.song_name;
		var link_song = oRootEngine.song_link;
		var song_id = curMp3Id;
		
		$(document).ready(function(){			
			ActionForSlideInput();
			hideDelButton();
			init();
			showRateMp3();
			loadMp3Info();
			updateListented();
			LoadSameNewMp3("sameMemberMp3New",1);
			LoadSameHotMp3("sameMemberMp3Hot",1);	
		    LoadMp3Related("mp3Related");
			
           chiase_str = {
                script: function () { return sServerPath+"nick_suggest.php?input="+$('#txtMember').val(); },
                json: true
            };
            chiase_json = new bsn.AutoSuggest('txtMember', chiase_str);

            tangqua_str = {
                script: function () { return sServerPath+"nick_suggest.php?input="+$('#txtListMember').val(); },
                json: true
            };
            tangqua_json = new bsn.AutoSuggest('txtListMember', tangqua_str); 
			
			export_code(1);
			$('#s7').cycle({
				fx:    'scrollHorz',
				delay: -1000,
				speed:  500, 
				next:   '#s2', 
				prev: '#s1',
				timeout: 500000
			});
		});	
		break;
		
	case 'detailPlaylist':		
		var sPath 		= oRootEngine.sPathMedia;
		var sPathLayout	= oRootEngine.m_sFilePathLayout;
		var sServerPath = oRootEngine.m_sAbsPath;
		var mid 		= oRootEngine.memberId;
		var	numSendGift = oRootEngine.numSendGift;
		hs.graphicsDir = oRootEngine.m_sFilePathJs+'highslide/graphics/';
		hs.outlineType = 'rounded-white.v1';
		hs.outlineWhileAnimating = true;
		getIcon_comment("div_icon_comment");	
		getIcon_gift("div_icon_gift");
        var tangqua_json = null;//new bsn.AutoSuggest('x_title1', options_xml);
        var chiase_json = null;
		$("#closeListPlaylist").click(function(){$("#listPlaylist").hide();});
		$(document).ready(function(){			
			init();
            PlaytopGetInfo();
			chiase_str = {
                script: function () { return sServerPath+"nick_suggest.php?input="+$('#txtMember').val(); },
                json: true
            };
            chiase_json = new bsn.AutoSuggest('txtMember', chiase_str);
            
            tangqua_str = {
                script: function () { return sServerPath+"nick_suggest.php?input="+$('#txtListMember').val(); },
                json: true
            };
            tangqua_json = new bsn.AutoSuggest('txtListMember', tangqua_str);
        		
		});
		break;
	default:
		break;
}



