//标签切换
function g(o) { return document.getElementById(o); }
function HoverLi(m, n, count) {
    for (var i = 1; i <= count; i++) {
        g('tb_' + m + i).className = 'menu_off'; g('tbc_' + m + i).style.display = "none";
    }
    g('tbc_' + m + n).style.display = ""; g('tb_' + m + n).className = 'menu_on';
}

var ua = navigator.userAgent.toLowerCase();
var isIe = true
if (ua.indexOf("firefox") != -1) isIe = false;

//取同名className，列表内容隔行变色
function getElementsByClassName(obj, className) {
    var objArray = [];
    if (className + '' == '') { return objArray; } //这是容错判断，防止使用函数的人传入空样式名的
    if (obj) {
        var tmpObj = obj.getElementsByTagName("*")
        for (i = 0; i < tmpObj.length; i++) {
            if (tmpObj[i].className == className) {
                objArray.push(tmpObj[i])
            }
        }
        return objArray;
    }
    else { return objArray; }

}
window.onload = function() {
    cRow();
}

function cRow() {
    var tmpobj = document.getElementById("rowColor")
    var byclass = getElementsByClassName(tmpobj, "linelist")
    //alert('')
    var tmpstr = ""
    for (i = 0; i < byclass.length; i++) {
        for (j = 0; j < byclass[i].rows.length; j++) {
            byclass[i].rows[j].onmouseover = function() {
                this.style.backgroundColor = "#FEEABF"
            }
            byclass[i].rows[j].onmouseout = function() {
                this.style.backgroundColor = "#fff"
            }
        }
    }
}
//打折列表内容隔行变色
function rowColor() {
    var tmpobj = document.getElementById("rowbus1")
    var tmpstr = ""
    for (j = 1; j < tmpobj.rows.length; j++) {
        tmpobj.rows[j].onmouseover = function() {
            this.style.backgroundColor = "#d7d7d7"
        }
        tmpobj.rows[j].onmouseout = function() {
            this.style.backgroundColor = "#fff"
        }

    }
}


//png图片兼容IE6透明
function correctPNG() {
    for (var i = 0; i < document.images.length; i++) {
        var img = document.images[i]
        var imgName = img.src.toUpperCase()
        if (imgName.substring(imgName.length - 3, imgName.length) == "PNG") {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
            img.outerHTML = strNewHTML
            i = i - 1
        };
    };
};

if (navigator.userAgent.indexOf("MSIE") > -1) {
    window.attachEvent("onload", correctPNG);
};



//下拉广告

var intervalId = null;
function slideAd(id, nStayTime, sState, nMaxHth, nMinHth) {
    this.stayTime = nStayTime * 1000 || 3000;
    this.maxHeigth = nMaxHth || 234;
    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 + 8) : (h - 4)) + "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, 20);
}
function d(a) {
    return a;
}
////得到广告信息
////advClassId  广告位编号
//function GetWebServiceHtml(advClassId) {
//    var url = "/Home/GetWebServiceHtml";
//    var a = new Array();
//    $.ajax({
//        type: "GET",
//        url: url,
//        data: { advClsId: advClassId },
//        dataType: "html",
//        async: false,
//        success: function(date) {
//            debugger;
//            a.push(date);

//        },
//        complete: function(XMLHttpRequest, textStatus) {
//            if (textStatus == "success") {
//                var msg = XMLHttpRequest.responseText;
//                alert msg;
//            } else if (textStatus == "error") {
//                
//            } else if (textStatus == "timeout") {

//            }
//        }
//    });
//    return 
//}

////得到广告信息
////advClassId  广告位编号
////caseName  容器名称
//function GetHtmlAdv(advClassId, caseName) {
//    debugger;
//    var data = GetWebServiceHtml(advClassId);
//    var caseObj = $("#" + caseName + "");
//    caseObj.html();
//    caseObj.html(data);
//}

