function hidePost(id){
	document.getElementById(id).style.display = 'none';
}

function unhidePost(id){
	if(document.getElementById(id)){document.getElementById(id).style.display = '';}
}

function threadViewer(page,postsPerPage,totalPosts){
	//hide all divs on the page to start with
	totalPosts++;
	for(i=1; i < totalPosts; i++){
		id = 'post' + i;
		hidePost(id);
	}
	//now we need to make visible the posts on the virtual page
	//first work out the id/num of the first visible post
	startPost = postsPerPage * page;
	startPost = startPost - (postsPerPage - 1);
	//work out last visible post
	lastPost = postsPerPage * page;
	//add one so the for loop goes all the way to the end
	lastPost++;
	//for loop to set all applicable divs/posts to visible
	for(i=startPost; i < lastPost; i++){
		id = 'post' + i;
		unhidePost(id);
	}
	//these last 4 lines are to make the main content divs "textbox" and "textboxinner" resize when the new posts are shown
	document.getElementById('textboxinner').style.height = '0px';
	document.getElementById('textbox').style.height = '0px';
	document.getElementById('textboxinner').style.height = 'auto';
	document.getElementById('textbox').style.height = 'auto';
	
	//hide the reply box
	if(document.getElementById('newpost')){
		document.getElementById('newpost').style.display = 'none';
	} 
	
	if(document.getElementById('verticalbarinner')){
		sizeVerticalBar();
	}
}



function insertSmilie(form,filename){
	
	postText = document.forms[form].elements['postBody'].value;
	postText = postText + filename;
	document.forms[form].elements['postBody'].value = postText;
	
	}