//<script type="text/javascript">

//=============================================================================
// The Doodle class provides the framework that binds the application's 
// components together
Doodle.Control = JSX.Class.create({
	name: 'Control',
	constructor: function() {
	},
	members: {
		onUpdate: function(controlType) {}
	}
});

Doodle.Control.DropList = JSX.Class.create({
	name: 'DropList',
	constructor: function(selectObject, getFunction, setFunction) {
		this.selectObject = selectObject;
		this.getValue = getFunction;
		this.setValue = setFunction;
		
		this.selectObject.value = this.getValue().toString();
		this.selectObject.onchange = this.onSelChange.bind(this);
	},
	members: {
		onUpdate: function(controlType) {
			if ( this.selectObject.value != this.getValue() ) {
				this.selectObject.value = this.getValue();
			}
		},
		onSelChange: function() {
			if ( this.selectObject.value != this.getValue() ) {
				this.setValue(parseInt(this.selectObject.value));
			}
		}
	}
});

//</script>