
function CheckOthers(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
//		if (e.name != 'chkall')
			if (e.checked==false)
			{
				e.checked = true;// form.chkall.checked;
			}
			else
			{
				e.checked = false;
			}
	}
}
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')
       e.checked = form.chkall.checked; 
   }
  }


//查找网页内宽度太大的图片进行缩放以及PNG纠正
 function ReImgSize(){
  for (i=0;i<document.images.length;i++)
   {
   if (document.all){
	if (document.images[i].width>500)
	 {
       document.images[i].width="500"
       document.images[i].outerHTML='<a href="'+document.images[i].src+'" target="_blank" title="在新窗口打开图片">'+document.images[i].outerHTML+'</a>'
  	 }
   }
  else{
	if (document.images[i].width>400) {
	  document.images[i].title="在新窗口打开图片"
	  document.images[i].style.cursor="pointer"
	  document.images[i].onclick=function(e){window.open(this.src)}
	}
  }
  }
 }
//显示隐藏主题
function TopicShow(e,TopicID){
	 e.className=(e.className=="BttnC")?"BttnE":"BttnC"
	 document.getElementById(TopicID).style.display=(e.className=="BttnC")?"":"none"
	 ReImgSize()
}



/*类型分页
CurrentPage:当前页
n：类型ID
MaxRows:每页记录数
CountNum:总记录数
Filefre：文件名前缀
*/
function CPageList(CurrentPage,n,MaxRows,CountNum,Filefre)
{	
	CountNum=parseInt(CountNum);
	CurrentPage=parseInt(CurrentPage);
	if (CountNum%MaxRows==0){var Pagecount= parseInt(CountNum / MaxRows);}else{var Pagecount = parseInt(CountNum / MaxRows)+1};	
	var ShowPage;
	ShowPage = "<table border=0 cellpadding=0 cellspacing=3 align=center><tr><td valign=middle nowrap>";
	ShowPage +="合计<font color=red><b>"+CountNum+"<\/b><\/font>个Flash作品 | "
if (CurrentPage!=1)
	ShowPage+="<a href='"+Filefre+"_"+n+"_1.html'>首页<\/a> <a href='"+Filefre+"_"+n+"_"+(CurrentPage -1)+".html'>上一页<\/a>";

if (CurrentPage!=Pagecount)
	ShowPage+=" <a href='"+Filefre+"_"+n+"_"+(CurrentPage+1)+".html'>下一页<\/a> <a href='"+Filefre+"_"+n+"_"+Pagecount+".html'>尾页<\/a> ";

	ShowPage+="页次：<font color=red><b>"+CurrentPage+"<\/b><\/font>\/<b>"+Pagecount+"<\/b>页 每页<b>"+MaxRows+"<\/b>个 <\/td><td valign=middle nowrap><div align=right>";
	ShowPage+="<form action=\"\" method=post onChange=\"submit()\">Go:<select name=\"select\" onChange='javascript:window.open(this.options[this.selectedIndex].value,\"_top\")'>"	

	for (var i=1;i<Pagecount+1;i++)
	{
		if (i==CurrentPage)
			ShowPage+="<option value='"+Filefre+"_"+n+"_"+i+".html' selected>第"+i+"页<\/option>";		
		else
			ShowPage+="<option value='"+Filefre+"_"+n+"_"+i+".html'>第"+i+"页<\/option>";		
	}

	ShowPage=ShowPage+"<\/form><\/div><\/td><\/tr><\/table>";
		document.write (ShowPage);
}


/*分页
CurrentPage:当前页
n：分隔数
MaxRows:每页记录数
CountNum:总记录数
PageSearch：搜索关键词
*/
function PageList(CurrentPage,n,MaxRows,CountNum,PageSearch)
{
	if (PageSearch!=''){
		PageSearch+="&";
	}
	CountNum=parseInt(CountNum);
	CurrentPage=parseInt(CurrentPage);
	if (CountNum%MaxRows==0){var Pagecount= parseInt(CountNum / MaxRows);}else{var Pagecount = parseInt(CountNum / MaxRows)+1};	
	var ShowPage;
	ShowPage = "<table border=0 cellpadding=0 cellspacing=3 align=center><tr><td valign=middle nowrap>";
	ShowPage=ShowPage+"页次：<b>"+CurrentPage+"<\/b>\/<b>"+Pagecount+"<\/b>页 每页<b>"+MaxRows+"<\/b>条 共有"+CountNum+"<\/b>条<\/td><td align=right nowrap>分页：";
	if (Pagecount>CurrentPage+n){var Endpage=CurrentPage+n;}else{var Endpage=Pagecount;}
	if (CurrentPage>4) {
		ShowPage=ShowPage+"<a href=\"?"+PageSearch+"page=1\">[1]<\/a> ...";
			}

	for (var i=CurrentPage-n;i<Endpage+1;i++){
		if (i>=1) {
			if (i==CurrentPage){
				ShowPage=ShowPage+"<font color=red>["+i+"]<\/font>";
				}
		else{
				ShowPage=ShowPage+"<a href=\"?"+PageSearch+"page="+i+"\">["+i+"]<\/a>";
				}
			
				}
		}
	if (CurrentPage+n<Pagecount){
		ShowPage=ShowPage+"...<a href=\"?"+PageSearch+"page="+Pagecount+"\">["+Pagecount+"]<\/a>";
			}

	ShowPage=ShowPage+"<\/td><\/tr><\/table>";
		document.write (ShowPage);
}

function createXmlHttp(){if(window.ActiveXObject){ return new ActiveXObject("Microsoft.XMLHTTP");}else{if(window.XMLHttpRequest){return new XMLHttpRequest();}}return null;}
function $() {
  var elements = new Array();
  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);
    if (arguments.length == 1)
      return element;
    elements.push(element);
  }
  return elements;
}
  