<html>
||include||meta.tpl||
<head>
<link rel="stylesheet" type="text/css" href="||nwimg||||tpl_color||/surge.css" />

||ifequal||changing_address||true||
	||define||ts_nick_name||(||ifinstr||cmd||saveaddrbook||||html_text||abk_full_name||||else||||html_text||nick_name||||endif||)||
	||ifnempty||nick_name||
		||define||ts_old_nick_name||(||html_text||nick_name||)||
	||endif||
	||define||ts_abk_address||(||abk_address||)||
	||define||ts_abk_full_name||(||html_text||abk_full_name||)||
	||define||ts_abk_email||(||html_text||abk_email||)||
	||define||ts_abk_phone||(||html_text||abk_phone||)||
	||define||ts_abk_mobile||(||html_text||abk_mobile||)||
	||define||ts_abk_fax||(||html_text||abk_fax||)||
	||define||ts_abk_note||(||html_text||abk_note||)||
	||undef||cur_rule_id||
	||ifinstr||surgemail_disallow||sms||
	||else||
		||ifdef||surgemail||
			||ifdef||ts_abk_email||
				||post_cmd||(||user_cgi_http_prefix||/cgi/user.cgi?cmd=auto_login&lcmd=user_sms_load&vhost=||vhost||&show=na_sms.xml)||
				||begin_for||1||sms_rule_num||
					||define||text||(||for||_sms_rule_text)||
					||define||header||(||for||_sms_rule_header)||
					||ifequal||header||From||
						||ifequal||text||ts_abk_email||
							||define||cur_rule_id||(||for||_sms_rule_id)||
						||endif||
					||endif||
				||end_for||
			||endif||
		||endif||
	||endif||
||endif||

||ifdef||change_sms_state||
	||ifndef||ts_abk_email||
		||post_cmd||(||user_cgi_http_prefix||/cgi/user.cgi?cmd=auto_login&lcmd=user_sms_load&vhost=||vhost||&show=na_sms.xml)||
	||endif||
	||undef||snum||	||ifdef||u_sms_number||	||define||snum||(||href_text||u_sms_number||)||	||endif||
	||ifequal||change_sms_state||true||
		||post_cmd||(||user_cgi_http_prefix||/cgi/user.cgi?cmd=auto_login&lcmd=user_sms_save_rule&sms_rule_header=From&sms_rule_text=||html_text||abk_email||&sms_number=||snum||&vhost=||vhost||&show=na_msg.xml)||
	||else||
		||post_cmd||(||user_cgi_http_prefix||/cgi/user.cgi?cmd=auto_login&lcmd=user_sms_delete_rule&sel_r_||old_sms_id||=on&sms_number=||snum||&vhost=||vhost||&show=na_msg.xml)||
	||endif||
||endif||

<script type="text/javascript">
<!--
||/*||// The following is the lang translations for POPUP javascript alerts||*/||
var x_saddr = "||lang_str||You need to enter both an email address and a nickname if you would like to be alerted by SMS if you receive an email from this person.||";
var x_prompt_s = "||lang_str||Do you want to delete the entire||";
var x_prompt_e = "||lang_str||Address Book?||";
var action="||action||";
var utoken="||utoken||";
var bk="||abook_edit||";
var old_sms_alert=||ifdef||cur_rule_id||true||else||false||endif||;
||ifempty||changing_address||
var ch_addr=false;
||else||
var ch_addr=true;
var enc_nick="||encode_quotes||nick_name||";
||endif||
function externwindow(){
	msgWindow = open(act+'ext_addr'+ut,'EXTERNADDR','width=550,height=450,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes','POPUP');
	if (msgWindow.opener == null) msgWindow.opener = self;
	if (msgWindow.opener.pickform == null) msgWindow.opener.pickform = document.pickform;
}
// -->
</script>
<script type="text/javascript" src="||common_files||/util.js"></script>
<script type="text/javascript" src="||nwimg||/layout.js"></script>
<script type="text/javascript" src="||nwimg||/pick.js"></script>

<title>||cust_title|| - ||lang_str||Addresses||</title>
</head>
<body class="body" onload="doresize();" onresize="doresize()">

||include||_layout_start.tpl||

||ifdef||error||
	||include||_errorinline.tpl||
||endif||
||ifdef||msg||
	||include||_msginline.tpl||
||endif||
||ifdef||u_message||
	||include||_umsginline.tpl||
||endif||

