function applyStuffToInput(input) {
	input.copy = function(type, focus) {
		var new_input = document.createElement("input");
		new_input.type = type;
		new_input.value = this.value;
		new_input.defaultValue = this.defaultValue;
		new_input.name = this.name;
		if (new_input.setAttribute) {
			new_input.setAttribute("type", type);
			new_input.setAttribute("defaultValue", this.defaultValue);
			new_input.setAttribute("name", this.getAttribute("name"));
		}
		new_input.copy = this.copy;
		new_input.onclick = this.onclick;
		new_input.onblur = this.onblur;
		this.parentNode.insertBefore(new_input, this);
		this.parentNode.removeChild(this);
		if (focus && new_input.focus)
			new_input.focus();
	}
	input.onclick = function() {
		if (this.value == this.defaultValue)
			this.value = "";
	}
	input.onblur = function() {
		if (!this.value)
			this.value = this.defaultValue;
	}
}

window.onload = function() {
	applyStuffToInput(document.getElementById("email"));
	applyStuffToInput(document.getElementById("zip"));
}

