function Tab(tab_cont_id, div_cont_id){

	//object that holds the tabs
	this.tab_container;

	//object that holds the divs
	this.div_container;

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

	//last error that occurred
	this.error;

	/**
	 * 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;
	}

	/**
	 * Initiates the tabs
	 *
	 * @param string div_cont_id
	 * @param string div_cont_id
	 * @return void
	 */
	this.init = function(tab_cont_id, div_cont_id){
		this.tab_container = tab_cont_id;
		this.div_container = div_cont_id;
	}

	/**
	 * Makes a tab active and shows content
	 *
	 * @param object obj; the tab
	 * @param string url; url from where the tab content is loaded
	 * @param string ajaxLoader
	 * @return void
	 */
	this.display = function(obj, url, ajaxLoader){
		if(jQuery(obj).hasClass("active")){
			return;
		}
		var mid = obj.id.substr(4);
		this.activate(obj);
		this.show("div_" + mid, url, ajaxLoader);
	}

	/**
	 * Makes a tab active
	 *
	 * @param object obj; the tab
	 * @return void
	 */
	this.activate = function(obj){
		this.inactivateAll();
		jQuery(obj).addClass('active');
		jQuery(obj).addClass(obj.id);
	}

	/**
	 * Makes a div active
	 *
	 * @param object div_id; id of the div
	 * @param string url; url from where the tab content is loaded
	 * @param string ajaxLoader
	 * @return void
	 */
	this.show = function(div_id, url, ajaxLoader){
		this.hideAll();
		jQuery("#" + div_id).addClass('active');
		if(!jQuery("#" + div_id).html()){
			Ajax.request(url, null, null, null, "Tab.populateTab('" + div_id + "', result);", null, null, null, ajaxLoader);
		}
	}

	/**
	 * Populates a dom object with some content
	 *
	 * @param string obj_id; the id of the dom object
	 * @param string result; the content
	 * @return void
	 */
	this.populateTab = function (obj_id, result){
		document.getElementById(obj_id).innerHTML = result;
	}

	/**
	 * Makes all tabs inactive
	 *
	 * @return void
	 */
	this.inactivateAll = function(){
		jQuery("#" + this.tab_container + " LI").removeClass();
		jQuery("#" + this.tab_container + " LI").addClass('tab');
	}

	/**
	 * Makes all divs inactive
	 *
	 * @return void
	 */
	this.hideAll = function(){
		jQuery("#" + this.div_container + " .div").removeClass('active');
	}

	this.init(tab_cont_id, div_cont_id);
}

var Tab;