function restoreUserPreferences() {

   userPrefsEnabled = getCookie("userPrefsEnabled") // test for enable

   // defaults
   mainWindowLeft        = 768+200
   mainWindowTop         = 1024+160
   mainWindowWidth       = 396
   mainWindowHeight      = 300
   mainWindowClosed      = 1
   menuWindowLeft        = 968+300
   menuWindowTop         = 1204+40
   theState              = 'hidden'
   soundPreference       = 0
   randomDelayValue      = 500
   floorValue            = screen.availHeight-150
   initializeFloorInput() // for floor value
   bgAudioPreference     = 0
   currentPage           = 'defaultPage'

   if (userPrefsEnabled == 1) {
      mainWindowLeft        = getCookie("mainWindowLeft")
      mainWindowTop         = getCookie("mainWindowTop")
      mainWindowWidth       = getCookie("mainWindowWidth")
      mainWindowHeight      = getCookie("mainWindowHeight")
      mainWindowClosed      = getCookie("mainWindowStatus")
      menuWindowLeft        = getCookie("menuWindowLeft")
      menuWindowTop         = getCookie("menuWindowTop")
      theState              = getCookie("interactiveStatus")
      soundPreference       = getCookie("soundPreference")
      randomDelayValue      = getCookie("randomDelayValue")
      floorValue            = getCookie("floorValue")
      floorInput.value = floorValue
      setFloor(floorValue)
      bgAudioPreference     = getCookie("bgAudioPreference")
      currentPage           = getCookie("defaultPagePreference")
      document['userPrefsStatus'].src = 'images/x_on.gif'
      removeMenuTip()
   }

   else
      setTimeout('flashMenu()',500,'Javascript');

   // set the preferences .. default or otherwise.
   if (currentPage == 'defaultPage')
      showContent(defaultPage);
   else if (currentPage == 'words')
      showContent(words);
   else if (currentPage == 'olderWords')
      showContent(olderWords);
   else if (currentPage == 'oldWords')
      showContent(oldWords);
   else if (currentPage == 'projects')
      showContent(projects);
   else if (currentPage == 'subsections')
      showContent(subsections);
   else if (currentPage == 'about')
      showContent(about);
   else if (currentPage == 'communication')
      showContent(communication);
   else if (currentPage == 'help')
      showContent(help);

   mainContentArea.width = mainWindowWidth
   mainContentArea.height = mainWindowHeight

   moveWindowTo(mainWindowLeft, mainWindowTop)
   moveMenuTo(menuWindowLeft, menuWindowTop)

   doHideAll() // show/hide interactive stuff (based on theState)

   if (mainWindowClosed)
      openWindow('mainWindow');

   if (soundPreference == '1') {
      suppressWarning=1
      document['off_0'].src = 'images/off.gif'
      document['on_0'].src = 'images/on_red.gif'
      enableSound()
      Start()
   }

   if (bgAudioPreference == '1')
      startBackgroundAudio();
}

function toggleUserPreferences() {
   if (userPrefsEnabled == 1) {
      document['userPrefsStatus'].src = 'images/x.gif'
      userPrefsEnabled=0
      setCookie("userPrefsEnabled",userPrefsEnabled,now,'/')
      deleteCookie('mainWindowLeft', '/')
      deleteCookie('mainWindowTop', '/')
      deleteCookie('mainWindowWidth', '/')
      deleteCookie('mainWindowHeight', '/')
      deleteCookie('mainWindowStatus', '/')
      deleteCookie('menuWindowLeft', '/')
      deleteCookie('menuWindowTop', '/')
      deleteCookie('interactiveStatus', '/')
      deleteCookie('soundPreference', '/')
      deleteCookie('randomDelayValue', '/')
      deleteCookie('floorValue', '/')
      deleteCookie('bgAudioPreference', '/')
      deleteCookie('defaultPagePreference', '/')
   }
   else {
      document['userPrefsStatus'].src = 'images/x_on.gif'
      userPrefsEnabled=1
      setCookie("userPrefsEnabled",userPrefsEnabled,now,'/')
   }
}

function saveUserPreferences() {
   // userPrefsEnabled = getCookie("userPrefsEnabled") // test for enable

//   if (userPrefsEnabled) {
      setCookie("mainWindowLeft",mainWindow.style.pixelLeft,now,'/')
      setCookie("mainWindowTop",mainWindow.style.pixelTop,now,'/')
      setCookie("mainWindowWidth",parseInt(mainContentArea.width),now,'/')
      setCookie("mainWindowHeight",parseInt(mainContentArea.height),now,'/')
      setCookie("mainWindowStatus",mainWindowClosed,now,'/')

      setCookie("menuWindowLeft",menuWindow.style.pixelLeft,now,'/')
      setCookie("menuWindowTop",menuWindow.style.pixelTop,now,'/')

      if (theState == 'visible') // flip state (so it is "reversed" for next visit)
         theState = 'hidden';
      else
         theState = 'visible';

      setCookie("interactiveStatus",theState,now,'/')
      setCookie("soundPreference",soundEnabled,now,'/')
      setCookie("randomDelayValue",delayInput.value,now,'/')
      setCookie("floorValue",floorInput.value,now,'/')
      setCookie("bgAudioPreference",bgAudioEnabled,now,'/')
      setCookie("defaultPagePreference",currentPage,now,'/')
//   }
}      
