
/**
 * Ad Age Comment Widget 1.0
 *
 * @author: 	Rahmin Pavlovic
 * @date: 		10 Nov 2008
 * @version: 	06 Jun 2009
 *
 * copyright (c) 2008, Crain Communications
 *
 */

var thisComment;

function Comments(container) {
	this.container = (container) ? container : 'adage_comment_box';
	this.loadingMessage = ''; //<br /><div align="center"><img src="http://adage.com/images/global/ajax-indicator-036.gif" width="24" height="24" alt="" style="vertical-align: middle; margin: -3px 3px 0 0;" /> Loading comments...</div>';

	this.output = function(msg) {
		DOM.getElementById(this.container).innerHTML = msg;
	}

	this.load = function() {
		this.output(this.loadingMessage);
		thisComment=this;
		new AJAX.FileRequest(
			'/functions/ajax/get_comment_box.php',
			this.print,
			null,
			'get'
		);
	}
	this.print = function() {
		if(this.request && this.response) {
			thisComment.output(this.response);
/*
			thisComment.form = document['poll_form' + thisComment.pollId];
			//thisComment.form.action = '#'+this.anchor;
			thisComment.form.onsubmit = function() {
				return thisComment.vote();
			}
*/
		}
		delete thisComment; // eliminate self reference (frees memory)
	}
}