function showhide(id){
	if (document.getElementById){
		obj = document.getElementById(id);
		if (obj.style.display == 'none'){
			obj.style.display = '';
		} else {
			obj.style.display = 'none';
		}
	}
}

// collapse expand modification
function getForumCookie() {
	var nameEQ = "fusion_forumindex=";
	var ca = document.cookie.split(';');
	for (var i = 0; i < ca.length; i++) {
		var c = ca[i];
		while (c.charAt(0) == ' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return false;
}
function createForumCookie() {
	var date = new Date();
	date.setTime(date.getTime()+(30*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
	var value = catCookie;
	document.cookie = "fusion_forumindex=" + value + expires + "; path=/";
}

function forumIndexInit() {
	var cookie = getForumCookie();
	if (cookie) {
		catCookie = cookie;
	}
}

function colExpForum(id) {
	var element = getForumElement('forum_cat_'+ id);
	if (!element)
		return;
		
	var operation = element.style.display == '' ? 'none' : '';
	element.style.display = operation;
	
	var inCookie = catCookie.indexOf(id +':')
	if (operation == 'none') {
		if (inCookie == -1) catCookie += id +':';
	} else {
		if (inCookie != -1) catCookie = catCookie.replace(id +':','');
	}
	createForumCookie();
}

function getForumElement(id) {
	var doc = document;
	if (doc.getElementById && doc.getElementById(id)) return doc.getElementById(id);
	else if (doc.all && doc.all(id)) return doc.all(id);
	else if (doc.layers && doc.layers[id]) return doc.layers[id];
	else return false;
};

var catCookie = '';
forumIndexInit();
function mtr_mark_all(forumIDs) {
var cookie_data = '';
var now = new Date();
var seconds = Math.round(now.getTime() / 1000);
var temp = forumIDs.split('.');
for(i = 0; i < temp.length; i ++) {
if (cookie_data != '') { cookie_data = cookie_data + '_'; }
cookie_data = cookie_data + temp[i] + '.0.' + seconds;
}
var temp2 = document.getElementsByTagName('img');
for(i = 0; i < temp2.length; i ++) {
var temp3 = temp2[i].id;
if (/^read([0-9]+$)/.test(temp3)) {
var read = document.getElementById(temp3);
var unread = document.getElementById('un' + temp3);
if (read.style.display == 'none') {
read.style.display = '';
unread.style.display = 'none';
}
}
}
mtr_set_cookie('fusion_mtr', cookie_data, 90, '/', '', 0);
}
