﻿/*function   closeErrors()   {     //关闭错误显示     
    return   true;          
}        
window.onerror=closeErrors;*/

function duilian_left_close(){              //关闭左对联
    document.getElementById("AD_duilian_left").style.display="none";
}

function duilian_right_close(){             //关闭右对联
    document.getElementById("AD_duilian_right").style.display="none";
}

function follow_left_close(){              //关闭左浮动
    document.getElementById("AD_follow_left").style.display="none";
}

function follow_right_close(){              //关闭右浮动
    document.getElementById("AD_follow_right").style.display="none";
}

/////////////////////////下拉广告//////////////////////////////////
var intervalId = null;
function slideAd(id,nStayTime,sState,nMaxHth,nMinHth){  //nStayTime:广告显示秒数
this.stayTime=nStayTime*1000 || 3000;
this.maxHeigth=nMaxHth || 358; //广告最大高度
this.minHeigth=nMinHth || 2;
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 +360 ) : (h - 359))+"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,2);
}
////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////幻灯////////////////////////////////////
function adRotator() {};
adRotator.initialize=function(o)
{
    // script by blueDestiny
    this._p = new Array();  //图片地址
    this._t = new Array();  //图片文字说明
    this._l = new Array();  //图片链接	
    this._i = new Image();
    this._c = 0;            //图片计数器
    this._f = true;
    this._o = o;            //控件名
    this._timeout = null;
    this._html = "";
    // configration.
    // @ image width
    // @ image height
    // @ rotator speed
    // @ filter type
    this._w = 250;
    this._h = 178;
    this._s = 3;
    this._x = 23;
    return this;
};
adRotator.add=function(p,t,l) { with (this)
{
    _p.push(p);
    _t.push(t);
    _l.push(l);
}};
adRotator.load=function() { with (adRotator)
{
    if( _i.readyState=='complete' )
    {
        if(_p.length-1==_c)
        {
            _f = true;
            _c = 0;
            window.clearTimeout(_timeout);
            //getRef("AdRotator").innerHTML="complete";
            adRotator.play();
        }
        else
        {
            _c++;
            getRef(_o).innerHTML="total images " + _p.length + ", loading picture " + _c + ' ' + _i.readyState + "...";
            _timeout=window.setTimeout(adRotator.load,10)
        }
    }
    else
    {
        getRef(_o).innerHTML="total images " + _p.length + ", loading picture " + _c + ' ' + _i.readyState + "...";
        _timeout=window.setTimeout(adRotator.load,10)
    }
}};
adRotator.play=function() { with (adRotator)
{
    if( _f )
    {
    _html = "";
    _html += '<table style="border:1px solid #959595;"><tr><td style="font-size:9pt;font-family:tahoma;font-weight:bold;">'
    _html += '<div id="rotatorPlayer"'
            + ' style="width:' + _w + ''
            + ';height:"' + _h + '"'
            + '>'
    _html += '<a href="' + ( _l[_c] ? _l[_c] : "javascript:void(0);" ) + '" target="_blank">';
    _html += '<img id="rotatorPic" src="' + _p[_c] + '"'
            + ' width="' + _w + '"'
            + ' height="' + _h + '"'
            + (_t[_c]?' title="' + _t[_c] + '"':'')
            + ' style="border:0px solid blue;FILTER:revealTrans(transition=' + _x + ',duration=1);"'
            + ' >';
    _html += '</a>';
    _html += "</div>";
    _html += '<div style="text-align:right;" style="background-color:#444444;height:14px;">'; 
    for(var i=0; i<_p.length; i++)
        _html += '<span'
              + ' style="border:1px solid #222222;padding:0px 1px 0px 1px;width: 28px;height:12px;color: white;font-size: 11px;  font-weight:normal;text-align:center;cursor:'
              + (_c==i ? ('default;background-color:red;"') : 'hand;background-color:black;" onclick="adRotator.select(' + i + ')"')
              + '>'
              + (i>8?(i+1):('0'+(i+1)))+ '</span>';  //单位数字前加0,双位直接显示
        _html += "</div>"
        _html += '<div style="background-image:url(images/美工条2.gif); width: ' + _w + '; height: 15px;font-size: 11px;">'
        _html += '<a href="' + ( _l[_c] ? _l[_c] : "javascript:void(0);" ) + '" target="_blank">'+(_t[_c]?('<div align="center;vertical-align: middle;">'  + _t[_c] + '</div>'):'<p></p>')+'</a>'
        _html += "</div></td></tr></table>";
        getRef(_o).innerHTML = _html;                //通过_o获取控件 用_html填充控件
        getRef("rotatorPic").filters[0].Apply();
        getRef("rotatorPic").filters[0].Play();
        next();
    }
    else
    {
        _i.src = _p[_c];
        adRotator.load();
    }
}};
adRotator.next=function() { with (this)
{
    (_p.length-1==_c) ? _c=0 : _c++;          //_c到达最后一张图片后置0  否则加1
    _timeout=window.setTimeout(adRotator.play,_s*1000);
}};
adRotator.select=function(i) { with (this)
{
    window.clearTimeout(_timeout);
    _c=i;
    adRotator.play();
}};
adRotator.set=function(second) { with (this)
{
    window.clearTimeout(_timeout);
    if((/\d+/).test(second)==true)
    {
        _s=second;
        adRotator.play();
    }
    else
    {
		
        adRotator.play();
    }
}};
function getRef(id)
{
    return (document.all?document.all(id):document.getElementById(id));
}
function powPointNewsRun(){
	adRotator.initialize("AdRotator");
	addAD();
	adRotator.play();	
}
//////////////////////////////////////////////////////////////////////////////

////////////////////////////////首页头条新闻翻动///////////////////////////////
var tn = 1;
var tims_running = 0;

function change_headline(n){
    show_intro('focus_text','focus_but',4,n,'focus_butc');
    tn = n;
}

function mouse_on(n){
    tims_running = 0;
    change_headline(n);
}

function mouse_out(){
    tims_running = 1;
}

function run(){
    if(tims_running == 1){
        change_headline(tn);
        tn++;
    }
    if(tn>=5) 
    {
        tn = 1;
    }
}

function startrun()
{
    tims_running = 1;
    tims = window.setInterval("run()",3000);
}

function show_intro(pre,pree,n,select_n,css) {
    for (i = 1; i <= n; i++) {
    var intro = document.getElementById(pre + i);
    var cha = document.getElementById(pree + i);
    intro.style.display = "none";
    cha.className=css + "1";
        if (i == select_n) {
        intro.style.display = "block";
        cha.className=css + "2";
        }
    }
}

function def_chang(pre,pree,select_n){
    for (i = 1; i <= 2; i++) {
    var intro1 = document.getElementById(pre + i);
    var cha1 = document.getElementById(pree + i);
    intro1.style.display = "none";
    cha1.className="def_change2";
        if (i == select_n) {
        intro1.style.display = "block";
        cha1.className="def_change1";
        }
    }
}


////////////////////////////////////////////////////////////////////////////