/**
 * Copyright (c) 2006 Adobe Macromedia Software LLC and its licensors.
 * All rights reserved.
 */  
        function pause(millis) {
          var then = new Date();
          var now = null;

          do { now = new Date(); }
          while(now - then < millis);
        } 

        function showGuest() {
              guestInputs.style.visibility = "visible";
              guestButton.style.visibility = "visible";
        }
        
        function switchToGuest(rollup) {
              if(chooser == 0) //radio guest already checked
                return;
              chooser = 0;
              document.contentForm.chooser[0].checked = true;
              document.contentForm.chooser[0].visible = true;
              document.contentForm.chooser[0].style.visibility = "visible";
              document.contentForm.chooser[0].tabindex = 10;
              document.contentForm.chooser[1].tabindex = 11;
              regHint.style.width = "400px";
              guestLogin.style.width = "450px";
              guestLogin.style.height = "80px";
              guestInputs.style.position = "absolute";
              guestInputs.style.top = "20px";
              guestButton.style.position = "absolute";
              guestButton.style.top = "13px";
              guestButton.style.width = "115px";
              guestButton.style.left = "220px";
              guestName.style.width = "215px";
              if(rollup == true) {
                regTop = TOP_SELECT;
                scrolldown();
                x = setTimeout("showGuest();", GUEST_POPUP);
                x = setTimeout("document.contentForm.guestName.focus();", GUEST_POPUP);
              } else {
                regLogin.style.top = TOP_UNSEL + "px"; 
                regRadioButton.style.top = (TOP_UNSEL + BUTTON_OFFSET) + "px";
                document.contentForm.guestName.focus();
              }
              regHint.style.visibility = "visible";
              if(IE == 1)
                regLogin.style.overflow = "hidden";
        }

        function switchToReg(rollup) {
              if(chooser == 1) //radio reg already checked
                return;
              chooser = 1;
              document.contentForm.chooser[1].checked = true;
              document.contentForm.chooser[1].visible = true;
              document.contentForm.chooser[1].style.visibility = "visible";
              document.contentForm.chooser[0].tabindex = 10;
              document.contentForm.chooser[1].tabindex = 11;

              guestInputs.style.visibility = "hidden";
              guestButton.style.visibility = "hidden";
              regHint.style.visibility = "hidden";
              regButton.style.position = "absolute";
              regButton.style.width = "115px";
              regButton.style.left = "228px";    
              regButton.style.top = "100px";
              regInputs.style.width = "450px";
              regInputs.style.visibility = "visible";
              if(rollup == true) {
                regTop = TOP_UNSEL;
                x = setTimeout("document.contentForm.name.focus();", 35);
                scrollup();
              } else {
                regLogin.style.top = TOP_SELECT + "px";
                regRadioButton.style.top = (TOP_SELECT + BUTTON_OFFSET) + "px";
                document.contentForm.name.focus();
              }
              regLogin.style.height = "160px";
              if(IE == 1)
                regLogin.style.overflow = "hidden";
        }
             
        function scrollup(reg, rad) {
            if(regTop - 5 < TOP_SELECT) {
              regLogin.style.top = TOP_SELECT + "px";
              regRadioButton.style.top = (TOP_SELECT + BUTTON_OFFSET) + "px";
              return;
            }
            regTop = regTop - 5;
            regLogin.style.top = regTop + "px";
            regRadioButton.style.top = (regTop + BUTTON_OFFSET) + "px";
            x = setTimeout("scrollup();", 0);
        }

        function scrolldown(reg, rad) {
            if(regTop + 5 > TOP_UNSEL) {
              regLogin.style.top = TOP_UNSEL + "px";
              regLogin.style.height = "50px";
              regRadioButton.style.top = (TOP_UNSEL + BUTTON_OFFSET) + "px";
              regInputs.style.visibility = "hidden";
              return;
            }
            regTop = regTop + 5;
            regLogin.style.top = regTop + "px";
            regRadioButton.style.top = (regTop + BUTTON_OFFSET) + "px";
            x = setTimeout("scrolldown();", 0);
        }

        function visibility(obj, state) {
          if(obj != null)
            obj.style.visibility = state;
        }

        function getWindowSize() {
          if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            width = window.innerWidth;
            height = window.innerHeight;
          } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            width = document.documentElement.clientWidth;
            height = document.documentElement.clientHeight;
          } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            width = document.body.clientWidth;
            height = document.body.clientHeight;
          }
        }

        function centerLogin() {
          if(loaded == false)
            return;
          var loginh = 310;
          getWindowSize();
          var headerh = 171;
          if(height < 90 + loginh + 180)
            return;
          greet.style.position = "relative";
              
          var botOfHeader = (height - loginh) / 2 - headerh; //height of login div,header
          greet.style.top = (botOfHeader) + "px";
          loginDiv.style.top = botOfHeader + "px";
          loginDiv.style.height = loginh;
          copyright.style.position = "relative";
          copyright.style.top = botOfHeader + "px"; 
        }
