function CommentNResponse(movieId){
	
	this.GetView = function(containerView){
		$.getJSON('Bend/GetLatestComment/movieId/'+movieId+'/trackId/1/page/'+currentCommentPage,function(data){
			if(data.status=="error") {
				FmvAlert(data.data);
				return false;
			}
			
			var commentAr = Array();
			var commentAllView ="";
			
			for(var i=0;i<data.data.length;i++){
				commentAr[i] = new Comment(data.data[i]);
				commentAllView += commentAr[i].GetCommentView();
			}
			
			$('#'+containerView).html(commentAllView);
			
			for(var i=0;i<data.data.length;i++){
				commentAr[i].Ready();
			}
		});
	};
	
	this.Ready = function(){
		
		$("#view-more-comment").mouseover(function(){
			$(this).css("cursor","pointer");
			$(this).css("color","#ff0000");
		});
		
		$('#view-more-comment').mouseout(function(){
			$(this).css("color","#000000");
		});
	
		$('#view-more-comment').click(function(){
			$(this).html("<img src='images/loading_3dot.gif'/>");
			
			$.getJSON('Bend/GetLatestComment/movieId/'+movieId+'/trackId/'+trackId+'/page/'+ ++currentCommentPage,function(data){
				var commentAr = Array();
				var commentAllView ="";
				
				for(i=0;i<data.data.length;i++){
					commentAr[i] = new Comment(data.data[i]);
					commentAllView += commentAr[i].GetCommentView();
				}
				
				$("#commentContainer").append(commentAllView);
				
				for(i=0;i<data.data.length;i++){
					commentAr[i].Ready();
				}
				
				$("#view-more-comment").html("View More Comment");
			});
		});
		
		$('#commentSubmit').click(function(){
			
			$("#commentSubmit").hide();
			$("#commentSubmitLoading").html("<img src='"+hosturl+"/images/loading_3dot.gif' />");
			
			movieId = $(this).attr('movieId');
			trackId = $(this).attr('trackId');
			var description = $('#comment_description').val();
			
			$.ajax({
				   type: "POST",
				   url: "Bend/SetComment/movieId/"+movieId+"/trackId/"+trackId,
				   data: {'description':description},
				   dataType : "json",
				   success: function(data){
					   if(data.status=="success"){
						   // DISPLAY POSTED COMMENT
						   comment = new Comment(data.data);
						   commentView = comment.GetCommentView();
						   $("#newCommentContainer").prepend(commentView);
						   comment.Ready();
						   
						   var postedCommentId = data.data.commentId;
						   $("#commentContainer"+postedCommentId).effect("highlight", {color:"#ff0000"}, 10000);

						   // DISPLAY SUCCESSFUL MESSAGE
						   // FmvAlert("Thank you for your comment. Your comment is posted successfully.");
						   
						   $('html, body').animate({
							   scrollTop: $("#commentContainer"+postedCommentId).offset().top
							   }, 1000);
						   // CLEAR COMMENT BOX AFTER SUCCESS
						   $("#comment_description").val("");
						}else {
							if(data.errCode == UNREGISTEREDUSER.code){
								FmvConfirmCallback(UNREGISTEREDUSER.msg,function(){window.location = hosturl +"/SignUp";});
							}else{
								FmvAlert(data.data);
							}
						}
					   $("#commentSubmit").show();
					   $("#commentSubmitLoading").html("");
				   }
			});
		});
	};
}
