function boxEditorUpdate()
{
  var browser_type = navigator.appName;

  document.getElementById("newsletter").style.backgroundColor = document.boxEditor.basicBackgroundColor.value;

  var frm = document.boxEditor;
  
  var allTds = document.getElementsByTagName("td");
  
  if(allTds != "") 
  {
    for(var i = 0; i < allTds.length; i++)
    {
      if(allTds[i].id == "headline")
      {
        allTds[i].style.textAlign = frm.headlineAlign.value;
        allTds[i].style.fontFamily = frm.headlineFontType.value;
        allTds[i].style.fontSize = frm.headlineFontSize.value + "pt";
        allTds[i].style.color = frm.headlineTextColor.value;
        allTds[i].style.fontWeight = frm.headlineFontWeight.value;
      }
      if(allTds[i].id == "interests")
      {
        allTds[i].style.textAlign = frm.interestAlign.value;
        allTds[i].style.fontFamily = frm.interestFontType.value;
        allTds[i].style.fontSize = frm.interestFontSize.value + "pt";
        allTds[i].style.color = frm.interestTextColor.value;
      }
      if(allTds[i].id == "buttons")
      {
        allTds[i].style.textAlign = frm.buttonAlign.value;
      }
      if((allTds[i].id == "datafields") || (allTds[i].id == "name") || (allTds[i].id == "email"))
      {
        allTds[i].style.textAlign = frm.fieldAlign.value;
      }
    }
  }
  var allInputs = document.getElementsByTagName("input");
  
  if(allInputs != "") 
  {
    for(var i = 0; i < allInputs.length; i++)
    {
      if((allInputs[i].id == "subscribeButton") || (allInputs[i].id == "unsubscribeButton"))
      {
        allInputs[i].style.fontFamily = frm.buttonFontType.value;
        allInputs[i].style.fontSize = frm.buttonFontSize.value + "pt";
        allInputs[i].style.color = frm.buttonTextColor.value;
        allInputs[i].style.backgroundColor = frm.buttonBackgroundColor.value;
        
        allInputs[i].style.borderWidth = "1px";
        allInputs[i].style.borderStyle = frm.buttonFrame.value;
        if(allInputs[i].style.borderColor == "")
        {
          allInputs[i].style.borderColor = "black";
        }
      }
      if(((allInputs[i].id.length >= 9) && (allInputs[i].id.substr(0, 9) == "datafield")) || (allInputs[i].id == "name") || (allInputs[i].id == "email"))
      {
        allInputs[i].style.fontFamily = frm.inputFontType.value;
        allInputs[i].style.fontSize = frm.inputFontSize.value + "pt";
        allInputs[i].style.color = frm.inputTextColor.value;
        allInputs[i].style.backgroundColor = frm.inputBackgroundColor.value;
        
        allInputs[i].style.borderWidth = "1px";
        allInputs[i].style.borderStyle = frm.inputBorderWidth.value;
        if(allInputs[i].style.borderColor == "")
        {
          allInputs[i].style.borderColor = "black";
        }
      }
    }
  }
  
  var allSelects = document.getElementsByTagName("select");
  if(allSelects != "")
  {
    for(var i = 0; i < allSelects.length; i++)
    {
      if((allSelects[i].id.length >= 9) && (allSelects[i].id.substr(0, 9) == "datafield"))
      {
        allSelects[i].style.fontFamily = frm.inputFontType.value;
        allSelects[i].style.fontSize = frm.inputFontSize.value + "pt";
        allSelects[i].style.color = frm.inputTextColor.value;
        allSelects[i].style.backgroundColor = frm.inputBackgroundColor.value;
        
        allSelects[i].style.borderWidth = "1px";
        allSelects[i].style.borderStyle = frm.inputBorderWidth.value;
        if(allSelects[i].style.borderColor == "")
        {
          allSelects[i].style.borderColor = "black";
        }
      }
    }
  }
}

function boxEditorTransBasicBackground()
{
  document.boxEditor.basicBackgroundColor.value = "";
  boxEditorUpdate();
}

function boxEditorStandardInputText()
{
  document.boxEditor.inputBackgroundColor.value = "";
  document.boxEditor.inputBorderWidth.value = "standard";
  boxEditorUpdate();
}

function boxEditorStandardButtons()
{
  document.boxEditor.buttonAlign.value = "center";
  document.boxEditor.buttonFontType.value = "verdana";
  document.boxEditor.buttonFontSize.value = "10";
  document.boxEditor.buttonTextColor.value = "#000000";
  document.boxEditor.buttonFrame.value = "outset";
  document.boxEditor.buttonBackgroundColor.value = "";
  boxEditorUpdate();
}
