function LatestListShow(listID) {
	listID = parseInt(listID);
	// get content element
	var content = document.getElementById('NERDlatestContent');
	if (content) {
		content.style.display = 'block';
	}
	// get icon element (minus)
	var iconHide = document.getElementById('NERD_latestHide');
	if (iconHide) {
		iconHide.style.display = 'block';
	}
	// get icon element (plus)
	var iconShow = document.getElementById('NERD_latestShow');
	if (iconShow) {
		iconShow.style.display = 'none';
	}	
	
	
	// .style.display='block';document.getElementById('NERD_latestHide').style.display='block';document.getElementById('NERD_latestShow').style.display='none';"

	var ajaxRequest = new AjaxRequest();
	ajaxRequest.openPost('index.php?page=Index&latestListShow='+listID+'#latestList'+SID_ARG_2ND);
	return true;
}

function LatestListHide(listID) {
	listID = parseInt(listID);
	// listID = this.listID;
	// get content element
	var content = document.getElementById('NERDlatestContent');
	if (content) {
		//show
		content.style.display = 'none';
	}
	// get icon element (minus)
	var iconHide = document.getElementById('NERD_latestHide');
	if (iconHide) {
		iconHide.style.display = 'none';
	}
	// get icon element (plus)
	var iconShow = document.getElementById('NERD_latestShow');
	if (iconShow) {
		iconShow.style.display = 'block';
	}	
	
	
	// .style.display='block';document.getElementById('NERD_latestHide').style.display='block';document.getElementById('NERD_latestShow').style.display='none';"

	var ajaxRequest = new AjaxRequest();
	ajaxRequest.openPost('index.php?page=Index&latestListHide='+listID+'#latestList'+SID_ARG_2ND);
	return true;
}

function ThreadMarkAsRead() {

/**
 * @license	WoltLab Burning Board License <http://www.woltlab.com/products/burning_board/license.php>
 */

	this.init = function(threadID) {
	
		// get additional icon (latest Posts and Threads-List)
		var iconAdd = document.getElementById('NERDlatestThreadEdit' + threadID);
		if (iconAdd) {
			// add information
			iconAdd.threadID = threadID;
			
			// add event listener
			iconAdd.ondblclick = function() { threadMarkAsRead.markAsRead(parseInt(this.threadID)); }
		}
	
		// get icon element
		var icon = document.getElementById('threadEdit' + threadID);
		if (icon) {
			// add information
			icon.threadID = threadID;
			
			// add event listener
			icon.ondblclick = function() { threadMarkAsRead.markAsRead(parseInt(this.threadID)); }
		}
	}
	
	/**
	 * Marks the thread as read.
	 */
	this.markAsRead = function(threadID) {
	
		// get icon element
		var icon = document.getElementById('threadEdit' + threadID);
		
		// get additional icon  element(latest Posts and Threads-List)
		var iconAdd = document.getElementById('NERDlatestThreadEdit' + threadID);
		
		// mark thread as read
		var ajaxRequest = new AjaxRequest();
		if (ajaxRequest.openGet('index.php?page=Thread&threadID='+threadID+'&action=markAsRead'+SID_ARG_2ND)) {
				
			if (icon) {
				// change icon
				icon.src = icon.src.replace(/New/, '');
				if (icon.name) icon.name = icon.name.replace(/New/, '');
				// change icon and class name in inline edit data
				if (typeof(threadListEdit) != 'undefined' && threadListEdit.data[threadID]) {
					threadListEdit.data[threadID]['icon'] = threadListEdit.data[threadID]['icon'].replace(/New/, '');
					threadListEdit.data[threadID]['class'] = threadListEdit.data[threadID]['icon'].replace(/ new/, '');
				}
				
				// clear title tag
				icon.title = '';
				
				// get div
				var div = document.getElementById('thread' + threadID);
				if (div) {
					// change class
					div.className = div.className.replace(/ new/, '');
					
					// remove go to first new post link
					var link = document.getElementById('gotoFirstNewPost' + threadID);
					if (link) {
						div.removeChild(link);
					}
				}
			}
		
			if (iconAdd) {
				// change icon
				iconAdd.src = iconAdd.src.replace(/New/, '');
				if (iconAdd.name) iconAdd.name = iconAdd.name.replace(/New/, '');
				
				// clear title tag
				iconAdd.title = '';
				
				// get div
				var div = document.getElementById('NERDlatestThread' + threadID);
				if (div) {
					// change class
					div.className = div.className.replace(/ new/, '');
					
					// remove go to first new post link
					var link = document.getElementById('NERDlatestGotoFirstNewPost' + threadID);
					if (link) {
						div.removeChild(link);
					}
				}
			}
		

		}
	
		// remove event listener
		if (icon) {
			icon.ondblclick = '';
		}
		if (iconAdd) {
			iconAdd.ondblclick = '';
		}
	}
}

var threadMarkAsRead = new ThreadMarkAsRead();