function S(i) {
    return document.getElementById(i)
}
function floatAdver() {
    this.fDivs = new Array();//浮动广告对象数组
    this.divCount = 0; //浮动广告对象数量
    this.h = 1000;//距离顶部距离
    this.fDiv;
    this.lDiv = "";
    this.rDiv = "";
    this.lDivCssText = "position:absolute;top:100px;left:2px;width:150px;height:10px; solid #fffff;";
    this.rDivCssText = "position:absolute;top:100px;right:10px;width:150px;height:10px; solid #fffff;";
    this.lDivInner = "";
    this.rDivInner = "";
}
floatAdver.prototype = {
    createInfo:function(lcss, rcss, linfo, rinfo, h) { //设置两边浮动层信息
        this.lDivCssText += lcss;
        this.rDivCssText += rcss;
        this.lDivInner = linfo;
        this.rDivInner = rinfo;
        this.h = h;
    },
    createFloatDiv:function() { // 创建２个浮动层
        this.lDiv = document.createElement("div");
        this.rDiv = document.createElement("div");
        this.lDiv.style.cssText = this.lDivCssText;
        this.rDiv.style.cssText = this.rDivCssText;
        this.lDiv.innerHTML = this.lDivInner;
        this.rDiv.innerHTML = this.rDivInner;
        document.body.appendChild(this.rDiv);
        document.body.appendChild(this.lDiv);
        //this.rDiv.id="r";
        //this.lDiv.id="l";
        this.divCount++;
    },
    createAdvPro:function() { //类内部创建层的浮动过程
        var bodyScrollTop = document.documentElement.clientHeight;
        if (parseInt(this.$(this.rDiv).style.top, 10) != bodyScrollTop - 166 + parseInt(document.documentElement.scrollTop, 10))
        {
            this.$(this.rDiv).style.top = bodyScrollTop - 650 + parseInt(document.documentElement.scrollTop, 10) + "px";
            this.$(this.lDiv).style.top = this.$(this.rDiv).style.top;
        }
    },

    createAdv:function() { //调用内部浮动 入口!!
        var _this = this;
        _this.createFloatDiv();
        setInterval(function() {
            _this.createAdvPro();
        }, 10);

    },
    floatPro:function() {//非类内部创建层的 浮动效果
        var bodyScrollTop = document.documentElement.clientHeight;
        if (this.fDiv.style.top != this.h)
        {
            this.$(this.fDiv).style.top = bodyScrollTop - parseInt(this.$(this.rDiv).style.top) + parseInt(document.documentElement.scrollTop, 10) + "px";

        }
    },
    $:function(o) { //获取对象
        if (typeof(o) == "string")
            return document.getElementById(o);
        return o;
    },
    begins:function(o, h) {//调用浮动 入口!!
        var _this = this;
        _this.fDiv = _this.$(o);
        _this.h = h;
        //alert(this.fDiv.id);
        setInterval(function() {
            _this.floatPro();
        }, 10);
    }
}
function floatAdver2() {
    this.fDivs = new Array();//浮动广告对象数组
    this.divCount = 0; //浮动广告对象数量
    this.h = 0;//距离顶部距离
    this.fDiv;
    this.lDiv = "";
    this.rDiv = "";
    this.lDivCssText = "position:absolute;top:0px;left:20px;width:100px;height:0px; solid #fffff;";
    this.rDivCssText = "position:absolute;top:0px;right:30px;width:100px;height:0px; solid #fffff;";
    this.lDivInner = "";
    this.rDivInner = "";
}
floatAdver2.prototype = {
    createInfo:function(lcss, rcss, linfo, rinfo, h) { //设置两边浮动层信息
        this.lDivCssText += lcss;
        this.rDivCssText += rcss;
        this.lDivInner = linfo;
        this.rDivInner = rinfo;
        this.h = h;
    },
    createFloatDiv:function() { // 创建２个浮动层
        this.lDiv = document.createElement("div");
        this.rDiv = document.createElement("div");
        this.lDiv.style.cssText = this.lDivCssText;
        this.rDiv.style.cssText = this.rDivCssText;
        this.lDiv.innerHTML = this.lDivInner;
        this.rDiv.innerHTML = this.rDivInner;
        document.body.appendChild(this.rDiv);
        document.body.appendChild(this.lDiv);
        //this.rDiv.id="r";
        //this.lDiv.id="l";
        this.divCount++;
    },
    createAdvPro:function() { //类内部创建层的浮动过程
        var bodyScrollTop = document.documentElement.clientHeight;
        if (parseInt(this.$(this.rDiv).style.top, 10) != bodyScrollTop - 166 + parseInt(document.documentElement.scrollTop, 10))
        {
            this.$(this.rDiv).style.top = bodyScrollTop - 466 + parseInt(document.documentElement.scrollTop, 10) + "px";
            this.$(this.lDiv).style.top = this.$(this.rDiv).style.top;
        }
    },

    createAdv:function() { //调用内部浮动 入口!!
        var _this = this;
        _this.createFloatDiv();
        setInterval(function() {
            _this.createAdvPro();
        }, 10);

    },
    floatPro:function() {//非类内部创建层的 浮动效果
        var bodyScrollTop = document.documentElement.clientHeight;
        if (this.fDiv.style.top != this.h)
        {
            this.$(this.fDiv).style.top = bodyScrollTop - parseInt(this.$(this.rDiv).style.top) + parseInt(document.documentElement.scrollTop, 10) + "px";

        }
    },
    $:function(o) { //获取对象
        if (typeof(o) == "string")
            return document.getElementById(o);
        return o;
    },
    begins:function(o, h) {//调用浮动 入口!!
        var _this = this;
        _this.fDiv = _this.$(o);
        _this.h = h;
        //alert(this.fDiv.id);
        setInterval(function() {
            _this.floatPro();
        }, 10);
    }
}

window.onload = function() {
    var m = new floatAdver();
    var m2 = new floatAdver2();
    m.createInfo("", "", "<div id=lovexin1 style='color:red;background:#CCC;'><img src='images/close.gif' onClick='javascript:window.hide()' style='cursor: hand;' width='150' height='14' border='0' vspace='3' alt='关闭广告' title='关闭广告'><a href='http://www.hncgxh.com/' target='_blank'><img src='images/henancg.gif' width='150' height='130' border='0'></a></div>", "", 100);
    m.createAdv();
    m2.createInfo("", "", "<div id=lovexin3 style='color:red;background:#CCC;'><img src='images/closemin.gif' onClick='javascript:window.hide1()' style='cursor: hand;' width='100' height='14' border='0' vspace='3' alt='关闭广告' title='关闭广告'><a href='http://info.sporttery.cn/lotterygame/?url=TICAI' target='_blank'><img src='images/hn-duilian.gif' width='100' height='300' border='0'></a></div>", "<div id=lovexin4 style='color:red;background:#CCC;'><img src='images/closemin.gif' onClick='javascript:window.hide1()' style='cursor: hand;' width='100' height='14' border='0' vspace='3' alt='关闭广告' title='关闭广告'><a href='http://info.sporttery.cn/lotterygame/?url=TICAI' target='_blank'><img src='images/hn-duilian.gif' width='100' height='300' border='0'></a></div>", 1);
    m2.createAdv();
}
function hide()
{
    //lovexin3.style.visibility="hidden";
    lovexin1.style.display = "none";
}
function hide1()
{
    lovexin3.style.visibility = "hidden";
    lovexin4.style.visibility = "hidden";
}


