
(function () {// START CLOSURE

// SEARCH TEXT INPUT //

function inputReplace (element, defaultText) {
	if (!element) return;
	var firstPass = true;
	element.onfocus = function () {
		if (this.value === defaultText) {
			this.value = '';
		}	
	};
	element.onblur = function () {
		if (/^\s*$/.test(this.value) || this.value === defaultText || firstPass) {
			this.value = defaultText;
			firstPass = false;
		} 
	};
	element.onblur();
};

var data = [
	['form-login-username', 'Username'],
	['form-login-password', 'Password'],
	['form-search-term', 'Type Here']
];

data.each(function (it) {
	inputReplace(document.getElementById(it[0]), it[1]);
});


})(); // END CLOSURE