﻿function IS_SlideShow() {
    //properties
    this.animation = new IS_SlideShow_Animation()
    this.autoplay = new IS_SlideShow_Autoplay();
    this.caption = new IS_SlideShow_Caption();
    this.controlsBox = new IS_SlideShow_ControlsBox();
    this.imageOptions = new IS_SlideShow_ImageOptions();
    this.images = new Array();
    this.resizeImages = false; // true;false
    this.resizeOptions = new IS_SlideShow_ResizeOptions();
    this.slideShowApplyedCSSRules = new IS_SlideShow_ApplyedCSSRules();
    this.slideshowComputedStyle = new IS_SlideShow_ComputedStyle();
    this.slideshowCssPrefix = '';
    this.slideshowHeight = 0;
    this.slideshowID = '';
    this.slideshowWidth = 0;
    this.thumbnails = new IS_SlideShow_Thumbnails();

    //slideshow's system properties
    this.imageControls = new IS_SlideShow_ImageControls()
    this.loadingMessageControlID = '';
    this.previousImageIndex = 0;
    this.slideShowMainContainerID = '';
    this.shownImageIndex = 0;

    //Initialization methods
    //initializeSlideShow
    this.InitializeSlideShow = function () {
        var ISSlideShow = this;

        this.InitializeApplyedCSSRules();

        this.InitializeComputedStyle();

        this.InitializeControls()
        
        var slideshowImageContainer = document.getElementById(this.imageControls.imageContainerID);
        var loadingMessageContainer = document.getElementById(this.loadingMessageControlID);

        if (this.resizeOptions.resize)
        {
            var slideshowMainContainer = document.getElementById(this.slideShowMainContainerID);
            var parentElement = slideshowMainContainer.parentNode;
            $telerik.$(window).resize(function() { ISSlideShow.Resize() });
        }

        slideshowImageContainer.style.display = 'none';
        slideshowImageContainer.style.visibility = '';

        $telerik.$(slideshowImageContainer).fadeIn(1000, function () { if (ISSlideShow.autoplay.autoplay) { ISSlideShow.Play() } });

        if (this.caption.displayCaption) {
            var slideshowCaptionContainer = document.getElementById(this.caption.captionContainerID);

            slideshowCaptionContainer.style.display = 'none';
            slideshowCaptionContainer.style.visibility = '';

            $telerik.$(slideshowCaptionContainer).fadeIn(1000);
        }

        if (this.thumbnails.displayThumbnails) {
            var thumbnailsContainer = document.getElementById(this.thumbnails.thumbnailsContainerID);

            thumbnailsContainer.style.display = 'none';
            thumbnailsContainer.style.visibility = '';

            $telerik.$(thumbnailsContainer).fadeIn(1000);
        }

        if (this.controlsBox.controlsBoxContainerID != '') {
            var controlsBox = document.getElementById(this.controlsBox.controlsBoxContainerID);

            $telerik.$(controlsBox).css('opacity', '0');
            controlsBox.style.display = 'none';
            controlsBox.style.visibility = '';
            //$telerik.$(controlsBox).fadeIn(1000);
        }

        $telerik.$(loadingMessageContainer).fadeOut(1000);
    }

    //Start: Init Applyed CSS Rules
    this.InitializeApplyedCSSRules = function () {
        for (CSSStyleSheetIndex = 0; CSSStyleSheetIndex <= document.styleSheets.length - 1; CSSStyleSheetIndex++) {
            var LoopCSSStyleSheet = document.styleSheets[CSSStyleSheetIndex];
            if ((LoopCSSStyleSheet != null) && (LoopCSSStyleSheet.href != null) && (LoopCSSStyleSheet.href.indexOf('IS_SlideShow') != -1)) {
                for (CSSRuleIndex = 0; CSSRuleIndex <= LoopCSSStyleSheet.cssRules.length - 1; CSSRuleIndex++) {
                    var LoopCSSRule = LoopCSSStyleSheet.cssRules[CSSRuleIndex];
                    if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_maincontainer') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_MainContainer = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_imagescontainer') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_ImagesContainer = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_captioncontainer') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_CaptionContainer = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_caption') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_Caption = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_thumbnailscontainer') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsContainer = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_thumbnailslist') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsList = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_thumbnailslistitem') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsListItem = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_thumbnailslistitem_hover') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsListItem_Hover = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_controlsbox') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_controlsbox_buttonslist') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox_ButtonsList = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_controlsbox_firstimagebutton') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox_FirstImageButton = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_controlsbox_previousimagebutton') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox_PreviousImageButton = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_controlsbox_playpauseimagebutton') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox_PlayPauseImageButton = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_controlsbox_nextimagebutton') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox_NextImageButton = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'is_slideshow_controlsbox_lastimagebutton') {
                        this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox_LastImageButton = LoopCSSRule;
                    }
                    else if (LoopCSSRule.selectorText.toLowerCase() == '.' + this.slideshowCssPrefix.toLowerCase() + 'slideshow_loadingmessage') {
                        this.slideShowApplyedCSSRules.SlideShow_LoadingMessage = LoopCSSRule;
                    }
                }
            }
        }
    }
    //End: Init Applyed CSS Rules

    // Start: Computed Styles Initialization
    //InitializeComputedStyle
    this.InitializeComputedStyle = function () {
        if (this.resizeOptions.resize)
        {
            this.InitializeResizeComputedStyle();
        }

        this.InitializeMainContainerComputedStyle();

        // initialize computed styles for the rest of the controls
        if (this.thumbnails.displayThumbnails) {
            this.InitializeThumbnailsComputedStyle();
        }

        this.InitializeImageComputedStyle();

        if (this.caption.displayCaption) {
            this.InitializeCaptionComputedStyle();
        }

        if (this.controlsBox.controlsBoxContainerID != '') {
            this.InitializeControlsBoxComputedStyle();
        }
    }

    // InitializeResizeComputedStyle
    this.InitializeResizeComputedStyle = function()
    {
        var slideshowMainContainer = document.getElementById(this.slideShowMainContainerID);
        var parentElement = slideshowMainContainer.parentNode;

        // reading computed styles
        var parentElementComputedStyle = getComputedStyle(parentElement);

        // width & heigh
        var parentElementWidth = IS_SlideShow_RemoveCssUnits(parentElementComputedStyle.width);
        if ((parentElementWidth != '') && (!isNaN(parentElementWidth))) {
            this.slideshowComputedStyle.resizeComputedStyle.resizeWidth = parseInt(parentElementWidth);
        }

        var parentElementHeight = IS_SlideShow_RemoveCssUnits(parentElementComputedStyle.height);
        if ((parentElementHeight != '') && (!isNaN(parentElementHeight))) {
            this.slideshowComputedStyle.resizeComputedStyle.resizeHeight = parseInt(parentElementHeight);
        }

        // margin
        var parentElementMarginLeft = IS_SlideShow_RemoveCssUnits(parentElementComputedStyle.marginLeft);
        if ((parentElementMarginLeft != '') && (!isNaN(parentElementMarginLeft))) {
            this.slideshowComputedStyle.resizeComputedStyle.resizeMarginLeft = parseInt(parentElementMarginLeft);
        }

        var parentElementMarginRight = IS_SlideShow_RemoveCssUnits(parentElementComputedStyle.marginRight);
        if ((parentElementMarginRight != '') && (!isNaN(parentElementMarginRight))) {
            this.slideshowComputedStyle.resizeComputedStyle.resizeBorderRight = parseInt(parentElementMarginRight);
        }

        var parentElementMarginTop = IS_SlideShow_RemoveCssUnits(parentElementComputedStyle.marginTop);
        if ((parentElementMarginTop != '') && (!isNaN(parentElementMarginTop))) {
            this.slideshowComputedStyle.resizeComputedStyle.resizeMarginTop = parseInt(parentElementMarginTop);
        }

        var parentElementMarginBottom = IS_SlideShow_RemoveCssUnits(parentElementComputedStyle.marginBottom);
        if ((parentElementMarginBottom != '') && (!isNaN(parentElementMarginBottom))) {
            this.slideshowComputedStyle.resizeComputedStyle.resizeMarginBottom = parseInt(parentElementMarginBottom);
        }

        // padding
        var parentElementPaddingLeft = IS_SlideShow_RemoveCssUnits(parentElementComputedStyle.paddingLeft);
        if ((parentElementPaddingLeft != '') && (!isNaN(parentElementPaddingLeft))) {
            this.slideshowComputedStyle.resizeComputedStyle.resizePaddingLeft = parseInt(parentElementPaddingLeft);
        }

        var parentElementPaddingRight = IS_SlideShow_RemoveCssUnits(parentElementComputedStyle.paddingRight);
        if ((parentElementPaddingRight != '') && (!isNaN(parentElementPaddingRight))) {
            this.slideshowComputedStyle.resizeComputedStyle.resizePaddingRight = parseInt(parentElementPaddingRight);
        }

        var parentElementPaddingTop = IS_SlideShow_RemoveCssUnits(parentElementComputedStyle.paddingTop);
        if ((parentElementPaddingTop != '') && (!isNaN(parentElementPaddingTop))) {
            this.slideshowComputedStyle.resizeComputedStyle.resizePaddingTop = parseInt(parentElementPaddingTop);
        }

        var parentElementPaddingBottom = IS_SlideShow_RemoveCssUnits(parentElementComputedStyle.paddingBottom);
        if ((parentElementPaddingBottom != '') && (!isNaN(parentElementPaddingBottom))) {
            this.slideshowComputedStyle.resizeComputedStyle.resizePaddingBottom = parseInt(parentElementPaddingBottom);
        }

        // border
        var parentElementBorderLeft = IS_SlideShow_RemoveCssUnits(parentElementComputedStyle.borderLeftWidth);
        if ((parentElementBorderLeft != '') && (!isNaN(parentElementBorderLeft))) {
            this.slideshowComputedStyle.resizeComputedStyle.resizeBorderLeft = parseInt(parentElementBorderLeft);
        }

        var parentElementBorderRight = IS_SlideShow_RemoveCssUnits(parentElementComputedStyle.borderRightWidth);
        if ((parentElementBorderRight != '') && (!isNaN(parentElementBorderRight))) {
            this.slideshowComputedStyle.resizeComputedStyle.resizeBorderRight = parseInt(parentElementBorderRight);
        }

        var parentElementBorderTop = IS_SlideShow_RemoveCssUnits(parentElementComputedStyle.borderTopWidth);
        if ((parentElementBorderTop != '') && (!isNaN(parentElementBorderTop))) {
            this.slideshowComputedStyle.resizeComputedStyle.resizeBorderTop = parseInt(parentElementBorderTop);
        }

        var parentElementBorderBottom = IS_SlideShow_RemoveCssUnits(parentElementComputedStyle.borderBottomWidth);
        if ((parentElementBorderBottom != '') && (!isNaN(parentElementBorderBottom))) {
            this.slideshowComputedStyle.resizeComputedStyle.resizeBorderBottom = parseInt(parentElementBorderBottom);
        }
    }

    // InitializeMainContainerComputedStyle
    this.InitializeMainContainerComputedStyle = function()
    {
        var slideshowMainContainer = document.getElementById(this.slideShowMainContainerID);

        this.slideshowComputedStyle.slideshowWidth = this.slideshowWidth;
        this.slideshowComputedStyle.slideshowHeight = this.slideshowHeight;

        // reading applyed css rules
        if (this.slideShowApplyedCSSRules.IS_SlideShow_MainContainer != null) {
            // width & height
            var MainContainerWidth = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_MainContainer.style.width);
            if ((MainContainerWidth != '') && (!isNaN(MainContainerWidth))) {
                this.slideshowComputedStyle.slideshowWidth = parseInt(MainContainerWidth);
            }

            var MainContainerHeight = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_MainContainer.style.height);
            if ((MainContainerHeight != '') && (!isNaN(MainContainerHeight))) {
                this.slideshowComputedStyle.slideshowHeight = parseInt(MainContainerHeight);
            }
        }

        // reading computed styles
        var slideShowMainContainerComputedStyle = getComputedStyle(slideshowMainContainer);

        // margin
        var MainContainerMarginLeft = IS_SlideShow_RemoveCssUnits(slideShowMainContainerComputedStyle.marginLeft);
        if ((MainContainerMarginLeft != '') && (!isNaN(MainContainerMarginLeft))) {
            this.slideshowComputedStyle.slideshowMarginLeft = parseInt(MainContainerMarginLeft);
        }

        var MainContainerMarginRight = IS_SlideShow_RemoveCssUnits(slideShowMainContainerComputedStyle.marginRight);
        if ((MainContainerMarginRight != '') && (!isNaN(MainContainerMarginRight))) {
            this.slideshowComputedStyle.slideshowMarginRight = parseInt(MainContainerMarginRight);
        }

        var MainContainerMarginTop = IS_SlideShow_RemoveCssUnits(slideShowMainContainerComputedStyle.marginTop);
        if ((MainContainerMarginTop != '') && (!isNaN(MainContainerMarginTop))) {
            this.slideshowComputedStyle.slideshowMarginTop = parseInt(MainContainerMarginTop);
        }

        var MainContainerMarginBottom = IS_SlideShow_RemoveCssUnits(slideShowMainContainerComputedStyle.marginBottom);
        if ((MainContainerMarginBottom != '') && (!isNaN(MainContainerMarginBottom))) {
            this.slideshowComputedStyle.slideshowMarginBottom = parseInt(MainContainerMarginBottom);
        }

        // padding
        var MainContainerPaddingLeft = IS_SlideShow_RemoveCssUnits(slideShowMainContainerComputedStyle.paddingLeft);
        if ((MainContainerPaddingLeft != '') && (!isNaN(MainContainerPaddingLeft))) {
            this.slideshowComputedStyle.slideshowPaddingLeft = parseInt(MainContainerPaddingLeft);
        }

        var MainContainerPaddingRight = IS_SlideShow_RemoveCssUnits(slideShowMainContainerComputedStyle.paddingRight);
        if ((MainContainerPaddingRight != '') && (!isNaN(MainContainerPaddingRight))) {
            this.slideshowComputedStyle.slideshowPaddingRight = parseInt(MainContainerPaddingRight);
        }

        var MainContainerPaddingTop = IS_SlideShow_RemoveCssUnits(slideShowMainContainerComputedStyle.paddingTop);
        if ((MainContainerPaddingTop != '') && (!isNaN(MainContainerPaddingTop))) {
            this.slideshowComputedStyle.slideshowPaddingTop = parseInt(MainContainerPaddingTop);
        }

        var MainContainerPaddingBottom = IS_SlideShow_RemoveCssUnits(slideShowMainContainerComputedStyle.paddingBottom);
        if ((MainContainerPaddingBottom != '') && (!isNaN(MainContainerPaddingBottom))) {
            this.slideshowComputedStyle.slideshowPaddingBottom = parseInt(MainContainerPaddingBottom);
        }

        // border
        var MainContainerBorderLeft = IS_SlideShow_RemoveCssUnits(slideShowMainContainerComputedStyle.borderLeftWidth);
        if ((MainContainerBorderLeft != '') && (!isNaN(MainContainerBorderLeft))) {
            this.slideshowComputedStyle.slideshowBorderLeft = parseInt(MainContainerBorderLeft);
        }

        var MainContainerBorderRight = IS_SlideShow_RemoveCssUnits(slideShowMainContainerComputedStyle.borderRightWidth);
        if ((MainContainerBorderRight != '') && (!isNaN(MainContainerBorderRight))) {
            this.slideshowComputedStyle.slideshowBorderRight= parseInt(MainContainerBorderRight);
        }

        var MainContainerBorderTop = IS_SlideShow_RemoveCssUnits(slideShowMainContainerComputedStyle.borderTopWidth);
        if ((MainContainerBorderTop != '') && (!isNaN(MainContainerBorderTop))) {
            this.slideshowComputedStyle.slideshowBorderTop = parseInt(MainContainerBorderTop);
        }

        var MainContainerBorderBottom = IS_SlideShow_RemoveCssUnits(slideShowMainContainerComputedStyle.borderBottomWidth);
        if ((MainContainerBorderBottom != '') && (!isNaN(MainContainerBorderBottom))) {
            this.slideshowComputedStyle.slideshowBorderBottom = parseInt(MainContainerBorderBottom);
        }

        // computing dimensions
        if (this.resizeOptions.resize)
        {
            this.slideshowComputedStyle.slideshowWidth = this.slideshowComputedStyle.resizeComputedStyle.resizeWidth
                                                         - this.slideshowComputedStyle.slideshowMarginLeft
                                                         - this.slideshowComputedStyle.slideshowMarginRight
                                                         - this.slideshowComputedStyle.slideshowBorderLeft
                                                         - this.slideshowComputedStyle.slideshowBorderRight
                                                         - this.slideshowComputedStyle.slideshowPaddingLeft
                                                         - this.slideshowComputedStyle.slideshowPaddingRight;

            this.slideshowComputedStyle.slideshowHeight = this.slideshowComputedStyle.resizeComputedStyle.resizeHeight
                                                          - this.slideshowComputedStyle.slideshowMarginTop
                                                          - this.slideshowComputedStyle.slideshowMarginBottom
                                                          - this.slideshowComputedStyle.slideshowBorderTop
                                                          - this.slideshowComputedStyle.slideshowBorderBottom
                                                          - this.slideshowComputedStyle.slideshowPaddingTop
                                                          - this.slideshowComputedStyle.slideshowPaddingBottom;
        }
    }

    // InitializeThumbnailsComputedStyle
    this.InitializeThumbnailsComputedStyle = function () {
        var thumbnailsContainer = document.getElementById(this.thumbnails.thumbnailsContainerID);

        // reading assigned styles
        if (this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsContainer != null) {
            // width & height
            var ThumbnailsContainerWidth = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsContainer.style.width);
            if ((ThumbnailsContainerWidth != '') && (!isNaN(ThumbnailsContainerWidth))) {
                this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsWidth = parseInt(ThumbnailsContainerWidth);
            }

            var ThumbnailsContainerHeight = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsContainer.style.height);
            if ((ThumbnailsContainerHeight != '') && (!isNaN(ThumbnailsContainerHeight))) {
                this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsHeight = parseInt(ThumbnailsContainerHeight);
            }

            // top & left
            var ThumbnailsContainerTop = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsContainer.style.top);
            if ((ThumbnailsContainerTop != '') && (!isNaN(ThumbnailsContainerTop))) {
                this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsTop = parseInt(ThumbnailsContainerTop);
            }

            var ThumbnailsContainerLeft = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsContainer.style.left);
            if ((ThumbnailsContainerLeft != '') && (!isNaN(ThumbnailsContainerLeft))) {
                this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsLeft = parseInt(ThumbnailsContainerLeft);
            }
        }

        // reading computed styles
        var thumbnailsContainerComputedStyle = getComputedStyle(thumbnailsContainer);

        var ThumbnailsContainerPaddingLeft = IS_SlideShow_RemoveCssUnits(thumbnailsContainerComputedStyle.paddingLeft);
        if ((ThumbnailsContainerPaddingLeft != '') && (!isNaN(ThumbnailsContainerPaddingLeft))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsPaddingLeft = parseInt(ThumbnailsContainerPaddingLeft);
        }

        var ThumbnailsContainerPaddingRight = IS_SlideShow_RemoveCssUnits(thumbnailsContainerComputedStyle.paddingRight);
        if ((ThumbnailsContainerPaddingRight != '') && (!isNaN(ThumbnailsContainerPaddingRight))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsPaddingRight = parseInt(ThumbnailsContainerPaddingRight);
        }

        var ThumbnailsContainerPaddingTop = IS_SlideShow_RemoveCssUnits(thumbnailsContainerComputedStyle.paddingTop);
        if ((ThumbnailsContainerPaddingTop != '') && (!isNaN(ThumbnailsContainerPaddingTop))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsPaddingTop = parseInt(ThumbnailsContainerPaddingTop);
        }

        var ThumbnailsContainerPaddingBottom = IS_SlideShow_RemoveCssUnits(thumbnailsContainerComputedStyle.paddingBottom);
        if ((ThumbnailsContainerPaddingBottom != '') && (!isNaN(ThumbnailsContainerPaddingBottom))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsPaddingBottom = parseInt(ThumbnailsContainerPaddingBottom);
        }

        // border
        var ThumbnailsContainerBorderLeft = IS_SlideShow_RemoveCssUnits(thumbnailsContainerComputedStyle.borderLeftWidth);
        if ((ThumbnailsContainerBorderLeft != '') && (!isNaN(ThumbnailsContainerBorderLeft))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsBorderLeft = parseInt(ThumbnailsContainerBorderLeft);
        }

        var ThumbnailsContainerBorderRight = IS_SlideShow_RemoveCssUnits(thumbnailsContainerComputedStyle.borderRightWidth);
        if ((ThumbnailsContainerBorderRight != '') && (!isNaN(ThumbnailsContainerBorderRight))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsBorderRight = parseInt(ThumbnailsContainerBorderRight);
        }

        var ThumbnailsContainerBorderTop = IS_SlideShow_RemoveCssUnits(thumbnailsContainerComputedStyle.borderTopWidth);
        if ((ThumbnailsContainerBorderTop != '') && (!isNaN(ThumbnailsContainerBorderTop))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsBorderTop = parseInt(ThumbnailsContainerBorderTop);
        }

        var ThumbnailsContainerBorderBottom = IS_SlideShow_RemoveCssUnits(thumbnailsContainerComputedStyle.borderBottomWidth);
        if ((ThumbnailsContainerBorderBottom != '') && (!isNaN(ThumbnailsContainerBorderBottom))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsBorderBottom = parseInt(ThumbnailsContainerBorderBottom);
        }

        this.InitializeThumbnailsListControlComputedStyle();

        // computing dimensions
        if (this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsHeight <= 0) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsHeight = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlHeight;
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsHeight += this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlMarginTop
                                                                                    + this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlMarginBottom
                                                                                    + this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlBorderTop
                                                                                    + this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlBorderBottom
                                                                                    + this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlPaddingTop
                                                                                    + this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlPaddingBottom;
        }

        if (this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsWidth <= 0) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsWidth = this.slideshowComputedStyle.slideshowWidth;
        }
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsWidth -= (this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsBorderLeft
                                                                               + this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsBorderRight
                                                                               + this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsPaddingLeft
                                                                               + this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsPaddingRight);

        if (this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsTop == null) {
            if (this.thumbnails.thumbnailsPosition == 'bottom') {
                this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsTop = this.slideshowComputedStyle.slideshowHeight - this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsHeight + this.slideshowComputedStyle.slideshowPaddingTop + 1;
            }
            else {
                this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsTop = this.slideshowComputedStyle.slideshowPaddingTop;
            }
        }
        else if (this.resizeOptions.resize)
        {   
            var SlideShowOriginalHeight = 0;

            var MainContainerHeight = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_MainContainer.style.height);
            if ((MainContainerHeight != '') && (!isNaN(MainContainerHeight))) {
                SlideShowOriginalHeight = parseInt(MainContainerHeight);
            }

            if ((SlideShowOriginalHeight !=0))
            {
                this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsTop = 
                    this.slideshowComputedStyle.slideshowHeight - (SlideShowOriginalHeight - this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsTop);
            }
        }

        if (this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsLeft == null) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsLeft = this.slideshowComputedStyle.slideshowPaddingLeft;
        }
        else if (this.resizeOptions.resize)
        {
            var SlideShowOriginalWidth = 0;

            var MainContainerWidth = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_MainContainer.style.width);
            if ((MainContainerWidth != '') && (!isNaN(MainContainerWidth))) {
                SlideShowOriginalWidth = parseInt(MainContainerWidth);
            }

            var ThumbnailsOriginalWidth = 0;

            var ThumbnailsContainerWidth = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsContainer.style.width);
            if ((ThumbnailsContainerWidth != '') && (!isNaN(ThumbnailsContainerWidth))) {
                ThumbnailsOriginalWidth = parseInt(ThumbnailsContainerWidth);
            }

            if ((SlideShowOriginalWidth !=0) && (ThumbnailsOriginalWidth !=0))
            {   
                var OriginalSpacing = SlideShowOriginalWidth - ThumbnailsOriginalWidth;
                var LeftSpacing = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsLeft;
                var LeftRation = LeftSpacing / OriginalSpacing;

                var CurrentSpacing = this.slideshowComputedStyle.slideshowWidth - this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsWidth;
                var CurrentLeftSpacing = parseInt(LeftRation * CurrentSpacing);

                this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsLeft = CurrentLeftSpacing;
            }
        }
    }

    //InitializeThumbnailsListControlComputedStyle
    this.InitializeThumbnailsListControlComputedStyle = function () {
        var thumbnailsListControl = document.getElementById(this.thumbnails.thumbnailsListControlID);

        // reading applyed css rules
        // height, width
        if (this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsList != null) {
            // width & height
            var ListControlWidth = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsList.style.width);
            if ((ListControlWidth != '') && (!isNaN(ListControlWidth))) {
                this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlWidth = parseInt(ListControlWidth);
            }

            var ListControlHeight = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsList.style.height);
            if ((ListControlHeight != '') && (!isNaN(ListControlHeight))) {
                this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlHeight = parseInt(ListControlHeight);
            }

            // top & left
            var ListControlTop = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsList.style.top);
            if ((ListControlTop != '') && (!isNaN(ListControlTop))) {
                this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlTop = parseInt(ListControlTop);
            }

            var ListControlLeft = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ThumbnailsList.style.left);
            if ((ListControlLeft != '') && (!isNaN(ListControlLeft))) {
                this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlLeft = parseInt(ListControlLeft);
            }
        }

        // reading computed styles
        // margin
        var listControlComputedStyle = getComputedStyle(thumbnailsListControl);

        var listControlMarginLeft = IS_SlideShow_RemoveCssUnits(listControlComputedStyle.marginLeft);
        if ((listControlMarginLeft != '') && (!isNaN(listControlMarginLeft))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlMarginLeft = parseInt(listControlMarginLeft);
        }

        var listControlMarginRight = IS_SlideShow_RemoveCssUnits(listControlComputedStyle.marginRight);
        if ((listControlMarginRight != '') && (!isNaN(listControlMarginRight))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlMarginRight = parseInt(listControlMarginRight);
        }

        var listControlMarginTop = IS_SlideShow_RemoveCssUnits(listControlComputedStyle.marginTop);
        if ((listControlMarginTop != '') && (!isNaN(listControlMarginTop))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlMarginTop = parseInt(listControlMarginTop);
        }

        var listControlMarginBottom = IS_SlideShow_RemoveCssUnits(listControlComputedStyle.marginBottom);
        if ((listControlMarginBottom != '') && (!isNaN(listControlMarginBottom))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlMarginBottom = parseInt(listControlMarginBottom);
        }

        // padding
        var listControlPaddingLeft = IS_SlideShow_RemoveCssUnits(listControlComputedStyle.paddingLeft);
        if ((listControlMarginLeft != '') && (!isNaN(listControlMarginLeft))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlPaddingLeft = parseInt(listControlMarginLeft);
        }

        var listControlPaddingRight = IS_SlideShow_RemoveCssUnits(listControlComputedStyle.paddingRight);
        if ((listControlPaddingRight != '') && (!isNaN(listControlPaddingRight))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlPaddingRight = parseInt(listControlPaddingRight);
        }

        var listControlPaddingTop = IS_SlideShow_RemoveCssUnits(listControlComputedStyle.paddingTop);
        if ((listControlPaddingTop != '') && (!isNaN(listControlPaddingTop))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlPaddingTop = parseInt(listControlPaddingTop);
        }

        var listControlPaddingBottom = IS_SlideShow_RemoveCssUnits(listControlComputedStyle.paddingBottom);
        if ((listControlPaddingBottom != '') && (!isNaN(listControlPaddingBottom))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlPaddingBottom = parseInt(listControlPaddingBottom);
        }

        // border
        var listControlBorderLeft = IS_SlideShow_RemoveCssUnits(listControlComputedStyle.borderLeftWidth);
        if ((listControlBorderLeft != '') && (!isNaN(listControlBorderLeft))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlBorderLeft = parseInt(listControlBorderLeft);
        }

        var listControlBorderRight = IS_SlideShow_RemoveCssUnits(listControlComputedStyle.borderRightWidth);
        if ((listControlBorderRight != '') && (!isNaN(listControlBorderRight))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlBorderRight = parseInt(listControlBorderRight);
        }

        var listControlBorderTop = IS_SlideShow_RemoveCssUnits(listControlComputedStyle.borderTopWidth);
        if ((listControlBorderTop != '') && (!isNaN(listControlBorderTop))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlBorderTop = parseInt(listControlBorderTop);
        }

        var listControlBorderBottom = IS_SlideShow_RemoveCssUnits(listControlComputedStyle.borderBottomWidth);
        if ((listControlBorderBottom != '') && (!isNaN(listControlBorderBottom))) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlBorderBottom = parseInt(listControlBorderBottom);
        }

        // computing dimensions
        // width & height
        var listControlWidth = 0;
        var listControlHeight = 0
        for (childIndex = 0; childIndex <= thumbnailsListControl.children.length - 1; childIndex++) {
            var LIchild = thumbnailsListControl.children[childIndex];
            listControlWidth += LIchild.offsetWidth;

            var LIchildComputedStyle = getComputedStyle(LIchild);
            var LIchildMarginLeft = IS_SlideShow_RemoveCssUnits(LIchildComputedStyle.marginLeft);
            if ((LIchildMarginLeft != '') && (!isNaN(LIchildMarginLeft))) { listControlWidth += parseInt(LIchildMarginLeft); }
            var LIchildMarginRight = IS_SlideShow_RemoveCssUnits(LIchildComputedStyle.marginRight);
            if ((LIchildMarginRight != '') && (!isNaN(LIchildMarginRight))) { listControlWidth += parseInt(LIchildMarginRight); }

            if (LIchild.offsetHeight > listControlHeight) { listControlHeight = LIchild.offsetHeight }
        }

        if (this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlWidth <= 0) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlWidth = listControlWidth;
        }

        if (this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlHeight <= 0) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlHeight = listControlHeight;
        }

        // top & left
        if (this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlTop == null) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlTop = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsBorderTop
                                                                                                       + this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsPaddingTop;
        }

        if (this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlLeft == null) {
            this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlLeft = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsBorderLeft
                                                                                                        + this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsPaddingLeft;
        }
    }

    //InitializeImageComputedStyle
    this.InitializeImageComputedStyle = function () {
        var imageContainer = document.getElementById(this.imageControls.imageContainerID);

        // reading applyed css rules
        if (this.slideShowApplyedCSSRules.IS_SlideShow_ImagesContainer) {
            // width & height
            var imageContainerWidth = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ImagesContainer.style.width);
            if ((imageContainerWidth != '') && (!isNaN(imageContainerWidth))) {
                this.slideshowComputedStyle.imageComputedStyle.imageContentWidth = parseInt(imageContainerWidth);
            }

            var imageContainerHeight = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ImagesContainer.style.height);
            if ((imageContainerHeight != '') && (!isNaN(imageContainerHeight))) {
                this.slideshowComputedStyle.imageComputedStyle.imageContentHeight = parseInt(imageContainerHeight);
            }

            // top
            var imageContainerTop = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ImagesContainer.style.top);
            if ((imageContainerTop != '') && (!isNaN(imageContainerTop))) {
                this.slideshowComputedStyle.imageComputedStyle.imageTop = parseInt(imageContainerTop);
            }

            var imageContainerLeft = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ImagesContainer.style.left);
            if ((imageContainerLeft != '') && (!isNaN(imageContainerLeft))) {
                this.slideshowComputedStyle.imageComputedStyle.imageTop = parseInt(imageContainerLeft);
            }
        }
        
        // computed styles
        if ((this.slideshowComputedStyle.imageComputedStyle.imageContentWidth <= 0) || (this.resizeOptions.resize)) {
            this.slideshowComputedStyle.imageComputedStyle.imageContentWidth = this.slideshowComputedStyle.slideshowWidth;
        }

        if ((this.slideshowComputedStyle.imageComputedStyle.imageContentHeight <= 0) || (this.resizeOptions.resize))
        {   
            this.slideshowComputedStyle.imageComputedStyle.imageContentHeight = this.slideshowComputedStyle.slideshowHeight;

            if ((this.thumbnails.displayThumbnails) && (this.slideShowApplyedCSSRules.IS_SlideShow_ImagesContainer.style.width == null))
            {
                this.slideshowComputedStyle.imageComputedStyle.imageContentHeight -= this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsHeight;
                if (this.thumbnails.thumbnailsPosition == 'top') 
                {
                    this.slideshowComputedStyle.imageComputedStyle.imageTop = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsHeight;
                }
            }
        }
    }

    //InitializeCaptionComputedStyle
    this.InitializeCaptionComputedStyle = function () {
        var captionContainer = document.getElementById(this.caption.captionContainerID);

        // reading applyed css rules
        if (this.slideShowApplyedCSSRules.IS_SlideShow_CaptionContainer != null) {
            // width & height
            var captionContainerWidth = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_CaptionContainer.style.width);
            if ((captionContainerWidth != '') && (!isNaN(captionContainerWidth))) {
                this.slideshowComputedStyle.captionComputedStyle.captionWidth = parseInt(captionContainerWidth);
            }

            var captionContainerHeight = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_CaptionContainer.style.height);
            if ((captionContainerHeight != '') && (!isNaN(captionContainerHeight))) {
                this.slideshowComputedStyle.captionComputedStyle.captionHeight = parseInt(captionContainerHeight);
            }

            // top & left
            var captionContainerTop = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_CaptionContainer.style.top);
            if ((captionContainerTop != '') && (!isNaN(captionContainerTop))) {
                this.slideshowComputedStyle.captionComputedStyle.captionTop = parseInt(captionContainerTop);
            }

            var captionContainerLeft = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_CaptionContainer.style.left);
            if ((captionContainerLeft != '') && (!isNaN(captionContainerLeft))) {
                this.slideshowComputedStyle.captionComputedStyle.captionLeft = parseInt(captionContainerLeft);
            }
        }

        // reading computed styles
        var captionContainerComputedStyle = getComputedStyle(captionContainer);

        // margin
        var CaptionMarginLeft = IS_SlideShow_RemoveCssUnits(captionContainerComputedStyle.marginLeft);
        if ((CaptionMarginLeft != '') && (!isNaN(CaptionMarginLeft))) {
            this.slideshowComputedStyle.captionComputedStyle.captionMarginLeft = parseInt(CaptionMarginLeft);
        }

        var CaptionMarginRight = IS_SlideShow_RemoveCssUnits(captionContainerComputedStyle.marginRight);
        if ((CaptionMarginRight != '') && (!isNaN(CaptionMarginRight))) {
            this.slideshowComputedStyle.captionComputedStyle.captionMarginRight = parseInt(CaptionMarginRight);
        }

        var CaptionMarginTop = IS_SlideShow_RemoveCssUnits(captionContainerComputedStyle.marginTop);
        if ((CaptionMarginTop != '') && (!isNaN(CaptionMarginTop))) {
            this.slideshowComputedStyle.captionComputedStyle.captionMarginTop = parseInt(CaptionMarginTop);
        }

        var CaptionMarginBottom = IS_SlideShow_RemoveCssUnits(captionContainerComputedStyle.marginBottom);
        if ((CaptionMarginBottom != '') && (!isNaN(CaptionMarginBottom))) {
            this.slideshowComputedStyle.captionComputedStyle.captionMarginBottom = parseInt(CaptionMarginBottom);
        }

        // padding
        var CaptionPaddingLeft = IS_SlideShow_RemoveCssUnits(captionContainerComputedStyle.paddingLeft);
        if ((CaptionPaddingLeft != '') && (!isNaN(CaptionPaddingLeft))) {
            this.slideshowComputedStyle.captionComputedStyle.captionPaddingLeft = parseInt(CaptionPaddingLeft);
        }

        var CaptionPaddingRight = IS_SlideShow_RemoveCssUnits(captionContainerComputedStyle.paddingRight);
        if ((CaptionPaddingRight != '') && (!isNaN(CaptionPaddingRight))) {
            this.slideshowComputedStyle.captionComputedStyle.captionPaddingRight = parseInt(CaptionPaddingRight);
        }

        var CaptionPaddingTop = IS_SlideShow_RemoveCssUnits(captionContainerComputedStyle.paddingTop);
        if ((CaptionPaddingTop != '') && (!isNaN(CaptionPaddingTop))) {
            this.slideshowComputedStyle.captionComputedStyle.captionPaddingTop = parseInt(CaptionPaddingTop);
        }

        var CaptionPaddingBottom = IS_SlideShow_RemoveCssUnits(captionContainerComputedStyle.paddingBottom);
        if ((CaptionPaddingBottom != '') && (!isNaN(CaptionPaddingBottom))) {
            this.slideshowComputedStyle.captionComputedStyle.captionPaddingBottom = parseInt(CaptionPaddingBottom);
        }

        // border
        var CaptionBorderLeft = IS_SlideShow_RemoveCssUnits(captionContainerComputedStyle.borderLeftWidth);
        if ((CaptionBorderLeft != '') && (!isNaN(CaptionBorderLeft))) {
            this.slideshowComputedStyle.captionComputedStyle.captionBorderLeft = parseInt(CaptionBorderLeft);
        }

        var CaptionBorderRight = IS_SlideShow_RemoveCssUnits(captionContainerComputedStyle.borderRightWidth);
        if ((CaptionBorderRight != '') && (!isNaN(CaptionBorderRight))) {
            this.slideshowComputedStyle.captionComputedStyle.captionBorderRight = parseInt(CaptionBorderRight);
        }

        var CaptionBorderTop = IS_SlideShow_RemoveCssUnits(captionContainerComputedStyle.borderTopWidth);
        if ((CaptionBorderTop != '') && (!isNaN(CaptionBorderTop))) {
            this.slideshowComputedStyle.captionComputedStyle.captionBorderTop = parseInt(CaptionBorderTop);
        }

        var CaptionBorderBottom = IS_SlideShow_RemoveCssUnits(captionContainerComputedStyle.borderBottomWidth);
        if ((CaptionBorderBottom != '') && (!isNaN(CaptionBorderBottom))) {
            this.slideshowComputedStyle.captionComputedStyle.captionBorderBottom = parseInt(CaptionBorderBottom);
        }

        // computing dimensions
        if (this.slideshowComputedStyle.captionComputedStyle.captionHeight <= 0) {
            this.slideshowComputedStyle.captionComputedStyle.captionHeight = parseInt(this.slideshowComputedStyle.slideshowHeight * 0.2);
            this.slideshowComputedStyle.captionComputedStyle.captionHeight -= (this.slideshowComputedStyle.captionComputedStyle.captionPaddingTop + this.slideshowComputedStyle.captionComputedStyle.captionPaddingBottom);
        }

        if (this.slideshowComputedStyle.captionComputedStyle.captionWidth <= 0) {
            this.slideshowComputedStyle.captionComputedStyle.captionWidth = this.slideshowComputedStyle.slideshowWidth;
            this.slideshowComputedStyle.captionComputedStyle.captionWidth -= (this.slideshowComputedStyle.captionComputedStyle.captionPaddingLeft
                                                                              + this.slideshowComputedStyle.captionComputedStyle.captionPaddingRight
                                                                              + this.slideshowComputedStyle.captionComputedStyle.captionBorderLeft
                                                                              + this.slideshowComputedStyle.captionComputedStyle.captionBorderRight);
        }

        if (this.slideshowComputedStyle.captionComputedStyle.captionTop == null) {
            if (this.caption.captionPosition == 'bottom') {
                var captionTop = this.slideshowComputedStyle.slideshowHeight - this.slideshowComputedStyle.captionComputedStyle.captionHeight + this.slideshowComputedStyle.slideshowPaddingTop + 1;
                if ((this.thumbnails.displayThumbnails) && (this.thumbnails.thumbnailsPosition == 'bottom')) {
                    captionTop -= this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsHeight;
                    captionTop -= (this.slideshowComputedStyle.captionComputedStyle.captionPaddingTop + this.slideshowComputedStyle.captionComputedStyle.captionPaddingBottom);
                }
                this.slideshowComputedStyle.captionComputedStyle.captionTop = captionTop;
            }
            else {
                if ((this.thumbnails.displayThumbnails) && (this.thumbnails.thumbnailsPosition == 'top')) {
                    this.slideshowComputedStyle.captionComputedStyle.captionTop = this.slideshowComputedStyle.slideshowPaddingTop + this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsHeight;
                    this.slideshowComputedStyle.captionComputedStyle.captionTop += (this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsPaddingTop + this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsPaddingBottom);
                }
                else {
                    this.slideshowComputedStyle.captionComputedStyle.captionTop = this.slideshowComputedStyle.slideshowPaddingTop;
                }
            }
        }

        if (this.slideshowComputedStyle.captionComputedStyle.captionLeft == null) {
            this.slideshowComputedStyle.captionComputedStyle.captionLeft = this.slideshowComputedStyle.slideshowPaddingLeft;
        }
    }

    //InitializeControlsBoxComputedStyle
    this.InitializeControlsBoxComputedStyle = function () {
        var controlsBox = document.getElementById(this.controlsBox.controlsBoxContainerID);

        // Initializing Controls Box's List Control
        this.InitializeControlsBoxListControlComputedStyle();

        // reading applyed css rules
        if (this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox != null) {
            // width & height
            var controlsBoxWidth = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox.style.width);
            if ((controlsBoxWidth != '') && (isNaN(controlsBoxWidth))) {
                this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxWidth = parseInt(controlsBox.style.width.replace('px', ''));
            }

            var controlsBoxHeight = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox.style.height);
            if ((controlsBoxHeight != '') && (isNaN(controlsBoxHeight))) {
                this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxHeight = parseInt(controlsBoxHeight);
            }

            // top & left
            var controlsBoxTop = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox.style.top);
            if ((controlsBoxTop != '') && (isNaN(controlsBoxTop))) {
                this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxTop = parseInt(controlsBoxTop);
            }

            var controlsBoxLeft = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox.style.left);
            if ((controlsBoxLeft != '') && (isNaN(controlsBoxLeft))) {
                this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxLeft = parseInt(controlsBoxLeft);
            }
        }

        // reading computed styles
        var controlsBoxComputedStyle = getComputedStyle(controlsBox);

        // padding
        if (controlsBoxComputedStyle.paddingLeft != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxPaddingLeft = parseInt(controlsBoxComputedStyle.paddingLeft.replace('px', ''));
        }

        if (controlsBoxComputedStyle.paddingRight != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxPaddingRight = parseInt(controlsBoxComputedStyle.paddingRight.replace('px', ''));
        }

        if (controlsBoxComputedStyle.paddingTop != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxPaddingTop = parseInt(controlsBoxComputedStyle.paddingTop.replace('px', ''));
        }

        if (controlsBoxComputedStyle.paddingBottom != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxPaddingBottom = parseInt(controlsBoxComputedStyle.paddingBottom.replace('px', ''));
        }

        // border
        if (controlsBoxComputedStyle.borderLeftWidth != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxBorderLeft = parseInt(controlsBoxComputedStyle.borderLeftWidth.replace('px', ''));
        }

        if (controlsBoxComputedStyle.borderRightWidth != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxBorderRight = parseInt(controlsBoxComputedStyle.borderRightWidth.replace('px', ''));
        }

        if (controlsBoxComputedStyle.borderTopWidth != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxBorderTop = parseInt(controlsBoxComputedStyle.borderTopWidth.replace('px', ''));
        }

        if (controlsBoxComputedStyle.borderBottomWidth != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxBorderBottom = parseInt(controlsBoxComputedStyle.borderBottomWidth.replace('px', ''));
        }

        // computing dimensions
        if (this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxHeight <= 0) {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxHeight = this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlHeight
                                                                                    + this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlMarginTop
                                                                                    + this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlMarginBottom
                                                                                    + this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlPaddingTop
                                                                                    + this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlPaddingBottom
                                                                                    + this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlBorderTop
                                                                                    + this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlBorderBottom;
        }

        if (this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxWidth <= 0) {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxWidth = this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlWidth
                                                                                   + this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlMarginLeft
                                                                                   + this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlMarginRight
                                                                                   + this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlPaddingLeft
                                                                                   + this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlPaddingRight
                                                                                   + this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlBorderLeft
                                                                                   + this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlBorderRight;
        }

        var controlBoxOffsetHeight = this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxHeight +
                                     this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxMarginTop +
                                     this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxMarginBottom +
                                     this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxPaddingTop +
                                     this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxPaddingBottom +
                                     this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxBorderTop +
                                     this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxBorderBottom;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxTop = this.slideshowComputedStyle.slideshowPaddingTop +
                                                                             parseInt(this.slideshowComputedStyle.imageComputedStyle.imageContentHeight / 2) -
                                                                             parseInt(controlBoxOffsetHeight / 2);

        if (this.thumbnails.displayThumbnails) {
            if (this.thumbnails.thumbnailsPosition == 'top') {
                this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxTop += this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsHeight;
            }
        }

        var controlBoxOffsetWidth = this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxWidth +
                                          this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxMarginLeft +
                                          this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxMarginRight +
                                          this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxPaddingLeft +
                                          this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxPaddingRight +
                                          this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxBorderLeft +
                                          this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxBorderRight;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxLeft = this.slideshowComputedStyle.slideshowPaddingLeft +
                                                                              parseInt(this.slideshowComputedStyle.imageComputedStyle.imageContentWidth / 2) -
                                                                              parseInt(controlBoxOffsetWidth / 2);

    }

    //InitializeControlsBoxListControlComputedStyle
    this.InitializeControlsBoxListControlComputedStyle = function () {
        var controlsBox = document.getElementById(this.controlsBox.controlsBoxContainerID);
        var listControl = controlsBox.children[0];

        // reading applyed css rules
        // height, width
        if (this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox_ButtonsList != null) {
            // width & height
            var listControlWidth = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox_ButtonsList.style.width);
            if ((listControlWidth != '') && (isNaN(listControlWidth))) {
                this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlWidth = parseInt(listControlWidth);
            }

            var listControlHeight = IS_SlideShow_RemoveCssUnits(this.slideShowApplyedCSSRules.IS_SlideShow_ControlsBox_ButtonsList.style.height);
            if ((listControlHeight != '') && (isNaN(listControlHeight))) {
                this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlHeight = parseInt(listControlHeight);
            }
        }

        // reading computed styles
        // margin
        var listControlComputedStyle = getComputedStyle(listControl);

        if (listControlComputedStyle.marginLeft != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlMarginLeft = parseInt(listControlComputedStyle.paddingLeft.replace('px', ''));
        }

        if (listControlComputedStyle.marginRight != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlMarginRight = parseInt(listControlComputedStyle.marginRight.replace('px', ''));
        }

        if (listControlComputedStyle.marginTop != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlMarginTop = parseInt(listControlComputedStyle.marginTop.replace('px', ''));
        }

        if (listControlComputedStyle.marginBottom != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlMarginBottom = parseInt(listControlComputedStyle.marginBottom.replace('px', ''));
        }

        // padding
        if (listControlComputedStyle.paddingLeft != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlPaddingLeft = parseInt(listControlComputedStyle.paddingLeft.replace('px', ''));
        }

        if (listControlComputedStyle.paddingRight != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlPaddingRight = parseInt(listControlComputedStyle.paddingRight.replace('px', ''));
        }

        if (listControlComputedStyle.paddingTop != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlPaddingTop = parseInt(listControlComputedStyle.paddingTop.replace('px', ''));
        }

        if (listControlComputedStyle.paddingBottom != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlPaddingBottom = parseInt(listControlComputedStyle.paddingBottom.replace('px', ''));
        }

        // border
        if (listControlComputedStyle.borderLeftWidth != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlBorderLeft = parseInt(listControlComputedStyle.borderLeftWidth.replace('px', ''));
        }

        if (listControlComputedStyle.borderRightWidth != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlBorderRight = parseInt(listControlComputedStyle.borderRightWidth.replace('px', ''));
        }

        if (listControlComputedStyle.borderTopWidth != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlBorderTop = parseInt(listControlComputedStyle.borderTopWidth.replace('px', ''));
        }

        if (listControlComputedStyle.borderBottomWidth != '') {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlBorderBottom = parseInt(listControlComputedStyle.borderBottomWidth.replace('px', ''));
        }

        // computing dimensions
        var listControlWidth = 0;
        var listControlHeight = 0
        for (childIndex = 0; childIndex <= listControl.children.length - 1; childIndex++) {
            var LIchild = listControl.children[childIndex];
            listControlWidth += LIchild.offsetWidth;

            var LIchildComputedStyle = getComputedStyle(LIchild);
            var LIchildMarginLeft = IS_SlideShow_RemoveCssUnits(LIchildComputedStyle.marginLeft);
            if ((LIchildMarginLeft != '') && (!isNaN(LIchildMarginLeft))) { listControlWidth += parseInt(LIchildMarginLeft); }
            var LIchildMarginRight = IS_SlideShow_RemoveCssUnits(LIchildComputedStyle.marginRight);
            if ((LIchildMarginRight != '') && (!isNaN(LIchildMarginRight))) { listControlWidth += parseInt(LIchildMarginRight); }

            if (LIchild.offsetHeight > listControlHeight) { listControlHeight = LIchild.offsetHeight }
        }

        if (this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlHeight <= 0) {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlHeight = listControlHeight;
        }

        if (this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlWidth <= 0) {
            this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlWidth = listControlWidth;
        }
    }
    // End: Computed Styles Initialization

    // Start: Clean Computed Styles

    this.CleanComputedStyles = function ()
    {
        // Main Container Computed Styles
        this.slideshowComputedStyle.slideshowBorderBottom = 0;
        this.slideshowComputedStyle.slideshowBorderLeft = 0;
        this.slideshowComputedStyle.slideshowBorderRight = 0;
        this.slideshowComputedStyle.slideshowBorderTop = 0;
        this.slideshowComputedStyle.slideshowHeight = 0;
        this.slideshowComputedStyle.slideshowPaddingBottom = 0;
        this.slideshowComputedStyle.slideshowPaddingLeft = 0;
        this.slideshowComputedStyle.slideshowPaddingRight = 0;
        this.slideshowComputedStyle.slideshowPaddingTop = 0;
        this.slideshowComputedStyle.slideshowWidth = 0;

        // Caption Computed Styles
        this.slideshowComputedStyle.captionComputedStyle.captionBorderBottom = 0;
        this.slideshowComputedStyle.captionComputedStyle.captionBorderLeft = 0;
        this.slideshowComputedStyle.captionComputedStyle.captionBorderRight = 0;
        this.slideshowComputedStyle.captionComputedStyle.captionBorderTop = 0;
        this.slideshowComputedStyle.captionComputedStyle.captionHeight = 0;
        this.slideshowComputedStyle.captionComputedStyle.captionLeft = null;
        this.slideshowComputedStyle.captionComputedStyle.captionMarginBottom = 0;
        this.slideshowComputedStyle.captionComputedStyle.captionMarginLeft = 0;
        this.slideshowComputedStyle.captionComputedStyle.captionMarginRight = 0;
        this.slideshowComputedStyle.captionComputedStyle.captionMarginTop = 0;
        this.slideshowComputedStyle.captionComputedStyle.captionPaddingBottom = 0;
        this.slideshowComputedStyle.captionComputedStyle.captionPaddingLeft = 0;
        this.slideshowComputedStyle.captionComputedStyle.captionPaddingRight = 0;
        this.slideshowComputedStyle.captionComputedStyle.captionPaddingTop = 0;
        this.slideshowComputedStyle.captionComputedStyle.captionTop = null;
        this.slideshowComputedStyle.captionComputedStyle.captionWidth = 0;

        // Controls Box Computed Styles
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxBorderBottom = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxBorderLeft = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxBorderRight = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxBorderTop = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxHeight = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxLeft = null;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxMarginBottom = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxMarginLeft = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxMarginRight = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxMarginTop = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxPaddingBottom = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxPaddingLeft = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxPaddingRight = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxPaddingTop = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxTop = null;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxWidth = 0;

        // Controls Box List Control Computed Styles
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlBorderBottom = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlBorderLeft = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlBorderRight = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlBorderTop = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlHeight = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlMarginBottom = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlMarginLeft = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlMarginRight = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlMarginTop = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlPaddingBottom = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlPaddingLeft = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlPaddingRight = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlPaddingTop = 0;
        this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlWidth = 0;

        // Image Content Computed Styles
        this.slideshowComputedStyle.imageComputedStyle.imageContentHeight = 0;
        this.slideshowComputedStyle.imageComputedStyle.imageContentWidth = 0;
        this.slideshowComputedStyle.imageComputedStyle.imageLeft = 0;
        this.slideshowComputedStyle.imageComputedStyle.imageTop = 0;
        
        // Resize Computed Styles
        this.slideshowComputedStyle.resizeComputedStyle.resizeBorderBottom = 0;
        this.slideshowComputedStyle.resizeComputedStyle.resizeBorderLeft = 0;
        this.slideshowComputedStyle.resizeComputedStyle.resizeBorderRight = 0;
        this.slideshowComputedStyle.resizeComputedStyle.resizeBorderTop = 0;
        this.slideshowComputedStyle.resizeComputedStyle.resizeHeight = 0;
        this.slideshowComputedStyle.resizeComputedStyle.resizeMarginBottom = 0;
        this.slideshowComputedStyle.resizeComputedStyle.resizeMarginLeft = 0;
        this.slideshowComputedStyle.resizeComputedStyle.resizeMarginRight = 0;
        this.slideshowComputedStyle.resizeComputedStyle.resizeMarginTop = 0;
        this.slideshowComputedStyle.resizeComputedStyle.resizePaddingBottom = 0;
        this.slideshowComputedStyle.resizeComputedStyle.resizePaddingLeft = 0;
        this.slideshowComputedStyle.resizeComputedStyle.resizePaddingRight = 0;
        this.slideshowComputedStyle.resizeComputedStyle.resizePaddingTop = 0;
        this.slideshowComputedStyle.resizeComputedStyle.resizeWidth = 0;
        
        // Thumbnails Computed Styles
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsBorderBottom = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsBorderLeft = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsBorderRight = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsBorderTop = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsHeight = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsLeft = null;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsPaddingBottom = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsPaddingLeft = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsPaddingRight = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsPaddingTop = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsTop = null;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsWidth = 0;

        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlBorderBottom = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlBorderLeft = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlBorderRight = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlBorderTop = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlHeight = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlLeft = null;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlMarginBottom = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlMarginLeft = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlMarginRight = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlMarginTop = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlPaddingBottom = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlPaddingLeft = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlPaddingRight = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlPaddingTop = 0;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlTop = null;
        this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlWidth = 0;
    }

    // End: Clean Computed Styles

    // Start: Initialize Controls
    //InitializeControls
    this.InitializeControls = function () {
        this.InitializeSlideShowContainer();

        if (this.thumbnails.displayThumbnails) {
            this.InitializeThumbnails();
        }

        if (this.caption.displayCaption) {
            this.InitializeCaption();
        }

        this.InitializeImageContainer();

        var ISSlideShowImage = this.images[0];
        var image1 = document.getElementById(this.imageControls.image1ID);

        if (this.imageOptions.imageRender == '')
        {
            image1.src = IS_SlideShow_GetDynamicImageURL(ISSlideShowImage.imageURL, this.slideshowComputedStyle.imageComputedStyle.imageContentWidth, this.slideshowComputedStyle.imageComputedStyle.imageContentHeight);
        }
        else
        {
            image1.style.backgroundImage = "url('" + IS_SlideShow_GetDynamicImageURL(ISSlideShowImage.imageURL, this.slideshowComputedStyle.imageComputedStyle.imageContentWidth, this.slideshowComputedStyle.imageComputedStyle.imageContentHeight) + "')";
        }
        
        this.InitializeImage(image1, ISSlideShowImage);

        if (this.controlsBox.controlsBoxContainerID != '') {
            this.InitializeControlsBox()
        }
    }

    //InitializeImageContainer
    this.InitializeImageContainer = function () {
        var imageContainer = document.getElementById(this.imageControls.imageContainerID);
        imageContainer.style.top = this.slideshowComputedStyle.imageComputedStyle.imageTop + 'px';
        imageContainer.style.width = this.slideshowComputedStyle.imageComputedStyle.imageContentWidth + 'px';
        imageContainer.style.height = this.slideshowComputedStyle.imageComputedStyle.imageContentHeight + 'px';
    }

    //InitializeCaption
    this.InitializeCaption = function () {
        var captionContainer = document.getElementById(this.caption.captionContainerID);
        var caption1 = document.getElementById(this.caption.caption1ID);
        var caption2 = document.getElementById(this.caption.caption2ID);

        captionContainer.style.height = this.slideshowComputedStyle.captionComputedStyle.captionHeight + 'px';
        captionContainer.style.width = this.slideshowComputedStyle.captionComputedStyle.captionWidth + 'px';
        captionContainer.style.top = this.slideshowComputedStyle.captionComputedStyle.captionTop + 'px';
        captionContainer.style.left = this.slideshowComputedStyle.captionComputedStyle.captionLeft + 'px';

        caption1.style.height = this.slideshowComputedStyle.captionComputedStyle.captionHeight -
                                (this.slideshowComputedStyle.captionComputedStyle.captionPaddingTop 
                                 + this.slideshowComputedStyle.captionComputedStyle.captionPaddingBottom) + 'px';
        caption1.style.width = this.slideshowComputedStyle.captionComputedStyle.captionWidth -
                               (this.slideshowComputedStyle.captionComputedStyle.captionPaddingLeft
                                + this.slideshowComputedStyle.captionComputedStyle.captionPaddingRight) + 'px';
        caption1.style.top = this.slideshowComputedStyle.captionComputedStyle.captionMarginTop
                             + this.slideshowComputedStyle.captionComputedStyle.captionBorderTop
                             + this.slideshowComputedStyle.captionComputedStyle.captionPaddingTop
        caption1.style.left = this.slideshowComputedStyle.captionComputedStyle.captionMarginLeft
                              + this.slideshowComputedStyle.captionComputedStyle.captionBorderLeft 
                              + this.slideshowComputedStyle.captionComputedStyle.captionPaddingLeft


        caption2.style.width = caption1.style.width;
        caption2.style.height = caption1.style.height;
        caption2.style.top = caption1.style.top;
        caption2.style.left = caption1.style.left;
    }

    // InitializeControlsBox
    this.InitializeControlsBox = function () {
        var controlsBox = document.getElementById(this.controlsBox.controlsBoxContainerID);

        controlsBox.style.width = this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxWidth + 'px';
        controlsBox.style.height = this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxHeight + 'px';
        controlsBox.style.top = this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxTop + 'px';
        controlsBox.style.left = this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxLeft + 'px';

        var controslBoxListControl = controlsBox.children[0];
        controslBoxListControl.style.width = this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlWidth + 'px';
        controslBoxListControl.style.height = this.slideshowComputedStyle.controlBoxComputedStyle.controlsBoxListControl.listControlHeight + 'px';
    }

    //InitializeImage
    this.InitializeImage = function (imageToSize, ISSlideShowImage) {
        var slideShowMainContainer = document.getElementById(this.slideShowMainContainerID);

        if (ISSlideShowImage.imageLink != '') {
            imageToSize.onclick = function () { window.location = ISSlideShowImage.imageLink; }
            imageToSize.style.cursor = 'pointer';
        }
        else {
            imageToSize.onclick = null;
            imageToSize.style.cursor = 'default';
        }

        var imageContentWidth = this.slideshowComputedStyle.imageComputedStyle.imageContentWidth;
        var imageContentHeight = this.slideshowComputedStyle.imageComputedStyle.imageContentHeight;

        if (this.resizeImages) {
            imageToSize.style.width = imageContentWidth + 'px';
            imageToSize.style.height = imageContentHeight + 'px';
            imageToSize.style.top = '0px';
            imageToSize.style.left = '0px';
        }
        else {
            if ((ISSlideShowImage.imageRealWidth >= ISSlideShowImage.imageRealHeight) && (ISSlideShowImage.imageRealWidth > imageContentWidth)) {
                var ResizeRatio = (imageContentWidth / ISSlideShowImage.imageRealWidth);
                var ImageNewWidth = imageContentWidth;
                var ImageNewHeight = parseInt(ISSlideShowImage.imageRealHeight * ResizeRatio);

                if (ImageNewHeight > imageContentHeight) {
                    ResizeRatio = imageContentHeight / ImageNewHeight;
                    ImageNewHeight = imageContentHeight;
                    ImageNewWidth = parseInt(ImageNewWidth * ResizeRatio);
                }

                imageToSize.style.width = ImageNewWidth + 'px';
                imageToSize.style.height = ImageNewHeight + 'px';

                imageToSize.style.top = parseInt((imageContentHeight / 2) - (ImageNewHeight / 2)) + 'px';
                imageToSize.style.left = parseInt(imageContentWidth / 2) - (ImageNewWidth / 2) + 'px';
            }
            else if (ISSlideShowImage.imageRealHeight > imageContentHeight) {
                var ResizeRatio = (imageContentHeight / ISSlideShowImage.imageRealHeight);
                var ImageNewWidth = parseInt(ISSlideShowImage.imageRealWidth * ResizeRatio);
                var ImageNewHeight = imageContentHeight;

                if (ImageNewWidth > imageContentWidth) {
                    ResizeRatio = imageContentWidth / ImageNewWidth;
                    ImageNewHeight = parseInt(ImageNewHeight * ResizeRatio);
                    ImageNewWidth = imageContentWidth;
                }

                imageToSize.style.width = ImageNewWidth + 'px';
                imageToSize.style.height = ImageNewHeight + 'px';

                imageToSize.style.top = parseInt((imageContentHeight / 2) - (ImageNewHeight / 2)) + 'px';
                imageToSize.style.left = parseInt(imageContentWidth / 2) - (ImageNewWidth / 2) + 'px';
            }
            else {
                imageToSize.style.width = ISSlideShowImage.imageRealWidth + 'px';
                imageToSize.style.height = ISSlideShowImage.imageRealHeight + 'px';

                imageToSize.style.top = parseInt((imageContentHeight / 2) - (ISSlideShowImage.imageRealHeight / 2)) + 'px';
                imageToSize.style.left = parseInt((imageContentWidth / 2) - (ISSlideShowImage.imageRealWidth / 2)) + 'px';
            }
        }
    }

    // InitializeSlideShow
    this.InitializeSlideShowContainer = function () {
        var slideShow = document.getElementById(this.slideshowID);
        slideShow.style.width = this.slideshowComputedStyle.slideshowWidth + 'px';
        slideShow.style.height = this.slideshowComputedStyle.slideshowHeight + 'px';
    }

    // InitializeThumbnails
    this.InitializeThumbnails = function () {
        var thumbnailsContainer = document.getElementById(this.thumbnails.thumbnailsContainerID);
        var thumbnailsListControl = document.getElementById(this.thumbnails.thumbnailsListControlID);

        thumbnailsContainer.style.width = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsWidth + 'px';
        thumbnailsContainer.style.height = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsHeight + 'px';
        thumbnailsContainer.style.top = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsTop + 'px';
        thumbnailsContainer.style.left = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsLeft + 'px';

        thumbnailsListControl.style.width = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlWidth + 'px';
        thumbnailsListControl.style.height = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlHeight + 'px';
        thumbnailsListControl.style.top = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlTop + 'px';
        thumbnailsListControl.style.left = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsListControl.listControlLeft + 'px';

        if (this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsWidth < thumbnailsListControl.offsetWidth) {
            var ISSlideShow = this;
            thumbnailsContainer.onmousemove = function () { ISSlideShow.ThumbnailsScroll(event); }
        }
        else
        {
            thumbnailsContainer.onmousemove = null;
        }

    }
    // End: Initialize Controls

    //Methods
    //AutoPlay
    this.AutoPlay = function () {
        if ((this.autoplay.autoplay) && (this.autoplay.play)) {
            var ISSlideShow = this;
            this.autoplay.slideshowTimer = setTimeout(function () { ISSlideShow.NextImage() }, this.autoplay.autoplaySpeed);
        }
    }

    //FirstImage method
    this.FirstImage = function () { };

    //GoToImage method
    this.GoToImage = function (imageIndex) {
        if (imageIndex > this.images.length - 1) { return }

        if ((this.autoplay.autoplay) && (this.autoplay.play)) { clearTimeout(this.autoplay.slideshowTimer) }

        if (this.shownImageIndex == imageIndex) { return }

        var image1 = document.getElementById(this.imageControls.image1ID);
        if ($telerik.$(image1).queue().length > 0) { return }

        this.previousImageIndex = this.shownImageIndex;
        this.shownImageIndex = imageIndex;

        this.ShowCurrentImage();
    }

    // HideControlsBox
    this.HideControlsBox = function (functionEvent) {
        var controlBox = document.getElementById(this.controlsBox.controlsBoxContainerID);

        var imageContainer = document.getElementById(this.imageControls.imageContainerID);
        var image1 = document.getElementById(this.imageControls.image1ID);
        var image2 = document.getElementById(this.imageControls.image2ID);

        var captionContainer = document.getElementById(this.caption.captionContainerID);
        var caption1 = document.getElementById(this.caption.caption1ID);
        var caption2 = document.getElementById(this.caption.caption2ID);

        var notImagesControls = (functionEvent.toElement != imageContainer) && (functionEvent.toElement != image1) && (functionEvent.toElement != image2);
        var notCaptionsControls = (functionEvent.toElement != captionContainer) && (functionEvent.toElement != caption1) && (functionEvent.toElement != caption2)
                                    && (functionEvent.toElement != caption1.children[0]) && (functionEvent.toElement != caption2.children[0])

        var notControlBoxControls = (functionEvent.toElement != controlBox);

        if (this.controlsBox.firstImageButton) {
            var firstImageButton = document.getElementById(this.controlsBox.firstImageButtonID);
            notControlBoxControls = (notControlBoxControls && (functionEvent.toElement != firstImageButton));
        }

        if (this.controlsBox.lastImageButton) {
            var lastImageButton = document.getElementById(this.controlsBox.lastImageButtonID);
            notControlBoxControls = (notControlBoxControls && (functionEvent.toElement != lastImageButton));
        }

        if (this.controlsBox.nextImageButton) {
            var nextImageButton = document.getElementById(this.controlsBox.nextImageButtonID);
            notControlBoxControls = (notControlBoxControls && (functionEvent.toElement != nextImageButton));
        }

        if (this.controlsBox.playPauseButton) {
            var playPauseImageButton = document.getElementById(this.controlsBox.playPauseButtonID);
            notControlBoxControls = (notControlBoxControls && (functionEvent.toElement != playPauseImageButton));
        }

        if (this.controlsBox.previousImageButton) {
            var previousImageButton = document.getElementById(this.controlsBox.previousImageButtonID);
            notControlBoxControls = (notControlBoxControls && (functionEvent.toElement != previousImageButton));
        }

        if (notImagesControls && notCaptionsControls && notControlBoxControls) {
            $telerik.$(controlBox).stop(true);
            $telerik.$(controlBox).animate({ opacity: 0 }, 500, null, function () { controlBox.style.display = 'none' });
        }
    }
    
    //LastImage method
    this.LastImage = function () { };

    //NextImage method
    this.NextImage = function () {
        if ((this.autoplay.autoplay) && (this.autoplay.play)) { clearTimeout(this.autoplay.slideshowTimer) }

        var image1 = document.getElementById(this.imageControls.image1ID);
        if ($telerik.$(image1).queue().length > 0) { return }

        this.previousImageIndex = this.shownImageIndex;

        if (this.shownImageIndex >= this.images.length - 1) {
            this.shownImageIndex = 0;
        }
        else {
            this.shownImageIndex++;
        }

        this.ShowCurrentImage();
    };

    //Pause method
    this.Pause = function () {
        clearTimeout(this.autoplay.slideshowTimer);
        this.autoplay.play = false;
    };

    // Play method
    this.Play = function () {
        var ISSlideShow = this;
        this.autoplay.slideshowTimer = setTimeout(function () { ISSlideShow.NextImage() }, this.autoplay.autoplaySpeed);
    };

    // PreviousImage method
    this.PreviousImage = function () { };

    // Resize
    this.Resize = function()
    {
        this.CleanComputedStyles();

        this.InitializeComputedStyle();

        this.InitializeSlideShowContainer();

        if (this.thumbnails.displayThumbnails) {
            this.InitializeThumbnails();
        }

        if (this.caption.displayCaption) {
            this.InitializeCaption();
        }

        this.InitializeImageContainer();

        var ISSlideShowImage = this.images[this.shownImageIndex];
        var image1 = document.getElementById(this.imageControls.image1ID);
        var image2 = document.getElementById(this.imageControls.image2ID);
        var imageToInitialize = null;

        var image1_imageLink = null

        if (this.imageOptions.imageRender == 'HtmlImage')
        {
            image1_imageLink = image1.src;
        }
        else
        {
            image1_imageLink = image1.style.backgroundImage;
        }

        if (image1_imageLink.indexOf(ISSlideShowImage.imageURL) != -1)
        {
            imageToInitialize = image1;
        }
        else
        {
            imageToInitialize = image2;
        }

        this.InitializeImage(imageToInitialize, ISSlideShowImage);

        if (this.controlsBox.controlsBoxContainerID != '') {
            this.InitializeControlsBox()
        }
    }

    // ShowControlsBox
    this.ShowControlsBox = function (functionEvent) {
        var controlBox = document.getElementById(this.controlsBox.controlsBoxContainerID);

        var fromElement = functionEvent.relatedTarget;

        var imageContainer = document.getElementById(this.imageControls.imageContainerID);
        var image1 = document.getElementById(this.imageControls.image1ID);
        var image2 = document.getElementById(this.imageControls.image2ID);

        var captionContainer = document.getElementById(this.caption.captionContainerID);
        var caption1 = document.getElementById(this.caption.caption1ID);
        var caption2 = document.getElementById(this.caption.caption2ID);

        var notImageControls = (functionEvent.fromElement != imageContainer) && (functionEvent.fromElement != image1) && (functionEvent.fromElement != image2);
        var notCaptionControls = (functionEvent.fromElement != captionContainer) && (functionEvent.fromElement != caption1) && (functionEvent.fromElement != caption2);

        var notControlBoxControls = (functionEvent.fromElement != controlBox);

        if (this.controlsBox.firstImageButton) {
            var firstImageButton = document.getElementById(this.controlsBox.firstImageButtonID);
            notControlBoxControls = (notControlBoxControls && (functionEvent.fromElement != firstImageButton));
        }

        if (this.controlsBox.lastImageButton) {
            var lastImageButton = document.getElementById(this.controlsBox.lastImageButtonID);
            notControlBoxControls = (notControlBoxControls && (functionEvent.fromElement != lastImageButton));
        }

        if (this.controlsBox.nextImageButton) {
            var nextImageButton = document.getElementById(this.controlsBox.nextImageButtonID);
            notControlBoxControls = (notControlBoxControls && (functionEvent.fromElement != nextImageButton));
        }

        if (this.controlsBox.playPauseButton) {
            var playPauseImageButton = document.getElementById(this.controlsBox.playPauseButtonID);
            notControlBoxControls = (notControlBoxControls && (functionEvent.fromElement != playPauseImageButton));
        }

        if (this.controlsBox.previousImageButton) {
            var previousImageButton = document.getElementById(this.controlsBox.previousImageButtonID);
            notControlBoxControls = (notControlBoxControls && (functionEvent.fromElement != previousImageButton));
        }

        if (notImageControls && notCaptionControls && notControlBoxControls) {
            $telerik.$(controlBox).stop(true);

            controlBox.style.display = 'block';
            $telerik.$(controlBox).animate({ opacity: 1 }, 500);
        }
    }

    // ShowCurrentImage method
    this.ShowCurrentImage = function () {
        var ISSlideShowPreviousImage = this.images[this.previousImageIndex];
        var ISSlideShowImage = this.images[this.shownImageIndex];

        // Start: Preparing images for animation
        var image1 = document.getElementById(this.imageControls.image1ID);
        var image2 = document.getElementById(this.imageControls.image2ID);

        var imageToFadeIn;
        var imageToFadeOut;

        if (this.imageOptions.imageRender == 'HtmlImage')
        {
            if ((ISSlideShowPreviousImage != null) && (image1.src.indexOf(ISSlideShowPreviousImage.imageURL) == -1)) {
                var imageToFadeIn = image1;
                var imageToFadeOut = image2;
            }
            else
            {
                var imageToFadeIn = image2;
                var imageToFadeOut = image1;
            }
            imageToFadeIn.src = IS_SlideShow_GetDynamicImageURL(ISSlideShowImage.imageURL, this.slideshowComputedStyle.imageComputedStyle.imageContentWidth, this.slideshowComputedStyle.imageComputedStyle.imageContentHeight);
        }
        else
        {
            if ((ISSlideShowPreviousImage != null) && (image1.style.backgroundImage.indexOf(ISSlideShowPreviousImage.imageURL) == -1)) {
                var imageToFadeIn = image1;
                var imageToFadeOut = image2;
            }
            else
            {
                var imageToFadeIn = image2;
                var imageToFadeOut = image1;
            }
            imageToFadeIn.style.backgroundImage = "url('" + IS_SlideShow_GetDynamicImageURL(ISSlideShowImage.imageURL, this.slideshowComputedStyle.imageComputedStyle.imageContentWidth, this.slideshowComputedStyle.imageComputedStyle.imageContentHeight) + "')";
        }

        this.InitializeImage(imageToFadeIn, ISSlideShowImage);

        imageToFadeOut.onclick = null;
        // End: Preparing images for animation

        // Start: Preparing captions for animation
        var captionToFadeIn;
        var captionToFadeOut;

        if (this.caption.displayCaption) {
            var HTMLTestElement = document.createElement('div');
            HTMLTestElement.innerHTML = ISSlideShowPreviousImage.imageCaption;

            var caption1 = document.getElementById(this.caption.caption1ID);
            var caption2 = document.getElementById(this.caption.caption2ID);
            if ((ISSlideShowPreviousImage != null) && (caption1.children[0].innerHTML != HTMLTestElement.innerHTML)) {
                captionToFadeIn = caption1;
                captionToFadeOut = caption2;
            }
            else {
                captionToFadeIn = caption2;
                captionToFadeOut = caption1
            }
            captionToFadeIn.children[0].innerHTML = ISSlideShowImage.imageCaption;
        }
        // Start: Preparing captions for animation
        
        var ISSlideShow = this;

        if (this.imageOptions.imageRender == 'HtmlImage')
        {
            setTimeout(function () {ISSlideShow.SwitchImages(ISSlideShowImage, ISSlideShowPreviousImage, imageToFadeIn, imageToFadeOut, captionToFadeIn, captionToFadeOut, null)}, 100);
        }
        else
        {
            var dummyImage = new Image();
            dummyImage.src = imageToFadeIn.src;

            setTimeout(function () {ISSlideShow.SwitchImages(ISSlideShowImage, ISSlideShowPreviousImage, imageToFadeIn, imageToFadeOut, captionToFadeIn, captionToFadeOut, dummyImage)}, 100);
        }
    }

    // SwitchImages
    this.SwitchImages = function (ISSlideShowImage, ISSlideShowPreviousImage, imageToFadeIn, imageToFadeOut, captionToFadeIn, captionToFadeOut, dummyImage)
    {
        var ISSlideShow = this;

        if (this.imageOptions.imageRender == 'HtmlImage')
        {
            if (!imageToFadeIn.complete)
            {
                setTimeout(function () {ISSlideShow.SwitchImages(ISSlideShowImage, ISSlideShowPreviousImage, imageToFadeIn, imageToFadeOut, captionToFadeIn, captionToFadeOut, null)}, 100);
                return;
            }
        }
        else if (!dummyImage.complete)
        {
            setTimeout(function () {ISSlideShow.SwitchImages(ISSlideShowImage, ISSlideShowPreviousImage, imageToFadeIn, imageToFadeOut, captionToFadeIn, captionToFadeOut, dummyImage)}, 100);
            return;
        }

        // Start: Calculating thumbnails scrolling
        var thumbnailsNewPosition = null;
        if ((this.thumbnails.displayThumbnails) && (!this.thumbnails.thumbnailsAreManualyScrolled)) {
            var thumbnailsList = document.getElementById(this.thumbnails.thumbnailsListControlID);
            var imageThumbnailControl = document.getElementById(ISSlideShowImage.imageThumbnail.imageThumbnailControlID);

            var thumbnailsListWidth = thumbnailsList.offsetWidth;
            var thumbnailsWidth = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsWidth;
            var thumbnailsPosition = parseInt(thumbnailsList.style.left.replace('px', ''));

            var imageThumbnailControlPositionX = imageThumbnailControl.offsetLeft;
            var thumbnailInContainerPosition = parseInt((thumbnailsWidth / 2) - 35);

            if ((imageThumbnailControlPositionX > thumbnailInContainerPosition) &&
                ((imageThumbnailControlPositionX - thumbnailInContainerPosition) <= (thumbnailsListWidth - thumbnailsWidth))) {
                thumbnailsNewPosition = imageThumbnailControlPositionX - thumbnailInContainerPosition;
            }

            if ((imageThumbnailControlPositionX <= thumbnailInContainerPosition) && (-thumbnailsPosition > imageThumbnailControlPositionX)) {
                thumbnailsNewPosition = 0;
            }

            if (((imageThumbnailControlPositionX - thumbnailInContainerPosition) > (thumbnailsListWidth - thumbnailsWidth)) &&
                ((thumbnailsPosition + imageThumbnailControlPositionX + 70) > thumbnailsWidth)) {
                thumbnailsNewPosition = thumbnailsListWidth - thumbnailsWidth;
            }
        }
        // End: Calculating thumbnails scrolling

        // Start: animation
        $telerik.$(imageToFadeOut).clearQueue();
        if (this.caption.displayCaption) {
            $telerik.$(captionToFadeOut).clearQueue();
        }

        if (this.thumbnails.displayThumbnails) {
            if (!this.thumbnails.thumbnailsAreManualyScrolled) { $telerik.$("#" + this.thumbnails.thumbnailsListControlID).clearQueue(); }

            if (ISSlideShowImage.imageThumbnail.activeImageURL != '') {
                var ThumbnailImageToStopAnimation = document.getElementById(this.images[this.previousImageIndex].imageThumbnail.imageThumbnailControlID).children[0].children[1];
                $telerik.$(ThumbnailImageToStopAnimation).clearQueue()
            }
            else {
                $telerik.$("#" + this.images[this.previousImageIndex].imageThumbnail.imageThumbnailControlID).clearQueue();
            }
        }

        $telerik.$(imageToFadeIn).animate({ opacity: 1 }, this.animation.animationSpeed, function () { ISSlideShow.AutoPlay();$telerik.$(imageToFadeIn).css('z-index', 1); });
        $telerik.$(imageToFadeOut).animate({ opacity: 0 }, this.animation.animationSpeed, function () { $telerik.$(imageToFadeOut).css('z-index', 0); });

        if (this.caption.displayCaption) {
            $telerik.$(captionToFadeIn).animate({ opacity: 1 }, this.animation.animationSpeed);
            $telerik.$(captionToFadeOut).animate({ opacity: 0 }, this.animation.animationSpeed);
        }

        if (this.thumbnails.displayThumbnails) {
            var ThumbnailImageToFadeIn = null;
            var ThumbnailImageToFadeOut = null;

            if (ISSlideShowImage.imageThumbnail.activeImageURL != '')
            {
                var ThumbnailImageToFadeIn = document.getElementById(ISSlideShowImage.imageThumbnail.imageThumbnailControlID).children[0].children[1];
            }

            if (ISSlideShowPreviousImage.imageThumbnail.activeImageURL != '')
            {
                var ThumbnailImageToFadeOut = document.getElementById(this.images[this.previousImageIndex].imageThumbnail.imageThumbnailControlID).children[0].children[1];
            }

            if (ThumbnailImageToFadeIn != null)
            {
                $telerik.$(ThumbnailImageToFadeIn).animate({ opacity: 1 }, this.animation.animationSpeed);
            }
            else
            {
                $telerik.$("#" + ISSlideShowImage.imageThumbnail.imageThumbnailControlID).animate({ opacity: 1 }, this.animation.animationSpeed);
            }

            if (ThumbnailImageToFadeOut != null)
            {
                $telerik.$(ThumbnailImageToFadeOut).animate({ opacity: 0 }, this.animation.animationSpeed);
            }
            else
            {
                $telerik.$("#" + ISSlideShowPreviousImage.imageThumbnail.imageThumbnailControlID).animate({ opacity: 0.5 }, this.animation.animationSpeed);
            }

            if (thumbnailsNewPosition != null && !this.thumbnails.thumbnailsAreManualyScrolled) {
                $telerik.$("#" + this.thumbnails.thumbnailsListControlID).animate({ left: -thumbnailsNewPosition + 'px' }, this.animation.animationSpeed);
            }
        }
        // End: animation
    }

    // ThumbnailHover
    this.ThumbnailHover = function (ImageIndex)
    {
        var ThumbnailLI = document.getElementById(this.images[ImageIndex].imageThumbnail.imageThumbnailControlID);
        var ThumbnailAnchor = ThumbnailLI.children[0];
        
        var ThumbnailImage = null;
        for (ChildrenIndex = 0; ChildrenIndex <= ThumbnailAnchor.children.length - 1; ChildrenIndex++)
        {
            if (ThumbnailAnchor.children[ChildrenIndex].id.toLowerCase().indexOf('thumbnailimagehover') > -1)
            {
                ThumbnailImage = ThumbnailAnchor.children[ChildrenIndex];
            }
        }

        if (ThumbnailImage != null)
        {
            ThumbnailImage.style.display = 'block';
        }
    }

    // ThumbnailHoverOut
    this.ThumbnailHoverOut = function (ImageIndex)
    {
        var ThumbnailLI = document.getElementById(this.images[ImageIndex].imageThumbnail.imageThumbnailControlID);
        var ThumbnailAnchor = ThumbnailLI.children[0];
        
        var ThumbnailImage = null;
        for (ChildrenIndex = 0; ChildrenIndex <= ThumbnailAnchor.children.length - 1; ChildrenIndex++)
        {
            if (ThumbnailAnchor.children[ChildrenIndex].id.toLowerCase().indexOf('thumbnailimagehover') > -1)
            {
                ThumbnailImage = ThumbnailAnchor.children[ChildrenIndex];
            }
        }

        if (ThumbnailImage != null)
        {
            ThumbnailImage.style.display = 'none';
        }
    }

    //ThumbnailsScroll method
    this.ThumbnailsScroll = function (functionEvent) {
        var scrollAreaWidth = parseInt((this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsWidth / 2) * 0.5);

        var thumbnailsContainer = document.getElementById(this.thumbnails.thumbnailsContainerID);
        var thumbnailsList = document.getElementById(this.thumbnails.thumbnailsListControlID);

        var thumbnailsLeftPosition = parseInt(thumbnailsList.style.left.replace('px', ''));

        var mouseOffsetX = functionEvent.layerX;
        var parentElement = functionEvent.srcElement;

        while (parentElement != thumbnailsContainer) {
            mouseOffsetX += parentElement.offsetLeft;
            parentElement = parentElement.parentNode;
        }

        if (mouseOffsetX <= scrollAreaWidth) {
            var scrollSpeed = this.Thumbnails_GetScrollSpeedLeft(mouseOffsetX);
            if ((this.thumbnails.mouseOffsetX != mouseOffsetX)
                && (this.thumbnails.scrollSpeed != scrollSpeed))
                {
                    this.thumbnails.mouseOffsetX = mouseOffsetX;
                    this.thumbnails.scrollSpeed = scrollSpeed;
                    this.thumbnails.thumbnailsAreManualyScrolled = true;
                    this.ThumbnailsScrollLeft(scrollSpeed);
                }
        }
        else if (mouseOffsetX > (thumbnailsContainer.offsetWidth - scrollAreaWidth)) {
            var scrollSpeed = this.Thumbnails_GetScrollSpeedRight(mouseOffsetX);
            if ((this.thumbnails.mouseOffsetX != mouseOffsetX)
                && (this.thumbnails.scrollSpeed != scrollSpeed))
                {
                    this.thumbnails.mouseOffsetX = mouseOffsetX;
                    this.thumbnails.scrollSpeed = scrollSpeed;
                    this.thumbnails.thumbnailsAreManualyScrolled = true;
                    this.ThumbnailsScrollRight(scrollSpeed);
                }
        }
        else {
            clearTimeout(this.thumbnails.thumbnailsTimer);
            this.thumbnails.mouseOffsetX = 0;
            this.thumbnails.scrollSpeed = 0;
            this.thumbnails.thumbnailsAreManualyScrolled = false;
        }
    }

    //Thumbnails_GetScrollLeftSpeed
    this.Thumbnails_GetScrollSpeedLeft = function (mouseOffsetX)
    {
        var scrollAreaWidth = parseInt((this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsWidth / 2) * 0.5);
        var scrollRation = parseInt(scrollAreaWidth / 3);

        var scrollSpeed = parseInt((scrollAreaWidth - mouseOffsetX) / scrollRation);
        scrollSpeed += 1;

        return scrollSpeed;
    }

    //ThumbnailsScrollLeft method
    this.ThumbnailsScrollLeft = function (scrollSpeed) {
        var thumbnailsList = document.getElementById(this.thumbnails.thumbnailsListControlID);
        $telerik.$(thumbnailsList).stop(true);

        clearTimeout(this.thumbnails.thumbnailsTimer);
                
        var thumbnailsLeftPosition = parseInt(thumbnailsList.style.left.replace('px', ''));

        var thumbnailsNewPosition = (thumbnailsLeftPosition + scrollSpeed);

        if (thumbnailsNewPosition >= 0) {
            thumbnailsList.style.left = '0px';
            this.thumbnails.thumbnailsAreManualyScrolled = false;
            return;
        }

        thumbnailsList.style.left = thumbnailsNewPosition + 'px';

        var ISSlideShow = this;
        this.thumbnails.thumbnailsTimer = setTimeout(function () { ISSlideShow.ThumbnailsScrollLeft(scrollSpeed) }, 10);
    }

    //Thumbnails_GetScrollLeftSpeed
    this.Thumbnails_GetScrollSpeedRight = function (mouseOffsetX)
    {
        var thumbnailsWidth = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsWidth;
        var scrollAreaWidth = parseInt((thumbnailsWidth / 2) * 0.5);
        var scrollRation = parseInt(scrollAreaWidth / 3);
        var adjustedLayerX = mouseOffsetX - (thumbnailsWidth - scrollAreaWidth);
        var scrollSpeed = parseInt(adjustedLayerX / scrollRation);
        scrollSpeed += 1;

        return scrollSpeed;
    }

    //ThumbnailsScrollRight method
    this.ThumbnailsScrollRight = function (scrollSpeed) {
        var thumbnailsList = document.getElementById(this.thumbnails.thumbnailsListControlID);
        $telerik.$(thumbnailsList).stop(true);

        clearTimeout(this.thumbnails.thumbnailsTimer);
        
        var thumbnailsWidth = this.slideshowComputedStyle.thumbnailsComputedStyle.thumbnailsWidth;
        
        var thumbnailsLeftPosition = parseInt(thumbnailsList.style.left.replace('px', ''));
        var thumbnailsListWidth = parseInt(thumbnailsList.offsetWidth);
               
        var thumbnailsNewPosition = (thumbnailsLeftPosition - scrollSpeed);

        if (thumbnailsNewPosition <= thumbnailsWidth - thumbnailsListWidth) {
            thumbnailsList.style.left = (thumbnailsWidth - thumbnailsListWidth) + 'px';
            this.thumbnails.thumbnailsAreManualyScrolled = false;
            return;
        }
                       
        thumbnailsList.style.left = thumbnailsNewPosition + 'px';

        var ISSlideShow = this;
        this.thumbnails.thumbnailsTimer = setTimeout(function () { ISSlideShow.ThumbnailsScrollRight(scrollSpeed) }, 10);
    }

    //ThumbnailsScrollStop method
    this.ThumbnailsScrollStop = function (functionEvent) {
        var thumbnailsContainer = document.getElementById(this.thumbnails.thumbnailsContainerID);
        
        var IsThumbnailsControl = (functionEvent.toElement == thumbnailsContainer);

        var thumbnailsList = thumbnailsContainer.children[0];

        IsThumbnailsControl = IsThumbnailsControl || (functionEvent.toElement == thumbnailsList);

        for (childIndex = 0; childIndex <= thumbnailsList.children.length - 1; childIndex++)
        {
            var thumbnailListItem = thumbnailsList.children[childIndex];
            IsThumbnailsControl = IsThumbnailsControl || (functionEvent.toElement == thumbnailListItem);
            IsThumbnailsControl = IsThumbnailsControl || (functionEvent.toElement == thumbnailListItem.children[0]);
            IsThumbnailsControl = IsThumbnailsControl || (functionEvent.toElement == thumbnailListItem.children[0].children[0]);
        }

        if (!IsThumbnailsControl)
        {
            clearTimeout(this.thumbnails.thumbnailsTimer);
            this.thumbnails.thumbnailsAreManualyScrolled = false;
        }
    }
}

