<?xml version="1.0" encoding="UTF-8"?>
<Report>
	<!-- $Id$ -->
	<Title><var var="WT_I18N::translate('Addresses')" /></Title>
	<Description><var var="WT_I18N::translate('A report of addresses, telephone numbers, and email addresses.')" /></Description>
	<Input name="address" type="text"><var var="WT_I18N::translate('Show addresses that contain:')" /> </Input>
	<Input name="email_in" type="select" options="all=>WT_I18N::translate('All addresses')|noemail=>WT_I18N::translate('Addresses without emails')|onlyemail=>WT_I18N::translate('Only addresses with emails')"><var var="WT_I18N::translate('Include:')"/> </Input>
	<Input name="report_type" type="select" options="list=>WT_I18N::translate('List')|labels=>WT_I18N::translate('Address Labels')"><var var="WT_I18N::translate('Type')" /></Input>
	<Input name="pageSize" type="select" default="A4" options="letter=>WT_I18N::translate_c('paper size','Letter')|A3=>WT_I18N::translate_c('paper size', 'A3')|A4=>WT_I18N::translate_c('paper size','A4')|legal=>WT_I18N::translate_c('paper size','Legal')"><var var="WT_I18N::translate('Page size')" /></Input>
	<Input name="fonts" type="select" default="dejavusans" options="arialunicid0=>WT_I18N::translate_c('font name', 'Arial')|dejavusans=>WT_I18N::translate_c('font name', 'DejaVu')|helvetica=>WT_I18N::translate_c('font name', 'Helvetica')"><var var="WT_I18N::translate('Font')"/></Input>

	<!-- Header -->
	<Style name="header" font="$fonts" size="16" style="b" />
	<!-- Page numbers text -->
	<Style name="pagenum" font="$fonts" size="8" style="" />
	<!-- Standard text -->
	<Style name="text" font="$fonts" size="9" style="" />
	<!-- Generated by style - required style name by the generator -->
	<Style name="genby" font="$fonts" size="8" />
	<if condition="$pageSize=='A4'">
		<SetVar name="pageHeight" value="841.89" />
	</if>
	<if condition="$pageSize=='A3'">
		<SetVar name="pageHeight" value="1190.55" />
	</if>
	<if condition="$pageSize=='letter'">
		<SetVar name="pageHeight" value="792.00" />
	</if>
	<if condition="$pageSize=='legal'">
		<SetVar name="pageHeight" value="1008.00" />
	</if>
	<if condition="$report_type=='list'">
		<!-- Date Text-->
		<Style name="date" font="$fonts" size="8"/>
		<!-- Column labels -->
		<Style name="label" font="$fonts" size="10" style="b" />
		<Doc pageSize="$pageSize" >
			<Header>
				<Cell align="center" height="20" newline="1" style="header"><var var="WT_I18N::translate('Addresses')" /></Cell>
				<Cell align="rightrtl" newline="1" style="pagenum"><var var="WT_I18N::translate('Page')" /> <PageNum /> <var var="WT_I18N::translate('of')" /> <TotalPages /></Cell>
				<TextBox border="1" height="12" width="40">
					<Text style="label"> </Text>
				</TextBox>
				<TextBox border="1" height="12" width="170">
					<Text style="label"><var var="WT_I18N::translate('Name')" /></Text>
				</TextBox>
				<TextBox border="1" height="12" width="160">
					<Text style="label"><var var="WT_I18N::translate('Address')" /></Text>
				</TextBox>
				<TextBox border="1" height="12" newline="1">
					<Text style="label"><var var="WT_I18N::translate('Phone')" /> / <var var="WT_I18N::translate('Email address')" /></Text>
				</TextBox>
			</Header>
			<Body>
				<SetVar name="email" value="" />
				<SetVar name="addrfilter" value=":ADDR CONTAINS " />
				<SetVar name="addrfilter2" value="" />
				<if condition="$address != ''">
					<SetVar name="addrfilter2" value="ADDR SUBCONTAINS $address" />
				</if>
				<if condition="$email_in=='noemail'">
					<SetVar name="email" value="EMAIL EQUALS ''" />
				</if>
				<if condition="$email_in=='onlyemail'">
					<SetVar name="email" value="EMAIL CONTAINS ." />
					<if condition="$address==''">
						<SetVar name="addrfilter" value="EMAIL CONTAINS ." />
						<SetVar name="email" value="" />
					</if>
				</if>
				<List list="individual" filter1="$addrfilter" filter2="$addrfilter2" filter3="$email" sortby="NAME">
					<TextBox width="40" height="52" border="1">
						<Text style="text"><GedcomValue tag="@id" /></Text>
					</TextBox>
					<TextBox width="170" height="52" border="1">
						<Text style="text"><GetPersonName id="" /></Text>
					</TextBox>
					<TextBox width="160" height="52" border="1">
						<Text style="text"><GedcomValue tag="ADDR" /><GedcomValue tag="RESI:ADDR" /></Text>
						<if condition="@ADDR:ADR1 != ''">
							<Text style="text"><br /><GedcomValue tag="ADDR:ADR1" /></Text>
						</if>
						<if condition="@ADDR:CITY != ''">
							<if condition="$POSTAL_CODE==false">
								<if condition="@ADDR:STAE != ''">
									<Text style="text"><br /><GedcomValue tag="ADDR:POST" /> <GedcomValue tag="ADDR:CITY" />, <GedcomValue tag="ADDR:STAE" /> </Text>
								</if>
								<if condition="@ADDR:STAE == ''">
									<Text style="text"><br /><GedcomValue tag="ADDR:POST" /> <GedcomValue tag="ADDR:CITY" /></Text>
								</if>
							</if>
							<if condition="$POSTAL_CODE==true">
								<if condition="@ADDR:STAE != ''">
									<Text style="text"><br /><GedcomValue tag="ADDR:CITY" />, <GedcomValue tag="ADDR:STAE" /> <GedcomValue tag="ADDR:POST" /></Text>
								</if>
								<if condition="@ADDR:STAE == ''">
									<Text style="text"><br /><GedcomValue tag="ADDR:CITY" /> <GedcomValue tag="ADDR:POST" /></Text>
								</if>
							</if>

						</if>
						<if condition="@ADDR:CTRY != ''">
							<Text style="text"><br /><GedcomValue tag="ADDR:CTRY" /></Text>
						</if>
					</TextBox>
					<TextBox height="52" border="1" newline="1">
						<Text style="text">
							<varLetter var="PHON" /> <GedcomValue tag="PHON" /><br />
							<varLetter var="FAX" /> <GedcomValue tag="FAX" /><br />
							<varLetter var="EMAIL" /> <GedcomValue tag="_EMAIL" /><GedcomValue tag="EMAIL" />
						</Text>
					</TextBox>
				</List>
				<Cell align="rightrtl" newline="1" style="label">
					<br /><var var="WT_I18N::translate('Total individuals')" />: <ListTotal />
				</Cell>
			</Body>
			
			<Footer>
				<Cell align="rightrtl" newline="1" style="date"><Now /></Cell>
			</Footer>
		</Doc>
	</if>
	<if condition="$report_type=='labels'">
		<Style name="label" font="$fonts" size="8" style="b" />
		<Style name="idstyle" font="$fonts" size="6" style="" />

		<Doc pageSize="$pageSize" leftmargin="1" rightmargin="1" showGeneratedBy="0">
			<Header>
			</Header>
			<Body>
				<SetVar name="email" value="" />
				<SetVar name="addrfilter" value=":ADDR CONTAINS " />
				<SetVar name="addrfilter2" value="" />
				<if condition="$address != ''">
					<SetVar name="addrfilter2" value="ADDR SUBCONTAINS $address" />
				</if>
				<if condition="$email_in=='noemail'">
					<SetVar name="email" value="EMAIL EQUALS ''" />
				</if>
				<if condition="$email_in=='onlyemail'">
					<SetVar name="email" value="EMAIL CONTAINS ." />
					<if condition="$address==''">
						<SetVar name="addrfilter" value="EMAIL CONTAINS ." />
						<SetVar name="email" value="" />
					</if>
				</if>
				<SetVar name="newline" value="0" />
				<SetVar name="count" value="1" />
				<SetVar name="Xstart" value="1" />
				<SetVar name="Ystart" value="30" />
				<SetVar name="width" value="200" />
				<SetVar name="height" value="74" />
				<SetVar name="Xspace" value="3" />
				<SetVar name="Yspace" value="1" />
				<if condition="$pageSize=='letter'">
					<SetVar name="Xstart" value="5" />
					<SetVar name="Ystart" value="25" />
					<SetVar name="width" value="194" />
					<SetVar name="height" value="76" />
					<SetVar name="Xspace" value="15" />
					<SetVar name="Yspace" value="1" />
				</if>
				<SetVar name="X" value="$Xstart" />
				<SetVar name="Y" value="$Ystart" />
				<List list="individual" filter1="$addrfilter" filter2="$addrfilter2" filter3="$email" sortby="NAME">
					<TextBox top="$Y" left="$X" width="$width" height="$height" newline="$newline" pagecheck="true">
						<Text style="label"><GetPersonName id="" /><br /></Text>
						<Text style="text"><GedcomValue tag="ADDR" /><GedcomValue tag="RESI:ADDR" /></Text>
						<if condition="@ADDR:ADR1 != ''">
							<Text style="text"><br /><GedcomValue tag="ADDR:ADR1" /></Text>
						</if>
						<if condition="@ADDR:CITY != ''">
							<if condition="$POSTAL_CODE==false">
								<if condition="@ADDR:STAE != ''">
									<Text style="text"><br /><GedcomValue tag="ADDR:POST" /> <GedcomValue tag="ADDR:CITY" />, <GedcomValue tag="ADDR:STAE" /> </Text>
								</if>
								<if condition="@ADDR:STAE == ''">
									<Text style="text"><br /><GedcomValue tag="ADDR:POST" /> <GedcomValue tag="ADDR:CITY" /></Text>
								</if>
							</if>
							<if condition="$POSTAL_CODE==true">
								<if condition="@ADDR:STAE != ''">
									<Text style="text"><br /><GedcomValue tag="ADDR:CITY" />, <GedcomValue tag="ADDR:STAE" /> <GedcomValue tag="ADDR:POST" /></Text>
								</if>
								<if condition="@ADDR:STAE == ''">
									<Text style="text"><br /><GedcomValue tag="ADDR:CITY" /> <GedcomValue tag="ADDR:POST" /></Text>
								</if>
							</if>
						</if>
						<if condition="@ADDR:CTRY != ''">
							<Text style="text"><br /><GedcomValue tag="ADDR:CTRY" /></Text>
						</if>
						<if condition="$showid==1">
							<Text style="idstyle"><br />                                                                       <GedcomValue tag="@id" /></Text>
						</if>
					</TextBox>
					<SetVar name="count" value="$count+1" />
					<SetVar name="X" value="$X+$Xspace" />
					<SetVar name="X" value="$X+$width" />
					<if condition="$count==4">
						<SetVar name="Y" value="$Y+$Yspace" />
						<SetVar name="Y" value="$Y+$height" />
					</if>
					<if condition="$Y>$pageHeight">
						<SetVar name="Y" value="$Ystart" />
						<SetVar name="X" value="$Xstart" />
						<NewPage />
					</if>
					<if condition="$count>3">
						<SetVar name="count" value="1" />
						<SetVar name="X" value="$Xstart" />
					</if>
				</List>
			</Body>
			<Footer>
			</Footer>
		</Doc>
	</if>
</Report>
