var current_page = 1;
var page_size = 11;
var prex = 1;
var article_kind = "";
function inits(){
	var str = window.location.href;
	if(str.indexOf("?")==-1) str = article[0]; else str = str.substring(str.indexOf("?")+1);
	check_url(str);
}

function check_url(str){
	
	if(sub_menu_type=="click"){
		menus.rows[prex].cells[0].firstChild.firstChild.src = 'images/tit/tit'+column_index+'_'+prex+'.gif';
	}
	for(var i=0;i<article.length;i++){
		if(article[i]==str){
			prex = i+1;
			break;
		}
	}
	if(sub_menu_type=="click"){
		menus.rows[prex].cells[0].firstChild.firstChild.src = 'images/tit/tit'+column_index+'_'+prex+'a.gif';
	}
	article_type = str;
	if(prex<=type.length&&type[prex-1]!="") article_kind = type[prex-1]; else article_kind = "article";
	current_page = 1;
	document.all.send_var.src = "article_list.asp?column="+column+"&article_type="+article_type+"&type="+article_kind;
}

function build(){
	var str, tmp, obj, str1;
	if(current_page==1){
		//title1.innerText = article_type;
		//img1.src = "images/tit/tit"+column_index+"_"+prex+"b.gif";
		if(img2_prex!="") img2.src = "images/"+img2_prex+prex+".gif";
	}
	if(type[prex-1]!="article"&&type[prex-1]!="software"){
		table1.style.display = "none";
		table0.style.display = "none";
		table2.style.display = "block";
		for(var i=0;i<page_size;i++){
			if(i<record_info.length){
				if(record_info[i][2]=="") tmp = "images/common/no_pic.jpg"; else tmp = record_info[i][2];
				str = " "+record_info[i][1];
				
				if(type[prex-1]=="show"){
					table2.rows[Math.floor(i/3)*2].cells[(i%3)].style.display = "block";
					table2.rows[Math.floor(i/3)*2].cells[(i%3)].innerHTML = '<img src="'+tmp+'" width="150" height="105" border="0" style="cursor:hand" onClick="window.open(\'article.asp?ids='+record_info[i][0]+'\',\'\',\'scrollbars,resizable,height=614,width=600\')">';
					table2.rows[Math.floor(i/3)*2+1].cells[(i%3)].style.display = "block";
					obj = table2.rows[Math.floor(i/3)*2+1].cells[(i%3)*2].firstChild;
					obj.rows[0].cells[1].innerText = record_info[i][1];
					obj.rows[1].cells[1].innerText = record_info[i][5];

				}
				if(type[prex-1]=="works") table2.rows[Math.floor(i/3)*2].cells[(i%3)*2].innerHTML = '<img src="'+tmp+'" border="0" style="cursor:hand" title="'+record_info[i][1]+'" onClick="window.open(\'show_img.htm?num='+i+'&type=works'+'\',\'win2\',\'scrollbars,resizable,height=240,width=360\')"><br><span>'+max_str(record_info[i][1],24)+'<br>姓名:<font color="#FF0000">'+record_info[i][3]+'</font>&nbsp;&nbsp;班级:<font color="#FF0000">'+record_info[i][4]+'</font></span>'; 
				if(type[prex-1]=="img") table2.rows[Math.floor(i/3)*2].cells[(i%3)*2].innerHTML = '<img src="'+tmp+'" width="162" height="93" border="0"><br><a href="javascript:void(null)" title="'+record_info[i][1]+'" onClick="window.open(\'article.asp?ids='+record_info[i][0]+'\',\'\',\'scrollbars,resizable,height=614,width=600\')">'+max_str(str,48)+'</a>';
			}else{
				if(type[prex-1]=="show"){
					table2.rows[Math.floor(i/3)*2].cells[(i%3)].style.display = "none";
					table2.rows[Math.floor(i/3)*2+1].cells[(i%3)].style.display = "none";
				}else{
					table2.rows[Math.floor(i/3)*2].cells[(i%3)*2].innerHTML = '&nbsp;';
				}
			};
		};
	}else{
		table1.style.display = "block";
		table0.style.display = "block";
		table2.style.display = "none";
		page_size = 11;
		if(dots!="") tmp = '<img src="'+dots+'"  align="absmiddle">'; else tmp = '';
		for(var i=0;i<page_size;i++){
			if(i<record_info.length){
				str =  max_str(record_info[i][1],48);
				
				if(column=="课改实验"||column=="教师频道"){
					
					if(record_info[i][4]==""||record_info[i][4]=="本站人员") str1 = ""; else str1 = ' <font color="#FF0000">('+recodrd_info[i][4]+')</font>';
				}
				table1.rows[i].cells[0].innerText = (current_page-1)*page_size+(i+1);
				if(type[prex-1]=="article"){
					table1.rows[i].cells[1].innerHTML = tmp+'<a href="#" title="'+record_info[i][1]+'" onClick="window.open(\'article.asp?ids='+record_info[i][0]+'\',\'\',\'scrollbars,resizable,height=614,width=600\')">'+str+'</a>';
					table1.rows[i].cells[2].innerText = record_info[i][3];
					table1.rows[i].cells[3].innerText = '【'+record_info[i][2].substring(2,record_info[i][2].indexOf(" "))+'】';
				}
				if(type[prex-1]=="software") {
					table1.rows[i].cells[1].innerText = str; 
					table1.rows[i].cells[2].innerHTML = '<a href="#" onClick="winers=window.open(\'download.asp?ids='+record_info[i][0]+'\',\'\',\'scrollbars,resizable,height=425,width=390\');winers.focus();winers.moveTo((screen.width-390)/2,0)"><img src="images/down.gif" border="0"></a>'; 
					table1.rows[i].cells[3].innerText = '【'+record_info[i][2].substring(2,record_info[i][2].indexOf(" "))+'】';
				}
				
			}else{
				table1.rows[i].cells[0].innerText = " ";
				table1.rows[i].cells[1].innerText = " ";
				table1.rows[i].cells[2].innerText = " ";
				table1.rows[i].cells[3].innerText = " ";
			}

		}
	}
	if(total_page==0) numss.innerText = "第0页/共0页"; else numss.innerText = "第"+current_page+"页/共"+total_page+"页";
	nums.innerText = total_num;
	if(total_page!=document.search_page.pages.options.length){
		str = new Array();
		for(var i=0;i<total_page;i++){
			str[i] = i+1;
		}
		create_select("pages",str,str);		
	}
	document.search_page.pages.value = current_page;
	//document.all.send_var.src = "";
}

function next_pre(type,url){
	var page
	if(total_num==0) return
	if(type=="first"){
		if(current_page!=1) current_page=1;
		else return;
	}
	if(type=="pre"){
		if(current_page!=1) current_page=current_page-1;
		else return;
	}

	if(type=="next"){
		if(current_page!=total_page) current_page=current_page+1;
		else return;
	}
	if(type=="last"){
		if(current_page!=total_page) current_page=total_page;
		else return;
	}
	if(types=="goto"){
		current_page=document.search_page.pages.value;
	}
	document.all.send_var.src = "article_list.asp?column="+column+"&article_type="+article_type+"&type="+article_kind+"&current_page="+current_page;	
}