// clear text input values

var current_input_value;

function clear_input () {

	inputs = document.getElementsByTagName('input');
	textareas = document.getElementsByTagName('textarea');

	for (var i=0; i<inputs.length; i++) {
		if (inputs[i].className == 'clear text' && inputs[i].value != null) {
			
			inputs[i].onfocus = function () {
				current_input_value = this.value;
				this.value = "";
			}
			inputs[i].onblur = function () {
				if (this.value == "") {
					this.value = current_input_value;
				}
			}
		}
	}
	
	for (var i=0; i<textareas.length; i++) {
		if (textareas[i].className == 'clear text' && textareas[i].value != null) {
			
			textareas[i].onfocus = function () {
				current_input_value = this.value;
				this.value = "";
			}
			textareas[i].onblur = function () {
				if (this.value == "") {
					this.value = current_input_value;
				}
			}
		}
	}
}


function addLoadEvent(func)
{	
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
    	window.onload = func;
	} else {
		window.onload = function(){
		oldonload();
		func();
		}
	}

}


addLoadEvent(clear_input);

