function do_jump(z) {
	//z.options[z.options.selectedItem].value
	if(z.selectedIndex>0) {
	self.location.href='/index.php?id=' + z.options[z.selectedIndex].value;	
	}
}

function Browser(maxn,n,currow) {	
	this.maxn = maxn;
	this.n = n;
	this.curpage = Math.floor(currow/maxn);
	currow = this.maxn * (this.curpage)
	this.currow = currow - maxn;
	up(this);
	this.pages = Math.ceil(this.n/this.maxn);
	document.getElementById("maxpages").innerHTML = this.pages;
	if(this.n<this.maxn) {
		document.getElementById("pageBrowser").style.display = "none";
	}
}

function up(obj) {
	if(obj.currow + obj.maxn<obj.n) {	
		obj.curpage++;
		obj.currow = obj.currow + obj.maxn;
		hideAll(obj);
		for(i=obj.currow; i<obj.currow+obj.maxn; i++) {
			row = document.getElementById("row" + i);
			if(row) {
				row.style.display = "";
			}
		}
		writePage(obj);
	}
}

function down(obj) {
	if(obj.currow-obj.maxn>=0) {
		obj.curpage--;
		obj.currow = obj.currow - obj.maxn;
	
		hideAll(obj);
		for(i=obj.currow; i<obj.currow+obj.maxn; i++) {
			row = document.getElementById("row" + i);
			if(row) {
				row.style.display = "";
			}
		}
		writePage(obj);
	} 
	
}

function hideAll(obj) {
	for(i=0; i<obj.n; i++) {
		row = document.getElementById("row" + i);
		if(row) {
			row.style.display = "none";
		}
	}
}

function writePage(obj) {
	document.getElementById("curpage").innerHTML = obj.curpage;
	testPage(obj);
}

function testPage(obj) {
	if(obj.curpage==1) {
		document.getElementById("browseDown").style.display = "none";
	} else {
		document.getElementById("browseDown").style.display = "";	
	}
	
	if(obj.curpage==obj.pages) {
		document.getElementById("browseUp").style.display = "none";
	} else {
		document.getElementById("browseUp").style.display = "";	
	}	

}
