function bar_mgr( mgr ) {
	
	first_arr	= new Array(  );
	second_arr	= new Array(  );
	man			= new Array(  );
	
	first_arr 	= mgr.split( ' / ' );
	
	for( unit in first_arr ) {
		
		second_arr	= first_arr[unit].split( '=' );
		man[second_arr[0]]	= second_arr[1];
	}
	
	if ( man['bid']						)	{	this.bid					= man['bid'];					}	else { this.bid						= 'my_id';	 			}
	if ( man['bar_box']					)	{	this.bar_box				= man['bar_box'];				}	else { this.bar_box					= 'body';	 			}
	if ( man['bar_type']				)	{	this.bar_type				= man['bar_type'];				}	else { this.bar_type				= 'tool';	 			}
	if ( man['bar_title']				)	{	this.bar_title				= man['bar_title'];				}	else { this.bar_title				= 'title';	 			}
	if ( man['bar_movable']				)	{	this.bar_movable			= man['bar_movable'];			}	else { this.bar_movable				= 'yes';	 			}
	if ( man['bar_resizable']			)	{	this.bar_resizable			= man['bar_resizable'];			}	else { this.bar_resizable			= 'no';	 				}
	if ( man['bar_max']					)	{	this.bar_max				= man['bar_max'];				}	else { this.bar_max					= 'yes';	 			}
	
	if ( man['bar_but_close']			)	{	this.bar_but_close			= man['bar_but_close'];			}	else { this.bar_but_close			= 'yes'; 				}
	if ( man['bar_but_min']				)	{	this.bar_but_min			= man['bar_but_min'];			}	else { this.bar_but_min				= 'yes'; 				}
	if ( man['bar_cls_but_close']		)	{	this.bar_cls_but_close		= man['bar_cls_but_close'];		}	else { this.bar_cls_but_close		= ''; 					}
	if ( man['bar_cls_but_min']			)	{	this.bar_cls_but_min		= man['bar_cls_but_min'];		}	else { this.bar_cls_but_min			= ''; 					}
	if ( man['bar_cls_but_min']			)	{	this.bar_cls_but_max		= man['bar_cls_but_max'];		}	else { this.bar_cls_but_max			= ''; 					}
	if ( man['bar_cls_mover']			)	{	this.bar_cls_mover			= man['bar_cls_mover'];			}	else { this.bar_cls_mover			= ''; 					}
	
	if ( man['bar_cls_box']				)	{	this.bar_cls_box			= man['bar_cls_box'];			}	else { this.bar_cls_box				= ''; 					}
	if ( man['bar_cls_header']			)	{	this.bar_cls_header			= man['bar_cls_header'];		}	else { this.bar_cls_header			= ''; 					}
	if ( man['bar_cls_header_left']		)	{	this.bar_cls_header_left	= man['bar_cls_header_left'];	}	else { this.bar_cls_header_left		= this.bar_cls_header;	}
	if ( man['bar_cls_header_right']	)	{	this.bar_cls_header_right	= man['bar_cls_header_right'];	}	else { this.bar_cls_header_right	= this.bar_cls_header;	}
	if ( man['bar_cls_title']			)	{	this.bar_cls_title			= man['bar_cls_title'];			}	else { this.bar_cls_title			= ''; 					}
	if ( man['bar_cls_body']			)	{	this.bar_cls_body			= man['bar_cls_body'];			}	else { this.bar_cls_body			= ''; 					}
	if ( man['bar_cls_cont']			)	{	this.bar_cls_cont			= man['bar_cls_cont'];			}	else { this.bar_cls_cont			= ''; 					}
	if ( man['bar_cls_footer']			)	{	this.bar_cls_footer			= man['bar_cls_footer'];		}	else { this.bar_cls_footer			= ''; 					}
	if ( man['bar_cls_mover']			)	{	this.bar_cls_mover			= man['bar_cls_mover'];			}	else { this.bar_cls_mover			= ''; 					}
	
	this.create_bar		= function(  ) {
		
		bar_cont	= this.generate_bar(  );
		
		$( bar_cont ).appendTo( "#" + this.bar_box );
		
		if ( 'yes'	== this.bar_movable ) {
			
			bar_start( this.bid, this.bar_cls_box );
		}
	}

	this.generate_bar	= function(  ) {
		
		bar_header	= this.gen_bar_header(  );
		bar_body	= this.gen_bar_body(  );
		
		str	=	'';
		
		str+=	'<div id="' + this.bid + '" class="' + this.bar_cls_box + '">';
		str+=			bar_header;
		str+=			bar_body;
		str+=	'</div>';
		
		return str;
	}

	this.gen_bar_cont	= function(  ) {
		
		str	=	'';
		
		if ( 'tool'			== this.bar_type ) {
			
			str	= get_tool_cont( this.bid );
		}
		
		return str;
	}
	
	this.gen_bar_stat	= function(  ) {
		
		str	=	'';
		
		return str;
	}
	
	this.gen_bar_header	= function(  ) {
		
		str	=	'';
		
		str+=		'<table style="width:100%; border:0px;" cellspacing="0" cellpadding="0">';
		str+=			'<tr>';
		str+=				'<td class="' + this.bar_cls_header_left + '">&nbsp;</td>';
		str+=				'<td id="' + this.bid + '_mover" class="' + this.bar_cls_header + '">';
		str+=					'<div class="' + this.bar_cls_title + '">' + this.bar_title + '</div>';
		str+=				'</td>';
		str+=				'<td style="width:70px;" class="' + this.bar_cls_header + '">';
		str+=					'<div style="width:70px;">';
		if ( 'yes' == this.bar_but_close ) {
			
			str+=					'<div class="' + this.bar_cls_but_close + '" onclick=\'bar_close( "' + this.bid + '" );\'></div>';
		}
		if ( 'yes' == this.bar_but_min ) {
			
			if ( 'yes' == this.bar_max ) {
				
				str+=				'<div id="' + this.bid + '_max" class="' + this.bar_cls_but_max + '" style="display:none;" onclick=\'bar_max( "' + this.bid + '" );\'></div>';
				str+=				'<div id="' + this.bid + '_min" class="' + this.bar_cls_but_min + '" onclick=\'bar_min( "' + this.bid + '" );\'></div>';
			}
			else {
				
				str+=				'<div id="' + this.bid + '_max" class="' + this.bar_cls_but_max + '" onclick=\'bar_max( "' + this.bid + '" );\'></div>';
				str+=				'<div id="' + this.bid + '_min" class="' + this.bar_cls_but_min + '" style="display:none;" onclick=\'bar_min( "' + this.bid + '" );\'></div>';
			}
		}
		str+=					'</div>';
		str+=				'</td>';
		str+=				'<td class="' + this.bar_cls_header_right + '">&nbsp;</td>';
		str+=			'</tr>';
		str+=		'</table>';
		
		return str;		
	}
	
	this.gen_bar_body	= function(  ) {
		
		bar_cont	= this.gen_bar_cont(  );
		
		str	=	'';
		
		if ( 'yes' == this.barMin ) {
		
			if ( 'yes' == this.bar_max ) {
				
				str+='<div id="' + this.bid + '_body" class="' + this.bar_cls_body + '">';
			}
			else {
				
				str+='<div id="' + this.bid + '_body" class="' + this.bar_cls_body + '" style="display:none;">';
			}
		}
		else {
			
			str+='<div id="' + this.bid + '_body" class="' + this.bar_cls_body + '">';
		}
		
		str+=		'<div id="' + this.bid + '_cont" class="' + this.bar_cls_cont + '">';
		str+=			bar_cont;
		str+=		'</div>';
		str+=	'</div>';
		
		str+=		'<div class="' + this.bar_cls_footer + '"></div>';
		
		return str;
	}
}