function IS_SlideShow_Animation() {
    this.animation = 'fade in'; // fade in;
    this.animationSpeed = 1000;
}

function IS_SlideShow_Autoplay() {
    this.autoplay = true; // true;false
    this.autoplaySpeed = 3000; // in miliseconds
    this.play = true;
    this.slideshowTimer = null;
}

function IS_SlideShow_Caption() {
    this.displayCaption = true; // true; false
    this.caption1ID = '';
    this.caption2ID = '';
    this.captionContainerID = '';
    this.captionPosition = 'bottom'; // bottom; top
}

function IS_SlideShow_ControlsBox() {
    this.controlsBoxContainerID = '';
    this.firstImageButton = true; // true; false
    this.firstImageButtonID = '';
    this.lastImageButton = true; // true; false
    this.lastImageButtonID = '';
    this.nextImageButton = true; // true; false
    this.nextImageButtonID = '';
    this.playPauseButton = true; // true; false
    this.playPauseButtonID = '';
    this.previousImageButton = true; // true; false
    this.previousImageButtonID = '';
}

function IS_SlideShow_Image() {
    this.imageCaption = ''; // caption to display in the caption container when image is shown
    this.imageLink = ''; // URL for the image's target when image is clicked
    this.imageLink_ButtonImageURL = ''; // If imageLinkOption = 'Button' this URL is used for the image displayed in the button that on click redirect to URL specified in imageLink
    this.imageRealHeight = 0; // original height of the image as in file
    this.imageRealWidth = 0; // original width of the image as in file
    this.imageURL = ''; // URL to the image
    this.imageThumbnail = new IS_SlideShow_ImageThumbnail();
}

