var WFLoginSent = false;

function WFLogin() {
	if (!WFLoginSent) {
		$('#login-submit-button').get(0).click();
	}
	
	return false;
}

function WFCheckLoginForm(form) {
	if (form.username.value.length == 0 || form.username.value == form.username.title) {
		form.username.focus();
		return false;
	}
	if (form.password.value.length == 0 || form.password.value == form.password.title) {
		form.password.focus();
		return false;
	}
	
	WFLoginSent = true;
	return true;
}

$(function() {
	$(".title-to-value").each(function() {
		this.cssColor = $(this).css("color");
		
		if (this.value.length == 0) {
			this.value = this.title;
			$(this).css("color", "#BBB")
		}

		$(this)
			.focus(function() {
				if (this.value == this.title) {
					this.value = "";
	
					$(this)
						.css("color", this.cssColor)
				}
			})
			.blur(function() {
				if ($.trim(this.value).length == 0) {
					this.value = this.title;
	
					$(this)
						.css("color", "#BBB")
				}
			});
	});
});
