

document.onkeypress = function (evt)
{
	var c = document.layers ? evt.which 
	        : document.all ? event.keyCode
	        : evt.keyCode;
	
	if ( c == 13 ) 
	{
		window.document.forms.SignIn.submit();
		return false;
	}

	return true;
};

function PerformAutoSignin()
{
    if (!document.singleSignin)
        return; // on the 'normal' sign-in page

    if (document.singleSignin.object == null)
    {
        var msg = "";

	    msg += "To sign in you need to install the FormScape plugin.\r\n\r\n";
	    msg += "Click OK to begin the download, and then run the installer.\r\n\r\n";
	    msg += "Follow the on-screen instructions and then restart your web browser.";

	    if (confirm(msg))
		    window.navigate("fspluginsetup.exe");
    }
    else
    {
        try
        {
            var session = document.getElementById("session").value;
            document.getElementById("signininfo").value = document.singleSignin.Pluglet.GenerateSigninInformation(session);
            document.getElementById("SignIn").submit();
        }
        catch (e)
        {
            // the Pluglet property will throw if the pluglet isn't downloaded yet, so retry every second
            setTimeout(PerformAutoSignin, 100);
        }
    }
}

// do after page has loaded to ensure plugin framework is initialized by browser
setTimeout(PerformAutoSignin, 100);