function IS_SlideShow_ImageControls() {
    this.image1ID = '';
    this.image2ID = '';
    this.imageContainerID = '';
}

function IS_SlideShow_ImageLinkOptions() {
    this.useButton = false; // true - image is not clickable and special button is rendered to redirect to URL specified for the image;
                            // false - image is clickable and on click redirects to URL specified for the image
    this.linkButtonID = ''; // id of the button element that is used to redirect to the URL specified for the image shown at current time
}

function IS_SlideShow_ImageOptions()
{
    this.imageLinkOptions = new IS_SlideShow_ImageLinkOptions();
    this.imageRender = 'HtmlImage'; // HtmlImage; BackGround
}

function IS_SlideShow_ImageThumbnail() {
    this.activeImageURL = '';
    this.hoverImageURL = '';
    this.imageURL = '';
    this.imageThumbnailControlID = '';
}

function IS_SlideShow_ResizeOptions() 
{
    this.resize = false;
}

function IS_SlideShow_Thumbnails() {
    this.displayThumbnails = true; // true; false
    this.mouseOffsetX = 0;
    this.scrollSpeed = 0;
    this.thumbnailsAreManualyScrolled = false;
    this.thumbnailsContainerID = '';
    this.thumbnailsListControlID = '';
    this.thumbnailsPosition = 'bottom'; // bottom; top
    this.thumbnailsTimer = null;
}

