﻿//28 June 2011   Vidya Panthalil  javascript used to display Feedback Indicator image and to show modal popup
//17 Nov  2011   Sreejith G A     Replaced feedbackIndicatorImage class with feedbackIndicatorImageId for fancy box pop up

$(document).ready(function() {

    //For restricting Feedback Indicator Image to display on survey loader page and to manage visibility of noThanks button
    if ($('div.outer').length > 0) {

        $('div.outer').append('<div  id="feedbackIndicatorImage" class="feedbackIndicatorImage" ></div>');
        var pageLevelFeedbackCref = $get('PageLevelFeedbackCref').value;
        var feedbackIndicatorImageId = document.getElementById("feedbackIndicatorImage");   
       
        // For loading the fancybox popup on the click event of Feedback Indicator Image
        $(feedbackIndicatorImageId).fancybox({
            'transitionIn': 'fade',
            'transitionOut': 'fade',
            'easingIn': 'easeOutBack',
            'easingOut': 'easeInBack',
            'autoDimensions': true,
            'overlayColor' : '#000',
            'overlayOpacity': 0.80,
            'scrolling' :'no',
            'width': 560,
            'height': 385,
            'type': 'iframe',
            'href': 'SurveyLoader.aspx?cref=' + pageLevelFeedbackCref + '&pageLevelFeedback=true',
            'z-index': 50000
        });
    }
    else {

        // Functionalities required only for SurveyLoader.aspx page, which doesn't have a master page
        $(".cancelPageLevelFeedback").click(function() {
            parent.$.fancybox.close()
        });
        $(".submitPageLevelFeedback").click(function() {
            parent.$.fancybox.close();
            submitQuestionnaire.call(this); return false;
        });

    }
    if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
        $('#feedbackIndicatorImage').hide();

   }

});
