InfoFind.SlideShow.Event_BeforeDisplay = SlideShow_BeforeDisplay;
InfoFind.SlideShow.Event_AfterDisplay = SlideShow_AfterDisplay;

function SlideShow_BeforeDisplay() {
    InfoFind.HTML.Element.SetVisibility("Table1", false);
}

function SlideShow_AfterDisplay() {
    InfoFind.HTML.Element.SetVisibility("Table1", true);
}

function cboAnimationType_onchange() {
    InfoFind.SlideShow.AnimationType = InfoFind.DataForms.GetOptionText("cboAnimationType");
    BuildJavaScript();
}

function cboPageOverlayPercent_onchange() {
    InfoFind.SlideShow.PageOverlayPercent = InfoFind.DataTypes.StringToNumber(InfoFind.DataForms.GetOptionText("cboPageOverlayPercent"));
    BuildJavaScript();
}

function cboPageOverlayBackgroundColor_onchange() {
    InfoFind.SlideShow.PageOverlayBackgroundColor = InfoFind.DataForms.GetOptionText("cboPageOverlayBackgroundColor");
    BuildJavaScript();
}

function cboPageOverlayBackgroundImage_onchange() {
    InfoFind.SlideShow.PageOverlayBackgroundImage = InfoFind.DataForms.GetOptionText("cboPageOverlayBackgroundImage");
    BuildJavaScript();
}

function cboDisplayImageSeconds_onchange() {
    InfoFind.SlideShow.DisplayImageSeconds = InfoFind.DataTypes.StringToNumber(InfoFind.DataForms.GetOptionText("cboDisplayImageSeconds"));
    BuildJavaScript();
}

function cboAnimationTime_onchange() {
    InfoFind.SlideShow.AnimationTime = InfoFind.DataTypes.StringToNumber(InfoFind.DataForms.GetOptionText("cboAnimationTime"));
    BuildJavaScript();
}

function cboImageSize_onchange() {
    InfoFind.SlideShow.ImageSize = InfoFind.DataTypes.StringToNumber(InfoFind.DataForms.GetOptionText("cboImageSize"));
    BuildJavaScript();
}

function BuildJavaScript() {
    var JS = '<script type="text\/javascript">\n';
    if (InfoFind.DataForms.GetOptionText("cboAnimationType") != "Advanced") {
        JS += 'InfoFind.SlideShow.AnimationType = "' + InfoFind.DataForms.GetOptionText("cboAnimationType") + '";\n';
    }
    if (InfoFind.DataForms.GetOptionText("cboPageOverlayPercent") != 50) {
        JS += 'InfoFind.SlideShow.PageOverlayPercent = ' + InfoFind.DataForms.GetOptionText("cboPageOverlayPercent") + ';\n';
    }
    if (InfoFind.DataForms.GetOptionText("cboPageOverlayBackgroundColor") != "Black") {
        JS += 'InfoFind.SlideShow.PageOverlayBackgroundColor = "' + InfoFind.DataForms.GetOptionText("cboPageOverlayBackgroundColor") + '";\n';
    }
    if (InfoFind.DataForms.GetOptionText("cboPageOverlayBackgroundImage") != "") {
        JS += 'InfoFind.SlideShow.PageOverlayBackgroundImage = "' + InfoFind.DataForms.GetOptionText("cboPageOverlayBackgroundImage") + '";\n';
    }
    if (InfoFind.DataForms.GetOptionText("cboDisplayImageSeconds") != 2) {
        JS += 'InfoFind.SlideShow.DisplayImageSeconds = ' + InfoFind.DataForms.GetOptionText("cboDisplayImageSeconds") + ';\n';
    }
    if (InfoFind.DataForms.GetOptionText("cboAnimationTime") != 1) {
        JS += 'InfoFind.SlideShow.AnimationTime = ' + InfoFind.DataForms.GetOptionText("cboAnimationTime") + ';\n';
    }
    if (InfoFind.DataForms.GetOptionText("cboImageSize") != 0.75) {
        JS += 'InfoFind.SlideShow.ImageSize = ' + InfoFind.DataForms.GetOptionText("cboImageSize") + ';\n';
    }
    if (JS == '<script type="text\/javascript">\n') {
        InfoFind.HTML.Element.SetText("preJS_Code_Example", "");
        InfoFind.HTML.Element.Hide("divJS_Code_Example");
    } else {
        JS += '<\/script>';
        InfoFind.HTML.Element.SetText("preJS_Code_Example", JS);
        InfoFind.HTML.Element.Show("divJS_Code_Example");
    }
}
