webs.loadEvent(function() {
    if(document.getElementById("FWloginUsername") != null && document.getElementById("FWloginUsername").value != "") focusInput("FWloginUsername");
    if(document.getElementById("FWloginPassword") != null && document.getElementById("FWloginPassword").value != "") focusInput("FWloginPassword");

    /* jQuery sadly not on every page yet, so fall back to this legacy version... */
    if(document.getElementById("login_leaf") != null) {
		document.getElementById("login_leaf").onsubmit = function() {
			document.getElementById("sign_in_leaf").style.display = "none";
			document.getElementById("login_loadingText").style.display = "block";
			setTimeout(pickup, 5000);
		}
	}
    
    blurInput('FWloginUsername');
	blurInput('FWloginPassword');
});            
    
function focusInput(theOne) {
    if(document.getElementById(theOne) != null) document.getElementById(theOne).className = "";
}
	
function blurInput(theOne) {
    var el = document.getElementById(theOne);
	if(el != null && el.value == '') {
	    el.className = theOne + '_background';
	} else if(el != null && el.className.indexOf('_background') > 0) {
	    el.className = theOne;
	}
}

function pickup() {
    counter = document.createElement('img');
    counter.src='http://counters.freewebs.com/Members/Counters/counter.jsp?userid=1&name=slowLogin';
    Tracker.init("Internal");
    Tracker.trackError("login-SlowLogin");
}
