﻿// JavaScript Document
var PAGE_COUNT;
var PAGE_NAME;
var PAGE_EXT;
<!-- 
function createPageHTML(_nPageCount, _nCurrIndex, _sPageName, _sPageExt){ 
//tita 翻页函数a
PAGE_COUNT =  _nPageCount;
PAGE_NAME  =  _sPageName;
PAGE_EXT   =  _sPageExt;
if(_nPageCount == null || _nPageCount<=1){
return; 
} 
if(_nPageCount==1)
	document.write('|&lt; 首页 <span class="tred tb">1</span> 尾页 &gt;|');
	else
	{
		 if(_nPageCount==2)
		 {
			if (_nCurrIndex==0)			
			document.write('<a href="'+_sPageName+'.'+_sPageExt+'">|&lt; 首页</a> <span class="tred tb">1</span> <a href="'+_sPageName+"_"+(_nPageCount-1)+'.'+_sPageExt+'">2</a> <a href="'+_sPageName+"_"+(_nPageCount-1)+'.'+_sPageExt+'">尾页 &gt;|</a>');
			 else
			 {
				document.write('<a href="'+_sPageName+'.'+_sPageExt+'">|&lt; 首页</a> <a href="'+_sPageName+'.'+_sPageExt+'">1</a> <span class="tred tb">2</span> <a href="'+_sPageName+"_"+(_nPageCount-1)+'.'+_sPageExt+'">尾页 &gt;|</a>');  
			 }
		 }   	
		 else 
		 {	
			document.write('<a href="'+_sPageName+'.'+_sPageExt+'">|&lt; 首页</a> ');
			
			if(_nCurrIndex != 0)
			{
				if(_nCurrIndex == 1)
				{
					
					document.write(' <a href="'+_sPageName+'.'+_sPageExt+'">'+1+'</a> ');
					document.write(' <span class="tred tb">'+(_nCurrIndex+1)+'</span> ');
					for(j = ++_nCurrIndex; j < _nPageCount && j<7; j++)
					{
						document.write(' <a href="'+_sPageName+'_'+ j +'.'+_sPageExt+'">'+(j+1)+'</a> ');
					}
				}
				else if(_nCurrIndex == 2)
				{
					
					document.write(' <a href="'+_sPageName+'.'+_sPageExt+'">'+1+'</a> ');
					document.write(' <a href="'+_sPageName+'_'+(_nCurrIndex-1)+'.'+_sPageExt+'">'+_nCurrIndex+'</a> ');
					document.write(' <span class="tred tb">'+(_nCurrIndex+1)+'</span> ');
					for(j = ++_nCurrIndex; j < _nPageCount && j<7; j++)
					{
						document.write(' <a href="'+_sPageName+"_"+ j +'.'+_sPageExt+'">'+(j+1)+'</a> ');
					}
				}
				else if(_nCurrIndex > 2)
				{
					if(_nPageCount-_nCurrIndex+1 > 4)
					{
						document.write(' <a href="'+_sPageName+'_'+ (_nCurrIndex-2) +'.'+_sPageExt+'">'+(_nCurrIndex-1)+'</a> ');
						document.write(' <a href="'+_sPageName+'_'+ (_nCurrIndex-1) +'.'+_sPageExt+'">'+_nCurrIndex+'</a> ');
						document.write(' <span class="tred tb">'+(_nCurrIndex+1)+'</span> ');
						for(j = ++_nCurrIndex; j < _nPageCount && j< _nCurrIndex+4; j++)
						{
							document.write(' <a href="'+_sPageName+"_"+ j +'.'+_sPageExt+'">'+(j+1)+'</a> ');
						}
					}
					else
					{
						var tempArray =new Array();
						for(i =0 ; i < (7-(_nPageCount-_nCurrIndex)); i++)
						{
							tempArray[i]=_nCurrIndex-i-1;
						}
						for(k=tempArray.length-1; k>=0; k--)
						{
							document.write(' <a href="'+_sPageName+'_'+ tempArray[k] +'.'+_sPageExt+'">'+(tempArray[k]+1)+'</a> ');
						}
						document.write(' <span class="tred tb">'+(_nCurrIndex+1)+'</span> ');
						for(j = ++_nCurrIndex; j < _nPageCount ; j++)
						{
							document.write(' <a href="'+_sPageName+"_"+ j +'.'+_sPageExt+'">'+(j+1)+'</a> ');
						}
					}
				}
			}
			else
			{
				document.write(' <span class="tred tb">'+(_nCurrIndex+1)+'</span> ');				
				_nCurrIndex++;
				for(i = _nCurrIndex; i < _nPageCount && i < 7; i++)
				{
					document.write(' <a href="'+_sPageName+'_'+(_nCurrIndex)+'.'+_sPageExt+'">'+(_nCurrIndex+1)+'</a> ');
					_nCurrIndex++;
				}
			}
			document.write(' <a href="'+_sPageName+"_"+(_nPageCount-1)+'.'+_sPageExt+'">尾页 &gt;|</a>');
		 }
	}
} 

