﻿$(function () {

    //Galleries without overflow-y:hidden;
    $('.aColorbox').colorbox({ maxWidth: "90%", maxHeight: "90%", current: "Bild {current} von {total}" });

    // edit Gallerie
    $('.showEditPage').colorbox({ width: "860px", height: "90%", iframe: true, onLoad: HideScrollbar, onCleanup: ShowSaveButtonOverlay });

    // standard editPage Highslide
    $('.colorbox').colorbox({ width: "860px", height: "90%", iframe: true, onLoad: HideScrollbar, onCleanup: ShowScrollbar });

    // edit Design
    $('.colorboxDesign').click(function () {
        $.scrollTo(0, 0);
        $('#colorbox').css('position', 'fixed');
        $('.colorboxDesign').colorbox({ width: "860px", height: "90%", iframe: true, onLoad: HideScrollbar, onCleanup: ShowScrollbar });
    });

    function HideScrollbar() {
        $('html').css('overflow-y', 'hidden');
    }

    function ShowScrollbar() {
        $('#colorbox').css('position', 'absolute');
        $('html').css('overflow-y', 'scroll');
    }

    function ShowSaveButtonOverlay() {
        $('#lblButtonWrapper').css('pCustomSubmitButton', 'block');
        $('#lblUploadMessage').css('pCustomSubmitButton', 'none');
        $('html').css('overflow-y', 'scroll');
    }

});


//$(document).ready(function () {
//    GetRemainingWindowHeight()
//    $(window).resize(function () {
//        GetRemainingWindowHeight();
//    });
//});

//function GetRemainingWindowHeight() {
//    var windowheight = $(window).height();
//    var headerHeight = $('.pnlHeader').innerHeight();
//    var mainNavigationHeight = $('.pnlMainNavigation').innerHeight();
//    var paddingTop = parseInt($('.pnlContentWrapper').css('padding-top'));
//    var contentMinHeight = windowheight - (headerHeight + mainNavigationHeight + paddingTop + 35);
//    $('.pnlContentWrapper').css('min-height', contentMinHeight);
//}

