var dlgError = false;
var loginTimeout = null;

function checkLoginForm() {
	if(!dlgError){
		dlgError = new YAHOO.widget.SimpleDialog("simpledialog1", 
				 { width: "300px",
				   fixedcenter: true,
				   visible: false,
				   draggable: false,
				   modal: true,
				   close: true,
				   text: "Your username/password was not recognized. Please try again.",
				   icon: YAHOO.widget.SimpleDialog.ICON_BLOCK,
				   constraintoviewport: true,
				   buttons: [ { text:"OK", handler:function(){ this.hide(); document.getElementById('username').focus(); }, isDefault:true } ]
				 } );
		dlgError.setHeader("Login Error")
	 	dlgError.render("dialogContainer");
	}
	
	document.body.style.cursor='wait';
	if(loginTimeout != null){
		clearTimeout(loginTimeout);
	}
	
	loginTimeout = setTimeout(function(){ document.body.style.cursor='auto'; dlgError.show()}, 2000+Math.floor(Math.random()*250));
	
	return false;
}