//-------------------------------------分页方法-------
	var page_size = 4;//每页显示几条记录 
	var P_rowcount = 0;//计录总条数 
	var atPage = 0 ;//当前在第几页	
	var p = 0;//动遍历数组每页显示几条记录大小 
	var target_k = 'target="_self"';
//总记录条数
function rs_conut_row(count_row){
	P_rowcount = count_row;
}
//根据　总记当条数　和　每页显示几条记录　算出分几页
function page_sum(){

	var page_count = parseInt(P_rowcount-1)/page_size+1; //应分页数 
	//alert(page_count+"  "+ P_rowcount +"   "+ page_size);
		//var cnt = this.pageConut/this.pageSize;//应分页数去掉尾巴 
	return parseInt(page_count);
}
	
	//返回分页后的记录*  crt当前所在页数 
function p_list(current_page,p_list){

	var list_tmp = new Array();
		
 	var rowAt=parseInt((current_page-1)*page_size); //算出在总记录中的第几条 （所在页数-1）*每页显示几条 =总记录中的第几条
 		
	var rowNow = parseInt(rowAt+page_size);//到第几条结束读计录
		
	//document.getElementById("a").innerHTML = "a---"+rowNow;
		//alert("rowAt="+current_page+"-1"+"*"+page_size+"    "+rowNow+"="+rowAt+" + "+page_size);
	for(i=rowAt;i<rowNow;i++){
	//alert(p_list[i]+"_________________"+i);
		list_tmp.push(p_list[i]);
        if (i == P_rowcount-1) break;//如果当前行数大于总行数就跳出循环
	}
		
	return list_tmp;
}	
//------------------------------------------------------
//精彩话题JS

var list = new Array();
var page_div_Id = "imgView";

//把JAVA集合给JS集合
function set_list(id,title,path,url){
	var obj = new Object();
	obj.id = id;
	obj.title = title;
	obj.path = path;
	obj.url = url;
		//alert(id);
	list.push(obj);
}

//传总计录条数 然后算出分几页
//function page_size_init(p_size){
		//rs_conut_row(p_size);//总计录条数
		//alert(p_size);
		//P_rowcount = p_size;
		//page_sum();//算出分几页
//}

//不停监听直到，图片浏览DIV不为null[此时也就说明companyHome.htm已被加载到companySpace.HTML页面]就往下执行
function load_first_page(){
	var timer;
	if(document.getElementById("ulId")==null){
	   timer=setTimeout("load_first_page()",100);
	}else{
		clearTimeout(timer);//首先清出定时器
		
		//如果总记录条数小于　每页显示记录数那么隐藏　上一页　和　下一页按扭
		if(list.length<=page_size){
			document.getElementById("updivId").style.display = 'none';
			document.getElementById("nextdivId").style.display = 'none';
		}
		
		if(list==null || list.length<=0){
			//alert(document.getElementById("ulId"));
			
			document.getElementById("cpztId").style.display = 'none';//最外面的div隐藏
			document.getElementById("ulId").style.display = 'none';
		}else{
	   		get_list(1);
	   }
	}

}

//构建显示记录布局2
function get_list(current_page){

document.getElementById("sizeId").innerHTML = list.length;
document.getElementById("ulId").style.display = 'block';
//alert(current_page);
	var tmps_list = p_list(current_page,list)
	//var rowshow = 1;//每行显示几列
	var tmp = "";
	var j = 0;
	var beginindex = 0;

	var size = tmps_list.length;
	//alert(size);
	var str ='<table width="150" border="0" align="center" cellpadding="0" cellspacing="0" class="css03">';

	var td_gbcolor = 'bgcolor="#F3FCFC"';
	str +='<tr>';
	for(var j=0;j<size;j++){
		//alert(tmps_list[j]);
			if(tmps_list[j]!=undefined){
				if(tmps_list[j]!=null){
					str += get_Td(tmps_list,j);
				}
			}
		
	}
	str +='</tr>';
	//str += pagetr();
	
	str +='</table>';
	//alert(str);
	document.getElementById(page_div_Id).innerHTML = str;
	
}
//生成记录排版
function get_Td(tmps_list,k){
		var str="";
	    var t_d = '<td width="50%" height="25" align="left">';
	    //alert(tmps_list[k].id);
	    str +=t_d;
		if(tmps_list[k]!=undefined){
			if(tmps_list[k]!=null){
				if(tmps_list[k].id!=undefined){
					if(tmps_list[k].id!=null){
						  		var id =(tmps_list[k].id!=null?tmps_list[k].id:"");
						  		var title =(tmps_list[k].title!=null?tmps_list[k].title:"");
						  		var path = (tmps_list[k].path!=null?tmps_list[k].path:"");//路径
						  		var url = (tmps_list[k].url!=null?tmps_list[k].url:"");//路径
						  		str +=href(url,title,path);
				    }
			    }
	   	 	}
	    }
	    str += '</td>';
	    return str;
}


function href(id,title,path){
	var str="";
		str += '<a href="'+id+'" '+ target_k +'><img alt='+title+' src="'+path+'" width="65" height="53" border="0"></a>';
		return str;
}
var up_last = 1;

function next(){
		var paged = page_sum();//分几页
		//alert(paged);
	    	up_last++;//下一页
	    	if(up_last<=paged){
	    	//alert(up_last);
		    	get_list(up_last);
			}else{
			    up_last=paged;//如果当前页大于总页数 那么分页变量等于最大 页数
			    get_list(up_last);
			}

}
function up(){
var paged = page_sum();//分几页
		    up_last--;//上一页 
		    if(up_last>=1){
		     	get_list(up_last);
			}else{
			    up_last=1;//如果小于最小页数 那么让他到初始页
			    get_list(up_last);
			}

}

//var count_row = 18;//总行数
//for(var i=0;i<count_row;i++){
//	set_list(i,"title"+i,"path"+i,"url"+i)
//}
//初始化
//function loadImg(){
//page_size_init(count_row);//总记录数 同时 加载第一页信息
//}
