function deleteStdComment(vWallId,vCmtItemId){
		
	Message.confirm("Are you sure to delete this comment?", function() {
			invoke(null,'channel:delete_comment', {wall_id:vWallId}, true, function(req){
				
				if(req.responseText=="success")
				{
					$("cmntItem_" + vCmtItemId).remove();
								
				}
			});
		});

}

function isUserFriend(vObject,vKeyId,vKeyAuthorId,vUserId){
	
	if(vKeyAuthorId!=vUserId && vUserId>0){	
		invoke(null, 'channel:isFriend', {author: vKeyAuthorId}, false, function(req) {
			
			if (req.responseText.indexOf("nofriend") >= 0) {
				if (vObject != null) vObject.blur();
				authorInfo = req.responseText.split("\n");
				author = authorInfo[1];
				
				channelInfo.user_id=vKeyAuthorId;
				channelInfo.user_name=authorInfo[1];
				channelInfo.url=authorInfo[2];			
				isFriend=0;
				Message.confirm('You need to be a friend of '+author+' to enter comments. Do you want to become a friend of '+author+'?', function() {
					vObject.value='';
					subscribe(1,true);
					isFriend=1;

				});						
			} else if (req.responseText.indexOf("success") >= 0) {
				if (vObject != null) $(vObject).morph('height:70px;');		
				isFriend=1;
			}
		});
	}
	
	if(vKeyAuthorId==vUserId  && vUserId>0) {
		isFriend=1;
		$(vObject).morph('height:70px;');
	}				
	
} 


function showMoreComments(vMode,vKeyId){

	
	if(vMode=='blog'){
	
		vBlogId=vKeyId
		if($("lnkShow_" + vBlogId).innerHTML=="Show more"){
		
		showProgress("Loading more comments..",true);
		invoke("dvMoreComments_" + vBlogId,"blog:blogComments",{blog_id:vBlogId,limit:-1},false,function(req){
		$("lnkShow_" + vBlogId).innerHTML="Show less";
		new Effect.BlindDown($("dvMoreComments_" + vBlogId), {duration: 0.4, queue: 'end'});
		hideProgress();
		});
		
		}else{
		$("lnkShow_" + vBlogId).innerHTML="Show more";
		new Effect.BlindUp($("dvMoreComments_" + vBlogId), {duration: 0.4, queue: 'end'});
		
		
		}
	
	}
	else if(vMode=='ideas'){
		
		vIdeaId=vKeyId
		if($("lnkShow_" + vIdeaId).innerHTML=="Show more"){
	
		showProgress("Loading more comments..",true);
		invoke("dvMoreComments_" + vIdeaId,"ideas:ideaComments",{idea_id:vIdeaId,limit:-1},false,function(req){
			$("lnkShow_" + vIdeaId).innerHTML="Show less";
			new Effect.BlindDown($("dvMoreComments_" + vIdeaId), {duration: 0.4, queue: 'end'});
			hideProgress();
		});
	
		}else{
			$("lnkShow_" + vIdeaId).innerHTML="Show more";
			new Effect.BlindUp($("dvMoreComments_" + vIdeaId), {duration: 0.4, queue: 'end'});
			
	
		}

	}
	else if(vMode=='story'){
	
		
		vGalleryId=vKeyId
		
		if($("lnkShow_" + vGalleryId).innerHTML=="Show more"){
	
		showProgress("Loading more comments..",true);
		invoke("dvMoreComments_" + vGalleryId,"story:wallComments",{gallery_id:vGalleryId,limit:-1},false,function(req){
	
			$("lnkShow_" + vGalleryId).innerHTML="Show less";
			new Effect.BlindDown($("dvMoreComments_" + vGalleryId), {duration: 1, queue: 'end'});
			hideProgress();
		});
	
		}else{
			$("lnkShow_" + vGalleryId).innerHTML="Show more";
			new Effect.BlindUp($("dvMoreComments_" + vGalleryId), {duration: 1, queue: 'end'});
			
	
		}

	
	}
	else if(vMode=='author'){
	
			
		vAuthorId=vKeyId
		
		if($("lnkShow_" + vAuthorId).innerHTML=="Show more"){
	
		showProgress("Loading more comments..",true);
		invoke("dvMoreComments_" + vAuthorId,"channel:authorComments",{limit:-1},false,function(req){
	
			$("lnkShow_" + vAuthorId).innerHTML="Show less";
			new Effect.BlindDown($("dvMoreComments_" + vAuthorId), {duration: 1, queue: 'end'});
			hideProgress();
		});
	
		}else{
			$("lnkShow_" + vAuthorId).innerHTML="Show more";
			new Effect.BlindUp($("dvMoreComments_" + vAuthorId), {duration: 1, queue: 'end'});
			
	
		}
		
	
	}
	return false;

}

