<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="fieldRight.aspx.cs" Inherits="view.flow.fieldRight" %>

<html><head>
  <meta http-equiv="X-UA-Compatible"content="IE=EmulateIE7"/>
  <meta http-equiv="Content-Type" content='text/html; charset=utf-8' />
  <title>workflow fields</title>
  <link href='../skin/view.css' type='text/css' rel='stylesheet'>
  <script language=javascript>document.write("<script type='text/javaScript' src='../common/view"+location.search.substring(location.search.indexOf("&lang=")+6)+".js'><\/script>");</script>
  <script type='text/javascript' src='../common/view.js'></script>
</head>

<body scroll=no>
<table cellspacing=10 cellpadding=0 border=0 style="font-size:13px;"><tr><td width=50%>
<fieldset><legend><script language=javaScript>document.write(translate['fieldEditableOfResponsor']);</script></legend>
<div style='height:350px;overflow:auto;' id=oFieldListOfResponsor runat=server></div></fieldset>
&nbsp;&nbsp;<input type=checkbox onclick='selectResponsorAllOrNone(this.checked);' /><script language=javaScript>document.write(translate['selectAllOrNone']);</script>
</td><td width=50%>
<fieldset><legend><script language=javaScript>document.write(translate['fieldEditableOfParticipants']);</script></legend>
<div style='height:350px;overflow:auto;' id=oFieldListOfParticipants runat=server></div></fieldset>
&nbsp;&nbsp;<input type=checkbox onclick='selectParticipantsAllOrNone(this.checked);' /><script language=javaScript>document.write(translate['selectAllOrNone']);</script>
</td></tr></table>
<script language=javaScript>
    workflowActionsShow('okCancel');
    var n = dialogArguments.value.indexOf("participantsX=");
    var sSourceResponsor = '';
    var sSourceParticipants = '';
    if (n < 0) {
        sSourceResponsor = ',' + dialogArguments.value + ',';
    }
    else {
        sSourceResponsor = ',' + dialogArguments.value.substr(0, n) + ',';
        sSourceParticipants = ',' + dialogArguments.value.substr(n + 14) + ',';
    }
    var ecResponsor = document.getElementById('oFieldListOfResponsor').getElementsByTagName('INPUT');
    var ecParticipants = document.getElementById('oFieldListOfParticipants').getElementsByTagName('INPUT');
    var e;
    for (var i = 0; i < ecResponsor.length; i++) {
        e = ecResponsor[i];
        if (sSourceResponsor.indexOf(',' + e.id + ',') > -1)
            e.checked = true;
    }
    for (var i = 0; i < ecParticipants.length; i++) {
        e = ecParticipants[i];
        if (sSourceParticipants.indexOf(',' + e.id + ',') > -1)
            e.checked = true;
    }
    function selectResponsorAllOrNone(bChecked) {
        for (var i = 0; i < ecResponsor.length; i++) {
            ecResponsor[i].checked = bChecked;
        }
    }
    function selectParticipantsAllOrNone(bChecked) {
        for (var i = 0; i < ecParticipants.length; i++) {
            ecParticipants[i].checked = bChecked;
        }
    }
    function onActionBefore(nActionId, sName, bPostForm) {
        if (nActionId > 0) {
            var s = '';
            for (var i = 0; i < ecResponsor.length; i++) {
                e = ecResponsor[i];
                if (e.checked)
                    s += e.id + ',';
            }
            s += "participantsX=";
            for (var i = 0; i < ecParticipants.length; i++) {
                e = ecParticipants[i];
                if (e.checked)
                    s += e.id + ',';
            }
            dialogArguments.value = s;
        }
        self.close();
        return 0; //prevent from submitting
    }
</script>
</body>
</html>