var KB_TABSET = function ( tabs_rows , active_tabs_row ) {
	//this.tabs_rows = tabs_rows;
	this.active_tabs_row = active_tabs_row;
	var tmp_obj, tmp_row;
	this.rows_array = new Array();
	this.tabs_array = new Array();
	for( var k=1; k <= tabs_rows; k++) {
		tmp_row = getElement( 'KB_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( "KB_tab_name_universal" );
				if( tab_univName != '' ) {
					this.tabs_array[ tab_univName ] = new Array();
					this.tabs_array[ tab_univName ][ "name" ] = tmp_tabs_array[i].getAttribute( "KB_tab_name" );
					this.tabs_array[ tab_univName ][ "obj_container" ] = tmp_tabs_array[i];
					if( tmp_tabs_array[i].className == "active" ) {						
						KB_cur_bookmark = tab_univName;
						this.cur_tab = this.tabs_array[ tab_univName ];
						}
					this.tabs_array[ tab_univName ][ "row_pos" ] = tmp_tabs_array[i].getAttribute( "KB_tabs_row" );
					//tmp_obj = this.tabs_array[ tab_univName ][ "obj_container" ];
					this.tabs_array[ tab_univName ][ "caption_container" ] = getElement( tab_univName + "_caption" );
					this.tabs_array[ tab_univName ][ "global_href_container" ] = getElement( tab_univName + "_href" );
					}
				}
			}
		}
	}

KB_TABSET.prototype.loadTab = function ( bokm_id , only_set_style ) {
	KB_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( "KB_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( !KB_CONTENT_OBJ.printContent( '' , '' , '' , 1 , KB_search_sess_file ) ) document.location.href = "?cur_page=1&sess_file=" + KB_sess_file;
			}
		else {
			if( !KB_CONTENT_OBJ.printContent( KB_cur_ppid , '' , bokm_id ) ) document.location.href = "?pp_id=" + KB_cur_ppid + "&select_mode=full&bokm_id=" + bokm_id;
			}
		}
	return true;	
	}
KB_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;
	}
KB_TABSET.prototype.setTabcountDocs = function ( dt_name , dt_count  ) {
	//alert(dt_name);
	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';
	//	}
	}
	

