﻿// JScript File
var SLarray = new Array();

// create silverlight slideshow
function SL(width, height, slidesSource, slideStartIndex, autoPlay, theme)
{
    if (width == null)
        width = '300';
    if (height == null)
        height = '300';
    if (slidesSource == null)
        slidesSource = 'images.xml';
    if (slideStartIndex == null)
        slideStartIndex = -1;
    if (autoPlay == null)
        autoPlay = true;

    // default colors and opacity
    var contentBackground = 'Black';
    var contentBackgroundFullscreen = 'Black';
    
    var captionBackgroundTop = 'Gray';
    var captionBackgroundBottom = 'Gray';
    var captionOpacity = .4;

    var controlBackgroundTop = 'Gray';
    var controlBackgroundBottom = 'Gray';
    var controlOpacity = .4;

    var sideControlBackgroundOuter = 'Silver';
    var sideControlBackgroundInner = 'Transparent';
    var sideControlOpacity = .3;

    var sideControlBackgroundTriangleOuter = 'Silver';
    var sideControlBackgroundTriangleInner = 'Silver';
    var sideControlTriangleOpacity = .7;

    // colors from css
    var redDark = '#DD0000';
    var redLight = '#330000';

    var greyDark = '#888888';
    var greyLight = '#000000';

    var greenDark = '#00B000';
    var greenLight = '#003300';

    var blueDark = '#5F89D8';
    var blueLight = '#011D50';

    var goldDark = '#B0B000';
    var goldLight = '#666600';

    function changeColor(darkColor, lightColor)
    {
        //contentBackground = darkColor;
        //contentBackgroundFullscreen = darkColor;
        
        captionBackgroundTop = darkColor;
        captionBackgroundBottom = lightColor;
        captionOpacity = .5;

        controlBackgroundTop = lightColor;
        controlBackgroundBottom = darkColor;
        controlOpacity = .5;

        sideControlBackgroundOuter = darkColor;
        sideControlBackgroundInner = lightColor;
        sideControlOpacity = .2;

        sideControlBackgroundTriangleOuter = lightColor;
        sideControlBackgroundTriangleInner = darkColor;
        sideControlTriangleOpacity = .2;
    }



    // pokud poslu udaje o theme, tak podle toho nastavim i barvy ve slideshow
    // barvy jsou prebrany c slbox.css
    if (theme != null)
    {
        if (theme.toLowerCase() == 'red')
        {
            changeColor(redDark, redLight);
        }
        else if (theme.toLowerCase() == 'green')
        {
            changeColor(greenDark, greenLight);
        }
        else if (theme.toLowerCase() == 'blue')
        {
            changeColor(blueDark, blueLight);
        }
        else if (theme.toLowerCase() == 'grey')
        {
            changeColor(greyDark, greyLight);
        }
        else if (theme.toLowerCase() == 'gold')
        {
            changeColor(goldDark, goldLight);
        }
    }

    createSlideshow('lbSlideShowContainer', {
    //createSlideshow('xxx', {
        width: width,
        height: height,
        slidesSource: '#' + slidesSource,
        background: '#202020',
        pageBackground: '#00FFFFFF',
        contentBackground: 'Black',
        contentBackgroundFullscreen: 'Black',
        captionBackgroundTop: 'Gray',
        captionBackgroundBottom: 'Gray',
        captionForeground: 'White',
        captionFontFamily: 'Verdana',
        captionFontSize: 11,
        captionFontStyle: 'Normal',
        captionFontWeight: 'Bold',
        captionOpacity: .4,
        captionAutoHide: false,
        animateCaptionByOpacity: true,
        controlBackgroundTop: 'Gray',
        controlBackgroundBottom: 'Gray',
        controlOpacity: .4,
        controlAutoHide: true,
        trackerForeground: 'White',
        trackerFontFamily: 'Verdana',
        trackerFontSize: 11,
        trackerFontStyle: 'Normal',
        trackerFontWeight: 'Normal',
        thumbnailWidth: 50,
        thumbnailHeight: 50,
        thumbnailRadiusX: 4,
        thumbnailRadiusY: 4,
        selectedThumbnailBorderColor: 'White',
        buttonBackground: 'Black',
        buttonForeground: 'White',
        buttonBorderColor: 'White',
        buttonPlayForeground: 'LightGreen',
        sideControlBackgroundOuter: 'Silver',
        sideControlBackgroundInner: 'Transparent',
        sideControlBackgroundTriangleOuter: 'Silver',
        sideControlBackgroundTriangleInner: 'Silver',
        sideControlOpacity: .3,
        sideControlTriangleOpacity: .7,
        borderRadius: 0,
        padding: 0,
        captionVisible: true,
        thumbnailsVisible: true,
        trackerVisible: true,
        buttonOptions: BUTTON_PLAYPAUSE | BUTTON_PREVNEXT | BUTTON_PREVNEXTPAGE | BUTTON_FULLSCREEN | BUTTON_SAVE,
        autoPlay: autoPlay,
        slideStartIndex: slideStartIndex,
        slideSettings: {
            speedRatio: 1,
            theme: THEME_NONE,
            borderVisible: false,
            borderColor: 'White',
            borderWidth: 4,
            borderRadius: 4,
            animationBegin: ANIMATION_FADE
        }
    });

}


