      function stdOnChange()
      {
          document.oneitControlsChanged = true;
      }
      
      function checkControlChanges()
      {
          if(document.oneitControlsChanged)
          {
              return wizConfirmation();
          }
          else
          {
              return true;
          }
      }

      function wizConfirmation()
      {
          return confirm("Are you sure you want to move away from the page? All changes made will be lost. Press OK to continue, or Cancel to stay on the current page.");
      }

      function cancelConfirmation()
      {
          return confirm("Are you sure you want to cancel the changes?");
      }

      function registerInputEvents(initialState)
      {
          document.oneitControlsChanged = initialState;
          
          if(document.getElementsByTagName)
          {
              allInputs = document.getElementsByTagName("input");
              for (i=0; i<allInputs.length; i++) 
              {
                  thisInput = allInputs[i];
                  
                  if(thisInput.type)
                  {
                      if(thisInput.type == "radio" || thisInput.type == "checkbox" || thisInput.type == "file" || thisInput.type == "text")
                      {
                          addOnchange(thisInput);
                      }
                  }
              }
              
              allSelects = document.getElementsByTagName("select");
              for (i=0; i<allSelects.length; i++) 
              {
                  addOnchange(allSelects[i]);
              }
              
              allTextAreas = document.getElementsByTagName("textarea");
              for (i=0; i<allTextAreas.length; i++) 
              {
                  addOnchange(allTextAreas[i]);
              }
              
              // class="confirmChanges" on links for confirm check
              // NOTE: This is not tested for the oneit:link tag
              allConfirmLinks = document.getElementsByTagName("a");
              for (i=0;i<allConfirmLinks.length;i++) 
              {
                  thisLink = allConfirmLinks[i];
                  if (((' '+thisLink.className+' ').indexOf("confirmChanges") != -1))
                  {
                      addClickEvent(thisLink, checkControlChanges);
                  }
              }    
          }
          
          // if there is an editor, that will register itself
      }
      
      function addOnchange(item)
      {
          addChangeEvent(item, stdOnChange);
      }
    
      function addClickEvent(item, func)
      {
          if(item.addEventListener)
          {
              item.addEventListener('click', func, false);
          }
          else if(item.attachEvent)
          {
              item.attachEvent('onclick', func);
          }      
      }

      function addChangeEvent(item, func)
      {
          if(item.addEventListener)
          {
              item.addEventListener('change', func, false);
          }
          else if(item.attachEvent)
          {
              item.attachEvent('onchange', func);
          }                      
      }
      
      function showHideFromCheckbox(checkboxId, toHideClass)
      {
          if(document.getElementById(checkboxId))
          {
              displayStyle = (document.getElementById(checkboxId).checked) ? 'block' : 'none';
              
              allDivs = document.getElementsByTagName("div");
              for (i=0;i<allDivs.length;i++) 
              {
                  thisDiv = allDivs[i];
                  if (((' '+thisDiv.className+' ').indexOf(toHideClass) != -1))
                  {
                      thisDiv.style.display = displayStyle;
                  }
              }    
          }
      }

