﻿// Get a reference to the PageRequestManager.
var prm = Sys.WebForms.PageRequestManager.getInstance();

// Using the prm reference, hook _initializeRequest and _endRequest, 
// to run the code at the begin and end of any async postbacks that occur.
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);

// Executed anytime an async postback occurs.
function InitializeRequest(sender, args) {
    // Get a reference to the element that raised the postback, and disables it.
    //$get(args._postBackElement.id).disabled = true;
}

// Executed when the async postback completes.
function EndRequest(sender, args) {
    // Get a reference to the element that raised the postback which is completing, and enable it.
    //$get(sender._postBackSettings.sourceElement.id).disabled = false;

    if ($get('fc_interactive') != null) {
        var xml = getQueryParamValue("tag");

        if (xml != "") {
            window["InteractiveMap"] = new Object();
            var soPromo = new SWFObject("../Assets/Flash/GarmapMod.swf", "InteractiveMap", "540", "317", "8", "#FFFFFF");
            soPromo.addVariable("xmlPath", xml + ".xml");
            soPromo.addParam("wmode", "transparent");
            soPromo.write("fc_interactive");
        }
        else {
            window["InteractiveMap"] = new Object();
            var soPromo = new SWFObject("../Assets/Flash/GarmapMod.swf", "InteractiveMap", "540", "317", "8", "#FFFFFF");
                soPromo.addParam("wmode", "transparent");
                soPromo.write("fc_interactive");
        }
    }
}
