  } else if (liEl.hasClass('toc_collapsed')) {
        liEl.children('ul').slideDown('fast', function () {
            liEl.removeClass('toc_collapsed').addClass('toc_expanded');
        });
    }
}
function getTocUrl () {
    return $('.toc_icon:first').data('tocUrl');
}

function getTocPageId() {
    var pathArray = ($(location).attr('pathname') + $(location).attr('href')).replace(/\/$/,'').split("/");
    var productDir = $(".toc_icon").attr("id").replace(/^toc\./,'');
    var reversePathArray = $(pathArray).get().reverse();
    var productDirIndex = $.inArray(productDir, reversePathArray);
    var pageId = "";
    if (productDirIndex === 0) {
        pageId = productDir + ".index.html";
    } else {
        productDirIndex = pathArray.length - productDirIndex - 1;
        pathArray.splice(0, productDirIndex);
        pageId =  pathArray.join(".");
    }
    return "#" + pageId.replace(/\./g, '\\.').replace(/\#/g, '\\#');
}

//Get teh correct base URL for the TOC links, based on the current page.
function getTocBaseUrl() {
    var tocUrl = getTocUrl();
    return tocUrl.substring(tocUrl,tocUrl.indexOf("doccentertoc"));
}

function checkAnimatedImage(imgElt) {
    imgElt.data('src', imgElt.attr('src'));
    imgElt.click(toggleImageAnimation);
}

function checkImage(imgElt) {
    //callback to be executed when image loads
    var callback = function () {
        if (needsScaling(imgElt)) {
            imgElt.addClass('scaled-image');
            imgElt.click(toggleImageScaling);
        }
    };
    //Preload image.
    loadImage(imgElt, callback);
}

function loadImage(imgElt, callback) {
    var img = new Image();
    img.onload = function () {
        imgElt.data('fullsize', {
            'width':img.width,
            'height':img.height
        });
        callback();
    };
    img.src = imgElt.attr('src');
}


function needsScaling(imgElt) {
    var fullSize = imgElt.data('fullsize');
    //Vary width and height values here to change scaling parameters.
    return fullSize.width > 480 || fullSize.height > 330;
}

function toggleImageAnimation() {
    var imgElt = $(this);
    if (imgElt.hasClass('dynamic-image')) {
        //swap in the static image
        imgElt.attr('src', imgElt.data('src'));
        imgElt.removeClass('dynamic-image');
        imgElt.attr('title', 'Play');
    } else {
        //swap in the animated image.
        var anm_prefix = "_anmtd_";
        var anm_suffix = ".gif";
        var pathArray = imgElt.data('src').split("/");
        var fileName = pathArray.slice(-1)[0];
        pathArray[pathArray.length - 1] = anm_prefix + fileName.split(".")[0] + anm_suffix;
        var anm_src = pathArray.join("/");
        imgElt.attr('src', anm_src);
        imgElt.addClass('dynamic-image');
        imgElt.attr('title', 'Stop');
    }
}

//Setup image scaling.
function toggleImageScaling() {
    var imgElt = $(this);
    if (imgElt.hasClass('expanded-image')) {
        imgElt.animate({
            'max-width':'400px',
            'max-height':'300px'
        }, function () {
            imgElt.removeClass('expanded-image');
        });
    } else {
        var fullSize = imgElt.data('fullsize');
        imgElt.animate({
            'max-width':fullSize.width + 'px',
            'max-height':fullSize.height + 'px'
        }, function () {
            imgElt.addClass('expanded-image');
        });
    }
}

function findExpandableContent(elt) {
    if (!elt.hasClass('expandableContent')) {
        elt = elt.closest('.expandableContent');
    }
    return elt;
}

function doExpand(elt) {
    var expan[ZoneTransfer]
ZoneId=3
