function Box(obj, template){
	//application template
	this.template = template ? template : 'standard';

	//multidimensional array with all the errors. each error is an array with keys: function and message
	this.errors;

	//last error that occurred
	this.error;

	//dom object that holds the box
	this.obj;

	//dom object that holds the box body
	this.body;

	//dom object that holds the box header
	this.header;

	/**
	 * Sets an error
	 *
	 * @return void
	 */
	this.setError = function(func, err){
		this.errors = this.errors ? this.errors : [];
		var key = this.errors.length;
		this.errors[key] = [];
		this.errors[key]['function'] = func;
		this.errors[key]['message'] = err;
		this.error = 'Function "' + func + '": ' + err;
	}

	/**
	 * Initializes box by creating the object that will hold the box
	 *
	 * @param string obj_id; the id of the dom object
	 * @return void
	 */
	this.init = function(obj){
		if(!obj){
			this.setError('boxInit', 'No object has been passed');
			return;
		}
		this.obj = obj;
		var divs = obj.getElementsByTagName('DIV');
		if(divs){
			for(i=0; i<divs.length; i++){
				if(divs[i].className.match("body")){
					this.body =divs[i];
				} else if(divs[i].className.match("header")){
					var dvs = divs[i].getElementsByTagName('DIV');
					if(dvs){
						for(j=0; j<dvs.length; j++){
							if(dvs[j].className.match("center")){
								this.header = dvs[j];
							}
						}
					}
				}
			}
		}
	};

	/**
	 * Toggles the status collapsed/expanded of a box
	 *
	 * @param string box_id
	 * @return void
	 */
	this.toggle = function(box_id){
		if(jQuery(this.body).css('display') != 'none'){
			this.colapse(box_id);
		} else {
			this.expand(box_id);
		}
	};

	/**
	 * Colapses the box
	 *
	 * @param string box_id
	 * @return void
	 */
	this.colapse = function(box_id){
		jQuery(this.header).css('background-image', 'url(/website/layout/' + this.template + '/images/plus.gif)');
		jQuery(this.body).css('display', 'none');
		Set_Cookie("box_" + box_id, 1);
	};

	/**
	 * Expands the box
	 *
	 * @param string box_id
	 * @return void
	 */
	this.expand = function(box_id){
		jQuery(this.header).css('background-image', 'url(/website/layout/' + this.template + '/images/minus.gif)');
		jQuery(this.body).css('display', 'block');
		Delete_Cookie("box_" + box_id);
	};

	//initialize box
	this.init(obj);
}