<center>
||ifempty||changing_address||

<form name="pickform" method="post" action="||action||">
<input type="hidden" name="utoken" value="||utoken||" />
<input type="hidden" name="force_connection" value="true" />
<input type="hidden" name="cmd" value="pick_edit" />
<input type="hidden" name="abook_edit" value="||encode_text||abook_edit||" />
<input type="hidden" name="abook_list" value="" />
<input type="hidden" name="page" value="" />


<table width="95%"><tr>
<td nowrap class="LF c">||lang_str||Address Book||</td>
<td></td>
<td nowrap class="LF c">||lang_str||New Address Book||</td>
<td></td>
<td width="100%"> </td>
<td rowspan="2" class="c">
	||ifdef||external_book||
	<INPUT TYPE="button" class="btn" VALUE="||lang_str||External Address Book||" onclick="javascript:externwindow()">
	||endif||
	<INPUT TYPE="button" class="btn" VALUE="||lang_str||Import an Address Book||" onclick="javascript:G2('import_new&force_connection=true')">
	<INPUT TYPE="button" class="btn" VALUE="||lang_str||Export an Address Book||" onclick="javascript:G2('pick_edit&page=export&force_connection=true')">
</td>
</tr>
<tr>
<td><select size="1" name="addr_books" onchange="do_copy(this)">
||ifdef||abook_list||<option>||abook_list||</option>||endif||
		||begin_book||
		<option value="||addr_book||" ||selected||>||trans_addr_book||</option>
		||end_book||
		<option value="Recent Addresses">||lang_str||Recent Addresses||</option>
		<option value="Groups">||lang_str||Groups||</option>
	</select></td>
<td nowrap class="LF"><input type="button" class="btn" onclick="javascript:prompt_user()" value="||lang_str||Delete||"><input type="button" class="btn" onclick="javascript:rename()" value="||lang_str||Rename||">&nbsp;&nbsp;&nbsp;</td>
<td><INPUT TYPE="Text"  name="abook_new" SIZE="26"></td>
<td><INPUT TYPE="button" class="btn" VALUE="||lang_str||Create||" onclick="javascript:create()"></td>
</tr></table>
<table class="LT" border="0" cellspacing="0" width="95%">
<TR class="bg1">
||ifequal||sort_abk_on||name||
	<th width="20%">||lang_str||Nickname||</th>
||else||
	<th width="20%"><a class="b" href="javascript:P('pick_edit&sort_abk_on=name')">||lang_str||Nickname||</a></th>
||endif||
||ifequal||sort_abk_on||abk_full_name||
	<th nowrap width="20%">||lang_str||Full Name||</th>
||else||
	<th nowrap width="20%"><a class="b" href="javascript:P('pick_edit&sort_abk_on=abk_full_name')">||lang_str||Full Name||</a></th>
||endif||
||ifequal||sort_abk_on||abk_email||
	<th nowrap width="40%">||lang_str||Email Address||</th>
||else||
	<th nowrap width="40%"><a class="b" href="javascript:P('pick_edit&sort_abk_on=abk_email')">||lang_str||Email Address||</a></th>
||endif||
	<th>||lang_str||Phone||</th>
	<th>||lang_str||Mobile||</th>
	<th>||lang_str||Fax||</th>
	<th></th>
</tr>
||define||color||1||
||begin_address||
<tr class="L||color||">
	||ifequal||color||1|| ||define||color||0|| ||else|| ||define||color||1|| ||endif||
	<td>||html_text||name||</td>
	<td nowrap>||html_text||abk_full_name||</td>
	<td nowrap><a href="javascript:G2('msg_new&get_attach_id=true&encode_text=h_from&h_from=||encode_text||abk_email||')">||html_text||abk_email||</a></td>
	<td nowrap>||html_text||abk_phone||</td>
	<td nowrap>||html_text||abk_mobile||</td>
	<td nowrap>||html_text||abk_fax||</td>
	<td nowrap align="right">
		||ifdef||abk_email||
			<a href="javascript:G2('msg_new&get_attach_id=true&encode_text=h_from&h_from=||encode_text||abk_email||')">||lang_str||email||</a>
		||else||
		||endif||
		<a href="javascript:G2('create_addr&encode_text=nick_name,abook_edit&nick_name=||encode_text||name||&changing_address=true&abook_edit=||encode_text||abook_edit||&force_connection=true&page=pick')">||lang_str||edit||</a>
		<a href="javascript:G2('del_addr&encode_text=nick_name,abook_edit&nick_name=||encode_text||name||&abook_edit=||encode_text||abook_edit||&force_connection=true&page=pick')">||lang_str||delete||</a>
	</td>
