function addSongComment(){
	_("loading").style.display = 'none'; 
	document.getElementById("comment_text").value = trim(document.getElementById("comment_text").value);	
	if(_l("comment_text") == 0){
		document.getElementById("loading").style.display = 'block';
		document.getElementById("loading").style.visibility = "visible";
		document.getElementById("loading").className = "error_msg";
		document.getElementById("loading").innerHTML = 'الرجاء ادخال نص التعليق';
		_("comment_text").focus();
		return;
	}
	strComments =_("comment_text").value ;
	for (i=0;i<strComments.length;i++){
		strComments = handleText(strComments);
	}
	_("comment_text").disabled = true ;
	AJAXGet(domainName+"request/addSongComment.php?songId="+_("songId").value+"&m5="+_("m5").value+"&comment="+strComments,commentHandler,false,true);
}
function commentHandler(sText){
	if(sText == 1){
		AJAXGet(domainName+"request/getSongComment.php?songId="+_("songId").value,viewComment,false,true);
	}else{
		alert(sText);
	}
}
function viewComment(sText){
	_("commentDiv").innerHTML  = sText;
	_("comment_text").disabled = false ;
	_("comment_text").value    = '';
	_("comNumber").innerHTML   = _("no").value ;
	document.getElementById("loading").style.display = 'block';
	document.getElementById("loading").style.visibility = "visible";
	document.getElementById("loading").className = "dlvr_msg";
	document.getElementById("loading").innerHTML = 'تم إدراج التعليق بنجاح ';
	_("no").value              = parseFloat(_("no").value) + 1;
}
function deleteSongComment(commentId,userId,encryption){
	_s(commentId).display = 'none';
	AJAXGet(domainName+"request/deleteSongComments.php?songId="+_("songId").value+"&m5="+encryption+"&commentId="+commentId+"&userId="+userId,deleteCommentHandler,false,true);
}
function deleteCommentHandler(sText){
	_(sText).innerHTML = '';
	_(sText).style.display = 'none' ;
}
function getCommentsAjax(pn){
	_("commentDiv").innerHTML  = '<br/><br/><div align="center"><img border="0" src="'+imagesPath+'loading_bigger.gif" alt="" /></div><br/>';
	AJAXGet(domainName+"request/getSongComment.php?songId="+_("songId").value+"&pn="+pn,viewCommentAjax,false,true);
}
function viewCommentAjax(sText){
	_("commentDiv").innerHTML  = sText;
}

function abuseSong (songId,encryption){
	var textFriendsAbuse = "نحن نعمل على توفير بيئة آمنة لكافة أصحاب مكتوب، <br/>	الرجاء كتابة سبب التبليغ ونعدك بمتابعة الموضوع بأقصى سرعة لاتخاذ الإجراء المناسب";
	
	var abuseHTML = "<div align=\"center\" style=\"width: 530px; direction: rtl;background: #ffffff\">"+
							"<div class=\"blubg pad5\">"+
							"<div class=\"fltrit\"><strong>ابلاغ عن ملف صوتي</strong>"+
			                   "</div><div class=\"fltlft\">"+
			                                "<a href=\"javascript:closeAbusePopup();\"> X اغلاق </a>  "+
			                  " </div></div>"+
						"<div class=\"brdr\">"+
							"<table style=\"border-collapse: collapse; line-height:25px\" border=\"0\" cellpadding=\"4\" width=\"500px\" cellspacing=\"4\">"+
								"<tr>"+
									"<td colspan=\"2\">"+textFriendsAbuse+"</td>"+
								"</tr>"+
								"<tr>"+
									"<td>"+
									"<textarea name=\"txtAbuse\" id=\"txtAbuse\" cols=\"60\" rows=\"7\"></textarea></td>"+
									"<td valign=\"top\" align=\"center\"></td>"+
								"</tr>"+
								"<tr>"+
									"<td colspan=\"2\">"+

									"<input type=\"button\" value=\"أبلغ\" id=\"hrfAbuse\" onclick=\"abuseAudioFunction('"+songId+"','"+encryption+"');\" class=\"btns\" />"+
									"<input type=\"button\" value=\"إلغاء\" class=\"btns\" onclick=\"closeAbusePopup();\" /> </td>"+
								"</tr></table></div></div><script> setTimeout('document.getElementById(\"txtAbuse\").focus()',1000); </script>";

	abuseObj = new ShadowBox(abuseHTML, { transHoldTime:500 , maxOpacity: 70});
	abuseObj.show();
}

function closeAbusePopup(){
	abuseObj.hide();
}

function abuseAudioFunction(songId,mKey){
	msg = document.getElementById('txtAbuse').value ;
	document.getElementById('hrfAbuse').disabled= true;
	msg = trim(msg);
	if(msg == ''){
		alert("الرجاء كتابة سبب التبليغ");
		document.getElementById('hrfAbuse').disabled= false;
		document.getElementById('txtAbuse').focus();
	}else{
		strMsg = msg ;
		for (i=0;i<strMsg.length;i++){
			strMsg = handleText(strMsg);
		}
		document.getElementById("abusedSong").innerHTML = 'الرجاء الانتظار';
		AJAXGet(domainName+"request/reportSongSpam.htm?songId="+songId+"&mKey="+mKey+"&msg="+strMsg,AbusedSpamHandler,false,true);
	}
}
function AbusedSpamHandler(sText){
	if(sText == 1){
		var response = "تم ارسال تبليغ ";

		if (document.getElementById("abusedSong")){
			document.getElementById("abusedSong").innerHTML = response;
		}
	}else{
		document.getElementById("abusedSong").innerHTML = '';
		alert(sText);
	}
	closeAbusePopup();
}