function initInputs () {
	var inputs = document.getElementsByTagName("input");
	for (var i = 0; i < inputs.length; i++ ){
		if(inputs[i].type == "text" ) {
			inputs[i].valueHtml = inputs[i].value;
			inputs[i].onfocus = function (){
				if (this.name == 'url') {
					this.focus();
					var _this = this;
					setTimeout(function(){_this.select()}, 100);
					this.onkeydown = function(){
						return false;
					}
				} else {
					if (this.value == this.valueHtml)
						this.value = "";
					if (this.className.indexOf('type') == -1)
						this.className += ' type';
				}
			}
			inputs[i].onblur = function (){
				if (this.value == "") {
					this.className = this.className.replace('type','');
					this.value = this.valueHtml;
				}
			}
		}
	}
	var textarea = document.getElementsByTagName("textarea");
	for (var i = 0; i < textarea.length; i++ ){
		textarea[i].valueHtml = textarea[i].value;
		textarea[i].onfocus = function (){
			this.value = "";
			this.className += ' type';
		}
		textarea[i].onblur = function (){
			this.className = this.className.replace('type','');
			this.value != ""? this.value = this.value: this.value = this.valueHtml;
		}
	}
}


if (window.addEventListener){
	window.addEventListener("load", initInputs, false);
}
else if (window.attachEvent){
	window.attachEvent("onload", initInputs);
}