﻿$(function() {

	$('.headerSearchField').focus(function() {
		if ($(this).val() == "Search") {
			$(this).val("");
		}
	}).blur(function() {
		if ($(this).val() === "") {
			$(this).val("Search");
		}
	});
});


var documentCheckCount = 0;
var questionAnswered;

function ShowHideFilter(hiddenfieldID, mainDivID, footerDivID, buttonImageID, headerFooterImageID) {
    if (document.getElementById(hiddenfieldID).value == 'none'
            || document.getElementById(hiddenfieldID).value == ''
            || document.getElementById(hiddenfieldID).value == null) {
        document.getElementById(hiddenfieldID).value = 'inline';
        document.getElementById(buttonImageID).src = '/Images/nav/rightbar/filter_close.gif';
        document.getElementById(headerFooterImageID).src = '/Images/nav/rightbar/filterPanelHeaderBtm1.gif';
    }
    else {
        document.getElementById(hiddenfieldID).value = 'none';
        document.getElementById(buttonImageID).src = '/Images/nav/rightbar/filter_open.gif';
        document.getElementById(headerFooterImageID).src = '/Images/nav/rightbar/filterPanelHeaderBtm2.gif';
    }

    document.getElementById(mainDivID).style.display = document.getElementById(hiddenfieldID).value;
    document.getElementById(footerDivID).style.display = document.getElementById(hiddenfieldID).value;
}

function ShowFilterPanel(hiddenfieldID, mainDivID, footerDivID, buttonImageID, headerFooterImageID) {
    document.getElementById(hiddenfieldID).value = 'inline';
    document.getElementById(buttonImageID).src = '/Images/nav/rightbar/filter_close.gif';
    document.getElementById(headerFooterImageID).src = '/Images/nav/rightbar/filterPanelHeaderBtm1.gif';
    document.getElementById(mainDivID).style.display = document.getElementById(hiddenfieldID).value;
    document.getElementById(footerDivID).style.display = document.getElementById(hiddenfieldID).value;
}

function SetFilterHiddenField(triggerID, hiddenfieldID) {
    if (document.getElementById(triggerID) && document.getElementById(hiddenfieldID)) {
        document.getElementById(hiddenfieldID).value = document.getElementById(triggerID).innerHTML;
    }
}

function SetTextBoxFilterHiddenField(triggerID, hiddenfieldID) {
    if (document.getElementById(triggerID) && document.getElementById(hiddenfieldID)) {
        document.getElementById(hiddenfieldID).value = document.getElementById(triggerID).value;
    }
}

function SetCheckBoxFilterHiddenField(checkboxID, hiddenfieldID) {
    if (document.getElementById(checkboxID) && document.getElementById(hiddenfieldID)) {
        if (document.getElementById(checkboxID).checked) {
            document.getElementById(hiddenfieldID).value = document.getElementById(checkboxID).value;
        } else {
            document.getElementById(hiddenfieldID).value = '0';
        }
    }
}

/*
=================================================================================
FAVOURITES
=================================================================================
*/

function toggleFavouritesSection(sectionID, imageID) {
    if (document.getElementById(sectionID) && document.getElementById(imageID)) {
        if (document.getElementById(sectionID).style.display == 'none') {
            document.getElementById(sectionID).style.display = 'inline';
            document.getElementById(imageID).src = '/Images/ioclub/icons/closeIcon.gif';
        } else {
            document.getElementById(sectionID).style.display = 'none';
            document.getElementById(imageID).src = '/Images/ioclub/icons/openIcon.gif';
        }
    }
}

function toggleFavouritesPanel(result) {
    if (result == null || result == "")
        document.getElementById("divFavouritesPanel").style.display = 'none';
    else
        document.getElementById("divFavouritesPanel").style.display = 'inline';
}

function RetrieveYourFavouritesTopNavOnComplete(result, txtResult, methodName) {
    document.getElementById("ulYourFavouritesTopNav").innerHTML = result;
}

function RetrieveYourFavouritesOnComplete(result, txtResult, methodName) {
    document.getElementById("divYourFavourites").innerHTML = result;

    ShowHideFavourites();
}

