function ajax_lista_napelnij( _source, _list, _select, _callback )
{
    $.ajax(
    {
	url: _source,
	type: 'GET',
	dataType: 'xml',
	success: function( xml )
	{
	    form_lista_reset( _list );

	    $(xml).find('nazwa').each( function()
	    {
		$('<option></option>')
		    .html( $(this).text() )
		    .attr( 'value', $(this).attr('id') )		    
		    .appendTo( _list );		    					
	    } );
	    
	    $.browser.msie ? setTimeout(zaznacz,1) : zaznacz();

	    if( _callback )
		_callback( );
		
	    function zaznacz()
	    {
		$( _list ).attr( 'value', _select );
	    }		
	}
    } );
}



function form_lista_reset( _target )
{
    $( _target ).each( function()
    {
	$( this ).find( 'option' ).remove( );
	$( '<option></option>' )
	    .html( '-- wybierz --' )
	    .val( 0 )
	    .appendTo( $(this) );
    } );
}

