﻿function chengeLoginHeiht() {
    try {
        //	alert(document.body.scrollHeight);
        if (ifrlogin.document.body.scrollHeight < 26) { document.getElementById("ifrlogin").style.height = 26; }
        else {
            document.getElementById("ifrlogin").style.height = ifrlogin.document.body.scrollHeight;
        }
    }
    catch (e) { document.getElementById("ifrlogin").style.height = 26 }
}


function openOrder(id) {
    window.open("/mall/ReqEdit.aspx?IID=" + id, "_blank", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=0,left=0,width=655,height=500");
}
function openOrderNone() {
    window.open("/mall/Order.aspx", "_blank", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=0,left=0,width=655,height=500");
}
function searchKey(key) {
    //var ddl = document.getElementById("ddlType");
    //var url = "/mall/Search.aspx?node=10&key=" + key;
    var url = "/mall/doSearch.aspx?type=&key=" + key;
    if (document.getElementById("keyEdit")) {
        keyEdit.document.location.href = url;
    } else {
        window.open(url);
    }
}
function doSearch() {
    var key = document.getElementById("txtKey").value;
    if (key == "" || key == "请输入要搜索的关键字") {
        alert("请输入您要查找的关键字");
        return;
    }
    else {
        searchKey(key);
    }
}


function login() {
    if (window.location.href.indexOf("/login/userlogin.aspx") >= 0) {
        window.location.href = window.location.href;
    }
    else {
        window.location.href = "/login/userlogin.aspx?nexturl=" + document.location.href;
    }
}

// 加入收藏夹
//function addFav() {
//    if (document.all) {
//        window.external.addFavorite(location.href, document.title);
//    } else if (window.sidebar) {
//        window.sidebar.addPanel(document.title, location.href, "");
//    }
//}
function AddFavorite(sURL, sTitle) {
    try {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e) {
        try {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e) {
            alert("加入收藏失败，请使用Ctrl+D进行添加。");
        }
    }
}

function addFav(sURL, sTitle) {  
    if (document.all) {
        window.external.addFavorite(sURL, sTitle);
    }
    else if (window.sidebar) {
        window.sidebar.addPanel(sTitle, sURL, "");
    }
} 　　

// 设置首页
function setHomepage() {
    if (document.all) {
        document.body.style.behavior = 'url(#default#homepage)';
        document.body.setHomePage(location.href);
    } else if (window.sidebar) {
        if (window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            } catch (e) {
                //alert("该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");
                alert("您的浏览器未启用该功能.");
            }
        }
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
        prefs.setCharPref('browser.startup.homepage', location.href);
    }
}

function setHomepage(sURL) {
    if (document.all) {
        document.body.style.behavior = 'url(#default#homepage)';
        document.body.setHomePage(sURL);
    }
    else if (window.sidebar) {
        if (window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            }
            catch (e) {
                alert(" 该操作被浏览器拒绝，假如想启用该功能，请在地址栏内输入 about:config, 然后将项 signed.applets.codebase_principal_support 值该为 true");
            }
        }
        else {
            try {
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
                prefs.setCharPref('browser.startup.homepage', sURL);
            }
            catch (e) {
                alert('您使用的浏览器不支持此操作，请手动设置。');
            }
        }
    }
    else {
        alert('您使用的浏览器不支持此操作，请手动设置。');
    }　　　　　　 
}