function ShowHideFavourites() {
    if (document.getElementById("hfNoOfFavourites").value == "0")
        toggleFavouritesPanel('');
    else
        toggleFavouritesPanel('true');
}

function YourFavouritesError(error, userContext, methodName) {
    if (error != null)
    //alert(error.get_message());
        alert("An error occured while processing your request");
}
/*
=================================================================================
Iomega Specific
=================================================================================
*/
// Hides and displays the preference panel
function showHidePreferences() {
    if (document.getElementById("hideSearchBar").className == "headerSearchHide") {
        document.getElementById("hideSearchBar").className = "headerSearch";
        document.getElementById("preferencesPanel").style.display = "none";
        document.getElementById("preferencesTab").className = "preferencesTab";
    }
    else {
        document.getElementById("hideSearchBar").className = "headerSearchHide";
        document.getElementById("preferencesPanel").style.display = "block";
        document.getElementById("preferencesTab").className = "preferencesTabActive";
    }
}

//webmethod for setting language
function setLanguage(languageID) {
    PageMethods.UpdateLanguage(languageID, OnCallPerformSetLanguageComplete, OnCallPerformSetLanguageError, '');
}

function OnCallPerformSetLanguageComplete(result, txtresult, methodName) {
    window.location.href = window.location.href;
}

function OnCallPerformSetLanguageError(error, userContext, methodName) {
    if (error !== null) {
        alert(error.get_message());
    }
}

function setContactGrading(contactID, useAllProducts) {
    var appConfigKey = 'AllProductsContactGradingID';
    if (!useAllProducts)
        appConfigKey = 'NetworkStorageContactGradingID';
    $.ajax({
        type: "POST",
        url: "/Modules/Content/Default.aspx/SetContactGrading",
        data: '{"contactID" : ' + contactID + ', "appConfigKey" : "' + appConfigKey + '"}',
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function () {
            var existingGrading = $('.menu a#idCurrentFocus span');
            var newGrading = $('#idSetGrading');

            var existingText = $(existingGrading).text();
            var newText = $(newGrading).text();
            
            $(existingGrading).text(newText);
            $(newGrading).text(existingText);
            $(newGrading).attr('href', 'javascript:setContactGrading(' + contactID + ', ' + !useAllProducts + ');');
        },
        error: function () {
            alert('Unknown Error');
        }
    });
}

//webmethod for setting product focus
function setProductFocus(productFocusValue) {
    PageMethods.SetProductFocus(productFocusValue, OnCallPerformSetProductFocusComplete, OnCallPerformSetProductFocusError, '');
}

function OnCallPerformSetProductFocusComplete(result, txtresult, methodName) {
    window.location.href = window.location.href;
}

function OnCallPerformSetProductFocusError(error, userContext, methodName) {
    if (error !== null) {
        alert(error.get_message());
    }
}

