var p_sortlist=new Array();
p_sortlist[0]='commentary';
p_sortlist[1]='articles';
p_sortlist[2]='news';
var p_titlelist=new Array();
p_titlelist[0]='Comm. ';
p_titlelist[1]='Article ';
p_titlelist[2]='News ';
var p_totalpage=new Array();
p_totalpage[0]=1;
p_totalpage[1]=5;
p_totalpage[2]=1;
var p_currpage=0;
var p_cursort=-1;
var p_curlang='';

function in_array(needle, haystack) {
	if(typeof needle == 'string') {
		for(var i in haystack) {
			if(haystack[i] == needle) {
					return true;
			}
		}
	}
	return false;
}
function in_array2(needle, haystack) {
	if(typeof needle == 'string') {
		for(var i in haystack) {
			if(haystack[i] == needle) {
					return i;
			}
		}
	}
	return -1;
}
function GetPage2() {
	list=document.URL.split('/');
	p_cursort=-1;
	p_currpage=0;
	p_curlang='';
	if(list.length) {
		for(i=0; i<p_sortlist.length; i++) {
			j=parseInt(in_array2(p_sortlist[i],list));
			if(j>-1) {
				p_cursort=i;
				p_curlang=list[j+1]+'/'+list[j+2]+'/'
				break;
			}
		}
		if(parseInt(list[list.length-1]))
			p_currpage=parseInt(list[list.length-1]);
	}
}

function WritePageList2(obj) {
	GetPage2();
	str2='';
	for (i=0; i<p_sortlist.length; i++) {
		str='';
		for (j=1; j<=p_totalpage[i]; j++) {
			str += (str==''?'':', ') + (i==p_cursort && j==p_currpage?'<span title="current page" style="width:15px"><font color="red" style="font-family:\'Times New Roman\'; font-size:16px; font-weight:bold;">'+j+'</font></span>':'<a href="../../../'+p_sortlist[i]+'/'+p_curlang+j+'.html" target="_self" style="font-family:\'Times New Roman\'; font-size:16px; text-decoration:none; color:black; width:15px;" onmouseover="this.style.color=\'red\';" onmouseout="this.style.color=\'black\';">'+j+'</a>');
		}
		str2 += (str2==''?'':' &nbsp; ') + (str==''?'':'<font color="#0000FF" style="font-size:12px;">'+p_titlelist[i]+'</font>'+str);
	}
	
	hstr=fstr='';
	if(p_cursort==0 && p_currpage==1)
		hstr='';
	else if(p_currpage==1) {
		hstr='';
		for (i=p_cursort-1; i>=0; i--) {
			if(p_totalpage[i]>0) {
				hstr='<a title="Prev" href="../../../'+p_sortlist[i]+'/'+p_curlang+p_totalpage[i]+'.html" target="_self" style="font-family:\'Times New Roman\'; font-size:20px; text-decoration:none; color:black;" onmouseover="this.style.color=\'red\';" onmouseout="this.style.color=\'black\';"><font style="font-size:12px;">Prev </font>&laquo;</a> &nbsp; ';
				break;
			}
		}
	} else
		hstr='<a title="Prev" href="../../../'+p_sortlist[p_cursort]+'/'+p_curlang+(p_currpage-1)+'.html" target="_self" style="font-family:\'Times New Roman\'; font-size:20px; text-decoration:none; color:black;" onmouseover="this.style.color=\'red\';" onmouseout="this.style.color=\'black\';"><font style="font-size:12px;">Prev </font>&laquo;</a> &nbsp; ';
		
	if(p_cursort==p_sortlist.length-1 && p_currpage==p_totalpage[p_cursort])
		fstr='';
	else if(p_currpage==p_totalpage[p_cursort]) {
		fstr='';
		for (i=p_cursort+1; i<p_sortlist.length; i++) {
			if(p_totalpage[i]>0) {
				fstr='<a title="Next" href="../../../'+p_sortlist[i]+'/'+p_curlang+'1.html" target="_self" style="font-family:\'Times New Roman\'; font-size:20px; text-decoration:none; color:black;" onmouseover="this.style.color=\'red\';" onmouseout="this.style.color=\'black\';">&raquo;<font style="font-size:12px;"> Next</font></a> &nbsp; ';
				break;
			}
		}
	} else
		fstr=' &nbsp; <a title="Next" href="../../../'+p_sortlist[p_cursort]+'/'+p_curlang+(p_currpage+1)+'.html" target="_self" style="font-family:\'Times New Roman\'; font-size:20px; text-decoration:none; color:black;" onmouseover="this.style.color=\'red\';" onmouseout="this.style.color=\'black\';">&raquo;<font style="font-size:12px;"> Next</font></a>';
	//alert(str2);
	obj.innerHTML=hstr+str2+fstr;
}
