var username_touched = false;
var password_touched = false;
function hdr_finish() 
{
	var valid = true;
	if (document.hdr_login_form.onsubmit) 
	{
		valid = false;
		valid = document.hdr_login_form.onsubmit();
	}
	if (valid)document.hdr_login_form.submit();
}

function clearLoginUsernamePrompt() {
	if(!username_touched) {
	   jQuery('#username-box').val("");
	}  
	/*if(!password_touched) {	   
        jQuery('#password-clear').hide();
        jQuery('#password-password').show();

	}*/
}

function clearLoginPasswordPrompt() {
    /*if(!username_touched) {
       jQuery('#username-box').val("");
    }  */
    if(!password_touched) {    
        jQuery('#password-clear').hide();
        jQuery('#password-password').show();
        jQuery('#password-password').focus();

    }
}

function markAsTouched(type) {
	if(type=="username") {
	   username_touched = true;
	}
	if(type=="password") {
       password_touched = true;
    }
}

function restoreLoginUsernamePrompt() {
	if(!username_touched) {
        jQuery('#username-box').val("username");
	}
	/*if(!password_touched) {
        jQuery('#password-clear').show();
        jQuery('#password-password').hide();
        
    }*/
}

function restoreLoginPasswordPrompt() {
	/*if(!username_touched) {
        jQuery('#username-box').val("username");
	}*/
    if(!password_touched) {
        jQuery('#password-clear').show();
        jQuery('#password-password').hide();
    }	
}

function submitenter(myfield, e)
{
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;

    if (keycode == 13)
    {
        document.hdr_login_form.submit();
        return false;
    }
    else
        return true;
}
