
Hedera.Photos = new Class
({
	Extends: Hedera.Form

	,activate: function ()
	{
		this.$('schema').value = 'catalog';
		this.$('photo-id').focus ();
		
		var self = this;
		this.$('html-form').onsubmit = function ()
			{ self._onSubmit (); return false; };
	}
	
	,_onSubmit: function ()
	{
		this.$('schema-field').value = this.$('schema').value;
		this.$('submit').disabled = true;

		this.conn.sendFormMultipart (this.$('html-form'),
			this._onResponse.bind (this));
	}
	
	,_onResponse: function (request, json, error)
	{
		this.$('submit').disabled = false;

		if (json)
		{
			this.$('photo-id').value = '';
			this.$('photo-id').focus ();
			Htk.Toast.showMessage (_('ImageAdded'));
		}
		else
			Htk.Toast.showError (error.message);
	}
});

