﻿// mediaModule.js extension
function loadMedia(fid, showPaging, startNode, term) {
    xml = "";
    url = "";
    if (fid != startNode) {
        var url = "/tertiary-content/media-data.aspx?fid=" + fid;
    }
    else {
        var url = "/tertiary-content/media-data.aspx?fid=" + startNode;
    }
    if (term != '') url = url + "&searchterm=" + term;
    $.ajax({
        type: "GET",
        url: url,
        dataType: "xml",
        async: false,
        error: function (x, e) {
            if (x.status == 0) {
                alert('You are offline!!\n Please Check Your Network.');
            } else if (x.status == 404) {
                alert('Requested URL not found.');
            } else if (x.status == 500) {
                alert('Internel Server Error.');
            } else if (e == 'parsererror') {
                alert('Error.\nParsing JSON Request failed.');
            } else if (e == 'timeout') {
                alert('Request Time out.');
            } else {
                alert('Unknow Error.\n' + x.responseText);
            }
        },
        success: function (xml) {
            $('.throbber').css("display", "none");
            xmlParser(xml, true, startNode);
        }
    });
    $('.throbber').css("display", "none");
    return true;
}
// synchronise share price in the body to that of the header
$(document).ready(function () {
    if ($('div#sharePriceHeader > span').length > 1) {
        $('div#sharePriceHeader > span').text($('#SharePriceContainerDiv .price').text);
    }
    //$('#SharePriceContainerDiv > h2.promo_header').text($('div#sharePriceHeader > span').text());
});

