var commonForm = {
	init: function() {
		var oldOnload = window.onload;
		var that = this;
		window.onload = function() {
			if (oldOnload) try{oldOnload();}catch(e){}
			that.initInputs();
		}
	},

	initInputs: function() {
		var inputs = document.body.getElementsByTagName('input');
		for(var i = 0; i < inputs.length; i++) {
			if(inputs[i].className.match(/commonFormInput/i)) {
				this.onInit(inputs[i]);
			}
		}
	},

	onInit: function(element) {
		if (!element || !element.getElementsByTagName) { return false; }
		
		element.onfocus = this.onFocus;
		element.onblur = this.onBlur;
	},
	
	onFocus: function(ev) {
		if(!this.valueBack || this.value == this.valueBack) {
			this.valueBack = this.value;
			this.value = '';
		}			
	},
	
	onBlur: function(ev) {		
		if(this.valueBack && this.value.length == 0) {
			this.value = this.valueBack;
		}
	}
};

commonForm.init();