// Validates VAR Application Form
function validateAppForm() {
    var validationMessage = "";
    
    // year established
    if (document.getElementById("ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_txtCompanyDetails").value == "")
        validationMessage = SiteLabel.TXT1142 + "\n";

    // Annual revenue
    if (document.getElementById("ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_ddlAnnualRevenue").value == "-1")
        validationMessage = validationMessage + SiteLabel.TXT1143 + "\n";

    // No of Employees
    if (document.getElementById("ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_txtNumberOfEmployees").value == "")
        validationMessage = validationMessage + SiteLabel.TXT1144 + "\n";

    // No of Sales Employees
    if (document.getElementById("ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_txtNumberOfSalesEmployees").value == "")
        validationMessage = validationMessage + SiteLabel.TXT1145 + "\n";

    // Website
    if (document.getElementById("ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_txtWebsite").value == "")
        validationMessage = validationMessage + SiteLabel.TXT1149 + "\n";

    // Only check contact details if the Primary checkbox has been checked.
    if (!document.getElementById("ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_chkPrimaryCheck").checked) {
    
        // Gender
        if (document.getElementById("ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_ddlGender").value == "-1")
            validationMessage = validationMessage + SiteLabel.TXT526 + "\n";

        // First Name
        if (document.getElementById("ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_txtPrimaryFirstName").value == "")
            validationMessage = validationMessage + SiteLabel.TXT524 + "\n";

        // Last Name
        if (document.getElementById("ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_txtPrimaryLastName").value == "")
            validationMessage = validationMessage + SiteLabel.TXT525 + "\n";

        // Job Title
        if (document.getElementById("ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_txtPrimaryJobTitle").value == "")
            validationMessage = validationMessage + SiteLabel.TXT527 + "\n";

        // Email Address missing
        if (document.getElementById("ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_txtPrimaryEmailAddress").value == "") {
            validationMessage = validationMessage + SiteLabel.TXT1146 + "\n";
        }
        else {
            // Email Address valid
            var filter = /^([a-zA-Z0-9_\.\-\'])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
            
            if (!filter.test(document.getElementById("ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_txtPrimaryEmailAddress").value))
                validationMessage = validationMessage + SiteLabel.TXT1147 + "\n";
        }
        
//        
//        // TO DO
////        if (document.getElementById("ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_txtPrimaryEmailAddress").text == "")
////            validationMessage = validationMessage + SiteLabel.TXT1147;

        // Phone number
        if (document.getElementById("ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_txtPrimaryPhone").value == "")
            validationMessage = validationMessage + SiteLabel.TXT1148;
    }

    if (validationMessage != "") {
        alert(validationMessage);
        return false;
    }
}

$(document).ready(function() {

    //	REGISTRATION CONTACT DETAILS TOGGLE
    //----------------------------------------------------
    // the default
    //$('div.primaryDets input').attr('disabled', true);
    //$('div.primaryDets select').attr('disabled', true);
    // the show/hide function

    // the disable/enable function

    $("span.primaryCheck input").click(function(event) {
        $('div.primaryDets').slideToggle('def');
        if ($('span.primaryCheck input').is(':checked')) {
            $('div.primaryDets input').attr('disabled', true);
            $('div.primaryDets select').attr('disabled', true);
        } else {
            $('div.primaryDets input').removeAttr('disabled');
            $('div.primaryDets select').removeAttr('disabled');

        }
    });

    // Training
    $('a.toggleTests').click(function(e) {
        e.preventDefault();
        if ($(this).hasClass('toggleTestsOpen')) {
            $(this).next('div.trainingTestList').children(' div.trainingTestListInner').slideUp();
            $(this).removeClass('toggleTestsOpen');
            $(this).text(SiteLabel.TXT1180);
        } else {
            $(this).next('div.trainingTestList').children(' div.trainingTestListInner').slideDown();
            $(this).addClass('toggleTestsOpen');
            $(this).text(SiteLabel.TXT36);
        }
    });
});

function csHideAppContactData() {
    $('div.primaryDets').slideToggle('def');
}

var TrainingModule = new function() {

    this.c = '#core-overlay-container';
    this.ct = '#core-overlay-content';
    this.showHideSpeed = 300;
    var ajaxLoadComplete = false;
    var showAnimComplete = false;
    var scrollTopSpeed = 400;
    this.prevScrollTop = 0;

    this.ShowTestOverlay = function() {
        $('#overlay').stop();
        $('#overlay').fadeTo(0, 0);
        $('#overlay').width($(window).width());
        $('#overlay').height($('body').height());
        $('#overlay').css('visibility', 'visible');
        $('#overlay').css('padding', '0');
        $('#overlay').css('z-index', '10000');
        $('#overlay').fadeTo(400, 0.7);
        $('div.trainingPanelContainer').show();
        $('div.trainingTestPanelSurround').animate({
            height: $('div.trainingTestPanelSurround div.miniPanel').outerHeight() + 20
        }, 'def', function(e) {
            $('div.trainingTestPanelSurround div.testOverlayContainer').show();
            $('div.trainingTestPanelSurround div.testOverlayContainer').animate({
                width: 604,
                height: $('div.testOverlayContainer div.testOverlay').height() + 26
            }, 'def', function(e) {
                $('div.testOverlayContainer div.testOverlay').fadeTo(0, 0);
                $('div.testOverlayContainer div.testOverlay').css('visibility', 'visible');
                $('div.testOverlayContainer div.testOverlay').fadeTo(600, 1);
                window.onbeforeunload = function() {
                    return SiteLabel.TXT1191;
                }
                $('div.testNav a.exitTestButton').bind('click', function(e) {
                    e.preventDefault();

                });
            });
        });
        $('div.trainingPanelContainer').animate({
            height: $('div.trainingTestPanelSurround div.miniPanel').outerHeight() + 28
        });
    }

    this.AnswerQuestion = function(testSessionID, sectionID, questionID, activityID) {
        var answerID = "";

        $("input[@name='testAnswer']:checked").each(function() {
            answerID += $(this).val() + ",";
        });

        if (answerID == undefined || answerID == "") {
            alert(SiteLabel.TXT1192);
        }
        else {
            // prevent the submit button being pressed twice
            if (questionAnswered != 1) {
                questionAnswered = 1;
                answerID = answerID.substring(0, answerID.length - 1);
                PageMethods.AnswerQuestion(testSessionID, sectionID, questionID, answerID, activityID,
                OnCallQuestionOverlayComplete, OnCallQuestionOverlayError, activityID);
            }
        }
    }

    this.RetakeTest = function(testID) {
        PageMethods.RetakeTest(testID, OnCallQuestionOverlayComplete, OnCallQuestionOverlayError, testID)
    }

    function OnCallQuestionOverlayComplete(result, activityID, method) {

        $('div.testOverlayContainer div.testOverlay div.testOverlayContent').fadeTo(400, 0, function() {
            $('div.testOverlayContainer div.testOverlay div.testOverlayContent').html(result.QuestionHTML)
            $('.downloadCertButton').click(function() { window.onbeforeunload = function() { } });


            $('#currentPercent').html(SiteLabel.TXT1186 + ": " + result.ResultPercentage + "%");
            $('#previousAnswer').html(result.PrevAnswerHTML);

            $('#hfQuestionNo').val(result.CurrentQuestion);

        });

        $('div.trainingTestPanelSurround div.testOverlayContainer').animate({
            height: $('div.testOverlayContainer div.testOverlay').height() + 26
        }, 'def', function() {
            $('div.testOverlayContainer div.testOverlay div.testOverlayContent').fadeTo(400, 1);
        });

        // If the test is complete, then we don't want the warning message appearing when we click a link on the page
        // or a browser button.
        if (result.TestComplete == 1) {
            window.onbeforeunload = function() { }
        }

        // If the user has completed the test and passed it, we need to get the certificate
        if (result.TestPassed == 1) {
            PageMethods.GetDocument(activityID, OnCallGetDocumentComplete, OnCallQuestionOverlayError, activityID);
        }

        setTimeout("questionAnswered = 0;", 500);
    }

    function OnCallGetDocumentComplete(result, activityID, method) {
        // if there is no document created yet, then check again, otherwise enable link
        if (result != "0") {
            setTimeout(function() { TrainingModule.fadeLoadingBar(result); }, 2000)
        }
        else {
            if (documentCheckCount < 30) {
                documentCheckCount = documentCheckCount + 1;
                setTimeout(function() { PageMethods.GetDocument(activityID, OnCallGetDocumentComplete, OnCallQuestionOverlayError, activityID); }, 1000);
            }
        }
    }


    function OnCallQuestionOverlayError(error, userContext, methodName) {
        if (error !== null) {
            alert(error.get_message());
        }
    }

    this.ConfirmCloseTestOverlay = function() {
        if (confirm(SiteLabel.TXT1190)) {
            TrainingModule.CloseTestOverlay();
        }
    }

    this.CloseTestOverlay = function() {
        window.onbeforeunload = function() { }
        $('div.testNav a.exitTestButton').unbind('click');

        // Change button text
        var totalQuestions = parseInt($('#ctl00_ctl00_ContentPlaceHolderPageFrame_ContentPlaceHolderMain_Question_hfTotalQuestions').val());
        var currentQuestion = parseInt($('#hfQuestionNo').val());

        if (currentQuestion > 1 && currentQuestion < totalQuestions)
            $('.startTest span.text').html(SiteLabel.TXT1216);  // Resume
        else
            $('.startTest span.text').html(SiteLabel.TXT1212);  // Start

        $('div.testOverlayContainer div.testOverlay').fadeTo(600, 0, function() {
            $('div.testOverlayContainer div.testOverlay').css('visibility', 'hidden');
            $('div.trainingTestPanelSurround div.testOverlayContainer').animate({
                width: 0,
                height: 0
            }, 'def', function() {
                $('div.trainingTestPanelSurround div.testOverlayContainer').hide();
                $('div.trainingTestPanelSurround').animate({
                    height: 0
                });
                $('div.trainingPanelContainer').animate({
                    height: 0
                }, 'def', function() { $('div.trainingPanelContainer').hide(); });
            });
            $('#overlay').fadeTo(400, 0, function() { $('#overlay').css('visibility', 'hidden'); });
        });
    }

    this.fadeLoadingBar = function(result) {
        $('.downloadCertButton').attr("href", "/Modules/Training/DownloadCertificate.aspx?documentID=" + result);
        $('#loadingBarContainer').fadeOut('def', function() { $(this).remove(); });
    }

    this.GetTrainingCourse = function(id) {
        TrainingModule.ShowOverlay("GetTrainingCourse", "{\"CourseID\":" + id + "}", OnGetTrainingResult);
    }

    this.DisplayCourse = function(url) {
        if (url != "") {
            $(TrainingModule.ct).html('<div id="iomega-swfContainer">'
					+ '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="799" height="599" id="mymoviename">'
					+ '<param name="movie" value="' + url + '" />'
					+ '<param name="quality" value="high" />'
					+ '<param name="allowScriptAccess" value="always" />'
					+ '<param name="bgcolor" value="#ffffff" />'
					+ '<param name="wmode" value="transparent" />'
					+ '<embed src="' + url + '" wmode="transparent" allowScriptAccess="always" quality="high" bgcolor="#ffffff" width="799" height="599" name="mymoviename" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'
					+ '</embed>'
					+ '</object>'
					+ '</div>');
            showAnimComplete = true;
            ajaxLoadComplete = true;
            AnimateOverlay();
        }
        else {
            alert("File does not exist");
        }
    }

    //    var OnGetTrainingResult = function(_success, _data) {
    //        if (_success) {
    //            if (_data.d.Success) {
    //                $(TrainingModule.ct).html('<div id="iomega-swfContainer">'
    //					+ '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="468" height="60" id="mymoviename">'
    //					+ '<param name="movie" value="' + _data.d.ResponseString + '" />'
    //					+ '<param name="quality" value="high" />'
    //					+ '<param name="bgcolor" value="#ffffff" />'
    //					+ '<param name="wmode" value="transparent" />'
    //					+ '<embed src="' + _data.d.ResponseString + '" wmode="transparent" quality="high" bgcolor="#ffffff" width="799" height="599" name="mymoviename" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'
    //					+ '</embed>'
    //					+ '</object>'
    //					+ '</div>');
    //                showAnimComplete = true;
    //                ajaxLoadComplete = true;
    //                AnimateOverlay();
    //            } else {
    //                alert(_data.d.ResponseString);
    //            }
    //        } else {
    //            alert('error');
    //        }
    //    }

    this.TakeTest = function() {
        $('#core-overlay-close').click();
        this.ShowTestOverlay();
    }

    this.ShowStartCourseOverlay = function(url) {

        $('body').append(TrainingModule.OverlayFramework);
        PositionOverlay(false, true, window);
        $('#overlay').show();
        $('#overlay').css({ 'visibility': 'visible', 'width': '100%', 'height': '100%' });

        $('#overlay').fadeTo(TrainingModule.showHideSpeed, 0.7, function() {

            showAnimComplete = true;
            AnimateOverlay();
        });

        TrainingModule.prevScrollTop = $(window).scrollTop();
        $('html,body').animate({ scrollTop: 0 }, scrollTopSpeed);
        $(TrainingModule.c).fadeIn(TrainingModule.showHideSpeed);
        var _positionOverlay = function() {
            PositionOverlay(false, false, window);
        }
        $(window).bind('resize', _positionOverlay);
        $('#core-overlay-close').click(function(evt) {
            evt.preventDefault();
            TrainingModule.HideOverlay(_positionOverlay);
        });

        TrainingModule.DisplayCourse(url);
    }

    // Positions the overlay relative to the window
    var PositionOverlay = function(loaded, start, parentObj) {

        var startWidth = 200;
        var startHeight = 200;

        var startOffsetLeft = ($(parentObj).width() / 2) - ((startWidth + $(TrainingModule.c).outerWidth() - $(TrainingModule.c).innerWidth()) / 2);
        var startOffsetTop = ($(parentObj).height() / 2) - ((startHeight + $(TrainingModule.c).outerHeight() - $(TrainingModule.c).innerHeight()) / 2);

        if (start) {
            if (!loaded)
                $(TrainingModule.c).css({ left: startOffsetLeft, top: startOffsetTop });
            else {
                $(TrainingModule.c).animate({
                    width: 200,
                    height: 200,
                    left: startOffsetLeft,
                    top: startOffsetTop
                });
            }
        } else {
            var offsetTop;
            var offsetLeft;
            if ($(parentObj).height() < ($(TrainingModule.ct).innerHeight() + $(TrainingModule.c).outerHeight() - $(TrainingModule.c).innerHeight() + 20))
                offsetTop = 10;
            else
                offsetTop = startOffsetTop - ($(TrainingModule.ct).innerHeight() - startHeight) / 2;
            if ($(parentObj).width() < (($(TrainingModule.ct).innerWidth() + $(TrainingModule.c).outerWidth()) - $(TrainingModule.c).innerWidth()) + 20)
                offsetLeft = 8;
            else
                offsetLeft = startOffsetLeft - ($(TrainingModule.ct).innerWidth() - startWidth) / 2;
            if (loaded) {
                $(TrainingModule.c).animate({
                    width: $(TrainingModule.ct).innerWidth(),
                    height: $(TrainingModule.ct).innerHeight(),
                    left: offsetLeft,
                    top: offsetTop
                }
				, TrainingModule.showHideSpeed
				, function() {
				    $(TrainingModule.ct).fadeTo(0, 0);
				    $(TrainingModule.ct).css('visibility', 'visible');
				    $(TrainingModule.ct).fadeTo(TrainingModule.showHideSpeed, 1);
				});
            } else {
                $(TrainingModule.c).css('top', offsetTop.toString() + 'px');
                $(TrainingModule.c).css('left', offsetLeft.toString() + 'px');
            }
        }
    }

    var AnimateOverlay = function() {
        if (ajaxLoadComplete && showAnimComplete) {
            $('#core-overlay-container div.core-overlay-largeSpinner').remove();
            PositionOverlay(true, false, window);
            ajaxLoadComplete = false;
            showAnimComplete = false;
        }
    }

    this.HideOverlay = function(_positionOverlay) {
        $(TrainingModule.c).fadeTo(TrainingModule.showHideSpeed, 0, function() {
            $(TrainingModule.c).remove();
        });
        $('#overlay').fadeTo(TrainingModule.showHideSpeed, 0, function() {
            $('#overlay').css('visibility', 'hidden');
        });
        $('html,body').animate({ scrollTop: TrainingModule.prevScrollTop }, scrollTopSpeed);
        $(window).unbind('resize', _positionOverlay);
    }

    this.OverlayFramework = ''
	+ '<div id="core-overlay-container" class="core-TrainingModule">'
	+ ' <div class="core-overlay-largeSpinner"></div>'
	+ ' <div id="core-overlay-content"></div>'
	+ ' <a id="core-overlay-close" href="#"></a>'
	+ '</div>';

    function GetData(_mode, _data, _callback) {
        if (_mode != "loading") {
            $.ajax({
                type: "POST",
                url: "/Modules/Training/TestIntro.aspx/" + _mode,
                data: _data,
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(_retData) {
                    if (typeof _callback == 'function')
                        _callback(true, _retData);
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    var d = JSON.parse("{\"d\":{\"Status\":\"" + textStatus + "\",\"ErrorText\":\"" + errorThrown + "\"}}");
                    if (typeof _callback == 'function')
                        _callback(false, d);
                }
            });
        } else {
            $(TrainingModule.ct).html('');
            $(TrainingModule.ct).before('<div class="core-overlay-largeSpinner"></div>');
            PositionOverlay(true, true, window);
        }
    }


}