//Start: Applyed CSS Rules

function IS_SlideShow_ApplyedCSSRules() {
    this.IS_SlideShow_MainContainer = null;
    this.IS_SlideShow_ImagesContainer = null;
    this.IS_SlideShow_CaptionContainer = null;
    this.IS_SlideShow_Caption = null;
    this.IS_SlideShow_ThumbnailsContainer = null;
    this.IS_SlideShow_ThumbnailsList = null;
    this.IS_SlideShow_ThumbnailsListItem = null;
    this.IS_SlideShow_ThumbnailsListItem_Hover = null;
    this.IS_SlideShow_ControlsBox = null;
    this.IS_SlideShow_ControlsBox_ButtonsList = null;
    this.IS_SlideShow_ControlsBox_FirstImageButton = null;
    this.IS_SlideShow_ControlsBox_PreviousImageButton = null;
    this.IS_SlideShow_ControlsBox_PlayPauseImageButton = null;
    this.IS_SlideShow_ControlsBox_NextImageButton = null;
    this.IS_SlideShow_ControlsBox_LastImageButton = null;
    this.SlideShow_LoadingMessage = null;
}

//End: Applyed CSS Rules

// Start: Computed Style

function IS_SlideShow_ComputedStyle() {
    this.slideshowBorderBottom = 0;
    this.slideshowBorderLeft = 0;
    this.slideshowBorderRight = 0;
    this.slideshowBorderTop = 0;
    this.captionComputedStyle = new IS_SlideShow_CaptionComputedStyle()
    this.controlBoxComputedStyle = new IS_SlideShow_ControlsBoxComputedStyle();
    this.imageComputedStyle = new IS_SlideShow_ImageComputedStyle();
    this.resizeComputedStyle = new IS_SlideShow_ResizeComputedStyle();
    this.slideshowHeight = 0;
    this.slideshowMarginBottom = 0;
    this.slideshowMarginLeft = 0;
    this.slideshowMarginRight = 0;
    this.slideshowMarginTop = 0;
    this.slideshowPaddingBottom = 0;
    this.slideshowPaddingLeft = 0;
    this.slideshowPaddingRight = 0;
    this.slideshowPaddingTop = 0;
    this.slideshowWidth = 0;
    this.thumbnailsComputedStyle = new IS_SlideShow_ThumbnailsComputedStyle();
}

