﻿    function SetHighlight(activerow,FromRow,MainCell)
    {
        for (var i=0; i < activerow.cells.length; i++)
        {
        if (i>=FromRow) {
                activerow.cells(i).style.background='#dfdfdf';
            }
            activerow.cells(i).style.cursor = 'hand'; 
            if (i==MainCell)
            {
                // activerow.cells(i).style.color='#FDFAF7';
            }
        }
    }
    
    function UndoHighlight(activerow,FromRow)
    {
        for (var i=FromRow; i < activerow.cells.length; i++)
        {
            activerow.cells(i).style.background='#FDFAF7';
            activerow.cells(i).style.cursor = 'auto'; 
        }
    }

    function SetHighlightIP(activerow,FromRow,MainCell)
    {
        for (var i=0; i < activerow.cells.length; i++)
        {
            if (i>=FromRow || i==0) {
                activerow.cells(i).style.background='#dfdfdf';
            }
            activerow.cells(i).style.cursor = 'hand'; 
            if (i==MainCell)
            {
                // activerow.cells(i).style.color='#FDFAF7';
            }
        }
        if (activerow.cells(1).innerText == '')
        {
            activerow.cells(1).style.background='#dfdfdf';
        }
    }
    
    function UndoHighlightIP(activerow,FromRow)
    {
        activerow.cells(0).style.background='#FDFAF7';
        activerow.cells(0).style.cursor = 'auto'; 
        for (var i=FromRow; i < activerow.cells.length; i++)
        {
            activerow.cells(i).style.background='#FDFAF7';
            activerow.cells(i).style.cursor = 'auto'; 
        }
        if (activerow.cells(1).innerText == '')
        {
            activerow.cells(1).style.background='#FDFAF7';
        }
    }
    
    function SetHighlightRPI(activerow,FromRow)
    {
        for (var i=0; i < activerow.cells.length; i++)
        {
        if (i>=FromRow) {
                activerow.cells(i).style.background='#dfdfdf';
            }
            activerow.cells(i).style.cursor = 'hand'; 
        }
    }
    
    function UndoHighlightRPI(activerow,FromRow)
    {
        for (var i=FromRow; i < activerow.cells.length; i++)
        {
            activerow.cells(i).style.background='#FDFAF7';
            activerow.cells(i).style.cursor = 'auto'; 
        }
    }
    
    function SetHighlightPers(activerow,FromRow,MainCell)
    {
        activerow.style.background = '#dfdfdf';
        activerow.style.cursor = 'hand';
        return;
/*
        for (var i=0; i < activerow.cells.length; i++)
        {
        if (i>=FromRow) {
                activerow.cells(i).style.background='#dfdfdf';
            }
            activerow.cells(i).style.cursor = 'hand'; 
            if (i==MainCell)
            {
               // activerow.cells(i).style.color='#ba151c';
            }
        }
*/
    }
    
    function UndoHighlightPers(activerow,FromRow,MainCell)
    {
        activerow.style.background = '#FDFAF7';
        activerow.style.cursor = 'auto';
        return;
/*
        for (var i=FromRow; i < activerow.cells.length; i++)
        {
            activerow.cells(i).style.background='#FDFAF7';
            activerow.cells(i).style.cursor = 'auto'; 
            if (i==MainCell)
            {
               // activerow.cells(i).style.color='#2c1965';
            }            
        }
*/
    }

    function SetHighlightLL(activerow,FromRow,MainCell)
    {
        for (var i=0; i < activerow.cells.length; i++)
        {
        if (i>=FromRow) {
                activerow.cells(i).style.background='#dfdfdf';
            }
            activerow.cells(i).style.cursor = 'hand'; 
            if (i==MainCell)
            {
               // activerow.cells(i).style.color='#ba151c';
            }
        }
    }
    
    function UndoHighlightLL(activerow,FromRow,MainCell)
    {
        for (var i=FromRow; i < activerow.cells.length; i++)
        {
            activerow.cells(i).style.background='#FDFAF7';
            activerow.cells(i).style.cursor = 'auto'; 
            if (i==MainCell)
            {
               // activerow.cells(i).style.color='#2c1965';
            }            
        }
    }

    function SetHighlightLLHist(activerow,FromRow,MainCell)
    {
        for (var i=0; i < activerow.cells.length; i++)
        {
        if (i>=FromRow) {
                activerow.cells(i).style.background='#dfdfdf';
            }
            activerow.cells(i).style.cursor = 'auto'; 
            if (i==MainCell)
            {
               // activerow.cells(i).style.color='#ba151c';
            }
        }
    }

    function dummy(elem) {

        //var prefix = elem.id.substr(0, elem.id.indexOf("_")) + "_"
        alert('ok ' + elem);

        //CheckInput(prefix + 'chkl', prefix + 'hidMaxValue', prefix + 'hidMinValue', prefix + 'lblError');
 
    }

    function CheckInput(chklId, MaxValueId, MinValueId, lblErrorId) {

    }
    function CheckInputOLD(chklId, MaxValueId, MinValueId, lblErrorId) {

        var Max = document.getElementById(MaxValueId).value;
        var Min = document.getElementById(MinValueId).value;

        var chkl = document.getElementById(chklId);
        var lblError = document.getElementById(lblErrorId);

        var cells = chkl.getElementsByTagName("td");
        var ctlr;
        var selectedCount = 0;
        
        for (var i = 0; i < cells.length; i++) {
            ctrl = cells[i].firstChild;

            if (ctrl.type == 'checkbox') {
                if (ctrl.checked) selectedCount++;
            }
        }
        showError(Min, Max, selectedCount, lblError);

    }

    function showError(Min, Max, selectedCount, lblError) {
        if (selectedCount > Max || selectedCount < Min) {

            var errorMessage = 'U moet';
            if (Min != -1)
                errorMessage += ' minimaal ' + Min;


            if (Min != -1 && Max != -1)
                errorMessage += ' en';

            if (Max != -1)
                errorMessage += ' maximaal ' + Max;

            errorMessage += ' selecties maken.';

            lblError.innerHTML = errorMessage;
        }
        else {
            lblError.innerHTML = '';
        }
    }

    /*function inputOK(val, args) {

        var prefix = val.id.replace("cvChkl", "")

        Max = document.getElementById(prefix + 'hidMaxValue').value;
        Min = document.getElementById(prefix + 'hidMinValue').value;
        lblError = document.getElementById(prefix + 'lblError');

        chkl = document.getElementById(prefix + 'chkl');

        var cells = chkl.getElementsByTagName("td");
        var ctlr;
        var selectedCount = 0;

        for (var i = 0; i < cells.length; i++) {
            ctrl = cells[i].firstChild;

            if (ctrl.type == 'checkbox') {
                if (ctrl.checked) selectedCount++;
            }
        }

        if (selectedCount > Max || selectedCount < Min) {
            showError(Min, Max, selectedCount, lblError);
            args.IsValid = false;
            document.getElementById('ctl08_lblError2o').innerText = 'Er zijn vragen niet goed ingevuld, controleer het profiel.';
        }
        else {
            args.IsValid = true;
        }
    }   */