<!--
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 saveAddress(){
	if (document.addrbook.sms_alert && (old_sms_alert != document.addrbook.sms_alert.checked)){
		if(document.addrbook.sms_alert.checked && (document.addrbook.abk_email.value == "" || document.addrbook.nick_name.value == "")){
			alert(x_saddr);
			return;
		}
		document.addrbook.change_sms_state.value = document.addrbook.sms_alert.checked;
	}
	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 P(p){
	G2(p+"&force_connection=true&page=pick&encode_text=abook_edit&abook_edit="+document.addrbook.abook_edit.value);
}
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 = "pick_dist";
			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.process.value = "";
	document.addrbook.cmd.value = "pick_edit";
	document.addrbook.submit();
}
function prompt_user(){
	if (confirm(x_prompt_s+' "'+bk+'" '+x_prompt_e)){
		document.addrbook.cmd.value = "del_abook";
		document.addrbook.submit();
	}
	return;
}
function rename(){
	msgWindow = open(action + '?cmd=show&page=pick_rename&encode_text=abook_edit&abook_edit=' + document.addrbook.abook_edit.value + '&utoken=' + utoken + '&&','RENAMEADDR','top=20,left=20,width=400,height=100,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes','POPUP');
	if (msgWindow.opener == null) msgWindow.opener = self;
	msgWindow.focus();
}

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 do_copy_export(sel){
	var i;
	for (i=0; i<sel.options.length; i++){
		if (sel.options[i].selected==true){
			document.addrbook.abook_edit.value = sel.options[i].text;
			break;
		}
	}
	document.addrbook.cmd.value = "pick_edit";
	document.addrbook.submit();
}
function export_sel_all()
{
	for (var i=0;i<document.addrbook.elements.length;i++)
	{
		var e = document.addrbook.elements[i];
		e.checked = !e.checked;
	}
}
function export_file()
{
	document.addrbook.cmd.value = "addr_export";
	document.addrbook.submit();
}
//-->