    function setCheckboxes()
    {
        var numelements = document.selectorform.elements.length;
        var item0 = document.selectorform.elements[0];
        var item1;

        for (var i=1 ; i < numelements ; i++)
        {
            item1 = document.selectorform.elements[i];
            item1.checked = item0.checked;
        }
    }

    function selectUsers()
    {
        var openerForm = opener.document.forms[formName];
        var openerEl = openerForm.elements[elementName];

        var numelements = document.selectorform.elements.length;
        var item;
        var checkedList = "";

        var sep = "";
        for (var i = 0 ; i < numelements ; i++)
        {
            item = document.selectorform.elements[i];
            if (item != null && item.type == "checkbox" && item.name != "all" && item.checked == true)
            {
                checkedList  = checkedList + sep + item.value;
                sep = ", ";
            }
        }
        if (checkedList != ""){
            if (openerEl.value == "")
                openerEl.value = checkedList;
            else
                openerEl.value = openerEl.value + sep + checkedList;
        }

        window.close();
    }


    // Multi-Select - Shift Click
    var recordedCheckBoxIndex;

    function processCBClick(myEvent, myCheckBox)
    {
        if (myCheckBox.checked)
        {
            if (myEvent.shiftKey)
            {
                selectMultiple(myCheckBox);
            }
            else
            {
                recordCheckBox(myCheckBox);
                // setRowClass(findCheckBox(myCheckBox), true);
            }
        }
        else
        {
            recordedCheckBoxIndex = null;
            // setRowClass(findCheckBox(myCheckBox), false);
        }
    }

    function recordCheckBox(checkBoxToRecord)
    {
        recordedCheckBoxIndex = findCheckBox(checkBoxToRecord);
    }

    function selectMultiple(myCheckBox)
    {
        if (recordedCheckBoxIndex == null)
            return;

        var currentCheckBox = findCheckBox(myCheckBox);

        var lastSelected = selectNeededCheckBoxes(myCheckBox, Math.min(currentCheckBox,recordedCheckBoxIndex),
                                          Math.max(currentCheckBox,recordedCheckBoxIndex),
                                          true);

        recordedCheckBoxIndex = lastSelected;
    }


    function findCheckBox(myCheckBox)
    {
        for(var i = 0; i < myCheckBox.form.elements[myCheckBox.name].length; i++)
        {
            if (myCheckBox.form.elements[myCheckBox.name][i].value == myCheckBox.value)
            {
                return i;
            }
        }
    }

    function selectNeededCheckBoxes(myCheckBox, from, to, value)
    {
        var j;
        for (j = from; j <= to; j++)
        {
            myCheckBox.form.elements[myCheckBox.name][j].checked = value;
            //setRowClass(j, value);
        }

        return j;
    }

    function toggleCheckBox(event, checkboxId)
    {
        checkbox = document.getElementById(checkboxId);

        if (checkbox == null)
            checkbox = document.all[checkboxId];

        checkbox.checked = !checkbox.checked;
        processCBClick(event, checkbox);
        return false;
    }

    function moveToPage(start)
    {
        var form = document.forms['jiraform'];
        var startField = form.elements['start'];
        startField.value = start;
        form.submit();
    }

    function select(value)
    {
        var openerForm = opener.document.forms[formName];
        var openerEl = openerForm.elements[elementName];

        if (value != "undefined")
            openerEl.value = value;

        window.close();
    }

    function selectEntity()
    {
        var openerForm = opener.document.forms[formName];
        var openerEl = openerForm.elements[elementName];

        var numelements = document.selectorform.elements.length;

        var item;
        var checkedList = "";

        for (var i = 0 ; i < numelements ; i++)
        {
            item = document.selectorform.elements[i];
            if (item != null && item.checked == true && item.value != "undefined")
            {
                if (checkedList == "")
                {
                    checkedList = item.value;
                }

                if (checkedList != "")
                    break;
            }
        }

        if (checkedList != "")
            openerEl.value = checkedList;

        window.close();
    }