</tr>
||end_address||
</table>
</form>

||endif||

<form name="addrbook" method="post" action="||action||">
<input type="hidden" name="force_connection" value="true" />
<input type="hidden" name="utoken" value="||utoken||"/>
<input type="hidden" name="cmd" value=""/>
<input type="hidden" name="process" value="pick_edit"/>
<input type="hidden" name="page" value="pick"/>
<input type="hidden" name="abook_edit" value="||encode_text||abook_edit||"/>
<input type="hidden" name="change_sms_state" value=""/>
<input type="hidden" name="encode_text" value="abook_edit" />
||ifdef||cur_rule_id||
	<input type="hidden" name="old_sms_id" value="||cur_rule_id||"/>
||endif||
<br />
<table>
<tr><td>
<TABLE class="bg1" width="500">
<TR><TD COLSPAN="3" class="c LF b">
	||ifempty||changing_address||
		||lang_str||Add a new contact to Address Book||
	||else||
		||lang_str||Updating contact in Address Book||<br>
		<a class="LF" href="javascript:P('pick_edit')">||lang_str||Back to Address Book||</a>
	||endif||
</TD></TR>
||ifdef||surgemail||
	||ifinstr||surgemail_disallow||sms||
	||else||
		||ifdef||use_surgemail_xfile||
<tr>
	<td COLSPAN="3" class="c">
	<input TYPE="Checkbox" NAME="sms_alert" value="on"||ifdef||cur_rule_id|| checked="checked"||endif||>
	||lang_str||Alert me by SMS if I receive an email from this person||.
	||lang_str||The first 160 characters of the email will be forwarded by SMS to your phone|| - <a HREF="||action||?cmd=config&utoken=||utoken||&page=config_sms&force_connection=true">||lang_str||view SMS settings||</a></td>
</tr>
		||endif||
	||endif||
||endif||
<tr>
	<td class="LF r">||lang_str||Nickname||</td>
	<td><input type="text" size="20" name="nick_name" value="||ts_nick_name||"/></td>
||ifnempty||ts_old_nick_name||	<input type="hidden" name="old_nick_name" id="old_nick_name" value="||ts_old_nick_name||"/>	||endif||
	<td rowspan="6" class="LF c">
		||lang_str||Postal Address||<br />
		<textarea name="abk_address" COLS="25" ROWS="7">||ts_abk_address||</textarea>
	</td>
</tr>
<tr>
	<td class="LF r">||lang_str||Full Name||</td>
	<td><input type="text" size="20" name="abk_full_name" value="||ts_abk_full_name||"/></td>
</tr>
<tr>
	<td nowrap class="LF r">||lang_str||Email Address||</td>
	<td><input type="text" size="20" name="abk_email" value="||ts_abk_email||"/></td>
</tr>
<tr>
	<td class="LF r">||lang_str||Phone||</td>
	<td><input type="text" size="20" name="abk_phone" value="||ts_abk_phone||"/></td>
</tr>
<tr>
	<td class="LF r">||lang_str||Mobile||</td>
	<td><input type="text" size="20" name="abk_mobile" value="||ts_abk_mobile||"/></td>
</tr>
<tr>
	<td class="LF r">||lang_str||Fax||</td>
	<td><input type="text" size="20" name="abk_fax" value="||ts_abk_fax||"/></td>
</tr>
<tr>
	<td class="LF r">||lang_str||Notes||</td>
	<td colspan="2"><textarea name="abk_note" COLS="49" ROWS="4">||ts_abk_note||</textarea></td>
</tr>
<tr><td colspan="3" class="c"><input type="button" class="btn" onclick="javascript:saveAddress();" ||ifempty||changing_address||value="||lang_str||Save entry||"||else||value="||lang_str||Update entry||"||endif||></td></tr>
</table>
</td></tr>
</form>

<form name="addr_rename" method="post" action="||action||">
	<input type="hidden" name="utoken" value="||utoken||" />
	<input type="hidden" name="force_connection" value="true" />
	<input type="hidden" name="cmd" value="do_rename_addr" />
	<input type="hidden" name="old_abook_edit" value="" />
	<input type="hidden" name="abook_edit" value="" />
</form>
</table>
</center>
</body>
</html>

