// JavaScript Document

function CommentsUpdate( italentid, ipage )
{
	$('comments-loading').style.display = 'block';
	new Effect.Fade('comments-area', {duration: 0.5});
	
	var url = 'ajax_get_talent_comments.php';
	new Ajax.Updater( 'comments-area',
							url,
							{
								parameters:
									{
										talentid: italentid,
										page: ipage
									},
								method: 'get',
								onComplete: function(transport){ 
										new Effect.Appear('comments-area', {duration: 1, delay: 0.5}); $('comments-loading').style.display = 'none';
									}
							});
}

function CommentsDisplay( italentid )
{
	CommentsUpdate( italentid, 1 );
}


function CommentsAccountUpdate( italentid, ipage )
{
	$('comments-loading').style.display = 'block';
	new Effect.Fade('comments-area', {duration: 0.5});
	
	var url = 'ajax_get_talent_account_comments.php';
	new Ajax.Updater( 'comments-area',
							url,
							{
								parameters:
									{
										talentid: italentid,
										page: ipage
									},
								method: 'get',
								onComplete: function(transport){ 
										new Effect.Appear('comments-area', {duration: 1, delay: 0.5}); $('comments-loading').style.display = 'none';
									}
							});
}

function CommentsAccountDisplay( italentid )
{
	CommentsAccountUpdate( italentid, 1 );
}

function CommentDelete( comment_id )
{
	var confirmed = confirm("Are you sure you want to delete this comment?");
	if( confirmed )
	{		
		var url = 'ajax_comments_actions.php?action=delete';
		new Ajax.Request( url,
								{
									parameters:
										{
											commentid: comment_id
										},
									method: 'get',
									onComplete: function(transport){ 
											new Effect.Fade('comment-'+comment_id, {duration: 1, delay: 0.5});
										}
								});
	}
}

function CommentBlock( comment_id )
{
	var url = 'ajax_comments_actions.php?action=block';
	new Ajax.Request( url,
							{
								parameters:
									{
										commentid: comment_id
									},
								method: 'get',
								onComplete: function(transport){ 
										new Effect.Fade( 'comment-block-'+comment_id, {duration: 0.5}  );
										new Effect.Appear( 'comment-unblock-'+comment_id, {delay:0.5} );
									}
							});
}

function CommentUnblock( comment_id )
{
	var url = 'ajax_comments_actions.php?action=unblock';
	new Ajax.Request( url,
							{
								parameters:
									{
										commentid: comment_id
									},
								method: 'get',
								onComplete: function(transport){ 
										new Effect.Fade( 'comment-unblock-'+comment_id, {duration: 0.5});
										new Effect.Appear( 'comment-block-'+comment_id, {delay:0.5} );
									}
							});
}
