<%@ Page language="c#" Codebehind="SendFiles.aspx.cs" AutoEventWireup="false" Inherits="Mediachase.UI.Web.FileStorage.SendFiles" %>
<%@ Register TagPrefix="ibn" TagName="BlockHeader" src="..\Modules\BlockHeader.ascx" %>
<%@ register TagPrefix="lst" namespace="Mediachase.UI.Web.Modules" Assembly="Mediachase.UI.Web" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > 

<html>
 <head>
    <title>
			<%=LocRM.GetString("tSendObject") %>
    </title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name=vs_defaultClientScript content="JavaScript">
    <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
    <script src="../Scripts/browser.js"></script>
		<script src="../Scripts/buttons.js"></script>
		<LINK href="../layouts/styles/windows.css" type="text/css" rel="stylesheet">
		<link href="../Themes/<%=Mediachase.UI.Web.Util.CommonHelper.GetTheme()%>/theme.css" rel="stylesheet">
		<link href="../Themes/<%=Mediachase.UI.Web.Util.CommonHelper.GetTheme()%>/color1.css" rel="stylesheet">
		<LINK href='<%=Mediachase.UI.Web.Util.CommonHelper.GetAbsolutePath("/layouts/styles/mcCalendClient.css")%>' rel="stylesheet">
		<script><!--
		if ((browseris.mac) && !browseris.ie5up)
		{
			var macstyle = "../layouts/styles/mac.css";
			document.write("<link rel='stylesheet' Type='text/css' href='" + macstyle + "'>");
		}
	
		//--></script>		
		<script language="JavaScript"> 
			function disableEnterKey() 
			{ 
				try {
					if (window.event.keyCode == 13 && window.event.srcElement.type != "textarea")
						window.event.keyCode = 0;
				}
				catch (e) {}
			} 
			
			function SaveFields()	
			{
				var sControl=document.forms[0].<%=lstSelected.ClientID%>;
				var str="";
				if(sControl != null)
				{
					for(var i=0;i<sControl.options.length;i++)
					{
						str += sControl.options[i].value + ",";
					}
				}
				document.getElementById('<%=iFields.ClientID%>').value = str;
			}
			function CheckExistence(objTo,str)
			{
				for(var j=0;j<objTo.options.length;j++)
					if(objTo.options[j].text==str)
						return true;
				return false;
			}

			function AddOption(objTo,Option)
			{
				var oOption = document.createElement("OPTION");
				oOption.text = Option.text;
				oOption.value = Option.value;
				objTo.options[objTo.options.length] = oOption;
			}
			
			function RemoveFew(FromControl,ToControl)
			{
				if((FromControl!=null)&&(ToControl!=null))
				{
					for(var i=0;i<FromControl.options.length;i++)
						if((FromControl.options[i].selected) && (!CheckExistence(ToControl,FromControl.options[i].text)))
						{
							try 
							{
								var user_id = parseInt(FromControl.options[i].value);
								var str = document.forms[0].<%=iGroupFields.ClientID%>.value;
								var str1 = FromControl.options[i].value + ",";
								if(!isNaN(user_id) && str.indexOf(str1)>=0)
								{
									AddOption(ToControl,FromControl.options[i]);
								}
							}
							catch (e) {}
						}
					for(var i=0;i<FromControl.options.length;i++)
						if(FromControl.options[i].selected)
						{
							FromControl.options[i]=null;		
							i=i-1;		
						}
					SaveFields();
					return true;
				}
			}
			
			function MoveFew(FromControl,ToControl)
			{
				if((FromControl!=null)&&(ToControl!=null))
				{
					for(var i=0;i<FromControl.options.length;i++)
						if((FromControl.options[i].selected) && (!CheckExistence(ToControl,FromControl.options[i].text)))
								AddOption(ToControl,FromControl.options[i]);

					for(var i=0;i<FromControl.options.length;i++)
						if(FromControl.options[i].selected)
						{
							FromControl.options[i]=null;		
							i=i-1;		
						}
					FromControl.selectedIndex = -1;
					obj = document.forms[0].<%=txtMail.ClientID%>;
					var re = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/g;
					if(obj!=null && obj.value!="" && re.test(obj.value))
					{
						var oOption = document.createElement("OPTION");
						oOption.text = obj.value;
						oOption.value = obj.value;
						AddOption(ToControl, oOption);
						obj.value = "";
					}
					return true;
				}
			}
		</script>	
  </head>
  <body class="UserBackground" id="pT_body" leftMargin="0" topMargin="0" marginwidth="0" marginheight="0">
	  <form id="frmMain" method="post" runat="server" enctype="multipart/form-data">
		<ibn:blockheader id="secHeader" title="ToolBar" runat="server"></ibn:blockheader>
		<table class="text" style="HEIGHT: 100%" height="100%" cellSpacing="0" cellPadding="2" width="100%" border="0">
			<tr height="22">
				<td width="320px" height="22" style="padding-left:5px"><span class="boldtext"><%=LocRM.GetString("Available") %>:</span></td>
				<td width="4px"></td>
				<td class="boldtext"><%=LocRM.GetString("Selected") %>:</td>
			</tr>
			<tr style="HEIGHT: 100%">
				<td vAlign="top" width="320px">
					<!-- Groups & Users -->
					<table class="text" style="MARGIN-TOP: 5px" cellSpacing="0" cellPadding="3" width="100%">
						<tr>
							<td width="9%"><%=LocRM.GetString("Group") %>:</td>
							<td width="91%">
								<lst:indenteddropdownlist id="ddGroups" runat="server" CssClass="text" Width="200px" AutoPostBack="True" DataTextField="GroupName" DataValueField="GroupId"></lst:indenteddropdownlist>
							</td>
						</tr>
						<TR>
							<TD width="9%"><%=LocRM.GetString("Search") %>:</TD>
							<TD width="91%">
								<asp:TextBox id="tbSearch" runat="server" CssClass="text" Width="125px"></asp:TextBox>
								<asp:button id="btnSearch" runat="server" Width="80px" CssClass="text" CausesValidation="False"></asp:button>
							</TD>
						</TR>
						<tr>
							<td vAlign="top" height="96"><%=LocRM.GetString("Users") %>:</td>
							<td vAlign="top">
								<asp:listbox id="lbUsers" runat="server" CssClass="text" Width="200px" SelectionMode="Multiple" Rows="6"></asp:listbox>
							</td>
						</tr>
						<TR>
							<TD width="9%"><%=LocRM.GetString("eMail") %>:</TD>
							<TD width="91%">
								<asp:TextBox id="txtMail" runat="server" CssClass="text" Width="200px"></asp:TextBox>
								<asp:regularexpressionvalidator id="reMail" runat="server" ErrorMessage="*" ControlToValidate="txtMail" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="Dynamic"></asp:regularexpressionvalidator>
							</TD>
						</TR>
						<tr>
							<td vAlign="top" height="28">&nbsp;</td>
							<td>
								<button id="btnAdd" runat="server" Class="text" style="width:100px;"></button>
							</td>
						</tr>
					</table>
					<!-- End Groups & Users -->
				</td>
				<td width="4px"></td>
				<td vAlign="top" height="100%">
					<!-- Selected Users -->
					<table class="text" style="MARGIN-TOP: 5px" cellSpacing="0" cellPadding="3" width="100%">
						<tr>
							<td vAlign="top">
								<asp:listbox id="lstSelected" runat="server" CssClass="text" Width="200px" SelectionMode="Multiple" Rows="13"></asp:listbox>
							</td>
						</tr>
						<tr>
							<td>
								<button id="btnDel" runat="server" Class="text" style="width:100px;"></button>
							</td>
						</tr>
					</table>
					<!-- End Selected Users -->
				</td>
			</tr>
		</table>
		<asp:LinkButton id="btnSave" runat="server" Visible="False"></asp:LinkButton>
		<INPUT id="iFields" type="hidden" name="iFields" runat="server">
		<INPUT id="iGroupFields" type="hidden" name="iGroupFields" runat="server">
    </form>
	
  </body>
</html>