﻿function floatAdver() {
    this.fDivs = new Array(); //浮动广告对象数组
    this.divCount = 0; //浮动广告对象数量
    this.h = 560; //距离顶部距离
    this.fDiv;
//    this.lDiv = "";
    this.rDiv = "";
//    this.lDivCssText = "position:absolute;top:0px;left:10px;width:100px;height:100px;border:1px solid red;";
    this.rDivCssText = "position:absolute;top:0px;right:10px;width:100px;height:100px;border:1px solid red;";
//    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.scrollTop;
        if (this.rDiv != bodyScrollTop + this.h) {
            this.$(this.rDiv).style.top = parseInt(this.$(this.rDiv).style.top) + Math.ceil((bodyScrollTop + this.h - parseInt(this.$(this.rDiv).style.top)) / 20) + "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.scrollTop;
        if (this.fDiv.style.top != bodyScrollTop + this.h) {
            this.$(this.fDiv).style.top = parseInt(this.$(this.fDiv).style.top) + Math.ceil((bodyScrollTop + this.h - parseInt(this.$(this.fDiv).style.top)) / 20) + "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);
    }
}

// 判断多选是否与选中项（没有选中的返回fa	
function slcNo_click()
{
    if (document.form1.checkboxname.length)
        {
            for (var i=0;i<document.form1.checkboxname.length;i++)
                {
                    if(document.form1.checkboxname[i].checked)
                    {
                        return true;
                    }
                }
        }
	else
        {
            if(document.form1.checkboxname.checked)
				{
					return true;
				}
		}
	alert("Please select !     ");
	return false;
}

// 多选的全选与取消
function checkJs(boolvalue)
{
if(document.all.checkboxname.length>1)
{
for(var i=0;i<document.all.checkboxname.length;i++)
{
document.all.checkboxname[i].checked = boolvalue;
}
}
else
document.all.checkboxname.checked = boolvalue;
}
//

// 只有全部选中时“全选”选中
function SingleCheckJs()
{
	var flag1=false;
	var flag2=false;

	if (document.form1.checkboxname.length)
	{
		for (var i=0;i<document.form1.checkboxname.length;i++)
		{
			if(document.form1.checkboxname[i].checked)
			flag1 = true;
			else
			flag2 = true;
		}
	}
	else
	{
		if(document.form1.checkboxname.checked)
			flag1 = true;
		else
			flag2 = true;
	}

	if(flag1==true&&flag2==false)
		document.getElementById("chk").checked = true;
	else
	document.getElementById("chk").checked = false;
}

