var QUIZZICALWEBLOGIN = 
{
    createHiddenElements: function(username, label)
    {
        document.write('<div class="jsloginbackground" id="jsloginbackground" style="display: none"></div><div id="jslogin" style="display: none" class="jslogin"><form action="a_login.php" method="get" name="jsloginform"><table class="jslogin"><tr><td colspan="2" class="jsloginhead">Quizzicalweb<br>LOGIN</td></tr>');
        if (username)
           document.write('<tr><td class="jslogin"><label for="xUser">' + QuizzicalStrings.username + '</label>:</td><td class="jslogin"><input type="hidden" id="xUser" name="xUser" value="' + username + '">' + username + '</td></tr>');
        else
           document.write('<tr><td class="jslogin"><label for="xUser">' + QuizzicalStrings.username + '</label>:</td><td class="jslogin"><input class="jslogin" type="text" id="xUser" name="xUser"></td></tr>');
        if (label)
           document.write('<input type="hidden" id="xLabel" name="xLabel" value="' + label + '">');   
        with(document)
           {
           write('<tr><td class="jslogin"><label for="xPasswort">' + QuizzicalStrings.password + '</label>:</td><td class="jslogin"><input class="jslogin" type="password" id="xPassword" name="xPassword"></td></tr>');
           write('<tr><td><input class="jslogin" type="submit" value="' + QuizzicalStrings.login + '"></td><td align="right"><a href="javascript:QUIZZICALWEBLOGIN.hideDialog()">' + QuizzicalStrings.cancel + '</a></td></tr></table></form></div>');
           }
    },
    
    showDialog: function()
    {
    var e;
    
       e = document.getElementById('jsloginbackground');
       if (!e)
          {
          //location.href = 'login2.php';
          return false;
          }
       e.style.width = document.body.scrollWidth;
       e.style.height = document.body.scrollHeight;
       e.top = document.body.scrollTop;
       e.left = document.body.scrollLeft;
       e.style.display = '';
       
       e = document.getElementById('jslogin');
       e.style.display = '';
       if (e.clientWidth == 0) 
          {
          e.style.width = 300;
          e.style.height = 150;
          e.style.left = (document.body.clientWidth - 300) / 2 + document.body.scrollLeft;
          e.style.top = (document.body.clientHeight - 150) / 2 + document.body.scrollTop;
          }
       else
          {    
          e.style.left = (document.body.clientWidth - e.clientWidth) / 2 + document.body.scrollLeft;
          e.style.top = (document.body.clientHeight - e.clientHeight) / 2 + document.body.scrollTop;
          }

       e = document.getElementById('xUser');
       if (e.type == 'hidden')
          e = document.getElementById('xPassword');
       e.focus();   
    },
    
    hideDialog: function()
    {
        document.getElementById('jsloginbackground').style.display = 'none';
        document.getElementById('jslogin').style.display = 'none';
    }
}