var TABSET = function ( tabs_rows , active_tabs_row , cur_href , obj_id , prefix , saveInCookie ) {
	//this.tabs_rows = tabs_rows;
	this.prefix = prefix;
	this.obj_id = obj_id;
	this.cur_href = cur_href;
	this.active_tabs_row = active_tabs_row;
	var tmp_obj, tmp_row;
	this.rows_array = new Array();
	this.tabs_array = new Array();
	this.saveInCookie = saveInCookie ? true : false;
	for( var k=1; k <= tabs_rows; k++) {
		tmp_row = getElement( prefix + 'TABS_tabs_row_' + k );
		if( !tmp_row ) 	tmp_row = getElement( 'TABS_tabs_row_' + k );
		if( tmp_row ) {
			this.rows_array[ k ] = tmp_row; 
			var tmp_tabs_array = tmp_row.getElementsByTagName( 'TABLE' );
			var tab_univName;
			for( var i=0; i < tmp_tabs_array.length; i++ ) {
				tab_univName = tmp_tabs_array[i].getAttribute( "tab_name_universal" );
				if( tab_univName != '' ) {
					this.tabs_array[ tab_univName ] = new Array();
					this.tabs_array[ tab_univName ][ "name" ] = tmp_tabs_array[i].getAttribute( "tab_name" );
					this.tabs_array[ tab_univName ][ "obj_container" ] = tmp_tabs_array[i];
					if( tmp_tabs_array[i].className == "active" ) {						
						cur_bookmark = tab_univName;
						this.cur_tab = this.tabs_array[ tab_univName ];
						}
					this.tabs_array[ tab_univName ][ "row_pos" ] = tmp_tabs_array[i].getAttribute( "tabs_row" );
					//tmp_obj = this.tabs_array[ tab_univName ][ "obj_container" ];
					this.tabs_array[ tab_univName ][ "caption_container" ] = getElement( tab_univName + "_caption" );
					}
				}
			}
		}
	}

TABSET.prototype.loadTab = function ( bokm_id , only_set_style , module_name ) {
	cur_bookmark = bokm_id;
	if( this.cur_tab ) {
		this.cur_tab[ "obj_container" ].className = "not_active";
		this.cur_tab[ "obj_container" ].setAttribute( 'previousClassName' , 'not_active' );
		}
	this.tabs_array[ bokm_id ][ "obj_container" ].className = "active";
	this.tabs_array[ bokm_id ][ "obj_container" ].setAttribute( 'previousClassName' , 'active' );
	this.cur_tab = this.tabs_array[ bokm_id ];	

	var row_real_pos = this.tabs_array[ bokm_id ][ "row_pos" ];
	var tmp_real_position;
	if( this.active_tabs_row  && this.active_tabs_row  != row_real_pos ) {
		var tmp_tabs_row_obj;
		for( var k = 1; k <= this.rows_array.length ; k++ ) {
			tmp_tabs_row_obj = this.rows_array[ k ];
			if( tmp_tabs_row_obj ) {
				tmp_real_position = tmp_tabs_row_obj.getAttribute( "TABS_real_position" );
				if( tmp_real_position == row_real_pos ) {
					tmp_tabs_row_obj.className = "tabs_row tabs_row_1";
					}
				else if( row_real_pos > tmp_real_position ) {
					tmp_tabs_row_obj.className = "tabs_row tabs_row_" + ( parseInt( tmp_real_position ) + 1 );
					}
				else {
					tmp_tabs_row_obj.className = "tabs_row tabs_row_" + tmp_real_position;
					}
				this.active_tabs_row = row_real_pos;
				}
			}	
		}
	
	if( !only_set_style ) {
		if( bokm_id == 'search_bookmark' ) {
			if( !CONTENT_OBJ.printContent( '' , '' , '' , 1 , search_sess_file ) ) document.location.href = "?cur_page=1&sess_file=" + sess_file;
			}
		else {
			if( this.saveInCookie ) {
				COOCK_largeExpDate.setTime( COOCK_largeExpDate.getTime() + ( 14 * 24 * 3600 ) );
				COOCK_set(this.prefix + "_" + this.obj_id, bokm_id, COOCK_largeExpDate, "/" , COOCK_getHost() , "" );
				}
			if( !CONTENT_OBJ.printContent( this.obj_id , bokm_id , this.prefix , module_name ) ) document.location.href = "?" + this.cur_href + "bokm_id=" + bokm_id;
			}
		}
	return true;
	}
TABSET.prototype.showType = function ( bokm_id , show_type ) {
	if( bokm_id && this.tabs_array[ bokm_id ] && this.tabs_array[ bokm_id ][ "obj_container" ] ) 
		this.tabs_array[ bokm_id ][ "obj_container" ].style.display = show_type;
	}
TABSET.prototype.setTabcountDocs = function ( dt_name , dt_count  ) {
	if( !this.tabs_array[ dt_name ] ) {
		return false;
		}
	var doc_count = dt_count != '-1' ? " (" + dt_count + ")" : "";
	this.tabs_array[ dt_name ][ "caption_container" ].innerHTML = this.tabs_array[ dt_name ][ "name" ] + doc_count;
	//if( this.tabs_array[ dt_name ][ "obj_container" ].style.display == 'none' && !not_for_show ) {
	//	this.tabs_array[ dt_name ][ "obj_container" ].style.display = 'block';
	//	}
	}
	
