﻿var flag = false;

function imageLoad() {  // called with onLoad()
    if (document.images) {
        img1on = new Image(); img1on.src = "../images/tools/quick-quote-over.gif";
        img2on = new Image(); img2on.src = "../images/tools/live-help-over.gif";
        img3on = new Image(); img3on.src = "../images/tools/postcode-over.gif";
        img4on = new Image(); img4on.src = "../images/tools/track-parcel-over.gif";
        img5on = new Image(); img5on.src = "../images/tools/leave-feedback-over.gif";
        img6on = new Image(); img6on.src = "../images/tools/link-site-over.gif";
        
        return (flag = true);  // set the flag and let the function know know it can work
    }
}

if (document.images) {   // load the off images in the normal way
    img1off = new Image(); img1off.src = "../images/tools/quick-quote.gif";
    img2off = new Image(); img2off.src = "../images/tools/live-help.gif";
    img3off = new Image(); img3off.src = "../images/tools/postcode.gif";
    img4off = new Image(); img4off.src = "../images/tools/track-parcel.gif";
    img5off = new Image(); img5off.src = "../images/tools/leave-feedback.gif";
    img6off = new Image(); img6off.src = "../images/tools/link-site.gif";
}


function rollIn(imgName) {
    if (document.images && (flag == true)) {
        document[imgName].src = eval(imgName + "on.src");
    }
}

function rollOut(imgName) {  // the normal onMouseOut function
    if (document.images){
        document[imgName].src = eval(imgName + "off.src");
    }
}
