﻿$(document).ready(function () {

    var winW = 630, winH = 460;
    if (document.body && document.body.offsetWidth) {
        winW = document.body.offsetWidth;
        winH = document.body.offsetHeight;
    }
    if (document.compatMode == 'CSS1Compat' && document.documentElement && document.documentElement.offsetWidth) {
        winW = document.documentElement.offsetWidth;
        winH = document.documentElement.offsetHeight;
    }
    if (window.innerWidth && window.innerHeight) {
        winW = window.innerWidth;
        winH = window.innerHeight;
    }

    function getDocHeight() {
        var D = document;
        return Math.max(
                    Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
                    Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
                    Math.max(D.body.clientHeight, D.documentElement.clientHeight)
                );
    }

    document.getElementById("left").style.height = getDocHeight() - 212 + "px";

});

$(function () {
    var galleries = $('.ad-gallery').adGallery();
    $('#switch-effect').change(
              function () {
                  galleries[0].settings.effect = $(this).val();
                  return false;
              }
            );
    $('#toggle-slideshow').click(
              function () {
                  galleries[0].slideshow.toggle();
                  return false;
              }
            );
    $('#toggle-description').click(
            function () {
                if (!galleries[0].settings.description_wrapper) {
                    galleries[0].settings.description_wrapper = $('#descriptions');
                } else {
                    galleries[0].settings.description_wrapper = false;
                }
                return false;
            }
            );
});
