
var comment = {
	/*
	show : function()
	{
		$('comment-footer').setStyle('display','none');
		$('page-comments').setStyle('display','block');
		
		return false;
	},
	
	hide : function()
	{
		$('comment-footer').setStyle('display','block');
		$('page-comments').setStyle('display','none');

		return false;
	},
	*/
	confirm : function(url)
	{
	    var test = confirm('Are you sure?');
	    if(test == true)
	    {
	        window.location = url;
	    }
	    return false;
	},
	
	reply_to : function(comment_id,nickname)
	{
	    //set inner html text of reply to id
	    var elm = $('reply_to');
	    //console.log(elm);
	    elm.set('html','Replying to '+nickname+' ');

	    //create cancel hyperlink     
	    var a = new Element ( 'a' , { 'href' : 'javascript:comment.reply_cancel();' , 'html' : 'Cancel' }) ;
	    a.inject(elm);

	    var a = new Element ( 'br' , {} ) ;
	    a.inject(elm);
		
	    //update comment_id in form
	   	$('reply_comment_id').value = comment_id;
	    
	    //jump to form
	   	window.location = '#replyForm';
	   	
	    return false;
	},
	
	reply_cancel : function()
	{
		//return false;
	    //set html to ''
	    $('reply_to').set('html','&nbsp;');

	    //update comment_id in form
	    $('reply_comment_id').value = '';
	    
	    //return false;
	},
	
	limit_text : function(limitField, limitNum)
	{
		if (limitField.value.length > limitNum)
		{
			limitField.value = limitField.value.substring(0, limitNum);
		}
		else
		{
			$('limitCount').value = limitNum - limitField.value.length;
		}
	}
}

