Of.Windows.ContactWindow = new Class({
	name: 'ContactWindow',
	namespace: 'Of.Windows',
	type: 'Window',
	Extends: Of.Windows.Simple,
	onBeforePropSet: function()
	{
		this.options.local.closed = true;
	},
	init_form: function(property, options)
	{
		property.get('send').addEvent('onSuccess', function(response){
			this.addError('Message sent. Thanks.');
			this.getProp('form').reset();
			this.close();
		}.bind(this));
		
		property.get('send').addEvent('onFailure', function(response){
			box.addError('Failed to send. Please try later');
		});
		
		property.addEvent('submit', function(e){
			new Event(e).stop();
			this.send();
		}.bind(this));
	},
	init_submit: function(property, options)
	{
		property.addEvent('click', function(e){
			new Event(e).stop();
			this.getProp('form').send();
		}.bind(this));
	}
});

// convert XML data into JavaScript array of JavaScript objects
function XML2JS(xmlDoc, containerTag) {
    var output = new Array( );
    var rawData = xmlDoc.getElementsByTagName(containerTag)[0];
    var i, j, oneRecord, oneObject;
    for (i = 0; i < rawData.childNodes.length; i++) {
        if (rawData.childNodes[i].nodeType == 1) {
            oneRecord = rawData.childNodes[i];
            oneObject = output[output.length] = new Object( );
            for (j = 0; j < oneRecord.childNodes.length; j++) {
                if (oneRecord.childNodes[j].nodeType == 1) {
                    oneObject[oneRecord.childNodes[j].tagName] = 
                        oneRecord.childNodes[j].firstChild.nodeValue;    
                }
            }
        }
    }
    return output;
}
