function num(_nPageCount, _nCurrIndex, _sPageName, _sPageExt){
	var nCurrIndex = _nCurrIndex || 0;
	if(nCurrIndex == 0)
		document.write("1&nbsp;");
	else
		document.write("<a style='font-size:12px;color:#007355' href=\""+_sPageName+"."+_sPageExt+"\">1</a>&nbsp;");
	
	for(var i=1; i<_nPageCount; i++){
		if(nCurrIndex == i){
			document.write(""+(i+1)+"&nbsp;");
			}
		else if(i%30 == 0){
			document.write("<a style='font-size:12px;color:#007355' href=\""+_sPageName+"_" + i + "."+_sPageExt+"\">"+(i+1)+"</a>&nbsp;<br>");
				}
		else 
			document.write("<a style='font-size:12px;color:#007355' href=\""+_sPageName+"_" + i + "."+_sPageExt+"\">"+(i+1)+"</a>&nbsp;");
	}
}
		
function createPageHTML(_nPageCount, _nCurrIndex, _sPageName, _sPageExt){
	if(_nPageCount == null || _nPageCount<=1){
		return;
	}
	
	var nCurrIndex = _nCurrIndex || 0;
	
	if (_nPageCount==2){
		if(nCurrIndex == 0){
			document.write("1&nbsp;<a style='font-size:12px;color:#007355' href=\""+_sPageName+"_" + (nCurrIndex+1) + "."+_sPageExt+"\">2</a>&nbsp;<a style='font-size:10.5pt;color:#007355;text-decoration:none;' href=\""+_sPageName+"_" + (nCurrIndex+1) + "."+_sPageExt+"\">【下一页】</a>&nbsp;");
		}
		else if (nCurrIndex == 1){
			document.write("<a style='font-size:10.5pt;color:#007355;text-decoration:none;' href=\""+_sPageName+ "."+_sPageExt+"\">【上一页】</a>&nbsp;<a style='font-size:12px;color:#007355' href=\""+_sPageName+ "."+_sPageExt+"\">1</a>&nbsp;2&nbsp;");
		}
	}
	else{

		if(nCurrIndex == 0){
			num(_nPageCount, _nCurrIndex, _sPageName, _sPageExt);
			document.write("<a style='font-size:10.5pt;color:#007355;text-decoration:none;' href=\""+_sPageName+"_" + (nCurrIndex+1) + "."+_sPageExt+"\">【下一页】</a>&nbsp;");
		}
		else if (nCurrIndex == 1){
			document.write("<a style='font-size:10.5pt;color:#007355;text-decoration:none;' href=\""+_sPageName+"."+_sPageExt+"\">【上一页】</a>&nbsp;");
			num(_nPageCount, _nCurrIndex, _sPageName, _sPageExt);
			document.write("<a style='font-size:10.5pt;color:#007355;text-decoration:none;' href=\""+_sPageName+"_" + (nCurrIndex+1) + "."+_sPageExt+"\">【下一页】</a>&nbsp;");
		}
		else if(nCurrIndex == (_nPageCount-1)){
			document.write("<a style='font-size:10.5pt;color:#007355;text-decoration:none;' href=\""+_sPageName+"_" + (nCurrIndex-1) + "."+_sPageExt+"\">【上一页】</a>&nbsp;");
			num(_nPageCount, _nCurrIndex, _sPageName, _sPageExt);
		}
		else{
			document.write("<a style='font-size:10.5pt;color:#007355;text-decoration:none;' href=\""+_sPageName+"_" + (nCurrIndex-1) + "."+_sPageExt+"\">【上一页】</a>&nbsp;");
			num(_nPageCount, _nCurrIndex, _sPageName, _sPageExt);
			document.write("<a style='font-size:10.5pt;color:#007355;text-decoration:none;' href=\""+_sPageName+"_" + (nCurrIndex+1) + "."+_sPageExt+"\">【下一页】</a>&nbsp;");
		}
	} 	
}

