function guide() {
    var body = document.getElementsByTagName("body")[0];
    var div = document.createElement("div");
    div.setAttribute("class", "install-bg")
    body.appendChild(div);
    var div_container = document.createElement("div");
    div_container.setAttribute("class", "install-bag")
    var img = document.getElementById("install-img")
    if (img) {
        img.setAttribute("class", "install-img")
        img.setAttribute("id", "install-img")
        img.addEventListener("mousedown",function(e) { body.removeChild(div); div_container.removeChild(e.currentTarget); },false);
        div_container.appendChild(img);
        img.style.display ="block"
        body.appendChild(div_container);
        img.style.marginTop = (document.documentElement.scrollTop+10) +"px"
    }
    var interval;
    var opacity = 0;
    var opacityDelta = 0.03
    var sizeInterval = function(div) {
        opacity += opacityDelta;
        div.style['opacity'] = opacity;
        finalOpacity = 0.8;
        if (div.id=="install-img") 
            finalOpacity = 1
        if (opacity>=finalOpacity) {
            clearInterval(interval)
            interval = null;
            if (div.id!="install-img") {
                opacity = 0;
                interval = setInterval(sizeInterval, 1, img);
            }
        }
    }
    interval = setInterval(sizeInterval, 1, div);
}

function install (aEvent, addonName, downloadLink) {
    var params = { "addon":downloadLink }
    switch (addonName) {
        case "FoxLingo": params = { "FoxLingo":downloadLink }
            break;
        case "LinkExtend": params = { "LinkExtend":downloadLink }
            break;
        case "newTabKing": params = { "NewTabKing":downloadLink }
            break;
    }
    InstallTrigger.install(params);
    guide();
    return false;
}
