function fengj(obj) {
    if (document.all && document.all(obj))
    { return document.all(obj) }
    else if (document.getElementById && document.getElementById(obj))
    { return document.getElementById(obj) }
    else if (document.layers && document.layers(obj))
    { return document.layers(obj) }
    else { return false }
}
function over(q, w) {
    for (var i = 1; i < 13; i++) {
        if (i == w) {
            if (fengj(q + i) && fengj("a" + q + i)) {
                fengj(q + i).className = 'onmove';
                fengj("a" + q + i).style.display = "block";
            }
        }
        else {
            if (fengj(q + i) && fengj("a" + q + i)) {
                fengj(q + i).className = 'zhengchang';
                fengj("a" + q + i).style.display = 'none';
            }
        }
    }
}
function ChangAndSetValue(container1, container2, e1, e2) {
    document.getElementById(e1).className = "onmove";
    document.getElementById(e2).className = "zhengchang";

    document.getElementById(container1).style.display = "none";
    document.getElementById(container2).style.display = "block";
}
function ChkForm(theForm) {
    return Validator.Validate(theForm);
}
function MenuOption(e, item) {
    if (item == null)
        return;

    if (item.className == "openCss") {
        e.className = "zhengchang overtop";
        item.className = "closeCss";
    } else {
        e.className = "onmove overtop";
        item.className = "openCss";
    }

}
var Loader = {};
Loader = {
    loadLoginInfo: function() {
        var http = new HTTPRequest();
        $id('dLoginInfo').innerHTML = "<img src=\"/images/reg/loading.gif\" />";
        http.get('/Handler/GetUserLoginInfo.ashx', function(data) {
            $id('dLoginInfo').innerHTML = data;
        })
    },
    loadLoginInfoCss: function() {
        var http = new HTTPRequest();
        $id('dLoginInfo').className = "bar_left";
        http.get('/Handler/GetUserLoginInfoCss.ashx', function(data) {
            $id('dLoginInfo').className = data;
        })
    },
    loadLoginInfoShow: function() {
        var http = new HTTPRequest();
        $id('dLoginInfoShow').innerHTML = "<img src=\"/images/reg/loading.gif\" />";
        http.get('/Handler/GetUserLoginInfoShow.ashx', function(data) {
            $id('dLoginInfoShow').innerHTML = data;
        })
    },
    loadLoginInfoShowCss: function() {
        var http = new HTTPRequest();
        $id('dLoginInfoShow').clasName = "bar_right";
        http.get('/Handler/GetUserLoginInfoShowCss.ashx', function(data) {
            $id('dLoginInfoShow').clasName = data;
        })
    },
    loadLoginShortInfo: function() {
        var http = new HTTPRequest();
        $id('dLoginShortInfo').innerHTML = "<img src=\"/images/reg/loading.gif\" />";
        http.get('/Handler/GetUserLoginShortInfo.ashx', function(data) {
            $id('dLoginShortInfo').innerHTML = data;
        })
    },
    loadContactInfo1: function(mineID) {
        var http = new HTTPRequest();
        $id('dContactInfo1').innerHTML = "<img src=\"/images/reg/loading.gif\" />";
        http.get('/Handler/GetMineContact1.ashx?mineID=' + mineID, function(data) {
            $id('dContactInfo1').innerHTML = data;
        })
    },
    loadContactInfo2: function(mineID) {
        var http = new HTTPRequest();
        $id('dContactInfo2').innerHTML = "<img src=\"/images/reg/loading.gif\" />";
        http.get('/Handler/GetMineContact2.ashx?mineID=' + mineID, function(data) {
            $id('dContactInfo2').innerHTML = data;
        })
    },
    loadCommentCount: function(Type, relateID) {
        var http = new HTTPRequest();
        $id('dCommentCount').innerHTML = "<img src=\"/images/reg/loading.gif\" />";
        http.get('/Handler/GetCommentCount.ashx?Type=' + Type + '&RelateID=' + relateID, function(data) {
            $id('dCommentCount').innerHTML = data;
        })
    },
    loadMineClickCount: function(mineID) {
        var http = new HTTPRequest();
        http.get('/Handler/GetMineClick.ashx?mineID=' + mineID, function(data) {
            $id('bClick').innerHTML = data;
        })
    },
    loadMineReportCount: function(mineID) {
        var http = new HTTPRequest();
        http.get('/Handler/GetMineReportCount.ashx?mineID=' + mineID, function(data) {
            $id('bReport').innerHTML = data;
        })
    },
    loadArticleClickCount: function(articleID) {
        var http = new HTTPRequest();
        http.get('/Handler/GetAticleClick.ashx?articleID=' + articleID, function(data) {
            $id('aClick').innerHTML = data;
        })
    },
    loadIsLoadDown: function(proveID) {
        var http = new HTTPRequest();
        http.get('/Handler/GetIsLoadDown.ashx?proveID=' + proveID, function(data) {
            $id('isLoad' + proveID).innerHTML = data;
        })
    }
}
var Comment = {};
Comment = {
    getList: function(t, pi, ps, rid) {
        var http = new HTTPRequest();
        $id('commentContainer').innerHTML = "<img src=\"/images/reg/loading.gif\" />";
        http.get('/Handler/GetCommentList.ashx?t=' + t + '&pi=' + pi + '&ps=' + ps + '&rid=' + rid + '&ts=' + Math.random(), function(data) {
            $id('commentContainer').innerHTML = data;
        })
    }
}
function getCode(e) {
    var ele = document.getElementById('hiddenCode');
    ele.style.display = "block";

    if (typeof e.srcElement == "undefined") {
        ele.style.left = e.target.clientLeft + e.target.offsetLeft + 'px';
        ele.style.top = "31px";
    } else {
        ele.style.left = (e.srcElement.clientLeft + e.srcElement.offsetLeft + $id('main').offsetLeft) + 'px';
        ele.style.top = "31px";
    }
}
function hiddenCode() {
    var ele = document.getElementById('hiddenCode');
    ele.style.display = "none";
}


