<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
||ifequal||changing_address||true||
	||define||tmp_nick_name||(||ifinstr||cmd||saveaddrbook||||html_text||abk_full_name||||else||||html_text||nick_name||||endif||)||
	||ifnempty||nick_name||
		||define||tmp_old_nick_name||(||html_text||nick_name||)||
	||endif||
	||define||tmp_abk_address||(||abk_address||)||
	||define||tmp_abk_full_name||(||html_text||abk_full_name||)||
	||define||tmp_abk_email||(||html_text||abk_email||)||
	||define||tmp_abk_phone||(||html_text||abk_phone||)||
	||define||tmp_abk_mobile||(||html_text||abk_mobile||)||
	||define||tmp_abk_fax||(||html_text||abk_fax||)||
	||define||tmp_abk_note||(||html_text||abk_note||)||
||endif||

<script type="text/javascript">
<!--
||ifdef||netscape_version||
	||define||amp||&||
||else||
	||define||amp||&amp;||
||endif||

||ifempty||changing_address||
var ch_addr=false;
||else||
var ch_addr=true;
var enc_nick="||encode_quotes||nick_name||";
||endif||
var menuframe = null;
var menuform = null;

function findMenu(){
	if(!menuframe){
		if(window.opener){
			menuframe = window.opener.parent.frames[0];
		}
		else{
			menuframe = window.parent.parent.frames[0];
		}
		menuform = menuframe.document.menu;
	}
}

function mylistsubmit(cmd){
	findMenu();
	menuform.listcmd.value = cmd;
	menuform.cmd.value = "show";
	menuform.page.value = "framenew";
	menuform.submit();
}

function clickAddress(address){
	findMenu();
	menuform.my_from.value = address;
	menuform.not_new.value = "false";
	menuform.target = menuframe.openWindow();
	mylistsubmit("msg_new");
	if(navigator.userAgent.indexOf("4.") >= 0 || (navigator.userAgent.indexOf("MSIE") >= 0 && navigator.userAgent.indexOf("Mac") >= 0) ){
		setTimeout('menuform.not_new.value = "";menuform.redirect.value = "";', 1000);
	}else{
		menuform.not_new.value = "";
		menuform.redirect.value = "";
	}
	return;
}

function create(){
	document.pickform.abook_edit.value = document.pickform.abook_new.value;
	document.pickform.abook_list.value = document.pickform.abook_new.value;
	document.pickform.submit();
}

function enc_quotes(str){
	var lastIndex = 0;
	for(lastIndex=0;;lastIndex++){
		if((lastIndex = str.indexOf("!", lastIndex))<0)break;
		str = str.substring(0, lastIndex) + "!21" + str.substring(lastIndex+1, str.length);
	}
	for(lastIndex=0;;lastIndex++){
		if((lastIndex = str.indexOf("'", lastIndex))<0)break;
		str = str.substring(0, lastIndex) + "!60" + str.substring(lastIndex+1, str.length);
	}
	for(lastIndex=0;;lastIndex++){
		if((lastIndex = str.indexOf('"', lastIndex))<0)break;
		str = str.substring(0, lastIndex) + "!22" + str.substring(lastIndex+1, str.length);
	}
	for(lastIndex=0;;lastIndex++){
		if((lastIndex = str.indexOf("~", lastIndex))<0)break;
		str = str.substring(0, lastIndex) + "!E7" + str.substring(lastIndex+1, str.length);
	}
	for(lastIndex=0;;){
		if((lastIndex = str.indexOf("\\", lastIndex+1))<0)break;
		str = str.substring(0, lastIndex) + "!5C" + str.substring(lastIndex+1, str.length);
	}
	return str;
}

