<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript">
<!--
function dele()
{
	var i = 0, j;
	for (j=0; j<1; j++)
  
	if (i==0)
		document.groupform.Group_List.value = "";
  
	document.groupform.tolist.options[0].selected = true;
}
function setto(sel)
{
	var option;
	var i;
	for (i=0; i<sel.options.length; i++) {
		if (sel.options[i].selected==true) {
			if (document.groupform.Group_List.value != "")
				document.groupform.Group_List.value = document.groupform.Group_List.value + "\n" ;

			document.groupform.Group_List.value = document.groupform.Group_List.value + sel.options[i].value ;
		}
	}   
	if (sel.options[0].selected==true) {
		dele();
	}
}
function addgr() 
{
	var Build_String = "";
	var last = 0;
	var index = -1;


	if (document.groupform.grnm.value.length > 0) {

		if (document.groupform.Group_List.value.length > 2) {
			index = document.groupform.Group_List.value.indexOf("\n",0);
			while (index >= 0) {
				Build_String += document.groupform.Group_List.value.substr(last,index-last-1) + ",";

				last = index + 1;
				index = document.groupform.Group_List.value.indexOf("\n",last);
			}

			Build_String += document.groupform.Group_List.value.substr(last, document.groupform.Group_List.value.length );

			if (opener.pickform.dist_list.value == "") {
				opener.pickform.dist_list.value = document.groupform.grnm.value + "=" + Build_String;
			}
			else if (opener.pickform.dist_list.value != "") {
				opener.pickform.dist_list.value = opener.pickform.dist_list.value + "\n" + document.groupform.grnm.value + "=" + Build_String;
			}

			dele();
			document.groupform.grnm.value = "";
			opener.pickform.cmd.value = "pick_save";
			opener.pickform.submit();
		}
		else
			alert("No Group Address Listed");
	}
	else
		alert("No Group Name");
}

function newwindow()
{
	msgWindow = open('||action||?process=addr_only&page=bookgroup&cmd=msg_new&utoken=||utoken||&attach_id=||attach_id||','ADDRESSBOOK','width=600,height=250,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes','POPUP');
	if (msgWindow.opener == null) msgWindow.opener = self;
        if (msgWindow.opener.sendform == null) msgWindow.opener.sendform = document.sendform;
	msgWindow.focus();
}

//-->
</script>

<title>Create new Group </title>
</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||

<center>
<form name="groupform" method="post" action="javascript:addgr();">
<input type="hidden" name="force_connection" value="true" />

<table border="0" cellspacing="0" cellpadding="0">
<tr>
	<td>
		<table>
		<tr>
			<td><b>Group Address List</b></td>
		</tr>
		<tr>
			<td><textarea rows="5" name="Group_List" cols="31"></textarea></td>
		</tr>
		<tr>
			<td><b>Group Name</b></td>
		</tr>
		<tr>
			<td><input name="grnm" size="30" value="" /></td>
		
		</tr>
		</table>
	</td>
	<td>
		<table>
		<tr>
			<td><input type="button" value="Clear" onclick="dele();" /></td>
			<td><a href="javascript:newwindow()"><img border="0" src="||nwimg||/addressbook.gif" alt="Use Address Book" /></a></td>
		</tr>
		<tr>
			<td colspan="2">
				<select name="tolist" size="8" onchange="setto(this)">
					<option>||picklist||</option> 
				</select>
			</td>
		</tr>
		</table>
	</td>
</tr>
<tr>
	<td><input type="button" name="Add" value="Add Group" onclick="addgr()" /></td>
</tr>
</table>
</form>
</center>

</body>
</html>