function IS_SlideShow_ControlsBoxComputedStyle() {
    this.controlsBoxBorderBottom = 0;
    this.controlsBoxBorderLeft = 0;
    this.controlsBoxBorderRight = 0;
    this.controlsBoxBorderTop = 0;
    this.controlsBoxHeight = 0;
    this.controlsBoxLeft = null;
    this.controlsBoxListControl = new IS_SlideShow_ControlsBoxListControl_ComputedStyle();
    this.controlsBoxMarginBottom = 0;
    this.controlsBoxMarginLeft = 0;
    this.controlsBoxMarginRight = 0;
    this.controlsBoxMarginTop = 0;
    this.controlsBoxPaddingBottom = 0;
    this.controlsBoxPaddingLeft = 0;
    this.controlsBoxPaddingRight = 0;
    this.controlsBoxPaddingTop = 0;
    this.controlsBoxTop = null;
    this.controlsBoxWidth = 0;
}

function IS_SlideShow_ControlsBoxListControl_ComputedStyle() {
    this.listControlBorderBottom = 0;
    this.listControlBorderLeft = 0;
    this.listControlBorderRight = 0;
    this.listControlBorderTop = 0;
    this.listControlHeight = 0;
    this.listControlMarginBottom = 0;
    this.listControlMarginLeft = 0;
    this.listControlMarginRight = 0;
    this.listControlMarginTop = 0;
    this.listControlPaddingBottom = 0;
    this.listControlPaddingLeft = 0;
    this.listControlPaddingRight = 0;
    this.listControlPaddingTop = 0;
    this.listControlWidth = 0;
}

