var Tweet = Class.create({
	initialize: function(name, textElement, appElement, dateElement) {
		this.name = name;
		this.textElement = $(textElement);
		this.appElement = $(appElement);
		this.dateElement = $(dateElement);
	},
	run: function () {
		new Ajax.Request('/ajax/twitter.php', {
			method: 'get',
			parameters: {
			name: this.name
			},
			onSuccess: this.onSuccessAjax.bind(this)
		});
	},
	onSuccessAjax: function(transport) {
		var json = transport.responseText.evalJSON();
		this.textElement.update(json.text);
		this.appElement.update(json.source);
		this.dateElement.update(json.created_at);
	}
});