//id层id,data数据,size每页显示记录数,empty如果是空的话填充的html内容,type选择显示方向1水平，2垂直
Scroll=function(id,data,pagesize,empty,type){
    this.obj=$(id);
    this.data=data;
    this.empty=empty;
    this.pagesize=pagesize;
    this.currentpage=1;
    this.count=data.length;
    this.type=type;
    this.totalpage=parseInt(data.length/pagesize) + (data.length%pagesize==0?0:1);
    
    this.Init=function(){
        if(this.count==0){
            this.obj.innerHTML="&nbsp;";
        }else{
            this.DrawPage();
        }
    }
    this.DrawPage=function(){
        var start = (this.currentpage-1)*this.pagesize + 1;
        var end = (this.currentpage*this.pagesize>this.count)?this.count:(this.currentpage*this.pagesize);
        var tmp = this.pagesize;
        var str="";
        if (type==1){
            str="<table width=100% border=0 cellpadding=0 cellspacing=0><tr>"
            for(var i=start;i<=end;i++){
                str+="<td align=center valign=top>"+this.data[i-1]+"</td>";
                tmp--;
            }
            if (tmp!=0){
                while(tmp>0){
                    str+="<td align=center valign=top>"+empty+"</td>";
                    tmp--;
                }
            }
            str+="</tr></table>";
        }else{
            str="<table width=100% border=0 cellpadding=0 cellspacing=0>"
            for(var i=start;i<=end;i++){
                str+="<tr><td valign=top width=100%>"+this.data[i-1]+"</td></tr>";
                tmp--;
            }
            if (tmp!=0){
                while(tmp>0){
                    str+="<tr><td valign=top width=100%>"+empty+"</td></tr>";
                    tmp--;
                }
            }
            str+="</table>";
        }
        //alert(str);
        this.obj.innerHTML=str;
    }
    this.NextPage=function(){
        if(this.currentpage+1>this.totalpage){
            alert("已到最后一页");
        }else{
            this.currentpage++;
            this.DrawPage();
        }
    }
    this.PrevPage=function(){
        if(this.currentpage-1<1){
            alert("已到首页");
        }else{
            this.currentpage--;
            this.DrawPage();
        }
    }
}
//eventId要触发事件的id，eventVal要，type跳转类型，zid作品id，hid活动id，uid用户id，val传递值（投票用）
function G(eventId,eventVal,type,zid,hid,htype,uid,val,disable){
    if (!disable){
        if(type=="nopub")
        {
            if(!confirm("不晒了将清零投票，确定吗？"))
                return;
        }
        if(type=="del")
        {
            if(!confirm("确定删除此作品集吗？"))
                return;
        }
        //alert("type="+type+"&zid="+zid+"&hid="+hid+"&htype="+htype+"&uid="+uid+"&val="+val);
        document.getElementById(eventVal).value="type="+type+"&zid="+zid+"&hid="+hid+"&htype="+htype+"&uid="+uid+"&val="+val;
        __doPostBack(eventId, '');
    }
}