function do_copy(sel){
	var i;
	for (i=0; i<sel.options.length; i++){
		if (sel.options[i].selected==true){
			if (sel.options[i].value == "Groups")
				document.addrbook.page.value = "group";
			else if (sel.options[i].value == "Recent Addresses")
				document.addrbook.page.value = "pick_recent";
			else
				document.addrbook.abook_edit.value = sel.options[i].value;
			break;
		}
	}
	document.addrbook.cmd.value = "pick_edit";
	document.addrbook.submit();
}

function saveAddress(){
	if(ch_addr){
		if(enc_nick == enc_quotes(document.addrbook.nick_name.value))
			document.addrbook.cmd.value = "add_addr";
		else
			document.addrbook.cmd.value = "replace_check_addr";
	}
	else
		document.addrbook.cmd.value = "add_nick_addr";
	document.addrbook.submit();
}

function externwindow(){
	msgWindow = open('||action||?cmd=ext_addr||amp||utoken=||putoken||||amp||||amp||','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;
}

function prompt_user()
{
	x = confirm('Do you want to delete the entire Address Book?');
	if (x == true) {
		document.pickform.cmd.value = "del_abook";
		document.pickform.submit();
	}
}

function setTitle(){
	||ifequal||top||_top||
		window.top.document.title = "||cust_display_name|| - ||current_user|| - Address Book";
	||endif||
}

function importNew(){
	document.location = "||action||?cmd=import_new||amp||utoken=||utoken||";
}

function rename(){
	msgWindow = open('||action||?cmd=show||amp||page=pick_rename||amp||abook_edit=' + document.addrbook.abook_edit.value + '||amp||utoken=||putoken||||amp||||amp||','RENAMEADDR','width=300,height=120,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>

||just_include||pickfcss.tpl||

<title>Address Book</title>
</head>

<body background="||cust_panel_background||" bgcolor="||cust_panel_bgcolor||" onload="setTitle();">

<center>

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


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

||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="||abook_edit||" />
<input type="hidden" name="abook_list" value="" />
<input type="hidden" name="page" value="" />

<table width="95%">
<tr>
	<td class="head" align="center">Address Book</td>
	<td></td>
	<td class="head" align="center">New Address Book</td>
	||ifdef||external_book||
		<td></td>
		<td></td>
		<td align="center"><input type="button" value="External Address Book" onclick="javascript:externwindow()" /></td>
	||endif||
</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">Recent Addresses</option>
			<option value="Groups">Groups</option>
		</select></td>
	<td nowrap>
		<input type="button" onclick="javascript:prompt_user()" value="Delete" />
		<input type="button" onclick="javascript:rename()" value="Rename" />&nbsp;&nbsp;&nbsp;&nbsp;
	</td>
	<td><input type="Text" name="abook_new" size="20"></td>
	<td><input type="button" value="Create" onclick="javascript:create()" /></td>
	<td width="100%">&nbsp;</td>
	<td align="center"><input type="button" value="Import an Address Book" onclick="javascript:importNew()"></td>
</tr>
</table>
<table width="95%" border="0" cellspacing="0" class="LT">
<tr bgcolor="#D6D6CE">
||ifequal||sort_abk_on||name||
	<td nowrap="nowrap" width="20%"><b>Nickname</b></td>
||else||
	<td nowrap="nowrap" width="20%"><a href="||action||?sort_abk_on=name&amp;abook_edit=||abook_edit||&amp;cmd=pick_edit&amp;utoken=||utoken||">Nickname</a></td>
||endif||

||ifequal||sort_abk_on||abk_email||
	<td nowrap="nowrap" width="50%"><b>Email Address</b></td>
||else||
	<td nowrap="nowrap" width="50%"><a href="||action||?sort_abk_on=abk_email&amp;abook_edit=||abook_edit||&amp;cmd=pick_edit&amp;utoken=||utoken||">Email Address</a></td>
||endif||
||ifequal||sort_abk_on||abk_full_name||
	<td nowrap="nowrap" width="20%"><b>Full Name</b></td>
||else||
	<td nowrap="nowrap" width="20%"><a href="||action||?sort_abk_on=abk_full_name&amp;abook_edit=||abook_edit||&amp;cmd=pick_edit&amp;utoken=||utoken||">Full Name</a></td>
||endif||
	<td nowrap="nowrap">Phone</td>
	<td nowrap="nowrap">Mobile</td>
	<td nowrap="nowrap">Fax</td>
	<td></td>
</tr>
||define||color||1||
||begin_address||
<tr class="L||color||">
	||ifequal||color||1|| ||define||color||0|| ||else|| ||define||color||1|| ||endif||
		<td><a href="||action||?cmd=create_addr&amp;nick_name=||href_text||name||&amp;encode_text=abook_edit&amp;abook_edit=||encode_text||abook_edit||&amp;utoken=||utoken||&amp;page=pickf&amp;changing_address=true">||html_text||name||</a></td>
		<td nowrap="nowrap"><a href='javascript:clickAddress("||message_text||abk_email||")'>||html_text||abk_email||</a></td>
		<td nowrap="nowrap">||html_text||abk_full_name||</td>
		<td>||html_text||abk_phone||</td>
		<td>||html_text||abk_mobile||</td>
		<td>||html_text||abk_fax||</td>
		<td><a href="||action||?cmd=del_addr&amp;nick_name=||href_text||name||&amp;abk_email=||href_text||(||abk_email||)||&amp;page=pickf&amp;abook_edit=||abook_edit||&amp;utoken=||utoken||">delete</a></td>
	</tr>
||end_address||
</table>
</form>

||endif||

<form name="addrbook" method="post" action="||action||">
<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=""/>
<input type="hidden" name="abook_edit" value="||abook_edit||"/>
<table bgcolor="#D6D6CE" width="500">
<tr>
	<td colspan="3" align="center" class="head"><b>
	||ifempty||changing_address||
		Add a new contact to the '||abook_edit||' Address Book
	||else||
		Updating contact in the '||abook_edit||' Address Book<br />
		<a class="head" href="||action||?cmd=pick_edit&amp;utoken=||utoken||&amp;encode_text=abook_edit&amp;abook_edit=||encode_text||abook_edit||">Back to Address Book</a>
	||endif||</b>
	</td>
</tr>
<tr>
	<td class="head" align="right">Nickname</td>
	<td><input type="text" size="26" name="nick_name" value="||tmp_nick_name||"/></td>
||ifnempty||tmp_old_nick_name||	<input type="hidden" name="old_nick_name" id="old_nick_name" value="||tmp_old_nick_name||"/>||endif||
	<td rowspan="6" class="head" align="center">
		Postal Address<br />
		<textarea name="abk_address" cols="30" rows="7">||tmp_abk_address||</textarea>
	</td>
</tr>
<tr>
	<td class="head" align="right">Full Name</td>
	<td><input type="text" size="26" name="abk_full_name" value="||tmp_abk_full_name||"/></td>
</tr>
<tr>
	<td nowrap class="head" align="right">EMail Address</td>
	<td><input type="text" size="26" name="abk_email" value="||tmp_abk_email||"/></td>
</tr>
<tr>
	<td class="head" align="right">Phone</td>
	<td><input type="text" size="26" name="abk_phone" value="||tmp_abk_phone||"/></td>
</tr>
<tr>
	<td class="head" align="right">Mobile</td>
	<td><input type="text" size="26" name="abk_mobile" value="||tmp_abk_mobile||"/></td>
</tr>
<tr>
	<td class="head" align="right">Fax</td>
	<td><input type="text" size="26" name="abk_fax" value="||tmp_abk_fax||"/></td>
</tr>
<tr>
	<td colspan="3" align="center"><input type="button" onclick="javascript:saveAddress();" ||ifempty||changing_address||value="Save entry"||else||value="Update entry"||endif||></td>
</tr>
</table>
</td></tr>
</form>

</table>
</center>

</body>
</html>
