<?xml version="1.0"?>
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>

<!DOCTYPE window SYSTEM "chrome://messenger/locale/pref-viewing_messages.dtd">

<window xmlns:html="http://www.w3.org/1999/xhtml"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        class="color-dialog"
        onload="parent.initPanel('chrome://messenger/content/pref-viewing_messages.xul');"
        orient="vertical">
  <popupset id="aTooltipSet"/>

  <script language="javascript">
  <![CDATA[
    _elementIDs = ["mailFixedWidthMessages", "mailQuotedStyle", "mailQuotedSize", "wrapLongLines", "displayGlyph", "displayStruct", "mailCitationColor", "sendDefaultCharsetList", "forceCharsetOverride"];

    function Startup()
    {
      getColorFromPickerAndSetWell('citationmenu', 'mailCitationColor');
    }

    function getColorFromPickerAndSetWell(menuID, colorfield)
    {
      var menu = document.getElementById( menuID );
      var colorValue = document.getElementById( colorfield );
      if( menu ) {
      	var colorWell = menu.firstChild.nextSibling;
      	var colorPicker = menu.firstChild.nextSibling.nextSibling.firstChild;
        colorWell.style.backgroundColor = colorValue.getAttribute("value");
        colorPicker.setAttribute( "color", colorValue.getAttribute("value") );
      }
    }
    
    function setColorWell(menu, colorfield) 
    {
    	// Find the colorWell and colorPicker in the hierarchy.
    	var colorWell = menu.firstChild.nextSibling;
    	var colorPicker = menu.firstChild.nextSibling.nextSibling.firstChild;
    
    	// Extract color from colorPicker and assign to colorWell.
    	var color = colorPicker.getAttribute('color');
    	colorWell.style.backgroundColor = color;
      document.getElementById(colorfield).setAttribute("value",color);
    }

    dump("*** foopy noopy\n");


  ]]>
  </script>
        
  <script language="javascript" src="chrome://global/content/strres.js"></script>
  <script language="javascript" src="chrome://communicator/content/pref/prefutilities.js"></script>

  <box class="box-smallheader" title="&pane.title;"/>

  <titledbox orient="vertical">
	  <title><text value="&displayWidth.label;"/></title>
	  <html>&plainText.label;</html>
    
    <radiogroup id="mailFixedWidthMessages" orient="vertical" autostretch="never"
                pref="true" preftype="bool" prefstring="mail.fixed_width_messages"
                prefattribute="data">
      <radio group="mailFixedWidthMessages" data="true" value="&fixedWidth.label;" accesskey="&fixedWidth.accesskey;"/>
      <radio group="mailFixedWidthMessages" data="false" value="&variableWidth.label;" accesskey="&variableWidth.accesskey;"/>                
    </radiogroup>

	<separator class="thin"/>
	<html>&displayText.label;</html>
    <box>
	  <text class="label" value="&style.label;" accesskey="&style.accesskey;" for="mailQuotedStyle"/>
      <menulist id="mailQuotedStyle" pref="true" preftype="int" prefstring="mail.quoted_style"
                prefattribute="data">
        <menupopup>
          <menuitem data="0" value="&regular.label;"/>
          <menuitem data="1" value="&bold.label;"/>
          <menuitem data="2" value="&italic.label;"/>
          <menuitem data="3" value="&boldItalic.label;"/>
        </menupopup>
      </menulist>

      <text class="label" value="&size.label;" accesskey="&size.label;" for="mailQuotedSize"/>
      <menulist id="mailQuotedSize" pref="true" preftype="int" prefstring="mail.quoted_size"
                prefattribute="data">
        <menupopup>
          <menuitem data="0" value="&regular.label;"/>
          <menuitem data="1" value="&bigger.label;"/>
          <menuitem data="2" value="&smaller.label;"/>
        </menupopup>
      </menulist>
      
      <menu id="citationmenu">
        <titledbutton value="&color.label;" class="popup" align="right"/> 
        <html:div style="width:30px; background-color:white"/>
        <menupopup>
          <colorpicker id="citation" palettename="standard" onclick="setColorWell(this.parentNode.parentNode,'mailCitationColor');"/>
        </menupopup>
        <broadcaster id="mailCitationColor" pref="true" preftype="color" prefstring="mail.citation_color" prefattribute="value" wsm_attributes="value"/>
      </menu>  
    </box>		

	<separator class="thin"/>
	<html>&viewingPlainText.label;</html>
    <checkbox id="wrapLongLines" value="&wrapInMsg.label;" accesskey="&wrapInMsg.accesskey;"
              pref="true" preftype="bool" prefstring="mail.wrap_long_lines" 
              prefattribute="checked"/>
    <checkbox class="iconic" id="displayGlyph" value="&convertEmoticons.label;" accesskey="&convertEmoticons.accesskey;"
              pref="true" preftype="bool" prefstring="mail.display_glyph"
              prefattribute="checked" tooltip="aTooltip" tooltiptext="&convertEmoticons.tooltip;"/>		
    <checkbox id="displayStruct" value="&convertStructs.label;" accesskey="&convertStructs.accesskey;" 
              pref="true" preftype="bool" prefstring="mail.display_struct"
              prefattribute="checked" tooltip="aTooltip" tooltiptext="&convertStructs.tooltip;"/>
  </titledbox>

	<titledbox orient="vertical" autostretch="never">
	<title><text value="&languages.label;"/></title>
	<html>&coding.label;</html>
	<box autostretch="never">
    <text class="label" value="&sendDefaultCharset.label;" for="sendDefaultCharsetList"/>
    <menulist id="sendDefaultCharsetList" ref="NC:MaileditCharsetMenuRoot" datasources="rdf:charset-menu"
              pref="true" preftype="string" prefstring="mailnews.view_default_charset"
              prefattribute="data">
      <template>
        <menupopup>
          <menuitem value="rdf:http://home.netscape.com/NC-rdf#Name" data="..." uri="..."/>
        </menupopup>
      </template>
    </menulist>       
    </box>    
  <checkbox id="forceCharsetOverride" value="&forceCharsetOverride.label;" accesskey="&forceCharsetOverride.accesskey;"
            pref="true" preftype="bool" prefstring="mailnews.force_charset_override" 
            prefattribute="checked"/>
	</titledbox>
	  
</window>
