function testJScript(){
    if (document.getElementById)    {
        $('#jsMessage').css({display: "none"});
        return true;
    }
    return false;
}

function testFlash(){
    version = swfobject.getFlashPlayerVersion();
    if (version['major'] < 9)   {
        $('#flashMessage').css({display: "block"});
        return false;
    }
    return true;
}

function testBrowser(){
    if( $.browser.opera)    {
        $('#browserMessage').css({display: "block"});
        return false;
    }
    return true;
}

function testCookies(){
    if(document.cookie != "")
    return true;

    $('#cookiesMessage').css({display: "block"});
    return false;
}

$(document).ready(function(){   
    if(testJScript() && testFlash() && testBrowser() && testCookies())  {
        $('#loginContent').css({display: "block"});
    }

  focus();

});



function changeLogin(val)
{
  if (val == '--') {
    document.getElementById('loginid').style.display = '';
    document.getElementById('loginid').value='';
    document.getElementById('password').value='';
  } else {
    document.getElementById('loginid').style.display = 'none';
    document.getElementById('loginid').value = val;
    document.getElementById('password').value=val;
  }
}



function focus()
{
    var loginBox = document.getElementById('loginid');
    var loginSelect = document.getElementById('loginid_select');
    var passwordBox = document.getElementById('password');
    var emailBox = document.getElementById('email');

    try
    {
        // might be on password page
        if (emailBox)
        {
          emailBox.focus();

        }

        // demo version
        else if (loginSelect)
        {
            loginSelect.focus();
            
        }
        
        // focus on login box if nothing is in it
        else if (loginBox && loginBox.value.length == 0)
        {
            try
            {
                loginBox.focus();
            } catch (e)
            {
                if (passwordBox)
                {
                    passwordBox.focus();        
                }
            }
                
        }
        
        else if (passwordBox)
        {
            passwordBox.focus();
        
        }

     } catch (e)
     {
     }
}
