﻿$(document).ready(function() {

    $('.HelperToolTip').tooltip({ showURL: false, fade: 250, showBody: " - " });

    $("img").error(function() {
        $(this).unbind("error").attr("src", "/images/Video/NoImage.gif");
    });

    $(".HelperToolTip").mouseover(function() {
        $(this).attr({ src: $(this).attr("src").replace('.gif', '_hover.gif') });
    });

    $(".HelperToolTip").mouseout(function() {
        $(this).attr({ src: $(this).attr("src").replace('_hover.gif', '.gif') });
    });

    $(".btClickSelectVideoFile").click(function() {
        $(".txtVideo").val($(".chkListVideos").find("input:checked").val());
        this.click();
    });

    $(".ddlQuestionChoices").change(function() {
        //Hide all for this question's answers
        jQuery.each($(this).children(), function() {
            if ($(this).attr("DependencyQuestions") != null) {
                jQuery.each(($(this).attr("DependencyQuestions")).split(":"), function() {
                    $(".divQuestionItem_" + this).attr("style", "display:none;");
                });
            }
        });
        //Show questions dependent of the selected answer 
        if ($(this).children("option:selected").attr("DependencyQuestions") != null) {
            jQuery.each(($(this).children("option:selected").attr("DependencyQuestions")).split(":"), function() {
                $(".divQuestionItem_" + this).attr("style", "display:block;");
            });
        }
    });

});


