<!--
var ajaxObj  = new XMLHTTP('/modules/pastebin_comment.php');
ajaxObj.method = 'GET';
ajaxObj.format = 'JSON';
ajaxObj.abort_timeout = 30000;
ajaxObj.net_down_func = error_handler;

function error_handler(status)
{
    alert('Connection error');
}

function comment()
{
	this.active = 0;
}

comment.prototype.show = function(LANG)
{
	// hide comments
	if (this.active != 0)
	{		
		this.hide();
		return;
	}
	
	this.showStatus();
	this.active = 1;
	ajaxObj.method = 'GET';
  	ajaxObj.format = 'JSON';  	  
  	ajaxObj.abort_timeout = 30000;
  	ajaxObj.call('action=show&id_pbin='+this.getIdPbin()+'&LANG='+LANG, this.importData);	
}

comment.prototype.importData = function(resp)
{
	// reset comment area
	document.getElementById('comments').innerHTML = '';
	
	var tmp = new comment();

	for (var i = 0; i < resp.length; i++)
		tmp.display(resp[i]);	
	tmp.hideStatus();		
}

comment.prototype.display = function(cm)
{
	var html;
	var width = 90;

	html = '<div class="wideBlock" style="width: '+(width-cm.margin)+'%;margin-left: '+cm.margin+'%">';
	html += '<div class="header show_header left">&nbsp;&nbsp;'+_pastebin_show_comment_show_posted_by+' <a href="" onclick="commentary.add('+cm.id_comment+');return false;">'+cm.author+'</a> '+cm.created+'</div>';
	html += '<div class="comment">'+cm.text;
	html += '<p class="centered"><a href="" onclick="commentary.add(\''+cm.id_comment+'\', \''+cm.LANG+'\');return false;"><b>[ '+_pastebin_show_comment_show_react+' ]</b></a></p>';
	html += '</div></div>';
	
	document.getElementById('comments').innerHTML += html;
}

comment.prototype.hide = function()
{
	document.getElementById('comments').innerHTML = '';
	this.active = 0;
}

comment.prototype.showStatus = function()
{
	document.getElementById('status').style.display = 'block';	
}

comment.prototype.hideStatus = function()
{
	document.getElementById('status').style.display = 'none';
}

comment.prototype.add = function(parent, LANG)
{
	var _comment_add_console;
	var author = document.forms.add_child.author.value;
	
	_comment_add_console = window.open("","comment_add","width=400,height=260,resizable,scrollbars=yes,left=200,top=200"); 	
 	_comment_add_console.document.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
 	_comment_add_console.document.writeln('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">');
 		_comment_add_console.document.writeln('<head>');
			_comment_add_console.document.writeln('<title>'+_pastebin_show_comment_add_title+'</title>');
		    _comment_add_console.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />');
			_comment_add_console.document.writeln('<meta http-equiv="Content-Style-Type" content="text/css" />');
		    _comment_add_console.document.writeln('<meta name="author" content="char0n, lordProtector - member of binary groop" />');
			_comment_add_console.document.writeln('<meta name="keywords" content="print, mortality, pastebin, code, bin" />');
			_comment_add_console.document.writeln('<meta name="description" content="Code print" />');
		    _comment_add_console.document.writeln('<meta name="generator" content="my brain, hands, ZEND IDE" />');
		    _comment_add_console.document.writeln('<style te="text/css">');
				_comment_add_console.document.writeln('body');
				_comment_add_console.document.writeln('{');
					_comment_add_console.document.writeln('font-family: Arial, Helvetica, serif;');
					_comment_add_console.document.writeln('font-size: 12px;');
					_comment_add_console.document.writeln('background: rgb(220, 220, 220); text-align: center;');
				_comment_add_console.document.writeln('}');
			_comment_add_console.document.writeln('</style>');		    
            // IE hack making browser not fall into recursive loop while loading external javascripts
            _comment_add_console.document.writeln('<script type="text/javascript" language="Javascript">');            
                _comment_add_console.document.writeln('window.onload = import_scripts;');
                _comment_add_console.document.writeln('function import_scripts()');
                _comment_add_console.document.writeln('{');
                    _comment_add_console.document.writeln('var mybic       =document.createElement("script")');
                    _comment_add_console.document.writeln('var comment_add =document.createElement("script")');
                    _comment_add_console.document.writeln('document.getElementsByTagName("head")[0].appendChild(mybic)');
                    _comment_add_console.document.writeln('document.getElementsByTagName("head")[0].appendChild(comment_add)');
                    _comment_add_console.document.writeln('mybic.setAttribute("type", "text/javascript", 0);');
                    _comment_add_console.document.writeln('mybic.setAttribute("src", "/libs/javascript/my-bic/mybic.js", 0);'); 
                    _comment_add_console.document.writeln('mybic.setAttribute("language", "Javascript", 0);'); 
                    _comment_add_console.document.writeln('comment_add.setAttribute("type", "text/javascript", 0);');
                    _comment_add_console.document.writeln('comment_add.setAttribute("src", "/libs/javascript/comment_add.js", 0);'); 
                    _comment_add_console.document.writeln('comment_add.setAttribute("language", "Javascript", 0);'); 
                _comment_add_console.document.writeln('}');
            _comment_add_console.document.writeln('</script>');
            // end of IE hack            
 		_comment_add_console.document.writeln('</head>');
 		_comment_add_console.document.writeln('<body>');
 		_comment_add_console.document.writeln('<h2>'+_pastebin_show_comment_add_title+'</h2>');
 		_comment_add_console.document.writeln('<form id="add_comment" name="add_comment" action="/" method="post">'); 		
 			_comment_add_console.document.writeln('<b>'+_pastebin_show_comment_add_author+' . . . </b><input type="text" name="author" value="'+author+'" /><br /><br />');
 			_comment_add_console.document.writeln('<textarea cols="40" rows="5" name="text"></textarea><br /><br />');
 			_comment_add_console.document.writeln('<input type="hidden" name="parent" value="'+parent+'" />');
 			_comment_add_console.document.writeln('<input type="hidden" name="id_pbin" value="'+this.getIdPbin()+'" />');
 			_comment_add_console.document.writeln('<input type="hidden" name="LANG" value="'+LANG+'" />');
 			_comment_add_console.document.writeln('<input type="hidden" name="action" value="add" />')
 			_comment_add_console.document.writeln('<input type="button" name="submit_button" value="'+_pastebin_show_comment_add_button+'" onclick="comment_add();" />');
 		_comment_add_console.document.writeln('</form>');
 		_comment_add_console.document.writeln('<div id="status" style="display: none"><img src="/images/loading.gif" width="126" height="22" alt="Loding" /></div>');
 		_comment_add_console.document.writeln('</body>');
 		_comment_add_console.document.writeln('</html>');
	_comment_add_console.document.close();
 }
 
 function deinit_print_console()
 {
 	_print_console.document.close(); 
 }

comment.prototype.getIdPbin = function()
{
	return (document.forms.add_child.parent_id.value);
}

comment.prototype.gotoComments = function(LANG)
{
	this.active = 0;
	this.show(LANG);	
	location.href = '/'+LANG+'/'+this.getIdPbin()+'/#comment';	
}

commentary = new comment();

function show_diff_form()
{
	document.getElementById('diff_form').style.display = 'block';
}

function show_deletion_form()
{
	document.getElementById('deletion_form').style.display = 'block';
}
-->