function postStdComment(vKeyId,vMode){

	if(vMode=='blog'){
	
		if($('blog.post.message' + vKeyId).value!="" && isFriend!=0){
		showProgress('Posting Comments',true);
		invoke(null, 'blog:comment&blog_id=' + vKeyId, {message:$('blog.post.message' + vKeyId).getValue()}, true, function(req){ if(req.responseText == 'success'){$$('#blogComments'+ vKeyId + ' .empty').each(function(item){item.remove();});var clone=$('blogPostEmpty' + vKeyId).cloneNode(true);$('blogComments' + vKeyId).insertBefore(clone, $$('#blogComments' + vKeyId + ' span')[0].nextSibling);$A(clone.getElementsByTagName('div')).each(function(item){if(item.getAttribute('name') == 'content') item.innerHTML=$('blog.post.message' + vKeyId).getValue();});Effect.BlindDown(clone);$('blog.post.message' + vKeyId).value='';hideProgress();$('blog_comment_' + vKeyId).hide();}});
		}
	
	}
	else if(vMode=='ideas'){
		
		if($('idea.post.message' + vKeyId).value!="" && isFriend!=0){
		showProgress('Posting Comments',true);
		invoke(null, 'ideas:addIdeaComment&idea_id=' + vKeyId, {message:$('idea.post.message' + vKeyId).getValue()}, true, function(req){if(req.responseText == 'success'){$$('#ideaComments' + vKeyId +' .empty').each(function(item){item.remove();});var clone=$('ideaPostEmpty' + vKeyId ).cloneNode(true);$('ideaComments' + vKeyId).insertBefore(clone, $$('#ideaComments' + vKeyId + ' span')[0].nextSibling);$A(clone.getElementsByTagName('div')).each(function(item){if(item.getAttribute('name') == 'content') item.innerHTML=$('idea.post.message' + vKeyId).getValue();});Effect.BlindDown(clone);$('idea.post.message' + vKeyId).value='';hideProgress();$('idea_comment_' + vKeyId).hide();}});
		}

	}
	else if(vMode=='story'){
	
		if($('story.post.message' + vKeyId).value!="" && isFriend!=0){
			showProgress('Posting Comments',true);
			invoke(null, 'story:addStoryPageComment&gallery_id=' + vKeyId, {message:$('story.post.message' + vKeyId).getValue()}, true, function(req){
				hideProgress();
				if(req.responseText == 'success'){
					$$('#storyComments' + vKeyId + ' .empty').each(function(item){
						item.remove();
					});
					var clone=$('storyPostEmpty' + vKeyId).cloneNode(true);
					$$('#storyComments' + vKeyId + ' span').last().insert({"after": clone});
//					$('storyComments' + vKeyId).insertBefore(clone, $$('#storyComments' + vKeyId + ' span')[0].nextSibling);
					$A(clone.getElementsByTagName('div')).each(function(item){
						if(item.getAttribute('name') == 'content') 
							item.innerHTML = $('story.post.message' + vKeyId).getValue();
					});
					Effect.BlindDown(clone);
					$('story.post.message' + vKeyId).value='';
					$('story_comment_' + vKeyId).hide();
				}
			});
		}
	
	}
	else if(vMode=='author'){
	
		if($('author.post.message' + vKeyId).value!="" && isFriend!=0){
		showProgress('Posting Comments',true);
		invoke(null, 'channel:postAuthorComment', {message:$('author.post.message' + vKeyId).getValue()}, true, function(req){if(req.responseText == 'success'){$$('#authorComments' + vKeyId +' .empty').each(function(item){item.remove();});var clone=$('authorPostEmpty' + vKeyId).cloneNode(true);$('authorComments' + vKeyId).insertBefore(clone, $$('#authorComments' + vKeyId + ' span')[0].nextSibling);$A(clone.getElementsByTagName('div')).each(function(item){if(item.getAttribute('name') == 'content') item.innerHTML=$('author.post.message' + vKeyId).getValue();});Effect.BlindDown(clone);$('author.post.message' + vKeyId).value='';hideProgress();$('author_comment_' + vKeyId).hide();}});
		}
	
	}
	return false;
}
