<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>External Address Book</title>

||just_include||externalcss.tpl||
</head>

<body background="||cust_panel_background||" bgcolor="||cust_panel_bgcolor||">
||ifdef||error||
	<center>
	<table border="1">		
		<tr>
			<td><img src="||nwimg||/attention.gif" alt="Attention" /></td>
			<td bgcolor="ffffff">||error||</td>
		</tr>
	</table>
	</center>
||endif||


<form name="external_search" action="||action||" method="post">
	<input type="hidden" name="utoken" value="||utoken||" />
	<input type="hidden" name="cmd" value="" />

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

||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="selected"> ||book_name|| - ||book_text|| </option>
					||else||
						<option value="||book_name||" > ||book_name|| - ||book_text|| </option>
					||endif||
				||end_ext_book||
			</select>
		</td>
	</tr>
	</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)||" />
			||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="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||num_pages||
||ifequal||num_pages||1||
||else||
<table border="0" cellpadding="0" cellspacing="0">
	<tr>	

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


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

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

	||else||

	||ifequal||npage||10||
		||iflower||9||page_pos||
			<td><a href="||action||?||search_str||&amp;ext_pos=||pagepos||"><img border="0" src="||nwimg||/staron.gif" alt="" /></a></td>
		||else||
			<td><a href="||action||?||search_str||&amp;ext_pos=||pagepos||"><img border="0" src="||nwimg||/staroff.gif" alt="" /></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||&amp;ext_pos=||pagedown||"><img border="0" src="||nwimg||/rendcol.gif" alt="" /></a></td>
||else||
		<td><img border="0" src="||nwimg||/rend.gif" alt="" /></td>
||endif||

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


<table border="1" bgcolor="ffffff">
	<tr>	
	||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||full_name||
				<td><a target="list" href="||action||?cmd=create_addr&amp;abk_full_name=||ext_display||field_name||&amp;abk_email=||ext_display||email_address||&amp;utoken=||utoken||">||ext_display||field_name||</a>
				</td>
			||else||
			||ifequal||field_name||email_address||
				<td><a target="list" href="||action||?cmd=msg_new&amp;h_from=||ext_display||field_name||&amp;utoken=||utoken||">||ext_display||field_name||</a>
				</td>
			||else||
				||ifequal||field_name||record_id||
				||else||
					<td>||ext_display||field_name||</td>
				||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>
