c = new Cookie();
c.setExpires(new Date(new Date().getTime() + 31536000000));
c.setDomain("." + document.domain);
c.setPath("/");

function toggleForum(id_forum) {
	var obj = document.getElementById('collapseforum-' + id_forum);
    if (obj.className == "collapsed") {
    	expandForum(id_forum);
	}
    else {
    	collapseForum(id_forum);
	}
}

function collapseForum(id_forum){
	var obj = document.getElementById('collapseforum-' + id_forum);
    var i = 'img' + id_forum;
    var i2 = document.getElementById(i);

    var tx = document.getElementById('TX-' + id_forum);
    var px = document.getElementById('PX-' + id_forum);
    var lpx = document.getElementById('LPX-' + id_forum);
    
    c.setValue("pt3_forums_" + id_forum, "1")
	obj.className = "collapsed";
	i2.src = "./styles/prosilver/theme/images/plus.gif";
	
	tx.style.display = 'none';
	px.style.display = 'none';
	lpx.style.display = 'none';
}

function expandForum(id_forum){
	var obj = document.getElementById('collapseforum-' + id_forum);
    var i = 'img' + id_forum;
    var i2 = document.getElementById(i);

    var tx = document.getElementById('TX-' + id_forum);
    var px = document.getElementById('PX-' + id_forum);
    var lpx = document.getElementById('LPX-' + id_forum);
    
    c.setValue("pt3_forums_" + id_forum, "0")
	obj.className = "topiclist forums";
	i2.src = "./styles/prosilver/theme/images/minus.gif";

	tx.style.display = 'block';
	px.style.display = 'block';
	lpx.style.display = 'block';
}

function Cookie()
{



	//Public properties
	this.isSet = (document.cookie.toString().length != 0);
	this.isEnabled = navigator.cookieEnabled;


	//Private properties
	this.expires = new Date();
	this.path = '';
	this.domain = '';
	this.isSecure = false;


	//Public methods
	this.getIsSet = function() { return (document.cookie != ""); }
	this.setExpires = function(date) { this.expires = date; }
	this.setPath = function(path) { this.path = path; }
	this.setDomain = function(domain) { this.domain = domain; }
	this.setSecure = function(secure) { this.isSecure = secure; }


	this.erase = function()
	{
		this.setExpires(new Date(new Date().getTime() - 1000000));
		var cArr = this.getCookieAsArray();
		for(var i in cArr) this.setValue(i, '');

		document.cookie = '';
	}


	this.parse = function()
	{
		var cValues = this.getCookieAsArray();
		for(var i in cValues) eval(i + ' = unescape("' + cValues[i] + '");');
	}


	this.getValue = function(name)
	{
		var cValues = this.getCookieAsArray();
		return cValues[name];
	}

	
	this.setValue = function(name, value) { document.cookie = name + '=' + escape(value) + '; ' + this.getCookieSettings(); }


	this.getCookieAsArray = function()
	{
		if(!document.cookie.toString().length) return new Array();

		cArr = document.cookie.toString().split('; ');
		var cookieArray = new Array();
		for(var x=0; x<cArr.length; x++)
		{
			if(!cArr[x].length) continue;
			cArr[x] = cArr[x].split("=");
			cookieArray[cArr[x][0].toString()] = unescape(cArr[x][1]);
		}

		return cookieArray;
	}


	//Private methods

	this.getCookieSettings = function()
	{
		var str = 'expires=' + this.expires.toGMTString() + '; ';

		if(this.domain.length) str += 'path=' + this.path + '; ';
		if(this.domain.length) str += 'domain=' + this.domain + '; ';
		if(this.isSecure) str += 'secure; ';
		
		return str;
	}
}

