<html>
<head>
<title>External Address Book</title>
</head>

||ifdef||background||
<body background="||nwimg||/||background||">
||else||
<body>
||endif||

||ifdef||error||
	<center>
	<table border="1">
		<tr>	<td><img src="||nwimg||/attention.gif">
			<td bgcolor="ffffff">||error||</td>
		</tr>
	</table>
	</center>
||endif||


<form name="external_search">
	<input type="hidden" name="utoken" value="||utoken||">
	<input type="hidden" name="cmd" value="">

<center>
<h1>Search External Address Book</h1>

||ifdef||ext_books||
	<table>
	<tr>	<td><b>Address Book:</b></td>
		<td><select name="book_selected" size="1" onchange="this.form.cmd.value='ext_addr';this.form.submit();">
			||begin_ext_book||
				||ifequal||book_selected||book_name||
					<option value="||book_name||" selected> ||book_name|| - ||book_text|| ||ifdef||book_edit||(edit)||endif||</option>
				||else||
					<option value="||book_name||" > ||book_name|| - ||book_text|| ||ifdef||book_edit||(edit)||endif||</option>
				||endif||
			||end_ext_book||
		</select>
		</td>
	</table>
||endif||


||ifdef||ext_search||
<table border="1">
<tr><td>
<table>
	||begin_ext_search||
	<tr>	<td align="right"><b>||field_text||:</b></td>
		<td>
		||ifequal||field_type||2||
		<!-- Number Field --->
			<input type="text" size="5" name="ext_||field_name||.x" value="||build(ext_||field_name||.x)||"><b>to</b>
			<input type="text" size="5" name="ext_||field_name||.y" value="||build(ext_||field_name||.y)||"></td>
		||else||
			||ifequal||field_type||4||
		<!-- Date Field --->
				<input type="text" size="2" name="ext_||field_name||.dx" value="||build(ext_||field_name||.dx)||"><b>/</b>
				<input type="text" size="2" name="ext_||field_name||.mx" value="||build(ext_||field_name||.mx)||"><b>/</b>
				<input type="text" size="2" name="ext_||field_name||.yx" value="||build(ext_||field_name||.yx)||"> <b>to</b>

				<input type="text" size="2" name="ext_||field_name||.dy" value="||build(ext_||field_name||.dy)||"><b>/</b>
				<input type="text" size="2" name="ext_||field_name||.my" value="||build(ext_||field_name||.my)||"><b>/</b>
				<input type="text" size="2" name="ext_||field_name||.yy" value="||build(ext_||field_name||.yy)||"> (d/m/y)
			||else||
		<!-- String Field (default) --->
				<input type="text" size="30" name="ext_||field_name||." value="||build(ext_||field_name||.)||">*
			||endif||
		||endif||
		</td>
	</tr>
	||end_ext_search||
	<tr><td></td><td><input type="checkbox" name="ext_match" checked> <b>Match All</b></td></tr>
	<tr>	<td align="right">* -</td>
		<td>These fields are allowed to use wild cards.</td>
	</tr>
	<tr><td align="center" colspan="2"><input type="submit" value="Search Address Book" name="ext_search"></td></tr>
</table>
</td></tr>
</table>
||else||
	<h2>Address Book does not support searching</h2>
||endif||

</center>

<hr>
<center>
||ifdef||ext_available||



||ifdef||book_allow_edit||
	<a href="||action||?||search_str||&cmd=ext_add&page=ext_edit.tpl&book_selected=||book_selected||&utoken=||utoken||&ext_pos=||pageup||">Add Address</a>
||endif||



||ifdef||num_pages||
||ifequal||num_pages||1||
||else||
<table border="0" cellpadding="0" cellspacing="0">
	<tr>

||ifdef||pageup||
		<td><a href="||action||?||search_str||&ext_pos=||pageup||"><img border="0" src="||nwimg||/lendcol.gif"></a></td>
||else||
		<td><img border="0" src="||nwimg||/lend.gif"></td>
||endif||


	||begin_pages||
	||iflower||npage||10||

	||ifequal||npage||page_pos||
		<td><a href="||action||?||search_str||&ext_pos=||pagepos||"><img border="0" src="||nwimg||/||npage||on.gif"></a></td>
	||else||
		<td><a href="||action||?||search_str||&ext_pos=||pagepos||"><img border="0" src="||nwimg||/||npage||off.gif"></a></td>
	||endif||

	||else||

	||ifequal||npage||10||
		||iflower||9||page_pos||
			<td><a href="||action||?||search_str||&ext_pos=||pagepos||"><img border="0" src="||nwimg||/staron.gif"></a></td>
		||else||
			<td><a href="||action||?||search_str||&ext_pos=||pagepos||"><img border="0" src="||nwimg||/staroff.gif"></a></td>
		||endif||

	||endif||
	||endif||
	||end_pages||


<!--- Can be used instead of the above.
	This will display 10 quick pages at a time, with the one which
	you are on in the middle if possible.

	||begin_xpages||10||
	||ifequal||npage||page_pos||
		<td width=15>||npage||</a></td>
	||else||
		<td width=15><a href="||search_str||&ext_pos=||pagepos||">||npage||</a></td>
	||endif||
	||end_xpages||
 --->


||ifdef||pagedown||
		<td><a href="||action||?||search_str||&ext_pos=||pagedown||"><img border="0" src="||nwimg||/rendcol.gif"></a></td>
||else||
		<td><img border="0" src="||nwimg||/rend.gif"></td>
||endif||

	</tr>
</table>
||endif||
||endif||


<table border="1" bgcolor="ffffff">
	<tr>	<th></th>
	||begin_ext_avail||
		||ifequal||field_name||record_id||
		||else||
			<th>||field_text||</th>
		||endif||
	||end_ext_avail||
	</tr>
	||begin_ext_results||
		<tr>
		||begin_ext_avail||
			||ifequal||field_name||record_id||
				<td><a href="||action||?||search_str||&cmd=ext_add&id=||ext_display||field_name||&book_selected=||book_selected||&utoken=||utoken||&ext_pos=||pageup||">Change</a></td>
			||else||
			||ifequal||field_name||full_name||
				<td><a target="list" href="||action||?cmd=create_addr&abk_full_name=||ext_display||field_name||&abk_email=||ext_display||email_address||&utoken=||utoken||">||ext_display||field_name||</a>
				</td>
			||else||
			||ifequal||field_name||email_address||
				<td><a target="list" href="||action||?cmd=msg_new&h_from=||ext_display||field_name||&utoken=||utoken||">||ext_display||field_name||</a>
				</td>
			||else||
				||ifequal||field_name||record_id||
				||else||
					<td>||ext_display||field_name||</td>
				||endif||
			||endif||
			||endif||
			||endif||
		||end_ext_avail||
		</tr>
	||end_ext_results||
</table>
||else||
	<h2>No Data Available in this Address Book</h2>
||endif||
</center>

</form>


</body>
</html>