function ecreatePageHTML(_nPageCount, _nCurrIndex, _sPageName, _sPageExt){
	if(_nPageCount == null || _nPageCount<=1){
		return;
	}
	
	var nCurrIndex = _nCurrIndex || 0;
	
	if (_nPageCount==2){
		if(nCurrIndex == 0){
			document.write("1&nbsp;<a style='font-size:12px;color:#007355' href=\""+_sPageName+"_" + (nCurrIndex+1) + "."+_sPageExt+"\">2</a>&nbsp;<a style='font-size:9pt;color:#007355;text-decoration:none;' href=\""+_sPageName+"_" + (nCurrIndex+1) + "."+_sPageExt+"\">[next page]</a>&nbsp;");
		}
		else if (nCurrIndex == 1){
			document.write("<a style='font-size:9pt;color:#007355;text-decoration:none;' href=\""+_sPageName+ "."+_sPageExt+"\">[last page]</a>&nbsp;<a style='font-size:12px;color:#007355' href=\""+_sPageName+ "."+_sPageExt+"\">1</a>&nbsp;2&nbsp;");
		}
	}
	else{

		if(nCurrIndex == 0){
			num(_nPageCount, _nCurrIndex, _sPageName, _sPageExt);
			document.write("<a style='font-size:9pt;color:#007355;text-decoration:none;' href=\""+_sPageName+"_" + (nCurrIndex+1) + "."+_sPageExt+"\">[next page]</a>&nbsp;");
		}
		else if (nCurrIndex == 1){
			document.write("<a style='font-size:9pt;color:#007355;text-decoration:none;' href=\""+_sPageName+"."+_sPageExt+"\">[last page]</a>&nbsp;");
			num(_nPageCount, _nCurrIndex, _sPageName, _sPageExt);
			document.write("<a style='font-size:9pt;color:#007355;text-decoration:none;' href=\""+_sPageName+"_" + (nCurrIndex+1) + "."+_sPageExt+"\">[next page]</a>&nbsp;");
		}
		else if(nCurrIndex == (_nPageCount-1)){
			document.write("<a style='font-size:9pt;color:#007355;text-decoration:none;' href=\""+_sPageName+"_" + (nCurrIndex-1) + "."+_sPageExt+"\">[last page]</a>&nbsp;");
			num(_nPageCount, _nCurrIndex, _sPageName, _sPageExt);
		}
		else{
			document.write("<a style='font-size:9pt;color:#007355;text-decoration:none;' href=\""+_sPageName+"_" + (nCurrIndex-1) + "."+_sPageExt+"\">[last page]</a>&nbsp;");
			num(_nPageCount, _nCurrIndex, _sPageName, _sPageExt);
			document.write("<a style='font-size:9pt;color:#007355;text-decoration:none;' href=\""+_sPageName+"_" + (nCurrIndex+1) + "."+_sPageExt+"\">[next page]</a>&nbsp;");
		}
	} 	
}

function showElementsTop(_nCurrIndex) {
	if (_nCurrIndex == 0) {
		var pageElementTops = document.all("pageElementTop");
		for (i=0; i<pageElementTops.length; i++) {
			pageElementTops[i].style.display = '';
		}    
	}
}

function showElementsBottom(_nPageCount, _nCurrIndex) {
	if (_nCurrIndex == _nPageCount - 1) {
		var pageElementBottoms = document.all("pageElementBottom");
		if (pageElementBottoms.length) {
			for (i=0; i<pageElementBottoms.length; i++) {
				pageElementBottoms[i].style.display = '';
			}   
		} else {
			document.getElementById("pageElementBottom").style.display = '';
		}
	}
}

function getDocumentDate() {
	var sUrl = location.href;
	var iIndex = sUrl.lastIndexOf("/");
	return sUrl.substring(iIndex-6,iIndex);
}

function resetContentMargin() {
	if (getDocumentDate() < '200704')
	{
		var contentPs = document.getElementById("doccontent").getElementsByTagName("p");
		if (contentPs.length != null)
		{
			for (i=0; i<contentPs.length; i++)
			{
				contentPs[i].style.margin = "10.5pt 0 10.5pt 0";
			}
		}
		else
		{
			contentPs[0].style.margin = "10.5pt 0 10.5pt 0";
		}
	}
}

function initAll() {
	resetContentMargin();
	initBody();
}

window.onload = initAll;
