﻿var Pola_Web_CustomControls_DecoratedCheckBox_Images = new Array();

function DecoratedCheckBoxList_OnImageClick(sender, itemIndex, listClientId) {
    var imageSuffix = Pola_Web_CustomControls_DecoratedCheckBox_ImageSuffix;
    var itemIdPrefix = listClientId + Pola_Web_CustomControls_DecoratedCheckBox_ClientIdSeparator;

    var elmCheckBox = document.getElementById(itemIdPrefix + itemIndex);

    elmCheckBox.checked = !elmCheckBox.checked;

    if (elmCheckBox.checked == false)
        if (elmCheckBox.disabled == false)
            sender.src = Pola_Web_CustomControls_DecoratedCheckBox_Images[listClientId + '_Unchecked'];
        else
            sender.src = Pola_Web_CustomControls_DecoratedCheckBox_Images[listClientId + '_UncheckedDisabled'];
    else
        if (elmCheckBox.disabled == false)
            sender.src = Pola_Web_CustomControls_DecoratedCheckBox_Images[listClientId + '_Checked'];
        else
            sender.src = Pola_Web_CustomControls_DecoratedCheckBox_Images[listClientId + '_CheckedDisabled'];

    if (elmCheckBox.onclick != null)
        elmCheckBox.onclick();
}

function DecoratedCheckBox_OnImageClick(sender, checkBoxClientId, checkedImageSrc, unCheckedImageSrc) {
    var elmCheckBox = document.getElementById(checkBoxClientId);
    if (elmCheckBox != null) {
        elmCheckBox.checked = !elmCheckBox.checked;
        sender.src = elmCheckBox.checked ? checkedImageSrc : unCheckedImageSrc
    }

}