var initiateForm = Class.create();

initiateForm.prototype = {
	initialize : function(form, options){
		this.options = Object.extend({
			readTitles : true,
			offColour : '#cccccc',
			onColour : '#000'
		}, options || {});
		this.form = $(form);
		
		var offColour = this.options.offColour;
		var onColour = this.options.onColour;
		
		if(this.options.readTitles) {
			Form.getElements(this.form).each( function (input) {
				
				if (input.title != '') { 
					if (input.value == '') {
						input.value=input.title;
						input.style.color = offColour;
					}
					Event.observe(input,'focus',function(e){ 
						if(this.value == this.title) {
							this.style.color = onColour;
							this.value = '';
						}
					});
					
					Event.observe(input,'blur',function(e){
						this.value = this.value.replace(/^\s+|\s+$/g, '');
						if (this.value == '') { 
							this.style.color = offColour;
							this.value = this.title;
						}
					});
					
				}
			});
		}

	}
	
}

