﻿function isIE7() {
    if (typeof document.body.style.maxHeight != "undefined") {
        return true;
    } else {
        return false;
    }
}
var liveSearchDivName = "liveSearch";

function showLiveSearch() {
    var element = document.getElementById(liveSearchDivName);
    element.style.display = 'inline';
}
function closeLiveSearch() {
    var element = document.getElementById(liveSearchDivName);
    element.style.display = 'none';
}
function setCookie() {
    var date = new Date();
    date.setTime(date.getTime() + (1000 * 24 * 60 * 60 * 1000));
    var expires = ";expires=" + date.toGMTString();
    document.cookie = "donotwanttoinstall=true" + expires + ";domain=magv.com";
    closeLiveSearch();
}
function doNotWantToInstall() {
    var aa = document.cookie.length
    var cookiedonotwanttoinstall = document.cookie.indexOf("donotwanttoinstall=true")
    if (cookiedonotwanttoinstall >= 0) {
        return true
    }
    else {
        return false
    }

}
window.onload=function(){
    if (isIE7() == true) {
        if (window.external.IsSearchProviderInstalled('http://tw.magv.com') == 0) {
            if (doNotWantToInstall() == true) {
                closeLiveSearch();
            }
            else { showLiveSearch(); }
        }
        else {
            closeLiveSearch();
        }
    }
    else
    {
       closeLiveSearch();
    }
}

function AddSearchProvider() {
    window.external.AddSearchProvider('http://tw.magv.com/xml/ie7search.xml'); 
    closeLiveSearch(); 
}      
            
