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

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

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

  <script type="text/javascript">
  <![CDATA[
    var _elementIDs = ["emailCollection", "emailCollectionIncoming", "emailCollectionOutgoing", "emailCollectionNewsgroup", "addressingAutocomplete", "enableCABsizeLimit", "CABsizeLimit"];
  ]]>

	function Startup(){
		doEnabling();
	}

	function doEnabling()
	{
		var emailCollection = document.getElementById("emailCollection");
		var emailCollectionIncoming = document.getElementById("emailCollectionIncoming");
		var emailCollectionOutgoing = document.getElementById("emailCollectionOutgoing");
		var emailCollectionNewsgroup = document.getElementById("emailCollectionNewsgroup");
		var emailCollectionTypeText = document.getElementById("emailCollectionTypeText");
		var enableCABsizeLimit = document.getElementById("enableCABsizeLimit");
		var CABsizeLimit = document.getElementById("CABsizeLimit");
		var useCABSizelimitPart2 = document.getElementById("useCABSizelimitPart2");
		
		if( emailCollection.checked ){
			emailCollectionIncoming.removeAttribute("disabled");
			emailCollectionOutgoing.removeAttribute("disabled");
			emailCollectionNewsgroup.removeAttribute("disabled");
			emailCollectionTypeText.removeAttribute("disabled");
			enableCABsizeLimit.removeAttribute("disabled");
			CABsizeLimit.removeAttribute("disabled");
			useCABSizelimitPart2.removeAttribute("disabled");
		} else {
			emailCollectionIncoming.setAttribute("disabled", "true");
			emailCollectionOutgoing.setAttribute("disabled", "true");
			emailCollectionNewsgroup.setAttribute("disabled", "true");
			emailCollectionTypeText.setAttribute("disabled", "true");
			enableCABsizeLimit.setAttribute("disabled", "true");
			CABsizeLimit.setAttribute("disabled", "true");
			useCABSizelimitPart2.setAttribute("disabled", "true");
		}

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

	<titledbox orient="vertical">
    <title><text value="&emailCollectiontitle.label;"/></title>
	<html>&emailCollectiontext.label;</html>
            <vbox autostretch="never">
                <checkbox id="emailCollection" value="&emailCollectionEnable.label;"
                          pref="true" preftype="bool" prefstring="mail.collect_email_address"
                          prefattribute="checked" oncommand="doEnabling();"/>
            </vbox>
    <box orient="vertical" autostretch="never" class="indent">
		<text class="label" value="&emailCollectionTypeText.label;" id="emailCollectionTypeText"/>
		<checkbox id="emailCollectionIncoming" value="&emailCollectionIncomingEnable.label;"
              pref="true" preftype="bool" prefstring="mail.collect_email_address_incoming"
              prefattribute="checked"/>
		<checkbox id="emailCollectionOutgoing" value="&emailCollectionOutgoingEnable.label;"
              pref="true" preftype="bool" prefstring="mail.collect_email_address_outgoing"
              prefattribute="checked"/>
		<checkbox id="emailCollectionNewsgroup" value="&emailCollectionNewsgroupEnable.label;"
              pref="true" preftype="bool" prefstring="mail.collect_email_address_newsgroup"
              prefattribute="checked"/>
		<box autostretch="never">
			<checkbox id="enableCABsizeLimit" value="&useCABSizelimitPart1.label;"
				pref="true" preftype="bool" prefstring="mail.collect_email_address_enable_size_limit"
				prefattribute="checked"/>
			<textfield id="CABsizeLimit" size="6" pref="true" preftype="int"
					prefstring="mail.collect_email_address_size_limit" prefattribute="value"/>
			<text id="useCABSizelimitPart2" class="label" value="&useCABSizelimitPart2.label;"/>
		</box> 
	</box>
	</titledbox>
	
    <titledbox orient="vertical">
      <title><text value="&addressingTitle.label;"/></title>
      <html>&addressingText.label;</html>
      <box autostretch="never">
        <checkbox id="addressingAutocomplete" value="&addressingEnable.label;"
          pref="true" preftype="bool" prefstring="mail.enable_autocomplete"
          prefattribute="checked"/>
      </box>
    </titledbox>

</window>