function ShowViCode(imgName, isRefresh) {
    var img = document.getElementById(imgName);
    if (img.style.display == 'none') { img.style.display = 'inline'; isRefresh = true; }
    if (isRefresh) { img.src = '/common/CheckCode.aspx?t=' + Math.random(); }
}

function goFavorite(id, classid) {
    var title = $id('hidtitle');
    var http = new HTTPRequest();
    http.get("/Handler/ArticleFavorite.ashx?articleID=" + id + "&classID=" + classid + "&title=" + encodeURI(title.value), function(data) {

    if (data == "yes") alert('恭喜！收藏成功在您的用户后台!');
    else if (data == "no") {
        alert("对不起！收藏失败！");
    } else if (data == "nouser") {
        alert("对不起！收藏失败！请您先登录。");
        window.location = "/user";
    } else if (data == "null") {
        alert("对不起！参数传递错误，收藏失败！");
    } else if (data == "isexist") {
        alert("此信息您已收藏！！！");
    }
    })
}

function goMessage(mineid, classid) {
    var name = document.getElementById("txtName").value;
    var tel = document.getElementById("txtTel").value;
    var content = document.getElementById("txtContent").value;
    if (name.length == 0) {
        alert("姓名不可以为空，请填写姓名！");
        name.focus();
    }
    else if (tel.length == 0) {
        alert("电话号码不可以为空，请填写电话号码！");
        tel.focus();
    }
    else if (content.length == 0) {
        alert("留言内容不可以为空，请填写留言内容！");
        content.focus();
    }
    else {
        var http = new HTTPRequest();
        http.get("/Handler/ArticleMineMessage.ashx?mineid=" + mineid + "&classid=" + classid + "&name=" + encodeURI(name) + "&tel=" + encodeURI(tel) + "&content=" + encodeURI(content), function(data) {
            if (data == "yes") {
                alert("留言成功！谢谢您的留言。");
            } else if (data == "no") {
                alert("留言失败,请刷新页面再提交。");
            } else if (data == "null") {
                alert("参数传递失败！请刷新页面再提交。");
            }
        })
    }
}

function loadtimer() {
    var secs = 3;
    for (var i = secs; i >= 0; i--) {
        setTimeout('timer(' + i + ')', (secs - i) * 1000);
    }
}

function timer(num) {
    document.getElementById('shownum').innerHTML = num;
    if (num == 0) { window.location = 'http://www.qqkqw.com' }
}
