﻿function exploreBarMouseClick(obj) {
    document.getElementById("IF_main").src = "Index.aspx";
}

function SlideBox(container, frequency, direction) {
    if (typeof (container) == 'string') {
        container = document.getElementById(container);
    }
    this.container = container;
    this.frequency = frequency;
    this.direction = direction;
    this.films = [];
    container.onmouseover = function(self) { return function() { self._mouseover() }; } (this);
    container.onmouseout = function(self) { return function() { self._mouseout() }; } (this);
    this._playTimeoutId = null;
    this._slideTimeoutId = null;
    this._slidable = true;
    this._loop();
}

SlideBox.prototype = {
    _loop: function() {
        var sb = this;
        this._playTimeoutId = setTimeout(function() { sb._slide() }, this.frequency);
    },

    _slide: function() {
        var sb = this;
        var _slide = function() {
            if (!sb._slidable) return;
            var c = sb.container;
            if (sb.direction == 'top') {
                if (c.scrollTop < c.offsetHeight - 1) {
                    c.scrollTop += 1;
                } else {
                    clearInterval(sb._slideTimeoutId);
                    sb._loop();
                    var ul = c.getElementsByTagName('ul')[0];
                    ul.appendChild(c.getElementsByTagName('li')[0]);
                    c.scrollTop = 0;
                }
            }
        }
        this._slideTimeoutId = setInterval(_slide, 50);
    },

    _mouseover: function() {
        this._slidable = false;
    },

    _mouseout: function() {
        this._slidable = true;
    }
}

function picNewsCirculation(cirTime) {
    if (document.getElementById("picnews_0") != null) {
        setInterval("picNewsClick()", cirTime);
    }
}

var picClickV = -1;
function picNewsClick() {
    if (document.getElementById("picnews_" + (++picClickV)) != null) {
        document.getElementById("picnews_" + picClickV).onclick();
    } else {
        picClickV = -1;
    }
}
var picIndex = 0;
function picNewsIndexCount() {
    while (document.getElementById("picnews_" + picIndex) != null) {
        picIndex++;
    }
}
function picNewsIndexClick(index) {
    for (var s = 0; s < picIndex; s++) {
        if (s != index) {
            document.getElementById("picnews_" + s).style.backgroundColor = "";
        }
    }
}

function NewsSearchResult() {
    var link = "NSearchList.aspx?blurcondition=" + document.getElementById("TB_SearchCondition").value + "&strictcondition=" + document.getElementById("DDL_NewsType").options[document.getElementById("DDL_NewsType").selectedIndex].value;
    document.getElementById("IF_NewsList").src = link;
    return false;
}

function ExpertSearchResult() {
    var link = "ESSearchList.aspx?blurcondition=" + document.getElementById("TB_SearchCondition").value + "&strictcondition=" + document.getElementById("DDL_ExpertType").options[document.getElementById("DDL_ExpertType").selectedIndex].value;
    document.getElementById("IF_List").src = link;
    return false;
}

function StandardSearchResult() {
    var link = "SSSearchList.aspx?blurcondition=" + document.getElementById("TB_SearchCondition").value + "&strictcondition=" + document.getElementById("DDL_StandardScopeType").options[document.getElementById("DDL_StandardScopeType").selectedIndex].value;
    document.getElementById("IF_StandardList").src = link;
    return false;
}

function fileSearchResult() {
    var link = "MDSearchList.aspx?blurcondition=" + document.getElementById("TB_SearchCondition").value + "&strictcondition=" + document.getElementById("DDL_NewsType").options[document.getElementById("DDL_NewsType").selectedIndex].value;
    document.getElementById("IF_FileList").src = link;
    return false;
}

function articleSearchResult() {
    var link = "NSearchList.aspx?blurcondition=" + document.getElementById("TB_SearchCondition").value + "&strictcondition=" + document.getElementById("DDL_NewsType").options[document.getElementById("DDL_NewsType").selectedIndex].value;
    document.getElementById("IF_NewsList").src = link;
    return false;
}

function printpreview() {
    if (window.ActiveXObject) {
        if (confirm('确定打印吗？')) {
            document.getElementById("wb").execwb(7, 1);
        }
    } else if (window.XMLHttpRequest) {
        window.print();
    }　　
    
    return false;
}

function barClick(obj) {
    var cid = obj.id.substring(1, obj.id.length);
    document.getElementById('TD_' + cid).style.backgroundImage = 'url(Img/exploreBar.gif)';
    for (var i = 1; i <= 13; i++) {
        if (i != cid) {
            document.getElementById('TD_' + i).style.backgroundImage = '';
        }
    }
}