function IS_SlideShow_CaptionComputedStyle() {
    this.captionBorderBottom = 0;
    this.captionBorderLeft = 0;
    this.captionBorderRight = 0;
    this.captionBorderTop = 0;
    this.captionHeight = 0;
    this.captionLeft = null
    this.captionMarginBottom = 0;
    this.captionMarginLeft = 0;
    this.captionMarginRight = 0;
    this.captionMarginTop = 0; ;
    this.captionPaddingBottom = 0;
    this.captionPaddingLeft = 0;
    this.captionPaddingRight = 0;
    this.captionPaddingTop = 0;
    this.captionTop = null;
    this.captionWidth = 0;
}

function IS_SlideShow_ImageComputedStyle() {
    this.imageContentHeight = 0;
    this.imageContentWidth = 0;
    this.imageLeft = 0;
    this.imageTop = 0;
}

function IS_SlideShow_ResizeComputedStyle()
{   
    this.resizeBorderBottom = 0;
    this.resizeBorderLeft = 0;
    this.resizeBorderRight = 0;
    this.resizeBorderTop = 0;
    this.resizeHeight = 0;
    this.resizeMarginBottom = 0;
    this.resizeMarginLeft = 0;
    this.resizeMarginRight = 0;
    this.resizeMarginTop = 0; ;
    this.resizePaddingBottom = 0;
    this.resizePaddingLeft = 0;
    this.resizePaddingRight = 0;
    this.resizePaddingTop = 0;
    this.resizeWidth = 0;
}

