﻿
function checkAll(isCheck, idsList)
{
    for (var i = 0; i < idsList.length; i++)
    {
        $("#" + idsList[i]).attr("checked", isCheck);
    }
}

function setListBox(isCheck, listBoxId)
{
    if (isCheck)
        $("#" + listBoxId + " option").attr("selected", "selected");
    else
        $("#" + listBoxId + " option").removeAttr("selected", "selected");
}

function openWindow(url, width, height, name)
{
    window.open(url, 'win' + name, 'width=' + width + ',height=' + height + ',location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0,addressbar=0');
}

function closeWindow()
{
    if (confirm("האם אתה בטוח שאתה רוצה לסגור את החלון?"))
        window.close();
}

function validateManufacture(sender, args)
{
    args.IsValid = args.Value != "הקלד שם מוסד";
}

function validateName(sender, args)
{
    args.IsValid = args.Value != "הקלד שם ושם משפחה";
}

function validateInterest(sender, args)
{
    args.IsValid = args.Value != "הקלד תחום עניין";
}


//Script para incluir en el ComboBox1 cada item chekeado del chkListMateriales
function CheckItem(checkBoxList, comboId, hiddenId)
{
    var options = checkBoxList.getElementsByTagName('input');
    var arrayOfCheckBoxLabels = checkBoxList.getElementsByTagName("label");
    var s = "";

    for (i = 0; i < options.length; i++)
    {
        var opt = options[i];
        if (opt.checked)
        {
            s = s + ", " + arrayOfCheckBoxLabels[i].innerText;
        }
    }
    if (s.length > 0)
    {
        s = s.substring(2, s.length); //sacar la primer 'coma'
    }
    var TxtBox = document.getElementById(comboId);
    TxtBox.value = s;
    document.getElementById(hiddenId).value = s;
}

function validateRules() {
    var chkRules = document.getElementById("chkRules");

    if (!chkRules.checked) {
        alert("חובה להסכים לתנאי השימוש באתר");
        return false;
    }
    else {
        return true;
    }
}