function cfg_bar(  ) {
	
	this.min_x		= 20;
	this.min_y		= 20;
	this.max_x		= 1024;
	this.max_y		= 768;
}

cfb	= new cfg_bar(  );

function bar_init(  ) {
	
	cfb.max_x	= cgg.scr_width;
	cfb.max_y	= cgg.scr_height;
}

function bar_min( bid ) {
	
	if ( document.getElementById( bid + '_max' ) ) {
		
		document.getElementById( bid + '_max' ).style.display	= 'block';
	}
	if ( document.getElementById( bid + '_min' ) ) {
		
		document.getElementById( bid + '_min' ).style.display	= 'none';
	}
	if ( document.getElementById( bid + '_body' ) ) {
		
		$( '#' + bid + '_body' ).animate( {height : "hide"}, cgg.popup_hide_speed );
	}
}

function bar_max( bid ) {
	
	if ( document.getElementById( bid + '_max' ) ) {
		
		document.getElementById( bid + '_max' ).style.display	= 'none';
	}
	if ( document.getElementById( bid + '_min' ) ) {
		
		document.getElementById( bid + '_min' ).style.display	= 'block';
	}
	if ( document.getElementById( bid + '_body' ) ) {
		
		$( '#' + bid + '_body' ).animate( {height : "show"}, cgg.popup_show_speed );
	}
}

function bar_close( bid ) {
	
	if ( document.getElementById( bid ) ) {
		
		$( '#' + bid ).animate( {opacity : "hide"}, cgg.popup_hide_speed*2 );
	}
	
	setTimeout( 'bar_del( "' + bid + '" )', cgg.popup_hide_speed*3 );
}

function bar_del( bid ) {
	
	$( '#' + bid ).remove(  );
}

function bar_start( bid, bar_cls_box ) {
	
	if ( document.getElementById( bid + '_mover' ) && document.getElementById( bid ) ) {
		
		cfb.max_x	= cgg.scr_width - document.getElementById( bid ).scrollWidth - 20;
		cfb.max_y	= cgg.scr_height - document.getElementById( bid ).scrollHeight - 20;
		
		Drag.init( document.getElementById( bid + '_mover' ),  document.getElementById( bid ), cfb.min_x, cfb.max_x, cfb.min_y, cfb.max_y, bar_cls_box );
	}
}

function bar_hide( el_id, bar_cls_box ) {
	
	if ( document.getElementById( el_id ) ) {
		
		document.getElementById( el_id ).className	= bar_cls_box + '_transp';
	}
}

function bar_show( el_id, bar_cls_box ) {
	
	if ( document.getElementById( el_id ) ) {
		
		document.getElementById( el_id ).className	= bar_cls_box;
	}
}