function IS_SlideShow_ThumbnailsComputedStyle() {
    this.thumbnailsBorderBottom = 0;
    this.thumbnailsBorderLeft = 0;
    this.thumbnailsBorderRight = 0;
    this.thumbnailsBorderTop = 0;
    this.thumbnailsHeight = 0;
    this.thumbnailsLeft = null;
    this.thumbnailsListControl = new IS_SlideShow_ThumbnailsListControl_ComputedStyle();
    this.thumbnailsPaddingBottom = 0;
    this.thumbnailsPaddingLeft = 0;
    this.thumbnailsPaddingRight = 0;
    this.thumbnailsPaddingTop = 0;
    this.thumbnailsTop = null;
    this.thumbnailsWidth = 0;
}

function IS_SlideShow_ThumbnailsListControl_ComputedStyle() {
    this.listControlBorderBottom = 0;
    this.listControlBorderLeft = 0;
    this.listControlBorderRight = 0;
    this.listControlBorderTop = 0;
    this.listControlHeight = 0;
    this.listControlLeft = null;
    this.listControlMarginBottom = 0;
    this.listControlMarginLeft = 0;
    this.listControlMarginRight = 0;
    this.listControlMarginTop = 0;
    this.listControlPaddingBottom = 0;
    this.listControlPaddingLeft = 0;
    this.listControlPaddingRight = 0;
    this.listControlPaddingTop = 0;
    this.listControlTop = null;
    this.listControlWidth = 0;
}

// End: Computed Style

// Start: Helpers

function IS_SlideShow_RemoveCssUnits(cssValue) {
    if (cssValue == null) return '';
    return cssValue.replace('%', '').replace('in', '').replace('cm', '').replace('mm', '').replace('em', '').replace('ex', '').replace('pt', '').replace('pc', '').replace('px', '');
}

function IS_SlideShow_GetDynamicImageURL(ImageURL, Width, Height)
{
    if (ImageURL.replace(/ /g, '') == '') { return ''; }
    if (ImageURL[0] == '/') { ImageURL = ImageURL.substring(1, ImageURL.length); }
    if (window.location.host == 'localhost')
    {
        return '/infoservenet/D_images/' + Width + '/' + Height + '/x/' + ImageURL;
    }
    else{
        return '/D_images/' + Width + '/' + Height + '/x/' + ImageURL;
    }
}

// End: Helpers
