emailuis/emailui/data/html/email.js
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:28:57 +0100
branchRCL_3
changeset 25 3533d4323edc
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

// Original image sources are stored in this array
var originalImageSources = new Array();

// Number of images hidden (or replaced with our placeholder image)
var hiddenCount = 0;

// Replace image sources with our placeholder (if the autoloading is disabled)
function hideImages(frameId) {
    if (parent.header_frame.g_autoLoadImages == 0) {
        var doc = document.getElementById(frameId).contentDocument;
        if (!doc) {
            doc = document.frames[frameId].document;
        }
        for (i = 0; i < doc.images.length; i++) {
        	var image = doc.images[i];
            originalImageSources.push(image.src);
            if (image.src.length > 0) {
                doc.images[i].src = "../hidden.png";
                hiddenCount++;
            }
        }
        if (hiddenCount == 0) {
            parent.header_frame.hideDisplayImagesButton();
        } else {
            parent.header_frame.showDisplayImagesButton();
        }
    } else {
        parent.header_frame.updateHeader();
    }
    requestLoadImages();
}

// Restore original images sources
function restoreImages(frameId) {
    if (parent.header_frame.g_autoLoadImages == 0) {
        var doc = document.getElementById(frameId).contentDocument;
        if (!doc) {
            doc = document.frames[frameId].document;
        }
        for (i = 0; i < originalImageSources.length; i++) {
            doc.images[i].src = originalImageSources[i];
        }
    }
}

// Causes application to reload images
function requestLoadImages() {
    location.href = "cmail://loadImages/";
}