/**
 * 
 */


$.fn.replaceInputValue = function(){
	return this.each(function() {
		if ($(this).attr("type") == "password") {
			var type = "password";
			this.type = "text";
		} else {
			var type = "text";
		}
		
		$(this).attr("alt", $(this).val());
		
		var replaceInputValueOnFocus = function () {
			$(this).val("");
			if(type == "password") {
				this.type = "password";
			}
			$(this).unbind("focus");
			return this;
		}
				
		var replaceInputValueOnBlur = function() {
			if($(this).val() == "") {
				if(type == "password") {
					this.type = "text";
				}
				$(this).val($(this).attr("alt"));
				$(this).bind("focus", replaceInputValueOnFocus);
			}
			return this;
		}
			
		$(this).bind("focus", replaceInputValueOnFocus);
		$(this).bind("blur", replaceInputValueOnBlur);
	});
}

$.fn.replaceInputValueForm = function(){
	return this.each(function() {
		if ($(this).attr("alt") == $(this).val()) {
			$(this).val("");
		}
	});
}
