//欄目頁分頁代碼 edit by wilson 060517
function createPageHTML(_nPageCount, _nCurrIndex, _sPageName, _sPageExt){
	if(_nPageCount == null || _nPageCount<=1 || _nCurrIndex>=_nPageCount){
	return;
	}
	var nCurrIndex = _nCurrIndex || 0;
	var firstPage = "<a href=\""+_sPageName+"."+_sPageExt+"\" class=Pagebutton target=_self>首 頁</a>";
	var nextPage = "<a href=\""+_sPageName+"_"+(nCurrIndex+1)+"."+_sPageExt+"\" class=Pagebutton target=_self>下 頁</a>";
	var prePage = "<a href=\""+_sPageName+"."+_sPageExt+"\" class=Pagebutton target=_self>上 頁</a>";
	var prePage_1 = "<a href=\""+_sPageName+"_"+(nCurrIndex-1)+"."+_sPageExt+"\" class=Pagebutton target=_self>上 頁</a>";
	var lastPage = "<a href=\""+_sPageName+"_" +(_nPageCount-1)+"."+_sPageExt+"\" class=Pagebutton target=_self>尾 頁</a>";
	var firstPage_off = "<span class=Pagebutton>首 頁</span>";
	var nextPage_off = "<span class=Pagebutton>下 頁</span>";
	var prePage_off = "<span class=Pagebutton>上 頁</span>";
	var lastPage_off = "<span class=Pagebutton>尾 頁</span>";
	
	document.write("第<span class=font_red>"+(nCurrIndex+1)+"</span>頁，共<span class=font_red>"+_nPageCount+"</span>頁 ");
	if(nCurrIndex == 0)
	{
		document.write(firstPage_off);
		document.write(prePage_off);
		document.write(nextPage);	
		document.write(lastPage);
		
	}
	else
		if(nCurrIndex==(_nPageCount-1))
		{
			document.write(firstPage);
			if(_nPageCount==2)
			{document.write(prePage);}
			else
			{document.write(prePage_1);}
			document.write(nextPage_off);
			document.write(lastPage_off);
		}
		else
		{
			document.write(firstPage);
				if(nCurrIndex==1)
				{document.write(prePage);}
				else
				{document.write(prePage_1);}
			document.write(nextPage);
			document.write(lastPage);
			
			document.write("<select name=\"select\" style=\"margin-bottom:-3px;\" onchange=\"location.replace(this.value)\">");
			document.write("<option selected >轉到</option>");
			for(var i=0; i<_nPageCount; i++)
			{
			if(i==0)
			document.write("<option value=\""+_sPageName+"."+_sPageExt+"\">第1頁</option>");
			else
			document.write("<option value=\""+_sPageName+"_" + i + "."+_sPageExt+"\">第"+(i+1)+"頁</option>");
			}
			document.write("</select>");
			
	}
}

function GetObj(objName){
if(document.getElementById){
return eval('document.getElementById("' + objName + '")');
}else if(document.layers){
return eval("document.layers['" + objName +"']");
}else
{return eval('document.all.' + objName);}
}
function SetBtn(preFix, idx){
for(var i=0;i<9;i++){
if(GetObj(preFix+"_btn_"+i)) GetObj(preFix+"_btn_"+i).className = "btn_off";
if(GetObj(preFix+"_con_"+i)) GetObj(preFix+"_con_"+i).style.display = "none";
}
GetObj(preFix+"_btn_"+idx).className = "btn_on";
GetObj(preFix+"_con_"+idx).style.display = "block";
}

//加入收藏

function bookmark(){
var title=document.title
var url=document.location.href
if (window.sidebar) window.sidebar.addPanel(title, url,"");
else if( window.opera && window.print ){
var mbm = document.createElement('a');
mbm.setAttribute('rel','sidebar');
mbm.setAttribute('href',url);
mbm.setAttribute('title',title);
mbm.click();}
else if( document.all ) window.external.AddFavorite( url, title);
}