function turnPage(pages,direction){
	if(pages > 1){
		nextButton = document.getElementById('pageNextButton');
		prevButton = document.getElementById('pagePrevButton');
		activePageNumber = document.getElementById('activePageNumber');
		for (i=1; i <= pages; i++){
			currentBox = document.getElementById('pageBox'+i);
			if(currentBox.style.display == ''){
				// set active page number
				activePageNumber.value = i;
				activeBox = currentBox;
				activeBoxID = i;
				if(i == 1){
					// hide previos button
					prevButton.style.display == 'none';
				}else if(i == pages){
					// hide next button
					nextButton.style.display == 'none';
				}
				if(direction=='next') {
					if(i+1 <= pages){
						showBox = i+1;
					}
				}
				if(direction=='previous'){
					if(i > 1){
						showBox = i-1;
					}
				}
			}
			currentBox.style.display == 'none';
		}
		if(showBox){
			pageBox = document.getElementById('pageBox'+showBox);
			pageBox.style.display == '';
			if(activeBoxID>1){
				prevButton.style.display == '';
			}
			if(activeBoxID<pages){
				nextButton.style.display == '';
			}
		}
	}
}
function switchItems(id,total){
	for (i=1; i <= total; i++){
		if(im = document.getElementById('tf'+i)){
			im.style.display = 'none';

			num = document.getElementById('tfLink'+i);
			num.className = 'topSwitch';
		}
	}
	if(id>0){
		if(im = document.getElementById('tf'+id)){
			im.style.display = '';

			num = document.getElementById('tfLink'+id);
			num.className = 'topSwitchSel';
		}
	}
	return false;
}
function switchPFItems(id,total){
	for (i=1; i <= total; i++){
		if(im = document.getElementById('prf'+i)){
			im.style.display = 'none';

			num = document.getElementById('prfLink'+i);
			num.className = 'pfSwitch';
		}
	}
	if(id>0){
		if(im = document.getElementById('prf'+id)){
			im.style.display = '';

			num = document.getElementById('prfLink'+id);
			num.className = 'pfSwitchSel';
		}
	}
	return false;
}
function sitchHP(g,id){
	if(id=='top'){
		tmp = document.getElementById('HPflop'+g);
		tmp.style.display = 'none';

		tmp = document.getElementById('HPtop'+g);
		tmp.style.display = '';

		tmp = document.getElementById('HPflopLink'+g);
		tmp.className = 'HPswitch';

		tmp = document.getElementById('HPtopLink'+g);
		tmp.className = 'HPswitchSel';

		return false;
	}
	if(id=='flop'){
		tmp = document.getElementById('HPtop'+g);
		tmp.style.display = 'none';

		tmp = document.getElementById('HPflop'+g);
		tmp.style.display = '';

		tmp = document.getElementById('HPflopLink'+g);
		tmp.className = 'HPswitchSel';

		tmp = document.getElementById('HPtopLink'+g);
		tmp.className = 'HPswitch';

		return false;
	}
}
function formSubmit(id){
	if(f = document.getElementById(id)){
		f.submit();
	}
}
function showTextPage(page,pages){
	for( i=1; i <= pages; i++){
		block = document.getElementById('textPage_'+i);
		nav = document.getElementById('textPageNav_'+i);
		if(page == i){
			block.style.display = '';
			nav.style.display = '';
		}else{
			block.style.display = 'none';
			nav.style.display = 'none';
		}
	}
	return false;
}
