﻿//检查登录
function checkLogin(s) {
    var arrStr = document.cookie.split("; ");
    var flag = false;
    for (var i = 0; i < arrStr.length; i++) {
        var temp = arrStr[i].split("=");
        if (temp[0] == "loginInfo") {
            flag = true;
        }
    }
    if (flag == false) {
        if (s == "0") {
            alert("您还没有登录！只有登录用户才能下载本站资源！");
            location.href = "login/userlogin.aspx?nexturl=/dzzz/online.aspx";
            return flag;
        }
        else {
            alert("您还没有登录！只有登录用户才能订购会员特供专区的商品！");
            location.href = "login/userlogin.aspx?nexturl=/mall/Order.aspx";
            return flag;
        }
    }
    else {
        if (s == "0") {
            location.href = "dzzz/online.aspx";
        }
        else {
            location.href = "mall/Order.aspx";
        }
    }
}

//商家进驻
function openSJJZ() {
    var ret = "false";
    if (window.showModalDialog != null) {
        ret = window.showModalDialog("/portal/SJJZ.html", null, "dialogHeight:450px;dialogWidth:950px;scroll:no;status:no;location:no;help:no;resizable:no");
    }
    else {
        ret = window.open("/portal/SJJZ.html", null, "width=950px,height=450px,menubar=no,toolbar=no,location=no,scrollbars=no,resizable=no,status=no,modal=yes");
    }
}

//图片滚动
function ScrollImgLeft() {
    var speed = 40;
    var scroll_begin = document.getElementById("scroll_begin");
    var scroll_end = document.getElementById("scroll_end");
    var scroll_div = document.getElementById("scroll_div");
    scroll_end.innerHTML = scroll_begin.innerHTML;
    function Marquee() {
        if (scroll_end.offsetWidth - scroll_div.scrollLeft <= 0)
            scroll_div.scrollLeft -= scroll_begin.offsetWidth;
        else
            scroll_div.scrollLeft++;
    }
    var MyMar = setInterval(Marquee, speed);
    scroll_div.onmouseover = function() { clearInterval(MyMar); }
    scroll_div.onmouseout = function() { MyMar = setInterval(Marquee, speed); }
}

//幕帘伸缩广告
//var intervalId = null;
//function slideAd(id, nStayTime, sState, nMaxHth, nMinHth) {
//    this.stayTime = nStayTime * 1000 || 3000;
//    this.maxHeigth = nMaxHth || 200;
//    this.minHeigth = nMinHth || 1;
//    this.state = sState || "down";
//    var obj = document.getElementById(id);
//    if (intervalId != null) window.clearInterval(intervalId);
//    function openBox() {
//        var h = obj.offsetHeight;
//        obj.style.height = ((this.state == "down") ? (h + 2) : (h - 2)) + "px";
//        if (obj.offsetHeight > this.maxHeigth) {
//            window.clearInterval(intervalId);
//            intervalId = window.setInterval(closeBox, this.stayTime);
//        }
//        if (obj.offsetHeight <= this.minHeigth) {
//            window.clearInterval(intervalId);
//            obj.style.display = "none";
//        }
//    }
//    function closeBox() {
//        slideAd(id, this.stayTime, "up", nMaxHth, nMinHth);
//    }
//    intervalId = window.setInterval(openBox, 10);
//}

//判断浏览器类别加载样式
if (window.navigator.userAgent.indexOf("MSIE") >= 0) {
    //如果浏览器为IE
    setActiveStyleSheet("/css/2010/head.css", "/css/2010/main.css");
}
else if (window.navigator.userAgent.indexOf("Firefox") >= 0) {
    //如果浏览器为Firefox
    setActiveStyleSheet("/css/2010/firefox/head.css", "/css/2010/firefox/main.css");
}
else if (window.navigator.userAgent.indexOf("Opera") >= 0) {
    //如果浏览器为Opera
    setActiveStyleSheet("/css/2010/opera/head.css", "/css/2010/opera/main.css");
}
else {
    //如果浏览器为其他
    setActiveStyleSheet("/css/2010/safari/head.css", "/css/2010/safari/main.css");
}
function setActiveStyleSheet(url1, url2) {
    document.getElementsByTagName("link")[1].href = url1;
    document.getElementsByTagName("link")[2].href = url2;
}


