

function applyDefaultValue(elem, val, clr) {
	if(!elem.value) {
		elem.style.color = clr;
		elem.value = val;
	}
	elem.onfocus = function() {
		if(this.value == val) {
			this.style.color = '';
			this.value = ''; //On focus, make blank
		}
	}
	elem.onblur = function() {
		if(this.value == '') {
			this.value = val; //If it's not in focus, use declared value
			this.style.color = clr;
		}
	}
}

function applyPasswordType(elem, val, clr) {
	if(!elem.value) {
		elem.style.color = clr;
		elem.value = val;
		if(!$.browser.msie) elem.type = 'text';
	}
	elem.onfocus = function() {
		if(this.value == val) {
			this.style.color = '';
			if(!$.browser.msie) this.type = 'password'; //If in focus, input type will be 'password'
			this.value = '';
		}
	}
	elem.onblur = function() {
		if(this.value == '') {
			this.value = val;
			this.style.color = clr;
			if(!$.browser.msie) this.type = 'text'; //On blur, input type will be 'text' in order to show value
		}
	}
}

