﻿function RefreshPhotoView() {

}

function OnPhotoClick(id) {
    var e = window.event;
    var popupControlExtender = $find("LargePhotoViewPopup_" + id);

    ResetPopupControlExtender(popupControlExtender);

    if (e != null && e.ctrlKey) {
        PreventPopupControlExtenderFromFiring(popupControlExtender);
        SelectPhoto(id, e.srcElement);
    }
}

function ResetPopupControlExtender(popupControlExtender) {
    if (popupControlExtender != null) {
        popupControlExtender._popupVisible = false;
    }
}

function SelectPhoto(id, photoContainer) {
    if (id != null && photoContainer != null) {
        var photoRemovalHost = $get("sl_PhotoRemovalHost");

        if (photoRemovalHost != null) {
            if (photoContainer.getAttribute("class") == "photo_item" || photoContainer.getAttribute("className") == "photo_item") {
                photoContainer.setAttribute("class", "photo_item photo_item_selected");
                photoContainer.setAttribute("className", "photo_item photo_item_selected");
                photoRemovalHost.content.PhotoRemoval.AddPhotoToList(id);
            }
            else {
                photoContainer.setAttribute("class", "photo_item");
                photoContainer.setAttribute("className", "photo_item");
                photoRemovalHost.content.PhotoRemoval.RemovePhotoFromList(id);
            }
        }
    }
}

function PreventPopupControlExtenderFromFiring(popupControlExtender) {
    if (popupControlExtender != null) {
        popupControlExtender._popupVisible = true;
    }
}

